diff --git a/app/Models/Gateway.php b/app/Models/Gateway.php index 8ad783b086ed..1b52c9652726 100644 --- a/app/Models/Gateway.php +++ b/app/Models/Gateway.php @@ -112,9 +112,9 @@ class Gateway extends StaticModel GatewayType::GIROPAY => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded']], GatewayType::EPS => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded']], GatewayType::BANCONTACT => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded']], + GatewayType::BECS => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded']], GatewayType::IDEAL => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded']], - ]; - + GatewayType::ACSS => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded']]]; case 39: return [GatewayType::CREDIT_CARD => ['refund' => true, 'token_billing' => true, 'webhooks' => [' ']]]; //Checkout break; diff --git a/app/Models/GatewayType.php b/app/Models/GatewayType.php index 61e15855a739..e7b5160b816a 100644 --- a/app/Models/GatewayType.php +++ b/app/Models/GatewayType.php @@ -11,6 +11,8 @@ namespace App\Models; +use function Symfony\Component\String\s; + class GatewayType extends StaticModel { public $timestamps = false; @@ -33,6 +35,8 @@ class GatewayType extends StaticModel const PRZELEWY24 = 16; const EPS = 17; const DIRECT_DEBIT = 18; + const ACSS = 19; + const BECS = 20; public function gateway() { @@ -79,6 +83,10 @@ class GatewayType extends StaticModel return ctrans('texts.giropay'); case self::EPS: return ctrans('texts.eps'); + case self::BECS: + return ctrans('tets.becs'); + case self::ACSS: + return ctrans('texts.acss'); case self::DIRECT_DEBIT: return ctrans('texts.payment_type_direct_debit'); default: diff --git a/app/Models/PaymentType.php b/app/Models/PaymentType.php index af84feeb9796..6a6f29360892 100644 --- a/app/Models/PaymentType.php +++ b/app/Models/PaymentType.php @@ -51,6 +51,8 @@ class PaymentType extends StaticModel const PRZELEWY24 = 40; const EPS = 41; const DIRECT_DEBIT = 42; + ` const BECS = 43; + const ACSS = 44; public static function parseCardType($cardName) { diff --git a/app/PaymentDrivers/Stripe/ACSS.php b/app/PaymentDrivers/Stripe/ACSS.php new file mode 100644 index 000000000000..6d5276e7e1fe --- /dev/null +++ b/app/PaymentDrivers/Stripe/ACSS.php @@ -0,0 +1,261 @@ +stripe = $stripe; + $this->stripe->init(); + } + + public function authorizeView($data) + { + $data['gateway'] = $this->stripe; + + return render('gateways.stripe.acss.authorize', array_merge($data)); + } + public function authorizeResponse(Request $request) + { + $stripe_response = json_decode($request->input('gateway_response')); + + $customer = $this->stripe->findOrCreateCustomer(); + + try { + $source = Customer::createSource($customer->id, ['source' => $stripe_response->token->id], $this->stripe->stripe_connect_auth); + } catch (InvalidRequestException $e) { + throw new PaymentFailed($e->getMessage(), $e->getCode()); + } + + $client_gateway_token = $this->storePaymentMethod($source, $request->input('method'), $customer); + + $verification = route('client.payment_methods.verification', ['payment_method' => $client_gateway_token->hashed_id, 'method' => GatewayType::ACSS], false); + + $mailer = new NinjaMailerObject(); + + $mailer->mailable = new ACHVerificationNotification( + auth('contact')->user()->client->company, + route('client.contact_login', ['contact_key' => auth('contact')->user()->contact_key, 'next' => $verification]) + ); + + $mailer->company = auth('contact')->user()->client->company; + $mailer->settings = auth('contact')->user()->client->company->settings; + $mailer->to_user = auth('contact')->user(); + + NinjaMailerJob::dispatch($mailer); + + return redirect()->route('client.payment_methods.verification', ['payment_method' => $client_gateway_token->hashed_id, 'method' => GatewayType::ACSS]); + } + + public function verificationView(ClientGatewayToken $token) + { + if (isset($token->meta->state) && $token->meta->state === 'authorized') { + return redirect() + ->route('client.payment_methods.show', $token->hashed_id) + ->with('message', __('texts.payment_method_verified')); + } + + $data = [ + 'token' => $token, + 'gateway' => $this->stripe, + ]; + + return render('gateways.stripe.acss.verify', $data); + } + + public function processVerification(Request $request, ClientGatewayToken $token) + { + $request->validate([ + 'transactions.*' => ['integer', 'min:1'], + ]); + + if (isset($token->meta->state) && $token->meta->state === 'authorized') { + return redirect() + ->route('client.payment_methods.show', $token->hashed_id) + ->with('message', __('texts.payment_method_verified')); + } + + $bank_account = Customer::retrieveSource($request->customer, $request->source, [], $this->stripe->stripe_connect_auth); + + try { + $bank_account->verify(['amounts' => request()->transactions]); + + $meta = $token->meta; + $meta->state = 'authorized'; + $token->meta = $meta; + $token->save(); + + return redirect() + ->route('client.payment_methods.show', $token->hashed_id) + ->with('message', __('texts.payment_method_verified')); + } catch (CardException $e) { + return back()->with('error', $e->getMessage()); + } + } + + public function paymentView(array $data) + { + $data['gateway'] = $this->stripe; + $data['return_url'] = $this->buildReturnUrl(); + $data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency()); + $data['client'] = $this->stripe->client; + $data['customer'] = $this->stripe->findOrCreateCustomer()->id; + $data['country'] = $this->stripe->client->country->iso_3166_2; + + $intent = \Stripe\PaymentIntent::create([ + 'amount' => $data['stripe_amount'], + 'currency' => $this->stripe->client->currency()->code, + 'setup_future_usage' => 'off_session', + 'payment_method_types' => ['acss_debit'], + 'customer' => $this->stripe->findOrCreateCustomer(), + 'description' => $this->stripe->decodeUnicodeString(ctrans('texts.invoices') . ': ' . collect($data['invoices'])->pluck('invoice_number')), + 'payment_method_options' => [ + 'acss_debit' => [ + 'mandate_options' => [ + 'payment_schedule' => 'combined', + 'interval_description' => 'when any invoice becomes due', + 'transaction_type' => 'personal' // TODO: check if is company or personal https://stripe.com/docs/payments/acss-debit + ], + 'currency' => $this->stripe->client->currency()->code, + ] + ] + ]); + + $data['pi_client_secret'] = $intent->client_secret; + + $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]); + $this->stripe->payment_hash->save(); + + return render('gateways.stripe.acss.pay', $data); + } + + private function buildReturnUrl(): string + { + return route('client.payments.response', [ + 'company_gateway_id' => $this->stripe->company_gateway->id, + 'payment_hash' => $this->stripe->payment_hash->hash, + 'payment_method_id' => GatewayType::ACSS, + ]); + } + + public function paymentResponse(PaymentResponseRequest $request) + { + $gateway_response = json_decode($request->gateway_response); + + $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all()); + $this->stripe->payment_hash->save(); + + if (property_exists($gateway_response, 'status') && $gateway_response->status == 'processing') { + $this->storePaymentMethod($gateway_response); + return $this->processSuccessfulPayment($gateway_response->id); + } + return $this->processUnsuccessfulPayment(); + } + + public function processSuccessfulPayment(string $payment_intent): \Illuminate\Http\RedirectResponse + { + $data = [ + 'payment_method' => $payment_intent, + 'payment_type' => PaymentType::ACSS, + 'amount' => $this->stripe->convertFromStripeAmount($this->stripe->payment_hash->data->stripe_amount, $this->stripe->client->currency()->precision, $this->stripe->client->currency()), + 'transaction_reference' => $payment_intent, + 'gateway_type_id' => GatewayType::ACSS, + ]; + + $payment = $this->stripe->createPayment($data, Payment::STATUS_PENDING); + + SystemLogger::dispatch( + ['response' => $this->stripe->payment_hash->data, 'data' => $data], + SystemLog::CATEGORY_GATEWAY_RESPONSE, + SystemLog::EVENT_GATEWAY_SUCCESS, + SystemLog::TYPE_STRIPE, + $this->stripe->client, + $this->stripe->client->company, + ); + + return redirect()->route('client.payments.show', $payment->hashed_id); + } + + public function processUnsuccessfulPayment() + { + $server_response = $this->stripe->payment_hash->data; + + PaymentFailureMailer::dispatch( + $this->stripe->client, + $server_response, + $this->stripe->client->company, + $this->stripe->convertFromStripeAmount($this->stripe->payment_hash->data->stripe_amount, $this->stripe->client->currency()->precision, $this->stripe->client->currency()) + ); + + $message = [ + 'server_response' => $server_response, + 'data' => $this->stripe->payment_hash->data, + ]; + + SystemLogger::dispatch( + $message, + SystemLog::CATEGORY_GATEWAY_RESPONSE, + SystemLog::EVENT_GATEWAY_FAILURE, + SystemLog::TYPE_STRIPE, + $this->stripe->client, + $this->stripe->client->company, + ); + + throw new PaymentFailed('Failed to process the payment.', 500); + } + + private function storePaymentMethod($intent) + { + try { + $method = $this->stripe->getStripePaymentMethod($intent->payment_method); + + $payment_meta = new \stdClass; + $payment_meta->brand = (string) \sprintf('%s (%s)', $method->au_becs_debit->bank_code, ctrans('texts.acss')); + $payment_meta->last4 = (string) $method->au_becs_debit->last4; + $payment_meta->state = 'authorized'; + $payment_meta->type = GatewayType::ACSS; + + $data = [ + 'payment_meta' => $payment_meta, + 'token' => $intent->payment_method, + 'payment_method_id' => GatewayType::ACSS, + ]; + + $this->stripe->storeGatewayToken($data, ['gateway_customer_reference' => $method->customer]); + } catch (\Exception $e) { + return $this->stripe->processInternallyFailedPayment($this->stripe, $e); + } + } +} diff --git a/app/PaymentDrivers/Stripe/BECS.php b/app/PaymentDrivers/Stripe/BECS.php new file mode 100644 index 000000000000..8a9007a0e1c3 --- /dev/null +++ b/app/PaymentDrivers/Stripe/BECS.php @@ -0,0 +1,160 @@ +stripe = $stripe; + $this->stripe->init(); + } + + public function authorizeView($data) + { + return render('gateways.stripe.becs.authorize', $data); + } + + public function paymentView(array $data) + { + $data['gateway'] = $this->stripe; + $data['payment_method_id'] = GatewayType::BECS; + $data['stripe_amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency()); + $data['client'] = $this->stripe->client; + $data['customer'] = $this->stripe->findOrCreateCustomer()->id; + $data['country'] = $this->stripe->client->country->iso_3166_2; + $data['payment_hash'] = $this->stripe->payment_hash->hash; + + $intent = \Stripe\PaymentIntent::create([ + 'amount' => $data['stripe_amount'], + 'currency' => $this->stripe->client->currency()->code, + 'payment_method_types' => ['au_becs_debit'], + 'setup_future_usage' => 'off_session', + 'customer' => $this->stripe->findOrCreateCustomer(), + 'description' => $this->stripe->decodeUnicodeString(ctrans('texts.invoices') . ': ' . collect($data['invoices'])->pluck('invoice_number')), + + ]); + + $data['pi_client_secret'] = $intent->client_secret; + + $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]); + $this->stripe->payment_hash->save(); + + return render('gateways.stripe.becs.pay', $data); + } + + public function paymentResponse(PaymentResponseRequest $request) + { + $gateway_response = json_decode($request->gateway_response); + + $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all()); + $this->stripe->payment_hash->save(); + + if (property_exists($gateway_response, 'status') && $gateway_response->status == 'processing') { + $this->stripe->init(); + $this->storePaymentMethod($gateway_response); + + return $this->processSuccessfulPayment($gateway_response->id); + } + + return $this->processUnsuccessfulPayment(); + } + + public function processSuccessfulPayment(string $payment_intent): \Illuminate\Http\RedirectResponse + { + $data = [ + 'payment_method' => $payment_intent, + 'payment_type' => PaymentType::BECS, + 'amount' => $this->stripe->convertFromStripeAmount($this->stripe->payment_hash->data->stripe_amount, $this->stripe->client->currency()->precision, $this->stripe->client->currency()), + 'transaction_reference' => $payment_intent, + 'gateway_type_id' => GatewayType::BECS, + ]; + + $payment = $this->stripe->createPayment($data, Payment::STATUS_PENDING); + + SystemLogger::dispatch( + ['response' => $this->stripe->payment_hash->data, 'data' => $data], + SystemLog::CATEGORY_GATEWAY_RESPONSE, + SystemLog::EVENT_GATEWAY_SUCCESS, + SystemLog::TYPE_STRIPE, + $this->stripe->client, + $this->stripe->client->company, + ); + + return redirect()->route('client.payments.show', $payment->hashed_id); + } + + public function processUnsuccessfulPayment() + { + $server_response = $this->stripe->payment_hash->data; + + PaymentFailureMailer::dispatch( + $this->stripe->client, + $server_response, + $this->stripe->client->company, + $this->stripe->convertFromStripeAmount($this->stripe->payment_hash->data->stripe_amount, $this->stripe->client->currency()->precision, $this->stripe->client->currency()) + ); + + $message = [ + 'server_response' => $server_response, + 'data' => $this->stripe->payment_hash->data, + ]; + + SystemLogger::dispatch( + $message, + SystemLog::CATEGORY_GATEWAY_RESPONSE, + SystemLog::EVENT_GATEWAY_FAILURE, + SystemLog::TYPE_STRIPE, + $this->stripe->client, + $this->stripe->client->company, + ); + + throw new PaymentFailed('Failed to process the payment.', 500); + } + + + private function storePaymentMethod($intent) + { + try { + $method = $this->stripe->getStripePaymentMethod($intent->payment_method); + + $payment_meta = new \stdClass; + $payment_meta->brand = (string) \sprintf('%s (%s)', $method->sepa_debit->bank_code, ctrans('texts.becs')); + $payment_meta->last4 = (string) $method->sepa_debit->last4; + $payment_meta->state = 'authorized'; + $payment_meta->type = GatewayType::BECS; + + $data = [ + 'payment_meta' => $payment_meta, + 'token' => $intent->payment_method, + 'payment_method_id' => GatewayType::BECS, + ]; + + $this->stripe->storeGatewayToken($data, ['gateway_customer_reference' => $method->customer]); + } catch (\Exception $e) { + return $this->stripe->processInternallyFailedPayment($this->stripe, $e); + } + } +} diff --git a/app/PaymentDrivers/Stripe/Bancontact.php b/app/PaymentDrivers/Stripe/Bancontact.php index c269b286f7e0..608783de77c6 100644 --- a/app/PaymentDrivers/Stripe/Bancontact.php +++ b/app/PaymentDrivers/Stripe/Bancontact.php @@ -87,8 +87,9 @@ class Bancontact /* @todo: https://github.com/invoiceninja/invoiceninja/pull/3789/files#r436175798 */ //catch duplicate submissions. - if(Payment::where('transaction_reference', $payment_intent)->exists()) + if (Payment::where('transaction_reference', $payment_intent)->exists()) { return redirect()->route('client.payments.index'); + } $this->stripe->init(); diff --git a/app/PaymentDrivers/Stripe/EPS.php b/app/PaymentDrivers/Stripe/EPS.php index 3d8f8323e7d6..5bd92956dca8 100644 --- a/app/PaymentDrivers/Stripe/EPS.php +++ b/app/PaymentDrivers/Stripe/EPS.php @@ -89,8 +89,9 @@ class EPS $this->stripe->init(); //catch duplicate submissions. - if(Payment::where('transaction_reference', $payment_intent)->exists()) + if (Payment::where('transaction_reference', $payment_intent)->exists()) { return redirect()->route('client.payments.index'); + } $data = [ 'payment_method' => $payment_intent, diff --git a/app/PaymentDrivers/Stripe/GIROPAY.php b/app/PaymentDrivers/Stripe/GIROPAY.php index 6894870af0a8..102cf371cfe8 100644 --- a/app/PaymentDrivers/Stripe/GIROPAY.php +++ b/app/PaymentDrivers/Stripe/GIROPAY.php @@ -89,8 +89,9 @@ class GIROPAY $this->stripe->init(); //catch duplicate submissions. - if(Payment::where('transaction_reference', $payment_intent)->exists()) + if (Payment::where('transaction_reference', $payment_intent)->exists()) { return redirect()->route('client.payments.index'); + } $data = [ 'payment_method' => $payment_intent, diff --git a/app/PaymentDrivers/Stripe/PRZELEWY24.php b/app/PaymentDrivers/Stripe/PRZELEWY24.php index 8ed4b76bc3a1..5438649912e1 100644 --- a/app/PaymentDrivers/Stripe/PRZELEWY24.php +++ b/app/PaymentDrivers/Stripe/PRZELEWY24.php @@ -89,8 +89,9 @@ class PRZELEWY24 $this->stripe->init(); //catch duplicate submissions. - if(Payment::where('transaction_reference', $payment_intent)->exists()) + if (Payment::where('transaction_reference', $payment_intent)->exists()) { return redirect()->route('client.payments.index'); + } $data = [ 'payment_method' => $payment_intent, diff --git a/app/PaymentDrivers/Stripe/iDeal.php b/app/PaymentDrivers/Stripe/iDeal.php index 1a26e03c18bd..c9a43a8e1793 100644 --- a/app/PaymentDrivers/Stripe/iDeal.php +++ b/app/PaymentDrivers/Stripe/iDeal.php @@ -89,8 +89,9 @@ class iDeal $this->stripe->init(); //catch duplicate submissions. - if(Payment::where('transaction_reference', $payment_intent)->exists()) + if (Payment::where('transaction_reference', $payment_intent)->exists()) { return redirect()->route('client.payments.index'); + } $data = [ 'payment_method' => $payment_intent, diff --git a/app/PaymentDrivers/StripePaymentDriver.php b/app/PaymentDrivers/StripePaymentDriver.php index b70ff0715dce..93cc87f8cd85 100644 --- a/app/PaymentDrivers/StripePaymentDriver.php +++ b/app/PaymentDrivers/StripePaymentDriver.php @@ -38,6 +38,8 @@ use App\PaymentDrivers\Stripe\GIROPAY; use App\PaymentDrivers\Stripe\iDeal; use App\PaymentDrivers\Stripe\EPS; use App\PaymentDrivers\Stripe\Bancontact; +use App\PaymentDrivers\Stripe\BECS; +use App\PaymentDrivers\Stripe\ACSS; use App\PaymentDrivers\Stripe\UpdatePaymentMethods; use App\PaymentDrivers\Stripe\Utilities; use App\Utils\Traits\MakesHash; @@ -87,6 +89,8 @@ class StripePaymentDriver extends BaseDriver GatewayType::IDEAL => iDeal::class, GatewayType::EPS => EPS::class, GatewayType::BANCONTACT => Bancontact::class, + GatewayType::BECS => BECS::class, + GatewayType::ACSS => ACSS::class, ]; const SYSTEM_LOG_TYPE = SystemLog::TYPE_STRIPE; @@ -200,6 +204,20 @@ class StripePaymentDriver extends BaseDriver && in_array($this->client->country->iso_3166_3, ["BEL"])) $types[] = GatewayType::BANCONTACT; + if ($this->client + && $this->client->currency() + && ($this->client->currency()->code == 'AUD') + && isset($this->client->country) + && in_array($this->client->country->iso_3166_3, ["AUS", "DEU"])) + $types[] = GatewayType::BECS; + + if ($this->client + && $this->client->currency() + && in_array($this->client->currency()->code, ['CAD', 'USD']) + && isset($this->client->country) + && in_array($this->client->country->iso_3166_3, ["CAN", "USA"])) + $types[] = GatewayType::ACSS; + return $types; } @@ -235,6 +253,10 @@ class StripePaymentDriver extends BaseDriver return 'gateways.stripe.eps'; case GatewayType::BANCONTACT: return 'gateways.stripe.bancontact'; + case GatewayType::BECS: + return 'gateways.stripe.becs'; + case GatewayType::ACSS: + return 'gateways.stripe.acss'; default: break; } diff --git a/database/migrations/2021_10_15_00000_stripe_payment_gateways.php b/database/migrations/2021_10_15_00000_stripe_payment_gateways.php new file mode 100644 index 000000000000..4a1e618ea259 --- /dev/null +++ b/database/migrations/2021_10_15_00000_stripe_payment_gateways.php @@ -0,0 +1,52 @@ +id = 44; + $type->name = 'ACSS'; + $type->gateway_type_id = GatewayType::ACSS; + + $type2->id = 43; + $type2->name = 'BECS'; + $type2->gateway_type_id = GatewayType::BECS; + + $type3->id = 39; + $type3->name = 'GiroPay'; + $type3->gateway_type_id = GatewayType::GIROPAY; + + $type4->id = 40; + $type4->name = 'Przelewy24'; + $type4->gateway_type_id = GatewayType::PRZELEWY24; + + $type5->id = 41; + $type5->name = 'EPS'; + $type5->gateway_type_id = GatewayType::EPS; + + $type->save(); + $type2->save(); + $type3->save(); + $type4->save(); + $type5->save(); + }); + } +} diff --git a/public/js/clients/payments/stripe-acss.js b/public/js/clients/payments/stripe-acss.js new file mode 100644 index 000000000000..f6309e9574ef --- /dev/null +++ b/public/js/clients/payments/stripe-acss.js @@ -0,0 +1,2 @@ +/*! For license information please see stripe-acss.js.LICENSE.txt */ +!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=31)}({31:function(e,t,n){e.exports=n("RyUd")},RyUd:function(e,t){var n,r,o,a;function u(e,t){for(var n=0;n svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),void r.stripe.confirmAcssDebitPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{billing_details:{name:document.getElementById("acss-name").value,email:document.getElementById("acss-email-address").value}}}).then((function(e){return e.error?r.handleFailure(e.error.message):r.handleSuccess(e)})))}))})),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}var t,n,r;return t=e,(n=[{key:"handleSuccess",value:function(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent),document.getElementById("server-response").submit()}},{key:"handleFailure",value:function(e){var t=document.getElementById("errors");t.textContent="",t.textContent=e,t.hidden=!1,document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden")}}])&&u(t.prototype,n),r&&u(t,r),e}(),d=null!==(n=null===(r=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"",l=null!==(o=null===(a=document.querySelector('meta[name="stripe-account-id"]'))||void 0===a?void 0:a.content)&&void 0!==o?o:"";new c(d,l).setupStripe().handle()}}); \ No newline at end of file diff --git a/public/js/clients/payments/stripe-acss.js.LICENSE.txt b/public/js/clients/payments/stripe-acss.js.LICENSE.txt new file mode 100644 index 000000000000..585c6ab0e4fc --- /dev/null +++ b/public/js/clients/payments/stripe-acss.js.LICENSE.txt @@ -0,0 +1,9 @@ +/** + * Invoice Ninja (https://invoiceninja.com) + * + * @link https://github.com/invoiceninja/invoiceninja source repository + * + * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com) + * + * @license https://opensource.org/licenses/AAL + */ diff --git a/public/js/clients/payments/stripe-bancontact.js b/public/js/clients/payments/stripe-bancontact.js index d1f9067d31aa..6e4fe1e60f4b 100644 --- a/public/js/clients/payments/stripe-bancontact.js +++ b/public/js/clients/payments/stripe-bancontact.js @@ -1 +1,2 @@ -!function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/",o(o.s=6)}({6:function(e,t,n){e.exports=n("RFiP")},RFiP:function(e,t){var n;function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var r=null!==(n=null===(r=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"",i=null!==(n=null===(n=document.querySelector('meta[name="stripe-account-id"]'))||void 0===n?void 0:n.content)&&void 0!==n?n:"";new function t(e,n){var r=this;!function(e){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),o(this,"setupStripe",function(){return r.stripe=Stripe(r.key),r.stripeConnect&&(r.stripe.stripeAccount=i),r}),o(this,"handle",function(){document.getElementById("pay-now").addEventListener("click",e=>{let t=document.getElementById("errors");if(!document.getElementById("bancontact-name").value)return t.textContent="Enter name",t.hidden=!1,void console.log("name");document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),this.stripe.confirmBancontactPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{billing_details:{name:document.getElementById("bancontact-name").value}},return_url:document.querySelector('meta[name="return-url"]').content})})}),this.key=e,this.errors=document.getElementById("errors"),this.stripeConnect=n}(r,i).setupStripe().handle()}}); +/*! For license information please see stripe-bancontact.js.LICENSE.txt */ +!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=32)}({32:function(e,t,n){e.exports=n("9g3I")},"9g3I":function(e,t){var n,r,o,u;function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=null!==(n=null===(r=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"",a=null!==(o=null===(u=document.querySelector('meta[name="stripe-account-id"]'))||void 0===u?void 0:u.content)&&void 0!==o?o:"";new function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"setupStripe",(function(){return r.stripe=Stripe(r.key),r.stripeConnect&&(r.stripe.stripeAccount=a),r})),i(this,"handle",(function(){document.getElementById("pay-now").addEventListener("click",(function(e){var t=document.getElementById("errors");if(!document.getElementById("bancontact-name").value)return t.textContent=document.querySelector("meta[name=translation-name-required]").content,t.hidden=!1,void console.log("name");document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),r.stripe.confirmBancontactPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{billing_details:{name:document.getElementById("bancontact-name").value}},return_url:document.querySelector('meta[name="return-url"]').content})}))})),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}(c,a).setupStripe().handle()}}); \ No newline at end of file diff --git a/public/js/clients/payments/stripe-becs.js b/public/js/clients/payments/stripe-becs.js new file mode 100644 index 000000000000..851bd93de950 --- /dev/null +++ b/public/js/clients/payments/stripe-becs.js @@ -0,0 +1,2 @@ +/*! For license information please see stripe-becs.js.LICENSE.txt */ +!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=33)}({33:function(e,t,n){e.exports=n("v79X")},v79X:function(e,t){var n,o,r,a;function c(e,t){for(var n=0;n svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),void o.stripe.confirmAuBecsDebitPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{au_becs_debit:o.auBankAccount,billing_details:{name:document.getElementById("becs-name").value,email:document.getElementById("becs-email-address").value}}}).then((function(e){return e.error?o.handleFailure(e.error.message):o.handleSuccess(e)}))):(document.getElementById("becs-mandate-acceptance").focus(),t.textContent=document.querySelector("meta[name=translation-terms-required]").content,t.hidden=!1,void console.log("Terms"))}))})),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}var t,n,o;return t=e,(n=[{key:"handleSuccess",value:function(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent),document.getElementById("server-response").submit()}},{key:"handleFailure",value:function(e){var t=document.getElementById("errors");t.textContent="",t.textContent=e,t.hidden=!1,document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden")}}])&&c(t.prototype,n),o&&c(t,o),e}(),l=null!==(n=null===(o=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===o?void 0:o.content)&&void 0!==n?n:"",d=null!==(r=null===(a=document.querySelector('meta[name="stripe-account-id"]'))||void 0===a?void 0:a.content)&&void 0!==r?r:"";new i(l,d).setupStripe().handle()}}); \ No newline at end of file diff --git a/public/js/clients/payments/stripe-becs.js.LICENSE.txt b/public/js/clients/payments/stripe-becs.js.LICENSE.txt new file mode 100644 index 000000000000..585c6ab0e4fc --- /dev/null +++ b/public/js/clients/payments/stripe-becs.js.LICENSE.txt @@ -0,0 +1,9 @@ +/** + * Invoice Ninja (https://invoiceninja.com) + * + * @link https://github.com/invoiceninja/invoiceninja source repository + * + * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com) + * + * @license https://opensource.org/licenses/AAL + */ diff --git a/public/js/clients/payments/stripe-eps.js b/public/js/clients/payments/stripe-eps.js index d587e26d4aea..3ee731a4541f 100644 --- a/public/js/clients/payments/stripe-eps.js +++ b/public/js/clients/payments/stripe-eps.js @@ -1 +1,2 @@ -!function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/",o(o.s=6)}({6:function(e,t,n){e.exports=n("RFiP")},RFiP:function(e,t){var n;function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var r=null!==(n=null===(r=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"",i=null!==(n=null===(n=document.querySelector('meta[name="stripe-account-id"]'))||void 0===n?void 0:n.content)&&void 0!==n?n:"";new function t(e,n){var r=this;!function(e){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),o(this,"setupStripe",function(){r.stripe=Stripe(r.key),r.stripeConnect&&(r.stripe.stripeAccount=i);let e=r.stripe.elements();return r.eps=e.create("epsBank",{style:{base:{padding:"10px 12px",color:"#32325d",fontSize:"16px","::placeholder":{color:"#aab7c4"}}}}),r.eps.mount("#eps-bank-element"),r}),o(this,"handle",function(){document.getElementById("pay-now").addEventListener("click",e=>{let t=document.getElementById("errors");if(!document.getElementById("eps-name").value)return t.textContent="Enter name",t.hidden=!1,void console.log("name");document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),this.stripe.confirmEpsPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{eps:r.eps,billing_details:{name:document.getElementById("eps-name").value}},return_url:document.querySelector('meta[name="return-url"]').content})})}),this.key=e,this.errors=document.getElementById("errors"),this.stripeConnect=n}(r,i).setupStripe().handle()}}); +/*! For license information please see stripe-eps.js.LICENSE.txt */ +!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=34)}({34:function(e,t,n){e.exports=n("Gn/6")},"Gn/6":function(e,t){var n,r,o,i;function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=null!==(n=null===(r=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"",c=null!==(o=null===(i=document.querySelector('meta[name="stripe-account-id"]'))||void 0===i?void 0:i.content)&&void 0!==o?o:"";new function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),u(this,"setupStripe",(function(){r.stripe=Stripe(r.key),r.stripeConnect&&(r.stripe.stripeAccount=c);var e=r.stripe.elements();return r.eps=e.create("epsBank",{style:{base:{padding:"10px 12px",color:"#32325d",fontSize:"16px","::placeholder":{color:"#aab7c4"}}}}),r.eps.mount("#eps-bank-element"),r})),u(this,"handle",(function(){document.getElementById("pay-now").addEventListener("click",(function(e){var t=document.getElementById("errors");if(!document.getElementById("eps-name").value)return t.textContent=document.querySelector("meta[name=translation-name-required]").content,t.hidden=!1,void console.log("name");document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),r.stripe.confirmEpsPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{eps:r.eps,billing_details:{name:document.getElementById("ideal-name").value}},return_url:document.querySelector('meta[name="return-url"]').content})}))})),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}(a,c).setupStripe().handle()}}); \ No newline at end of file diff --git a/public/js/clients/payments/stripe-giropay.js b/public/js/clients/payments/stripe-giropay.js index add121c25afe..d46a0137c377 100644 --- a/public/js/clients/payments/stripe-giropay.js +++ b/public/js/clients/payments/stripe-giropay.js @@ -1 +1,2 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=6)}({6:function(e,t,n){e.exports=n("RFiP")},RFiP:function(e,t){var n,r,o,i;function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=null!==(n=null===(r=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"",l=null!==(o=null===(i=document.querySelector('meta[name="stripe-account-id"]'))||void 0===i?void 0:i.content)&&void 0!==o?o:"";new function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),u(this,"setupStripe",function(){return r.stripe=Stripe(r.key),r.stripeConnect&&(r.stripe.stripeAccount=l),r}),u(this,"handle",function(){document.getElementById("pay-now").addEventListener("click",function(e){let t=document.getElementById("errors");if(!document.getElementById("giropay-mandate-acceptance").checked)return t.textContent="Accept Terms",t.hidden=!1,void console.log("Terms");document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),r.stripe.confirmGiropayPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{billing_details:{name:document.getElementById("giropay-name").value}},return_url:document.querySelector('meta[name="return-url"]').content})})}),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}(c,l).setupStripe().handle()}}); +/*! For license information please see stripe-giropay.js.LICENSE.txt */ +!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=30)}({30:function(e,t,n){e.exports=n("5IXF")},"5IXF":function(e,t){var n,r,o,i;function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=null!==(n=null===(r=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"",a=null!==(o=null===(i=document.querySelector('meta[name="stripe-account-id"]'))||void 0===i?void 0:i.content)&&void 0!==o?o:"";new function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),u(this,"setupStripe",(function(){return r.stripe=Stripe(r.key),r.stripeConnect&&(r.stripe.stripeAccount=a),r})),u(this,"handle",(function(){document.getElementById("pay-now").addEventListener("click",(function(e){var t=document.getElementById("errors");if(!document.getElementById("giropay-mandate-acceptance").checked)return t.textContent=document.querySelector("meta[name=translation-terms-required]").content,t.hidden=!1,void console.log("Terms");document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),r.stripe.confirmGiropayPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{billing_details:{name:document.getElementById("giropay-name").value}},return_url:document.querySelector('meta[name="return-url"]').content})}))})),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}(c,a).setupStripe().handle()}}); \ No newline at end of file diff --git a/public/js/clients/payments/stripe-ideal.js b/public/js/clients/payments/stripe-ideal.js index 5c8ddc3e22d3..ddf7fcb670dc 100644 --- a/public/js/clients/payments/stripe-ideal.js +++ b/public/js/clients/payments/stripe-ideal.js @@ -1 +1,2 @@ -!function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/",o(o.s=6)}({6:function(e,t,n){e.exports=n("RFiP")},RFiP:function(e,t){var n;function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var r=null!==(n=null===(r=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"",i=null!==(n=null===(n=document.querySelector('meta[name="stripe-account-id"]'))||void 0===n?void 0:n.content)&&void 0!==n?n:"";new function t(e,n){var r=this;!function(e){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),o(this,"setupStripe",function(){r.stripe=Stripe(r.key),r.stripeConnect&&(r.stripe.stripeAccount=i);let e=r.stripe.elements();return this.ideal=e.create("idealBank",{style:{base:{padding:"10px 12px",color:"#32325d",fontSize:"16px","::placeholder":{color:"#aab7c4"}}}}),this.ideal.mount("#ideal-bank-element"),r}),o(this,"handle",function(){document.getElementById("pay-now").addEventListener("click",e=>{let t=document.getElementById("errors");if(!document.getElementById("ideal-name").value)return t.textContent="Enter name",t.hidden=!1,void console.log("name");document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),this.stripe.confirmIdealPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{ideal:this.ideal,billing_details:{name:document.getElementById("ideal-name").value}},return_url:document.querySelector('meta[name="return-url"]').content})})}),this.key=e,this.errors=document.getElementById("errors"),this.stripeConnect=n}(r,i).setupStripe().handle()}}); +/*! For license information please see stripe-ideal.js.LICENSE.txt */ +!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=35)}({35:function(e,t,n){e.exports=n("T01t")},T01t:function(e,t){var n,r,o,i;function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=null!==(n=null===(r=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"",u=null!==(o=null===(i=document.querySelector('meta[name="stripe-account-id"]'))||void 0===i?void 0:i.content)&&void 0!==o?o:"";new function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),a(this,"setupStripe",(function(){r.stripe=Stripe(r.key),r.stripeConnect&&(r.stripe.stripeAccount=u);var e=r.stripe.elements();return r.ideal=e.create("idealBank",{style:{base:{padding:"10px 12px",color:"#32325d",fontSize:"16px","::placeholder":{color:"#aab7c4"}}}}),r.ideal.mount("#ideal-bank-element"),r})),a(this,"handle",(function(){document.getElementById("pay-now").addEventListener("click",(function(e){var t=document.getElementById("errors");if(!document.getElementById("ideal-name").value)return t.textContent=document.querySelector("meta[name=translation-name-required]").content,t.hidden=!1,void console.log("name");document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),r.stripe.confirmIdealPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{ideal:r.ideal,billing_details:{name:document.getElementById("ideal-name").value}},return_url:document.querySelector('meta[name="return-url"]').content})}))})),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}(l,u).setupStripe().handle()}}); \ No newline at end of file diff --git a/public/js/clients/payments/stripe-przelewy24.js b/public/js/clients/payments/stripe-przelewy24.js index b9918322e052..a5606cd143e5 100644 --- a/public/js/clients/payments/stripe-przelewy24.js +++ b/public/js/clients/payments/stripe-przelewy24.js @@ -1 +1,2 @@ -!function(n){var o={};function r(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,r),t.l=!0,t.exports}r.m=n,r.c=o,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=6)}({6:function(e,t,n){e.exports=n("RFiP")},RFiP:function(e,t){var n;function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var o=null!==(n=null===(o=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===o?void 0:o.content)&&void 0!==n?n:"",a=null!==(n=null===(n=document.querySelector('meta[name="stripe-account-id"]'))||void 0===n?void 0:n.content)&&void 0!==n?n:"";new function t(e,n){var o=this;!function(e){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),r(this,"setupStripe",function(){o.stripe=Stripe(o.key),o.stripeConnect&&(o.stripe.stripeAccount=a);let e=o.stripe.elements();return o.p24bank=e.create("p24Bank",{style:{base:{padding:"10px 12px",color:"#32325d",fontSize:"16px","::placeholder":{color:"#aab7c4"}}}}),o.p24bank.mount("#p24-bank-element"),o}),r(this,"handle",function(){document.getElementById("pay-now").addEventListener("click",function(e){let t=document.getElementById("errors");return""===document.getElementById("p24-name").value?(document.getElementById("p24-name").focus(),t.textContent="Name required.",void(t.hidden=!1)):""===document.getElementById("p24-email-address").value?(document.getElementById("p24-email-address").focus(),t.textContent="Email required.",void(t.hidden=!1)):document.getElementById("p24-mandate-acceptance").checked?(document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),void o.stripe.confirmP24Payment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{p24:o.p24bank,billing_details:{name:document.getElementById("p24-name").value,email:document.getElementById("p24-email-address").value}},payment_method_options:{p24:{tos_shown_and_accepted:document.getElementById("p24-mandate-acceptance").checked}},return_url:document.querySelector('meta[name="return-url"]').content})):(document.getElementById("p24-mandate-acceptance").focus(),t.textContent="Accept Terms.",void(t.hidden=!1))})}),this.key=e,this.errors=document.getElementById("errors"),this.stripeConnect=n}(o,a).setupStripe().handle()}}),a; +/*! For license information please see stripe-przelewy24.js.LICENSE.txt */ +!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=36)}({36:function(e,t,n){e.exports=n("Btf5")},Btf5:function(e,t){var n,o,r,a;function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var d=null!==(n=null===(o=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===o?void 0:o.content)&&void 0!==n?n:"",u=null!==(r=null===(a=document.querySelector('meta[name="stripe-account-id"]'))||void 0===a?void 0:a.content)&&void 0!==r?r:"";new function e(t,n){var o=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),c(this,"setupStripe",(function(){o.stripe=Stripe(o.key),o.stripeConnect&&(o.stripe.stripeAccount=u);var e=o.stripe.elements();return o.p24bank=e.create("p24Bank",{style:{base:{padding:"10px 12px",color:"#32325d",fontSize:"16px","::placeholder":{color:"#aab7c4"}}}}),o.p24bank.mount("#p24-bank-element"),o})),c(this,"handle",(function(){document.getElementById("pay-now").addEventListener("click",(function(e){var t=document.getElementById("errors");return""===document.getElementById("p24-name").value?(document.getElementById("p24-name").focus(),t.textContent=document.querySelector("meta[name=translation-name-required]").content,void(t.hidden=!1)):""===document.getElementById("p24-email-address").value?(document.getElementById("p24-email-address").focus(),t.textContent=document.querySelector("meta[name=translation-email-required]").content,void(t.hidden=!1)):document.getElementById("p24-mandate-acceptance").checked?(document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),void o.stripe.confirmP24Payment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{p24:o.p24bank,billing_details:{name:document.getElementById("p24-name").value,email:document.getElementById("p24-email-address").value}},payment_method_options:{p24:{tos_shown_and_accepted:document.getElementById("p24-mandate-acceptance").checked}},return_url:document.querySelector('meta[name="return-url"]').content})):(document.getElementById("p24-mandate-acceptance").focus(),t.textContent=document.querySelector("meta[name=translation-terms-required]").content,void(t.hidden=!1))}))})),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}(d,u).setupStripe().handle()}}); \ No newline at end of file diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 73de42e23a47..1d81c0bd044c 100755 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -1,6 +1,6 @@ { - "/js/app.js": "/js/app.js?id=696e8203d5e8e7cf5ff5", - "/css/app.css": "/css/app.css?id=f7f7b35aa3f417a3eca3", + "/js/app.js": "/js/app.js?id=019831a9b0c0aff43c7f", + "/css/app.css": "/css/app.css?id=df1ea83ea621533ac837", "/js/clients/invoices/action-selectors.js": "/js/clients/invoices/action-selectors.js?id=a09bb529b8e1826f13b4", "/js/clients/invoices/payment.js": "/js/clients/invoices/payment.js?id=8ce8955ba775ea5f47d1", "/js/clients/linkify-urls.js": "/js/clients/linkify-urls.js?id=0dc8c34010d09195d2f7", @@ -19,8 +19,15 @@ "/js/clients/payments/razorpay-aio.js": "/js/clients/payments/razorpay-aio.js?id=817ab3b2b94ee37b14eb", "/js/clients/payments/square-credit-card.js": "/js/clients/payments/square-credit-card.js?id=070c86b293b532c5a56c", "/js/clients/payments/stripe-ach.js": "/js/clients/payments/stripe-ach.js?id=81c2623fc1e5769b51c7", + "/js/clients/payments/stripe-acss.js": "/js/clients/payments/stripe-acss.js?id=4a85142c085723991d28", "/js/clients/payments/stripe-alipay.js": "/js/clients/payments/stripe-alipay.js?id=665ddf663500767f1a17", + "/js/clients/payments/stripe-bancontact.js": "/js/clients/payments/stripe-bancontact.js?id=d803da4574a36e8472d5", + "/js/clients/payments/stripe-becs.js": "/js/clients/payments/stripe-becs.js?id=fdc4defaeded2312eac2", "/js/clients/payments/stripe-credit-card.js": "/js/clients/payments/stripe-credit-card.js?id=a30464874dee84678344", + "/js/clients/payments/stripe-eps.js": "/js/clients/payments/stripe-eps.js?id=ea3deb74233cfe4abd13", + "/js/clients/payments/stripe-giropay.js": "/js/clients/payments/stripe-giropay.js?id=51ff0603d109eb5487c2", + "/js/clients/payments/stripe-ideal.js": "/js/clients/payments/stripe-ideal.js?id=cd8299e9f3df07f25144", + "/js/clients/payments/stripe-przelewy24.js": "/js/clients/payments/stripe-przelewy24.js?id=693e8e5ac5ada09c597a", "/js/clients/payments/stripe-sepa.js": "/js/clients/payments/stripe-sepa.js?id=3f2fa0857dc804a85dcb", "/js/clients/payments/stripe-sofort.js": "/js/clients/payments/stripe-sofort.js?id=231571942310348aa616", "/js/clients/payments/wepay-credit-card.js": "/js/clients/payments/wepay-credit-card.js?id=f51400e03c5fdb6cdabe", @@ -29,6 +36,6 @@ "/js/clients/shared/multiple-downloads.js": "/js/clients/shared/multiple-downloads.js?id=5c35d28cf0a3286e7c45", "/js/clients/shared/pdf.js": "/js/clients/shared/pdf.js?id=2a99d83305ba87bfa6cc", "/js/clients/statements/view.js": "/js/clients/statements/view.js?id=ca3ec4cea0de824f3a36", - "/js/setup/setup.js": "/js/setup/setup.js?id=8d454e7090f119552a6c", + "/js/setup/setup.js": "/js/setup/setup.js?id=03ea88a737e59eb2bd5a", "/css/card-js.min.css": "/css/card-js.min.css?id=62afeb675235451543ad" } diff --git a/resources/js/clients/payments/stripe-acss.js b/resources/js/clients/payments/stripe-acss.js new file mode 100644 index 000000000000..1885374d43d1 --- /dev/null +++ b/resources/js/clients/payments/stripe-acss.js @@ -0,0 +1,97 @@ +/** + * Invoice Ninja (https://invoiceninja.com) + * + * @link https://github.com/invoiceninja/invoiceninja source repository + * + * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com) + * + * @license https://opensource.org/licenses/AAL + */ + +class ProcessACSS { + constructor(key, stripeConnect) { + this.key = key; + this.errors = document.getElementById('errors'); + this.stripeConnect = stripeConnect; + } + + setupStripe = () => { + this.stripe = Stripe(this.key); + + if(this.stripeConnect) + this.stripe.stripeAccount = stripeConnect; + return this; + }; + + handle = () => { + document.getElementById('pay-now').addEventListener('click', (e) => { + + let errors = document.getElementById('errors'); + + if (document.getElementById('acss-name').value === "") { + document.getElementById('acss-name').focus(); + errors.textContent = document.querySelector('meta[name=translation-name-required]').content; + errors.hidden = false; + return; + } + + if (document.getElementById('acss-email-address').value === "") { + document.getElementById('acss-email-address').focus(); + errors.textContent = document.querySelector('meta[name=translation-email-required]').content; + errors.hidden = false; + return ; + } + + document.getElementById('pay-now').disabled = true; + document.querySelector('#pay-now > svg').classList.remove('hidden'); + document.querySelector('#pay-now > span').classList.add('hidden'); + + this.stripe.confirmAcssDebitPayment( + document.querySelector('meta[name=pi-client-secret').content, + { + payment_method: { + billing_details: { + name: document.getElementById("acss-name").value, + email: document.getElementById("acss-email-address").value, + }, + }, + } + ).then((result) => { + if (result.error) { + return this.handleFailure(result.error.message); + } + + return this.handleSuccess(result); + }); + }); + }; + + handleSuccess(result) { + document.querySelector( + 'input[name="gateway_response"]' + ).value = JSON.stringify(result.paymentIntent); + + document.getElementById('server-response').submit(); + } + + handleFailure(message) { + let errors = document.getElementById('errors'); + + errors.textContent = ''; + errors.textContent = message; + errors.hidden = false; + + document.getElementById('pay-now').disabled = false; + document.querySelector('#pay-now > svg').classList.add('hidden'); + document.querySelector('#pay-now > span').classList.remove('hidden'); + } +} + +const publishableKey = document.querySelector( + 'meta[name="stripe-publishable-key"]' +)?.content ?? ''; + +const stripeConnect = + document.querySelector('meta[name="stripe-account-id"]')?.content ?? ''; + +new ProcessACSS(publishableKey, stripeConnect).setupStripe().handle(); diff --git a/resources/js/clients/payments/stripe-bancontact.js b/resources/js/clients/payments/stripe-bancontact.js index 4d45eb64fd0b..8b5b468d705a 100644 --- a/resources/js/clients/payments/stripe-bancontact.js +++ b/resources/js/clients/payments/stripe-bancontact.js @@ -28,7 +28,7 @@ class ProcessBANCONTACTPay { let errors = document.getElementById('errors'); if (!document.getElementById('bancontact-name').value) { - errors.textContent = "Enter name"; + errors.textContent = document.querySelector('meta[name=translation-name-required]').content; errors.hidden = false; console.log("name"); return ; diff --git a/resources/js/clients/payments/stripe-becs.js b/resources/js/clients/payments/stripe-becs.js new file mode 100644 index 000000000000..843870efce78 --- /dev/null +++ b/resources/js/clients/payments/stripe-becs.js @@ -0,0 +1,136 @@ +/** + * Invoice Ninja (https://invoiceninja.com) + * + * @link https://github.com/invoiceninja/invoiceninja source repository + * + * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com) + * + * @license https://opensource.org/licenses/AAL + */ + +class ProcessBECS { + constructor(key, stripeConnect) { + this.key = key; + this.errors = document.getElementById('errors'); + this.stripeConnect = stripeConnect; + } + + setupStripe = () => { + this.stripe = Stripe(this.key); + + if(this.stripeConnect) + this.stripe.stripeAccount = stripeConnect; + const elements = this.stripe.elements(); + const style = { + base: { + color: '#32325d', + fontSize: '16px', + '::placeholder': { + color: '#aab7c4' + }, + ':-webkit-autofill': { + color: '#32325d', + }, + }, + invalid: { + color: '#fa755a', + iconColor: '#fa755a', + ':-webkit-autofill': { + color: '#fa755a', + }, + } + }; + + const options = { + style: style, + disabled: false, + hideIcon: false, + iconStyle: "default", // or "solid" + }; + this.auBankAccount = elements.create("auBankAccount", options); + this.auBankAccount.mount("#becs-iban"); + return this; + }; + + handle = () => { + document.getElementById('pay-now').addEventListener('click', (e) => { + + let errors = document.getElementById('errors'); + + if (document.getElementById('becs-name').value === "") { + document.getElementById('becs-name').focus(); + errors.textContent = document.querySelector('meta[name=translation-name-required]').content; + errors.hidden = false; + return; + } + + if (document.getElementById('becs-email-address').value === "") { + document.getElementById('becs-email-address').focus(); + errors.textContent = document.querySelector('meta[name=translation-email-required]').content; + errors.hidden = false; + return ; + } + + + if (!document.getElementById('becs-mandate-acceptance').checked) { + document.getElementById('becs-mandate-acceptance').focus(); + errors.textContent = document.querySelector('meta[name=translation-terms-required]').content; + errors.hidden = false; + console.log("Terms"); + return ; + } + + document.getElementById('pay-now').disabled = true; + document.querySelector('#pay-now > svg').classList.remove('hidden'); + document.querySelector('#pay-now > span').classList.add('hidden'); + + this.stripe.confirmAuBecsDebitPayment( + document.querySelector('meta[name=pi-client-secret').content, + { + payment_method: { + au_becs_debit: this.auBankAccount, + billing_details: { + name: document.getElementById("becs-name").value, + email: document.getElementById("becs-email-address").value, + }, + }, + } + ).then((result) => { + if (result.error) { + return this.handleFailure(result.error.message); + } + + return this.handleSuccess(result); + }); + }); + }; + + handleSuccess(result) { + document.querySelector( + 'input[name="gateway_response"]' + ).value = JSON.stringify(result.paymentIntent); + + document.getElementById('server-response').submit(); + } + + handleFailure(message) { + let errors = document.getElementById('errors'); + + errors.textContent = ''; + errors.textContent = message; + errors.hidden = false; + + document.getElementById('pay-now').disabled = false; + document.querySelector('#pay-now > svg').classList.add('hidden'); + document.querySelector('#pay-now > span').classList.remove('hidden'); + } +} + +const publishableKey = document.querySelector( + 'meta[name="stripe-publishable-key"]' +)?.content ?? ''; + +const stripeConnect = + document.querySelector('meta[name="stripe-account-id"]')?.content ?? ''; + +new ProcessBECS(publishableKey, stripeConnect).setupStripe().handle(); diff --git a/resources/js/clients/payments/stripe-eps.js b/resources/js/clients/payments/stripe-eps.js index 1013d40cfb72..f99a3f7ee754 100644 --- a/resources/js/clients/payments/stripe-eps.js +++ b/resources/js/clients/payments/stripe-eps.js @@ -43,7 +43,7 @@ class ProcessEPSPay { let errors = document.getElementById('errors'); if (!document.getElementById('eps-name').value) { - errors.textContent = "Enter name"; + errors.textContent = document.querySelector('meta[name=translation-name-required]').content; errors.hidden = false; console.log("name"); return ; diff --git a/resources/js/clients/payments/stripe-giropay.js b/resources/js/clients/payments/stripe-giropay.js index bf751ef44610..55eb1d0733c4 100644 --- a/resources/js/clients/payments/stripe-giropay.js +++ b/resources/js/clients/payments/stripe-giropay.js @@ -29,7 +29,7 @@ class ProcessGiroPay { let errors = document.getElementById('errors'); if (!document.getElementById('giropay-mandate-acceptance').checked) { - errors.textContent = "Accept Terms"; + errors.textContent = document.querySelector('meta[name=translation-terms-required]').content; errors.hidden = false; console.log("Terms"); return ; diff --git a/resources/js/clients/payments/stripe-ideal.js b/resources/js/clients/payments/stripe-ideal.js index 97722d001927..56d7470be15b 100644 --- a/resources/js/clients/payments/stripe-ideal.js +++ b/resources/js/clients/payments/stripe-ideal.js @@ -43,7 +43,7 @@ class ProcessIDEALPay { let errors = document.getElementById('errors'); if (!document.getElementById('ideal-name').value) { - errors.textContent = "Enter name"; + errors.textContent = document.querySelector('meta[name=translation-name-required]').content; errors.hidden = false; console.log("name"); return ; diff --git a/resources/js/clients/payments/stripe-przelewy24.js b/resources/js/clients/payments/stripe-przelewy24.js index f535a3070781..ca6df2654e46 100644 --- a/resources/js/clients/payments/stripe-przelewy24.js +++ b/resources/js/clients/payments/stripe-przelewy24.js @@ -45,19 +45,19 @@ class ProcessPRZELEWY24 { if (document.getElementById('p24-name').value === "") { document.getElementById('p24-name').focus(); - errors.textContent = "Name required."; + errors.textContent = document.querySelector('meta[name=translation-name-required]').content; errors.hidden = false; return; } if (document.getElementById('p24-email-address').value === "") { document.getElementById('p24-email-address').focus(); - errors.textContent = "Email required."; + errors.textContent = document.querySelector('meta[name=translation-email-required]').content; errors.hidden = false; return; } if (!document.getElementById('p24-mandate-acceptance').checked) { document.getElementById('p24-mandate-acceptance').focus(); - errors.textContent = "Accept Terms."; + errors.textContent = document.querySelector('meta[name=translation-terms-required]').content; errors.hidden = false; return; } diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 765a74b3532e..e8c367e9d0f9 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -4327,10 +4327,13 @@ $LANG = array( 'giropay' => 'GiroPay', 'giropay_law' => 'By entering your Customer information (such as name, sort code and account number) you (the Customer) agree that this information is given voluntarily.', 'eps' => 'EPS', + 'becs' => 'BECS Direct Debit', + 'becs_mandate' => 'By providing your bank account details, you agree to this Direct Debit Request and the Direct Debit Request service agreement, and authorise Stripe Payments Australia Pty Ltd ACN 160 180 343 Direct Debit User ID number 507156 (“Stripe”) to debit your account through the Bulk Electronic Clearing System (BECS) on behalf of :company (the “Merchant”) for any amounts separately communicated to you by the Merchant. You certify that you are either an account holder or an authorised signatory on the account listed above.', 'you_need_to_accept_the_terms_before_proceeding' => 'You need to accept the terms before proceeding.', 'direct_debit' => 'Direct Debit', 'clone_to_expense' => 'Clone to expense', 'checkout' => 'Checkout', + 'acss' => 'Pre-authorized debit payments', ); return $LANG; diff --git a/resources/views/portal/ninja2020/gateways/stripe/acss/acss.blade.php b/resources/views/portal/ninja2020/gateways/stripe/acss/acss.blade.php new file mode 100644 index 000000000000..43d72fd0fae6 --- /dev/null +++ b/resources/views/portal/ninja2020/gateways/stripe/acss/acss.blade.php @@ -0,0 +1,19 @@ +
+ @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.name')]) +
+ @csrf + + + + + + + + +
+ @endcomponent +
diff --git a/resources/views/portal/ninja2020/gateways/stripe/acss/authorize.blade.php b/resources/views/portal/ninja2020/gateways/stripe/acss/authorize.blade.php new file mode 100644 index 000000000000..ceb2d28000d5 --- /dev/null +++ b/resources/views/portal/ninja2020/gateways/stripe/acss/authorize.blade.php @@ -0,0 +1,7 @@ +@extends('portal.ninja2020.layout.payments', ['gateway_title' => ctrans('texts.bank_account'), 'card_title' => ctrans('texts.bank_account')]) + +@section('gateway_content') + @component('portal.ninja2020.components.general.card-element-single', ['title' => ctrans('texts.bank_account'), 'show_title' => false]) + {{ __('texts.sofort_authorize_label') }} + @endcomponent +@endsection diff --git a/resources/views/portal/ninja2020/gateways/stripe/acss/pay.blade.php b/resources/views/portal/ninja2020/gateways/stripe/acss/pay.blade.php new file mode 100644 index 000000000000..97b69f1bc763 --- /dev/null +++ b/resources/views/portal/ninja2020/gateways/stripe/acss/pay.blade.php @@ -0,0 +1,30 @@ +@extends('portal.ninja2020.layout.payments', ['gateway_title' => 'Pre-authorized debit payments', 'card_title' => 'Pre-authorized debit payments']) + +@section('gateway_head') + + + + + + + + + + +@endsection + +@section('gateway_content') + + + @include('portal.ninja2020.gateways.includes.payment_details') + + @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.payment_type')]) + {{ ctrans('texts.acss') }} ({{ ctrans('texts.bank_transfer') }}) + @endcomponent + @include('portal.ninja2020.gateways.includes.pay_now') +@endsection + +@push('footer') + + +@endpush diff --git a/resources/views/portal/ninja2020/gateways/stripe/acss/verify.blade.php b/resources/views/portal/ninja2020/gateways/stripe/acss/verify.blade.php new file mode 100644 index 000000000000..2ed3382090d2 --- /dev/null +++ b/resources/views/portal/ninja2020/gateways/stripe/acss/verify.blade.php @@ -0,0 +1,37 @@ +@extends('portal.ninja2020.layout.payments', ['gateway_title' => 'ACSS (Verification)', 'card_title' => 'ACSS (Verification)']) + +@section('gateway_content') + @if(session()->has('error')) +
{{ session('error') }}
+ @endif + +
+ @csrf + + + + @component('portal.ninja2020.components.general.card-element', ['title' => '#1 ' . ctrans('texts.amount_cents')]) + + + @error('transactions.0') +
+ {{ $message }} +
+ @enderror + @endcomponent + + @component('portal.ninja2020.components.general.card-element', ['title' => '#2 ' . ctrans('texts.amount_cents')]) + + + @error('transactions.1') +
+ {{ $message }} +
+ @enderror + @endcomponent + + @component('portal.ninja2020.gateways.includes.pay_now', ['type' => 'submit']) + {{ ctrans('texts.complete_verification')}} + @endcomponent +
+@endsection diff --git a/resources/views/portal/ninja2020/gateways/stripe/bancontact/pay.blade.php b/resources/views/portal/ninja2020/gateways/stripe/bancontact/pay.blade.php index 46caef8dba78..e91d8bc3a36f 100644 --- a/resources/views/portal/ninja2020/gateways/stripe/bancontact/pay.blade.php +++ b/resources/views/portal/ninja2020/gateways/stripe/bancontact/pay.blade.php @@ -8,6 +8,8 @@ + + @endsection @section('gateway_content') diff --git a/resources/views/portal/ninja2020/gateways/stripe/becs/authorize.blade.php b/resources/views/portal/ninja2020/gateways/stripe/becs/authorize.blade.php new file mode 100644 index 000000000000..78f859b75c30 --- /dev/null +++ b/resources/views/portal/ninja2020/gateways/stripe/becs/authorize.blade.php @@ -0,0 +1,84 @@ +@extends('portal.ninja2020.layout.payments', ['gateway_title' => 'SEPA', 'card_title' => 'SEPA-Lastschrift']) + +@section('gateway_head') + @if($gateway->company_gateway->getConfigField('account_id')) + + + @else + + @endif +@endsection + +@section('gateway_content') + @if(session()->has('sepa_error')) +
+

{{ session('sepa_error') }}

+
+ @endif + +
+ @csrf + + + + + + + +
+ + + + @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.account_holder_type')]) + + + {{ __('texts.individual_account') }} + + + + {{ __('texts.company_account') }} + + @endcomponent + + @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.account_holder_name')]) + + @endcomponent + + @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.country')]) + + @endcomponent + + @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.currency')]) + + @endcomponent + + @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.routing_number')]) + + @endcomponent + + @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.account_number')]) + + @endcomponent + + @component('portal.ninja2020.components.general.card-element-single') + + + @endcomponent + + @component('portal.ninja2020.gateways.includes.pay_now', ['id' => 'save-button']) + {{ ctrans('texts.add_payment_method') }} + @endcomponent +@endsection + +@section('gateway_footer') + + +@endsection diff --git a/resources/views/portal/ninja2020/gateways/stripe/becs/becs_debit.blade.php b/resources/views/portal/ninja2020/gateways/stripe/becs/becs_debit.blade.php new file mode 100644 index 000000000000..cd41c59d29e6 --- /dev/null +++ b/resources/views/portal/ninja2020/gateways/stripe/becs/becs_debit.blade.php @@ -0,0 +1,29 @@ +
+ @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.name')]) + +
+ @csrf + + + + + + + + + +
+ + +
+
+ @endcomponent +
diff --git a/resources/views/portal/ninja2020/gateways/stripe/becs/pay.blade.php b/resources/views/portal/ninja2020/gateways/stripe/becs/pay.blade.php new file mode 100644 index 000000000000..4221da33780b --- /dev/null +++ b/resources/views/portal/ninja2020/gateways/stripe/becs/pay.blade.php @@ -0,0 +1,33 @@ +@extends('portal.ninja2020.layout.payments', ['gateway_title' => 'BECS', 'card_title' => 'BECS']) + +@section('gateway_head') + + + + + + + + + + +@endsection + +@section('gateway_content') + + + @include('portal.ninja2020.gateways.includes.payment_details') + + @component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.payment_type')]) + {{ ctrans('texts.becs') }} ({{ ctrans('texts.bank_transfer') }}) + @endcomponent + + @include('portal.ninja2020.gateways.stripe.becs.becs_debit') + @include('portal.ninja2020.gateways.includes.save_card') + @include('portal.ninja2020.gateways.includes.pay_now') +@endsection + +@push('footer') + + +@endpush diff --git a/resources/views/portal/ninja2020/gateways/stripe/eps/pay.blade.php b/resources/views/portal/ninja2020/gateways/stripe/eps/pay.blade.php index 2146d5e6908a..17fd0cd2e0bd 100644 --- a/resources/views/portal/ninja2020/gateways/stripe/eps/pay.blade.php +++ b/resources/views/portal/ninja2020/gateways/stripe/eps/pay.blade.php @@ -8,6 +8,8 @@ + + @endsection @section('gateway_content') diff --git a/resources/views/portal/ninja2020/gateways/stripe/giropay/pay.blade.php b/resources/views/portal/ninja2020/gateways/stripe/giropay/pay.blade.php index faa0af1b58b9..974a534119e8 100644 --- a/resources/views/portal/ninja2020/gateways/stripe/giropay/pay.blade.php +++ b/resources/views/portal/ninja2020/gateways/stripe/giropay/pay.blade.php @@ -8,6 +8,8 @@ + + @endsection @section('gateway_content') diff --git a/resources/views/portal/ninja2020/gateways/stripe/ideal/pay.blade.php b/resources/views/portal/ninja2020/gateways/stripe/ideal/pay.blade.php index 9456751ed904..5de1b9d2bb65 100644 --- a/resources/views/portal/ninja2020/gateways/stripe/ideal/pay.blade.php +++ b/resources/views/portal/ninja2020/gateways/stripe/ideal/pay.blade.php @@ -8,6 +8,8 @@ + + @endsection @section('gateway_content') diff --git a/resources/views/portal/ninja2020/gateways/stripe/przelewy24/pay.blade.php b/resources/views/portal/ninja2020/gateways/stripe/przelewy24/pay.blade.php index faa2e12b3faa..7c4b72228614 100644 --- a/resources/views/portal/ninja2020/gateways/stripe/przelewy24/pay.blade.php +++ b/resources/views/portal/ninja2020/gateways/stripe/przelewy24/pay.blade.php @@ -8,6 +8,10 @@ + + + + @endsection @section('gateway_content') diff --git a/tests/Browser/ClientPortal/Gateways/Stripe/ACSSTest.php b/tests/Browser/ClientPortal/Gateways/Stripe/ACSSTest.php new file mode 100644 index 000000000000..a0f349b0404a --- /dev/null +++ b/tests/Browser/ClientPortal/Gateways/Stripe/ACSSTest.php @@ -0,0 +1,75 @@ +driver->manage()->deleteAllCookies(); + } + + $this->browse(function (Browser $browser) { + $browser + ->visit(new Login()) + ->auth(); + }); + + $this->disableCompanyGateways(); + + // Enable Stripe. + CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore(); + + // Enable SOFORT. + $cg = CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->firstOrFail(); + $fees_and_limits = $cg->fees_and_limits; + $fees_and_limits->{GatewayType::ACSS} = new FeesAndLimits(); + $cg->fees_and_limits = $fees_and_limits; + $cg->save(); + + $client = Client::first(); + $client->country_id = 276; // Change to US or Canada + $client->save(); + } + + public function testPayingWithACSS() + { + $this->browse(function (Browser $browser) { + $browser + ->visitRoute('client.invoices.index') + ->click('@pay-now') + ->press('Pay Now') + ->clickLink('ACSS') + ->type('#acss-name', 'John Doe') + ->type('#acss-name', 'John@Doe.com') + ->withinFrame('iframe', function (Browser $browser) { + $browser->type('acss', '12345'); + }) + ->click('#pay-now') + ->waitForText('ACSS test payment page', 120) + ->press('.common-Button.common-Button--default') + ->waitForText('Details of the payment', 60); + }); + } +} diff --git a/tests/Browser/ClientPortal/Gateways/Stripe/BECSTest.php b/tests/Browser/ClientPortal/Gateways/Stripe/BECSTest.php new file mode 100644 index 000000000000..388e94bf93e4 --- /dev/null +++ b/tests/Browser/ClientPortal/Gateways/Stripe/BECSTest.php @@ -0,0 +1,75 @@ +driver->manage()->deleteAllCookies(); + } + + $this->browse(function (Browser $browser) { + $browser + ->visit(new Login()) + ->auth(); + }); + + $this->disableCompanyGateways(); + + // Enable Stripe. + CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore(); + + // Enable SOFORT. + $cg = CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->firstOrFail(); + $fees_and_limits = $cg->fees_and_limits; + $fees_and_limits->{GatewayType::BECS} = new FeesAndLimits(); + $cg->fees_and_limits = $fees_and_limits; + $cg->save(); + + $client = Client::first(); + $client->country_id = 276; // Change to austria + $client->save(); + } + + public function testPayingWithBECS() + { + $this->browse(function (Browser $browser) { + $browser + ->visitRoute('client.invoices.index') + ->click('@pay-now') + ->press('Pay Now') + ->clickLink('BECS') + ->type('#becs-name', 'John Doe') + ->type('#becs-email', 'john@doe.com') + ->withinFrame('iframe', function (Browser $browser) { + $browser->type('becs-iban', '000123456'); + }) + ->click('#pay-now') + ->waitForText('BECS test payment page', 120) + ->press('.common-Button.common-Button--default') + ->waitForText('Details of the payment', 60); + }); + } +} diff --git a/tests/Browser/ClientPortal/Gateways/Stripe/BancontactTest.php b/tests/Browser/ClientPortal/Gateways/Stripe/BancontactTest.php new file mode 100644 index 000000000000..8a517cd0d29a --- /dev/null +++ b/tests/Browser/ClientPortal/Gateways/Stripe/BancontactTest.php @@ -0,0 +1,70 @@ +driver->manage()->deleteAllCookies(); + } + + $this->browse(function (Browser $browser) { + $browser + ->visit(new Login()) + ->auth(); + }); + + $this->disableCompanyGateways(); + + // Enable Stripe. + CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore(); + + // Enable SOFORT. + $cg = CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->firstOrFail(); + $fees_and_limits = $cg->fees_and_limits; + $fees_and_limits->{GatewayType::BANCONTACT} = new FeesAndLimits(); + $cg->fees_and_limits = $fees_and_limits; + $cg->save(); + + $client = Client::first(); + $client->country_id = 276; + $client->save(); + } + + public function testPayingWithBancontact() + { + $this->browse(function (Browser $browser) { + $browser + ->visitRoute('client.invoices.index') + ->click('@pay-now') + ->press('Pay Now') + ->clickLink('EPS') + ->type('#bancontact-name', 'John Doe') + ->click('#pay-now') + ->waitForText('Bancontact test payment page', 120) + ->press('.common-Button.common-Button--default') + ->waitForText('Details of the payment', 60); + }); +}} diff --git a/tests/Browser/ClientPortal/Gateways/Stripe/EPSTest.php b/tests/Browser/ClientPortal/Gateways/Stripe/EPSTest.php new file mode 100644 index 000000000000..4660d6a030ea --- /dev/null +++ b/tests/Browser/ClientPortal/Gateways/Stripe/EPSTest.php @@ -0,0 +1,74 @@ +driver->manage()->deleteAllCookies(); + } + + $this->browse(function (Browser $browser) { + $browser + ->visit(new Login()) + ->auth(); + }); + + $this->disableCompanyGateways(); + + // Enable Stripe. + CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore(); + + // Enable SOFORT. + $cg = CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->firstOrFail(); + $fees_and_limits = $cg->fees_and_limits; + $fees_and_limits->{GatewayType::EPS} = new FeesAndLimits(); + $cg->fees_and_limits = $fees_and_limits; + $cg->save(); + + $client = Client::first(); + $client->country_id = 276; + $client->save(); + } + + public function testPayingWithEPS() + { + $this->browse(function (Browser $browser) { + $browser + ->visitRoute('client.invoices.index') + ->click('@pay-now') + ->press('Pay Now') + ->clickLink('EPS') + ->type('#eps-name', 'John Doe') + ->withinFrame('iframe', function (Browser $browser) { + $browser->type('eps', '12345'); + }) + ->click('#pay-now') + ->waitForText('EPS test payment page', 120) + ->press('.common-Button.common-Button--default') + ->waitForText('Details of the payment', 60); + }); + } +} diff --git a/tests/Browser/ClientPortal/Gateways/Stripe/GiropayTest.php b/tests/Browser/ClientPortal/Gateways/Stripe/GiropayTest.php new file mode 100644 index 000000000000..469e4d15b7b9 --- /dev/null +++ b/tests/Browser/ClientPortal/Gateways/Stripe/GiropayTest.php @@ -0,0 +1,71 @@ +driver->manage()->deleteAllCookies(); + } + + $this->browse(function (Browser $browser) { + $browser + ->visit(new Login()) + ->auth(); + }); + + $this->disableCompanyGateways(); + + // Enable Stripe. + CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore(); + + // Enable SOFORT. + $cg = CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->firstOrFail(); + $fees_and_limits = $cg->fees_and_limits; + $fees_and_limits->{GatewayType::GIROPAY} = new FeesAndLimits(); + $cg->fees_and_limits = $fees_and_limits; + $cg->save(); + + $client = Client::first(); + $client->country_id = 276; + $client->save(); + } + + public function testPayingWithGiropay() + { + $this->browse(function (Browser $browser) { + $browser + ->visitRoute('client.invoices.index') + ->click('@pay-now') + ->press('Pay Now') + ->clickLink('Giropay') + ->type('#giropay-name', 'John Doe') + ->click('#pay-now') + ->waitForText('Giropay test payment page', 120) + ->press('.common-Button.common-Button--default') + ->waitForText('Details of the payment', 60); + }); + } +} diff --git a/tests/Browser/ClientPortal/Gateways/Stripe/Prezelewy24Test.php b/tests/Browser/ClientPortal/Gateways/Stripe/Prezelewy24Test.php new file mode 100644 index 000000000000..a0b3f4a2a23f --- /dev/null +++ b/tests/Browser/ClientPortal/Gateways/Stripe/Prezelewy24Test.php @@ -0,0 +1,76 @@ +driver->manage()->deleteAllCookies(); + } + + $this->browse(function (Browser $browser) { + $browser + ->visit(new Login()) + ->auth(); + }); + + $this->disableCompanyGateways(); + + // Enable Stripe. + CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore(); + + // Enable SOFORT. + $cg = CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->firstOrFail(); + $fees_and_limits = $cg->fees_and_limits; + $fees_and_limits->{GatewayType::PRZELEWY24} = new FeesAndLimits(); + $cg->fees_and_limits = $fees_and_limits; + $cg->save(); + + $client = Client::first(); + $client->country_id = 276; + $client->save(); + } + + public function testPayingWithPrezelewy24() + { + $this->browse(function (Browser $browser) { + $browser + ->visitRoute('client.invoices.index') + ->click('@pay-now') + ->press('Pay Now') + ->clickLink('EPS') + ->type('#eps-name', 'John Doe') + ->type('#eps-email', 'john@doe.com') + ->check('#p24-mandate-acceptance', 'John Doe') + ->withinFrame('iframe', function (Browser $browser) { + $browser->type('p24', '12345'); + }) + ->click('#pay-now') + ->waitForText('P24 test payment page', 120) + ->press('.common-Button.common-Button--default') + ->waitForText('Details of the payment', 60); + }); + } +} diff --git a/tests/Browser/ClientPortal/Gateways/Stripe/iDEAL.php b/tests/Browser/ClientPortal/Gateways/Stripe/iDEAL.php new file mode 100644 index 000000000000..a9a6549e290b --- /dev/null +++ b/tests/Browser/ClientPortal/Gateways/Stripe/iDEAL.php @@ -0,0 +1,74 @@ +driver->manage()->deleteAllCookies(); + } + + $this->browse(function (Browser $browser) { + $browser + ->visit(new Login()) + ->auth(); + }); + + $this->disableCompanyGateways(); + + // Enable Stripe. + CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore(); + + // Enable SOFORT. + $cg = CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->firstOrFail(); + $fees_and_limits = $cg->fees_and_limits; + $fees_and_limits->{GatewayType::IDEAL} = new FeesAndLimits(); + $cg->fees_and_limits = $fees_and_limits; + $cg->save(); + + $client = Client::first(); + $client->country_id = 276; + $client->save(); + } + + public function testPayingWithiDeal() + { + $this->browse(function (Browser $browser) { + $browser + ->visitRoute('client.invoices.index') + ->click('@pay-now') + ->press('Pay Now') + ->clickLink('iDeal') + ->type('#ideal-name', 'John Doe') + ->withinFrame('iframe', function (Browser $browser) { + $browser->type('ideal', '12345'); + }) + ->click('#pay-now') + ->waitForText('iDeal test payment page', 120) + ->press('.common-Button.common-Button--default') + ->waitForText('Details of the payment', 60); + }); + } +} diff --git a/webpack.mix.js b/webpack.mix.js index 34b60abfe3bb..e593a4d750ae 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -118,6 +118,34 @@ mix.js("resources/js/app.js", "public/js") "resources/js/clients/payment_methods/authorize-checkout-card.js", "public/js/clients/payment_methods/authorize-checkout-card.js" ) + .js( + "resources/js/clients/payments/stripe-giropay.js", + "public/js/clients/payments/stripe-giropay.js" + ) + .js( + "resources/js/clients/payments/stripe-acss.js", + "public/js/clients/payments/stripe-acss.js" + ) + .js( + "resources/js/clients/payments/stripe-bancontact.js", + "public/js/clients/payments/stripe-bancontact.js" + ) + .js( + "resources/js/clients/payments/stripe-becs.js", + "public/js/clients/payments/stripe-becs.js" + ) + .js( + "resources/js/clients/payments/stripe-eps.js", + "public/js/clients/payments/stripe-eps.js" + ) + .js( + "resources/js/clients/payments/stripe-ideal.js", + "public/js/clients/payments/stripe-ideal.js" + ) + .js( + "resources/js/clients/payments/stripe-przelewy24.js", + "public/js/clients/payments/stripe-przelewy24.js" + ) mix.copyDirectory('node_modules/card-js/card-js.min.css', 'public/css/card-js.min.css');