diff --git a/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php b/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php index 8122d7326479..ded2837787fd 100644 --- a/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php +++ b/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php @@ -75,13 +75,16 @@ class AuthorizeCreditCard $authorise_payment_method = new AuthorizePaymentMethod($this->authorize); $payment_profile = $authorise_payment_method->addPaymentMethodToClient($gateway_customer_reference, $data); + $payment_profile_id = $payment_profile->getPaymentProfile()->getCustomerPaymentProfileId(); - if($request->has('store_card') && $request->input('store_card')){ + info($request->input('store_card')); + + if($request->has('store_card') && $request->input('store_card') === 'true'){ $authorise_payment_method->payment_method = GatewayType::CREDIT_CARD; $client_gateway_token = $authorise_payment_method->createClientGatewayToken($payment_profile, $gateway_customer_reference); } - $data = (new ChargePaymentProfile($this->authorize))->chargeCustomerProfile($gateway_customer_reference, $payment_profile, $data['amount_with_fee']); + $data = (new ChargePaymentProfile($this->authorize))->chargeCustomerProfile($gateway_customer_reference, $payment_profile_id, $data['amount_with_fee']); return $this->handleResponse($data, $request); @@ -91,7 +94,7 @@ class AuthorizeCreditCard { $client_gateway_token = ClientGatewayToken::find($this->decodePrimaryKey($request->token)); - $data = (new ChargePaymentProfile($this->authorize))->chargeCustomerProfile($client_gateway_token->gateway_customer_reference, $client_gateway_token->token, $request->input('amount')); + $data = (new ChargePaymentProfile($this->authorize))->chargeCustomerProfile($client_gateway_token->gateway_customer_reference, $client_gateway_token->token, $request->input('amount_with_fee')); return $this->handleResponse($data, $request); } @@ -121,7 +124,7 @@ class AuthorizeCreditCard $payment->currency_id = $this->authorize->client->getSetting('currency_id'); $payment->date = Carbon::now(); $payment->transaction_reference = $response->getTransactionResponse()->getTransId(); - $payment->amount = $request->input('amount'); + $payment->amount = $request->input('amount_with_fee'); $payment->currency_id = $this->authorize->client->getSetting('currency_id'); $payment->client->getNextPaymentNumber($this->authorize->client); $payment->save(); @@ -145,7 +148,7 @@ class AuthorizeCreditCard } private function processFailedResponse($data, $request) - { + { dd($data); info(print_r($data,1)); } diff --git a/database/factories/CompanyFactory.php b/database/factories/CompanyFactory.php index d8616f152fb5..f90e418dd0ef 100644 --- a/database/factories/CompanyFactory.php +++ b/database/factories/CompanyFactory.php @@ -11,7 +11,7 @@ $factory->define(App\Models\Company::class, function (Faker $faker) { 'db' => config('database.default'), 'settings' => CompanySettings::defaults(), 'custom_fields' => (object) [ - 'invoice1' => '1|date', + 'invoice1' => 'Custom Date|date', // 'invoice2' => '2|switch', // 'invoice3' => '3|', // 'invoice4' => '4', diff --git a/public/js/clients/payments/authorize-credit-card-payment.js b/public/js/clients/payments/authorize-credit-card-payment.js index ca4850b33e5d..135c65d2b123 100644 --- a/public/js/clients/payments/authorize-credit-card-payment.js +++ b/public/js/clients/payments/authorize-credit-card-payment.js @@ -141,6 +141,8 @@ var AuthorizeAuthorizeCard = /*#__PURE__*/function () { _defineProperty(this, "handle", function () { if (_this.cardButton) { _this.cardButton.addEventListener("click", function () { + _this.cardButton.disabled = true; + _this.handleAuthorization(); }); } @@ -154,6 +156,8 @@ var AuthorizeAuthorizeCard = /*#__PURE__*/function () { var _loop = function _loop() { var item = _step.value; item.addEventListener('click', function () { + item.disabled = true; + _this.handlePayNowAction(item.dataset.id); }); }; @@ -208,6 +212,7 @@ var AuthorizeAuthorizeCard = /*#__PURE__*/function () { document.getElementById("server_response").submit(); } + this.cardButton.disabled = false; return false; } }]); diff --git a/public/mix-manifest.json b/public/mix-manifest.json index d38e897d8cf9..f29520f24bc5 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -7,7 +7,7 @@ "/js/clients/payment_methods/authorize-authorize-card.js": "/js/clients/payment_methods/authorize-authorize-card.js?id=7f63b5cd48631432a424", "/js/clients/payment_methods/authorize-stripe-card.js": "/js/clients/payment_methods/authorize-stripe-card.js?id=420e22ba244289dd75f8", "/js/clients/payments/alipay.js": "/js/clients/payments/alipay.js?id=cf114848ef8a3633a51b", - "/js/clients/payments/authorize-credit-card-payment.js": "/js/clients/payments/authorize-credit-card-payment.js?id=1b765d273ca55c87f910", + "/js/clients/payments/authorize-credit-card-payment.js": "/js/clients/payments/authorize-credit-card-payment.js?id=a474e669b65198f7ce6f", "/js/clients/payments/card-js.min.js": "/js/clients/payments/card-js.min.js?id=3fe6822360e6c456d1a2", "/js/clients/payments/checkout.com.js": "/js/clients/payments/checkout.com.js?id=31df208670107e18f59d", "/js/clients/payments/process.js": "/js/clients/payments/process.js?id=f4c4b09d4454070a6db6", diff --git a/resources/js/clients/payments/authorize-credit-card-payment.js b/resources/js/clients/payments/authorize-credit-card-payment.js index 23f91387e2b6..a5f1abac6100 100644 --- a/resources/js/clients/payments/authorize-credit-card-payment.js +++ b/resources/js/clients/payments/authorize-credit-card-payment.js @@ -55,6 +55,7 @@ class AuthorizeAuthorizeCard { responseHandler(response) { + if (response.messages.resultCode === "Error") { var i = 0; @@ -70,7 +71,8 @@ class AuthorizeAuthorizeCard { document.getElementById("server_response").submit(); } - + + this.cardButton.disabled=false; return false; } @@ -83,6 +85,8 @@ class AuthorizeAuthorizeCard { { this.cardButton.addEventListener("click", () => { + this.cardButton.disabled = true; + this.handleAuthorization(); }); @@ -94,7 +98,7 @@ class AuthorizeAuthorizeCard { for(let item of this.payNowButton) { item.addEventListener('click', () => { - + item.disabled = true; this.handlePayNowAction(item.dataset.id); }); diff --git a/resources/views/portal/ninja2020/gateways/authorize/credit_card_payment.blade.php b/resources/views/portal/ninja2020/gateways/authorize/credit_card_payment.blade.php index c0c10ace8b46..7f7c5ec2e580 100644 --- a/resources/views/portal/ninja2020/gateways/authorize/credit_card_payment.blade.php +++ b/resources/views/portal/ninja2020/gateways/authorize/credit_card_payment.blade.php @@ -31,10 +31,22 @@
+

+ {{ ctrans('texts.enter_payment') }} +

@if($tokens->count() == 0)
+
+
+ {{ ctrans('texts.amount') }} +
+
+ {{ App\Utils\Number::formatMoney($amount_with_fee, $client) }} +
+
+ @include('portal.ninja2020.gateways.authorize.credit_card')
@@ -51,21 +63,50 @@
@else - - + +
+
+
+
+ {{ ctrans('texts.amount') }} +
+
+ {{ App\Utils\Number::formatMoney($amount_with_fee, $client) }} +
+
+ @foreach($tokens as $token) +
+
+ {{ $token->meta->brand }} : {{ $token->meta->last4 }} +
+
+ +
+
+ @endforeach + +
+
+ @endif
+ + + + + + + + + + + + + @endsection @push('footer')