From b0e680ee5cc6808245ce2ca5b5d92ba2849c7910 Mon Sep 17 00:00:00 2001 From: Francisco Ferreira Date: Thu, 18 Jul 2019 07:26:08 +0100 Subject: [PATCH] Stripe improvements (port #2863 to master) (#2903) * View credit card: send more billing data to Stripe when available As commit 8e8414ab498a6fcfee423a81294789769b68305f shows, this commit had more code that was wrongly commited in ff064367d6f64ce6c05249459ca8ea88c846c99a by another author * Stripe: fill payment card details --- app/Ninja/PaymentDrivers/StripePaymentDriver.php | 5 +++++ resources/views/payments/credit_card.blade.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Ninja/PaymentDrivers/StripePaymentDriver.php b/app/Ninja/PaymentDrivers/StripePaymentDriver.php index 9464169429..60cb070521 100644 --- a/app/Ninja/PaymentDrivers/StripePaymentDriver.php +++ b/app/Ninja/PaymentDrivers/StripePaymentDriver.php @@ -437,6 +437,11 @@ class StripePaymentDriver extends BasePaymentDriver } elseif ($isBitcoin) { $payment->payment_type_id = PAYMENT_TYPE_BITCOIN; } + } else if (! $paymentMethod && $this->isGatewayType(GATEWAY_TYPE_CREDIT_CARD) && ! strcmp($this->purchaseResponse['payment_method_details']['type'], "card")) { + $card = $this->purchaseResponse['payment_method_details']['card']; + $payment->last4 = $card['last4']; + $payment->expiration = $card['exp_year'] . '-' . $card['exp_month'] . '-01'; + $payment->payment_type_id = PaymentType::parseCardType($card['brand']); } return $payment; diff --git a/resources/views/payments/credit_card.blade.php b/resources/views/payments/credit_card.blade.php index f3216543a3..4fa61932b7 100644 --- a/resources/views/payments/credit_card.blade.php +++ b/resources/views/payments/credit_card.blade.php @@ -254,7 +254,7 @@
{!! Former::select('country_id') ->placeholder(trans('texts.country_id')) - ->fromQuery($countries, 'name', 'id') + ->fromQuery($countries, 'name', ['value' => 'id', 'data-iso_3166_2' => 'iso_3166_2']) ->addGroupClass('country-select') ->label('') !!}