← All changes
|
app/Modules/PaymentMethods/StripeGateway/Confirmations.php
+7
-7
1.6.2
→
1.7.0
View file →
| @@ -772,13 +772,13 @@ | ||
| 772 | 772 | |
| 773 | 773 | $fctCustomer->updateMeta($metaKey, $meta); |
| 774 | 774 | } |
| 775 | 775 | |
| 776 | - public function confirmSetupIntent($setupIntent, $trxHash = null) | |
| 776 | + public function confirmSetupIntent($setupIntent, $trxHash = null, $mode = 'current') | |
| 777 | 777 | { |
| 778 | 778 | $api = new API(); |
| 779 | 779 | |
| 780 | - $response = $api->getStripeObject('setup_intents/' . $setupIntent); | |
| 780 | + $response = $api->getStripeObject('setup_intents/' . $setupIntent, [], $mode); | |
| 781 | 781 | |
| 782 | 782 | if (is_wp_error($response)) { |
| 783 | 783 | return $response; |
| 784 | 784 | } |
| @@ -839,15 +839,15 @@ | ||
| 839 | 839 | |
| 840 | 840 | $paymentMethod = Arr::get($response, 'payment_method'); |
| 841 | 841 | $customer = Arr::get($response, 'customer'); |
| 842 | 842 | |
| 843 | - $billingInfo = $this->getPaymentMethodDetails($paymentMethod); | |
| 843 | + $billingInfo = $this->getPaymentMethodDetails($paymentMethod, $mode); | |
| 844 | 844 | |
| 845 | 845 | // attach the payment method to the customer |
| 846 | 846 | if ($paymentMethod && $customer) { |
| 847 | 847 | $api->createStripeObject('payment_methods/' . $paymentMethod . '/attach', [ |
| 848 | 848 | 'customer' => $customer |
| 849 | - ]); | |
| 849 | + ], $mode); | |
| 850 | 850 | |
| 851 | 851 | $this->savePaymentMethodToCustomerMeta($customer, $paymentMethod, $order); |
| 852 | 852 | } |
| 853 | 853 | |
| @@ -923,11 +923,11 @@ | ||
| 923 | 923 | ); |
| 924 | 924 | } |
| 925 | 925 | } |
| 926 | 926 | |
| 927 | - public function getPaymentMethodDetails($methodId) | |
| 927 | + public function getPaymentMethodDetails($methodId, $mode = 'current') | |
| 928 | 928 | { |
| 929 | - $paymentMethodDetails = (new API())->makeRequest('payment_methods/' . $methodId, [], (new StripeSettingsBase())->getApiKey(), 'GET'); | |
| 929 | + $paymentMethodDetails = (new API())->makeRequest('payment_methods/' . $methodId, [], (new StripeSettingsBase())->getApiKey($mode), 'GET'); | |
| 930 | 930 | |
| 931 | 931 | if (is_wp_error($paymentMethodDetails) || !$paymentMethodDetails) { |
| 932 | 932 | $billingInfo = PaymentHelper::parsePaymentMethodDetails('stripe', ['type' => 'card']); |
| 933 | 933 | } else { |
| @@ -1075,9 +1075,9 @@ | ||
| 1075 | 1075 | $transactionUpdateData['transaction_type'] = Status::TRANSACTION_TYPE_DISPUTE; |
| 1076 | 1076 | $disputeId = Arr::get($charge, 'dispute', ''); |
| 1077 | 1077 | $reason = 'unknown'; |
| 1078 | 1078 | |
| 1079 | - $retreiveDispute = (new API())->getStripeObject('disputes/' . $disputeId); | |
| 1079 | + $retreiveDispute = (new API())->getStripeObject('disputes/' . $disputeId, [], StripeHelper::modeFromLivemode(Arr::isTrue($charge, 'livemode'))); | |
| 1080 | 1080 | |
| 1081 | 1081 | if (!is_wp_error($retreiveDispute)) { |
| 1082 | 1082 | $reason = Arr::get($retreiveDispute, 'reason'); |
| 1083 | 1083 | } |