diff --git a/app/PaymentDrivers/Stripe/BrowserPay.php b/app/PaymentDrivers/Stripe/BrowserPay.php index 2586f0727883..edb2f16a945a 100644 --- a/app/PaymentDrivers/Stripe/BrowserPay.php +++ b/app/PaymentDrivers/Stripe/BrowserPay.php @@ -100,15 +100,6 @@ class BrowserPay implements MethodInterface */ public function paymentResponse(PaymentResponseRequest $request) { - // if ($request->shouldUseToken()) { - // $charge = \Stripe\Charge::create([ - // 'amount' => $this->stripe->convertToStripeAmount($this->stripe->payment_hash->data->amount_with_fee, $this->stripe->client->currency()->precision, $this->stripe->client->currency()), - // 'currency' => $this->stripe->client->getCurrencyCode(), - // 'customer' => $this->stripe->findOrCreateCustomer()->id, - // 'source' => $request->token, - // ], $this->stripe->stripe_connect_auth); - // } - $gateway_response = json_decode($request->gateway_response); $this->stripe->payment_hash @@ -116,46 +107,11 @@ class BrowserPay implements MethodInterface ->withData('payment_intent', PaymentIntent::retrieve($gateway_response->id, $this->stripe->stripe_connect_auth)); if ($gateway_response->status === 'succeeded') { - if ($request->shouldStoreToken()) { - // $this->storePaymentMethod(); - } - return $this->processSuccessfulPayment(); } return $this->processUnsuccessfulPayment(); } - - protected function storePaymentMethod() - { - $customer = new \stdClass; - $customer->id = $this->stripe->findOrCreateCustomer()->id; - - $payment_method = $this->stripe->payment_hash->data->gateway_response->payment_method; - - $this->stripe->attach($payment_method, $customer); - - $method = $this->stripe->getStripePaymentMethod($payment_method); - - try { - $payment_meta = new \stdClass; - $payment_meta->exp_month = (string) $method->card->exp_month; - $payment_meta->exp_year = (string) $method->card->exp_year; - $payment_meta->brand = (string) $method->card->brand; - $payment_meta->last4 = (string) $method->card->last4; - $payment_meta->type = GatewayType::APPLE_PAY; - - $data = [ - 'payment_meta' => $payment_meta, - 'token' => $method->id, - 'payment_method_id' => GatewayType::APPLE_PAY, - ]; - - $this->stripe->storeGatewayToken($data, ['gateway_customer_reference' => $customer->id]); - } catch (\Exception $e) { - return $this->stripe->processInternallyFailedPayment($this->stripe, $e); - } - } /** * Handle successful payment for browser pay. diff --git a/app/PaymentDrivers/StripePaymentDriver.php b/app/PaymentDrivers/StripePaymentDriver.php index dcdda73b98b5..7ac9ab9d0411 100644 --- a/app/PaymentDrivers/StripePaymentDriver.php +++ b/app/PaymentDrivers/StripePaymentDriver.php @@ -224,7 +224,7 @@ class StripePaymentDriver extends BaseDriver && isset($this->client->country) && in_array($this->client->country->iso_3166_2, ['AE', 'AT', 'AU', 'BE', 'BG', 'BR', 'CA', 'CH', 'CI', 'CR', 'CY', 'CZ', 'DE', 'DK', 'DO', 'EE', 'ES', 'FI', 'FR', 'GB', 'GI', 'GR', 'GT', 'HK', 'HU', 'ID', 'IE', 'IN', 'IT', 'JP', 'LI', 'LT', 'LU', 'LV', 'MT', 'MX', 'MY', 'NL', 'NO', 'NZ', 'PE', 'PH', 'PL', 'PT', 'RO', 'SE', 'SG', 'SI', 'SK', 'SN', 'TH', 'TT', 'US', 'UY']) ) { - $types[] = GatewayType::SOFORT; + $types[] = GatewayType::APPLE_PAY; } return $types; diff --git a/public/js/clients/payments/stripe-browserpay.js b/public/js/clients/payments/stripe-browserpay.js index 8933f9e29028..9598eb1892ea 100644 --- a/public/js/clients/payments/stripe-browserpay.js +++ b/public/js/clients/payments/stripe-browserpay.js @@ -1,2 +1,2 @@ /*! For license information please see stripe-browserpay.js.LICENSE.txt */ -(()=>{function e(e,t){for(var n=0;n{function e(e,t){for(var n=0;n - element.addEventListener('click', (element) => { - document - .getElementById('payment-request-button') - .classList.add('hidden'); - document.getElementById('save-card--container').style.display = - 'none'; - document.querySelector('input[name=token]').value = - element.target.dataset.token; - - document.querySelector( - '.pay-now-button-container' - ).style.display = 'block'; - }) - ); - - document - .getElementById('toggle-payment-with-credit-card') - .addEventListener('click', (element) => { - document - .getElementById('payment-request-button') - .classList.remove('hidden'); - document.getElementById('save-card--container').style.display = - 'grid'; - document.querySelector('input[name=token]').value = ''; - - document.querySelector( - '.pay-now-button-container' - ).style.display = 'none'; - }); - - document - .getElementById('pay-now') - .addEventListener('click', (event) => { - event.target.parentElement.disabled = true; - - document.querySelector('#server-response').submit(); - }); - - document.querySelector('.pay-now-button-container').style.display = - 'none'; } } diff --git a/resources/views/portal/ninja2020/gateways/stripe/browser_pay/pay.blade.php b/resources/views/portal/ninja2020/gateways/stripe/browser_pay/pay.blade.php index db4e3bfb8561..24fd269d76b9 100644 --- a/resources/views/portal/ninja2020/gateways/stripe/browser_pay/pay.blade.php +++ b/resources/views/portal/ninja2020/gateways/stripe/browser_pay/pay.blade.php @@ -28,38 +28,9 @@ @include('portal.ninja2020.gateways.includes.payment_details') - @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.pay_with')]) - @if(count($tokens) > 0) - @foreach($tokens as $token) - - @endforeach - @endisset - - - @endcomponent - @component('portal.ninja2020.components.general.card-element-single')
@endcomponent - -
- @include('portal.ninja2020.gateways.includes.pay_now') -
@endsection @section('gateway_footer')