Merge remote-tracking branch 'upstream/master' into change-log-modification
This commit is contained in:
commit
61bfcfbb59
|
|
@ -61,7 +61,7 @@ class SmartButtonController extends Controller
|
|||
try {
|
||||
return response()->json($this->smartButton->createOrder($this->buildRequestBody()));
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
return response()->json(json_decode($e->getMessage()), 400);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ class SmartButtonController extends Controller
|
|||
$this->smartButton->captureOrder(request()->input('orderData.orderID'));
|
||||
return $this->saveOrder();
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
return response()->json(json_decode($e->getMessage()), 400);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ class PaypalServiceProvider extends ServiceProvider
|
|||
{
|
||||
include __DIR__ . '/../Http/routes.php';
|
||||
|
||||
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'paypal');
|
||||
|
||||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'paypal');
|
||||
|
||||
$this->app->register(EventServiceProvider::class);
|
||||
|
|
@ -29,7 +31,7 @@ class PaypalServiceProvider extends ServiceProvider
|
|||
{
|
||||
$this->registerConfig();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register package config.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'error' => [
|
||||
'universal-error' => 'Something went wrong!',
|
||||
'sdk-validation-error' => 'Client ID not recognized for either production or sandbox!',
|
||||
'authorization-error' => 'Client ID and Client Secret should be valid!'
|
||||
]
|
||||
];
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'error' => [
|
||||
'universal-error' => 'Something went wrong!',
|
||||
'sdk-validation-error' => 'Client ID not recognized for either production or sandbox!',
|
||||
'authorization-error' => 'Client ID and Client Secret should be valid!'
|
||||
]
|
||||
];
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'error' => [
|
||||
'universal-error' => 'Something went wrong!',
|
||||
'sdk-validation-error' => 'Client ID not recognized for either production or sandbox!',
|
||||
'authorization-error' => 'Client ID and Client Secret should be valid!'
|
||||
]
|
||||
];
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'error' => [
|
||||
'universal-error' => 'Something went wrong!',
|
||||
'sdk-validation-error' => 'Client ID not recognized for either production or sandbox!',
|
||||
'authorization-error' => 'Client ID and Client Secret should be valid!'
|
||||
]
|
||||
];
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'error' => [
|
||||
'universal-error' => 'Something went wrong!',
|
||||
'sdk-validation-error' => 'Client ID not recognized for either production or sandbox!',
|
||||
'authorization-error' => 'Client ID and Client Secret should be valid!'
|
||||
]
|
||||
];
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'error' => [
|
||||
'universal-error' => 'Something went wrong!',
|
||||
'sdk-validation-error' => 'Client ID not recognized for either production or sandbox!',
|
||||
'authorization-error' => 'Client ID and Client Secret should be valid!'
|
||||
]
|
||||
];
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'error' => [
|
||||
'universal-error' => 'Something went wrong!',
|
||||
'sdk-validation-error' => 'Client ID not recognized for either production or sandbox!',
|
||||
'authorization-error' => 'Client ID and Client Secret should be valid!'
|
||||
]
|
||||
];
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'error' => [
|
||||
'universal-error' => 'Something went wrong!',
|
||||
'sdk-validation-error' => 'Client ID not recognized for either production or sandbox!',
|
||||
'authorization-error' => 'Client ID and Client Secret should be valid!'
|
||||
]
|
||||
];
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'error' => [
|
||||
'universal-error' => 'Something went wrong!',
|
||||
'sdk-validation-error' => 'Client ID not recognized for either production or sandbox!',
|
||||
'authorization-error' => 'Client ID and Client Secret should be valid!'
|
||||
]
|
||||
];
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'error' => [
|
||||
'universal-error' => 'Something went wrong!',
|
||||
'sdk-validation-error' => 'Client ID not recognized for either production or sandbox!',
|
||||
'authorization-error' => 'Client ID and Client Secret should be valid!'
|
||||
]
|
||||
];
|
||||
|
|
@ -14,8 +14,14 @@
|
|||
</style>
|
||||
|
||||
<script>
|
||||
let messages = {
|
||||
universalError: "{{ __('paypal::app.error.universal-error') }}",
|
||||
sdkValidationError: "{{ __('paypal::app.error.sdk-validation-error') }}",
|
||||
authorizationError: "{{ __('paypal::app.error.authorization-error') }}"
|
||||
};
|
||||
|
||||
window.onload = (function() {
|
||||
eventBus.$on('after-payment-method-selected', function(payment) {
|
||||
eventBus.$on('after-payment-method-selected', function (payment) {
|
||||
if (payment.method != 'paypal_smart_button') {
|
||||
$('.paypal-buttons').remove();
|
||||
|
||||
|
|
@ -23,11 +29,7 @@
|
|||
}
|
||||
|
||||
if (typeof paypal == 'undefined') {
|
||||
window.flashMessages = [{'type': 'alert-error', 'message': "SDK Validation error: 'client-id not recognized for either production or sandbox: {{core()->getConfigData('sales.paymentmethods.paypal_smart_button.client_id')}}'" }];
|
||||
|
||||
window.flashMessages.alertMessage = "SDK Validation error: 'client-id not recognized for either production or sandbox: {{core()->getConfigData('sales.paymentmethods.paypal_smart_button.client_id')}}'";
|
||||
|
||||
app.addFlashMessages();
|
||||
options.alertBox(messages.sdkValidationError);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -38,8 +40,16 @@
|
|||
shape: 'rect',
|
||||
},
|
||||
|
||||
authorizationFailed: false,
|
||||
|
||||
enableStandardCardFields: false,
|
||||
|
||||
alertBox: function (message) {
|
||||
window.flashMessages = [{'type': 'alert-error', 'message': message }];
|
||||
window.flashMessages.alertMessage = message;
|
||||
app.addFlashMessages();
|
||||
},
|
||||
|
||||
createOrder: function(data, actions) {
|
||||
return window.axios.get("{{ route('paypal.smart-button.create-order') }}")
|
||||
.then(function(response) {
|
||||
|
|
@ -48,7 +58,14 @@
|
|||
.then(function(orderData) {
|
||||
return orderData.id;
|
||||
})
|
||||
.catch(function (error) {})
|
||||
.catch(function (error) {
|
||||
if (error.response.data.error === 'invalid_client') {
|
||||
options.authorizationFailed = true;
|
||||
options.alertBox(messages.authorizationError);
|
||||
}
|
||||
|
||||
return error;
|
||||
});
|
||||
},
|
||||
|
||||
onApprove: function(data, actions) {
|
||||
|
|
@ -74,16 +91,10 @@
|
|||
})
|
||||
},
|
||||
|
||||
onCancel: function (data) {
|
||||
console.log('Canceled payment...');
|
||||
},
|
||||
|
||||
onError: function (err) {
|
||||
window.flashMessages = [{'type': 'alert-error', 'message': err }];
|
||||
|
||||
window.flashMessages.alertMessage = err;
|
||||
|
||||
app.addFlashMessages();
|
||||
onError: function (error) {
|
||||
if (! options.authorizationFailed) {
|
||||
options.alertBox(error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -130,7 +130,8 @@ class ProductFlatRepository extends Repository
|
|||
$allFilterableAttributes = array_filter(array_unique(array_intersect($categoryFilterableAttributes, $productCategoryArrributes['attributes'])));
|
||||
|
||||
$attributes = app('Webkul\Attribute\Repositories\AttributeRepository')->getModel()::with(['options' => function($query) use ($productCategoryArrributes) {
|
||||
return $query->whereIn('id', $productCategoryArrributes['attributeOptions']);
|
||||
return $query->whereIn('id', $productCategoryArrributes['attributeOptions'])
|
||||
->orderBy('sort_order');
|
||||
}
|
||||
])->whereIn('id', $allFilterableAttributes)->get();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue