@@ -183,7 +183,7 @@ public function execute(Observer $observer): MotoPaymentRequest
183
183
$ api = $ this ->apiHandler ->init ($ storeCode , ScopeInterface::SCOPE_STORE );
184
184
185
185
// Set the source
186
- $ source = $ this ->getSource ($ order , $ params );
186
+ $ source = $ this ->getSource ($ order , $ storeCode , $ params );
187
187
188
188
// Set the payment
189
189
if ($ this ->apiHandler ->isPreviousMode ()) {
@@ -239,13 +239,12 @@ public function execute(Observer $observer): MotoPaymentRequest
239
239
240
240
// Send the charge request
241
241
try {
242
+ $ this ->logger ->display ($ request );
242
243
$ response = $ api ->getCheckoutApi ()->getPaymentsClient ()->requestPayment ($ request );
244
+ $ this ->logger ->display ($ response );
243
245
} catch (CheckoutApiException $ e ) {
244
- $ this ->logger ->write ($ e ->error_details );
246
+ $ this ->logger ->write ($ e ->getMessage () );
245
247
} finally {
246
- // Logging
247
- $ this ->logger ->display ($ response );
248
-
249
248
// Add the response to the order
250
249
if (is_array ($ response ) && $ api ->isValidResponse ($ response )) {
251
250
$ this ->utilities ->setPaymentData ($ order , $ response );
@@ -299,11 +298,11 @@ protected function needsMotoProcessing(string $methodId, array $params): bool
299
298
* @throws CheckoutArgumentException
300
299
* @throws LocalizedException
301
300
*/
302
- protected function getSource (Order $ order , array $ params )
301
+ protected function getSource (Order $ order , string $ storeCode , array $ params )
303
302
{
304
303
if ($ this ->isCardToken ($ params )) {
305
304
// Initialize the API handler
306
- $ api = $ this ->apiHandler ->init ();
305
+ $ api = $ this ->apiHandler ->init ($ storeCode , ScopeInterface:: SCOPE_STORE );
307
306
308
307
// Create the token source
309
308
if ($ this ->apiHandler ->isPreviousMode ()) {
0 commit comments