mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for new payment flow
This commit is contained in:
parent
bca672a1fb
commit
4e59f4d8a8
@ -199,47 +199,7 @@ class ACH
|
|||||||
*/
|
*/
|
||||||
public function paymentView(array $data)
|
public function paymentView(array $data)
|
||||||
{
|
{
|
||||||
$data['gateway'] = $this->stripe;
|
$data = $this->paymentData($data);
|
||||||
$data['currency'] = $this->stripe->client->getCurrencyCode();
|
|
||||||
$data['payment_method_id'] = GatewayType::BANK_TRANSFER;
|
|
||||||
$data['customer'] = $this->stripe->findOrCreateCustomer();
|
|
||||||
$data['amount'] = $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency());
|
|
||||||
|
|
||||||
$description = $this->stripe->getDescription(false);
|
|
||||||
|
|
||||||
$intent = false;
|
|
||||||
|
|
||||||
if (count($data['tokens']) == 1) {
|
|
||||||
|
|
||||||
$token = $data['tokens'][0];
|
|
||||||
|
|
||||||
$meta = $token->meta;
|
|
||||||
|
|
||||||
if(isset($meta->state) && $meta->state == 'unauthorized') {
|
|
||||||
return redirect()->route('client.payment_methods.show', $token->hashed_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($data['tokens']) == 0) {
|
|
||||||
$intent =
|
|
||||||
$this->stripe->createPaymentIntent(
|
|
||||||
[
|
|
||||||
'amount' => $data['amount'],
|
|
||||||
'currency' => $data['currency'],
|
|
||||||
'setup_future_usage' => 'off_session',
|
|
||||||
'customer' => $data['customer']->id,
|
|
||||||
'payment_method_types' => ['us_bank_account'],
|
|
||||||
'description' => $description,
|
|
||||||
'metadata' => [
|
|
||||||
'payment_hash' => $this->stripe->payment_hash->hash,
|
|
||||||
'gateway_type_id' => GatewayType::BANK_TRANSFER,
|
|
||||||
],
|
|
||||||
'statement_descriptor' => $this->stripe->getStatementDescriptor(),
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$data['client_secret'] = $intent ? $intent->client_secret : false;
|
|
||||||
|
|
||||||
return render('gateways.stripe.ach.pay', $data);
|
return render('gateways.stripe.ach.pay', $data);
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ namespace App\PaymentDrivers\Stripe;
|
|||||||
|
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\SystemLog;
|
use App\Models\SystemLog;
|
||||||
|
use Stripe\PaymentIntent;
|
||||||
use App\Models\GatewayType;
|
use App\Models\GatewayType;
|
||||||
use App\Models\PaymentHash;
|
use App\Models\PaymentHash;
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
@ -26,10 +27,10 @@ use App\Models\ClientGatewayToken;
|
|||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
use App\Jobs\Mail\PaymentFailureMailer;
|
use App\Jobs\Mail\PaymentFailureMailer;
|
||||||
use App\PaymentDrivers\StripePaymentDriver;
|
use App\PaymentDrivers\StripePaymentDriver;
|
||||||
|
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||||
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
|
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
|
||||||
use Stripe\PaymentIntent;
|
|
||||||
|
|
||||||
class ACSS
|
class ACSS implements LivewireMethodInterface
|
||||||
{
|
{
|
||||||
use MakesHash;
|
use MakesHash;
|
||||||
|
|
||||||
@ -92,7 +93,7 @@ class ACSS
|
|||||||
|
|
||||||
$error = "There was a problem setting up this payment method for future use";
|
$error = "There was a problem setting up this payment method for future use";
|
||||||
|
|
||||||
if(in_array($setup_intent->type, ["validation_error", "invalid_request_error"])) {
|
if (in_array($setup_intent->type, ["validation_error", "invalid_request_error"])) {
|
||||||
$error = "Please provide complete payment details.";
|
$error = "Please provide complete payment details.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,11 +113,11 @@ class ACSS
|
|||||||
|
|
||||||
$client_gateway_token = $this->storePaymentMethod($setup_intent->payment_method, $stripe_setup_intent->mandate, $setup_intent->status == 'succeeded' ? 'authorized' : 'unauthorized');
|
$client_gateway_token = $this->storePaymentMethod($setup_intent->payment_method, $stripe_setup_intent->mandate, $setup_intent->status == 'succeeded' ? 'authorized' : 'unauthorized');
|
||||||
|
|
||||||
if($request->has('post_auth_response') && boolval($request->post_auth_response)) {
|
if ($request->has('post_auth_response') && boolval($request->post_auth_response)) {
|
||||||
/** @var array $data */
|
/** @var array $data */
|
||||||
$data = Cache::pull($request->post_auth_response);
|
$data = Cache::pull($request->post_auth_response);
|
||||||
|
|
||||||
if(!$data) {
|
if (!$data) {
|
||||||
throw new PaymentFailed("There was a problem storing this payment method", 500);
|
throw new PaymentFailed("There was a problem storing this payment method", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +128,7 @@ class ACSS
|
|||||||
$this->stripe->setClient($hash->fee_invoice->client);
|
$this->stripe->setClient($hash->fee_invoice->client);
|
||||||
$this->stripe->setPaymentMethod(GatewayType::ACSS);
|
$this->stripe->setPaymentMethod(GatewayType::ACSS);
|
||||||
|
|
||||||
return $this->continuePayment($data);
|
return $this->paymentView($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('client.payment_methods.show', $client_gateway_token->hashed_id);
|
return redirect()->route('client.payment_methods.show', $client_gateway_token->hashed_id);
|
||||||
@ -163,63 +164,41 @@ class ACSS
|
|||||||
|
|
||||||
public function paymentData(array $data): array
|
public function paymentData(array $data): array
|
||||||
{
|
{
|
||||||
|
if (count($data['tokens']) == 0) {
|
||||||
if(count($data['tokens']) == 0) {
|
|
||||||
$hash = Str::random(32);
|
$hash = Str::random(32);
|
||||||
|
|
||||||
Cache::put($hash, $data, 3600);
|
Cache::put($hash, $data, 3600);
|
||||||
|
|
||||||
$data['post_auth_response'] = $hash;
|
$data['post_auth_response'] = $hash;
|
||||||
|
$data['needs_mandate_generate'] = true;
|
||||||
|
|
||||||
return $this->generateMandate($data);
|
$data['gateway'] = $this->stripe;
|
||||||
|
$data['company_gateway'] = $this->stripe->company_gateway;
|
||||||
|
$data['customer'] = $this->stripe->findOrCreateCustomer()->id;
|
||||||
|
$data['country'] = $this->stripe->client->country->iso_3166_2;
|
||||||
|
|
||||||
|
$intent = \Stripe\SetupIntent::create([
|
||||||
|
'usage' => 'off_session',
|
||||||
|
'payment_method_types' => ['acss_debit'],
|
||||||
|
'customer' => $data['customer'],
|
||||||
|
'payment_method_options' => [
|
||||||
|
'acss_debit' => [
|
||||||
|
'currency' => 'cad',
|
||||||
|
'mandate_options' => [
|
||||||
|
'payment_schedule' => 'combined',
|
||||||
|
'interval_description' => 'On any invoice due date',
|
||||||
|
'transaction_type' => 'personal',
|
||||||
|
],
|
||||||
|
'verification_method' => 'instant',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
], $this->stripe->stripe_connect_auth);
|
||||||
|
|
||||||
|
$data['pi_client_secret'] = $intent->client_secret;
|
||||||
|
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->continuePayment($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate a payment Mandate for ACSS
|
|
||||||
*
|
|
||||||
* @param array $data
|
|
||||||
|
|
||||||
*/
|
|
||||||
private function generateMandate(array $data)
|
|
||||||
{
|
|
||||||
|
|
||||||
$data['gateway'] = $this->stripe;
|
|
||||||
$data['company_gateway'] = $this->stripe->company_gateway;
|
|
||||||
$data['customer'] = $this->stripe->findOrCreateCustomer()->id;
|
|
||||||
$data['country'] = $this->stripe->client->country->iso_3166_2;
|
|
||||||
|
|
||||||
$intent = \Stripe\SetupIntent::create([
|
|
||||||
'usage' => 'off_session',
|
|
||||||
'payment_method_types' => ['acss_debit'],
|
|
||||||
'customer' => $data['customer'],
|
|
||||||
'payment_method_options' => [
|
|
||||||
'acss_debit' => [
|
|
||||||
'currency' => 'cad',
|
|
||||||
'mandate_options' => [
|
|
||||||
'payment_schedule' => 'combined',
|
|
||||||
'interval_description' => 'On any invoice due date',
|
|
||||||
'transaction_type' => 'personal',
|
|
||||||
],
|
|
||||||
'verification_method' => 'instant',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
], $this->stripe->stripe_connect_auth);
|
|
||||||
|
|
||||||
$data['pi_client_secret'] = $intent->client_secret;
|
|
||||||
|
|
||||||
return render('gateways.stripe.acss.authorize', array_merge($data));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Continues the payment flow after a Mandate has been successfully generated
|
|
||||||
*
|
|
||||||
* @param array $data
|
|
||||||
*/
|
|
||||||
private function continuePayment(array $data)
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->stripe->init();
|
$this->stripe->init();
|
||||||
|
|
||||||
$data['gateway'] = $this->stripe;
|
$data['gateway'] = $this->stripe;
|
||||||
@ -232,6 +211,25 @@ class ACSS
|
|||||||
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]);
|
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $data['stripe_amount']]);
|
||||||
$this->stripe->payment_hash->save();
|
$this->stripe->payment_hash->save();
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Payment view for ACSS
|
||||||
|
*
|
||||||
|
* Determines if any payment tokens are available and if not, generates a mandate
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
|
||||||
|
*/
|
||||||
|
public function paymentView(array $data)
|
||||||
|
{
|
||||||
|
$data = $this->paymentData($data);
|
||||||
|
|
||||||
|
if (array_key_exists('needs_mandate_generate', $data)) {
|
||||||
|
return render('gateways.stripe.acss.authorize', array_merge($data));
|
||||||
|
}
|
||||||
|
|
||||||
return render('gateways.stripe.acss.pay', $data);
|
return render('gateways.stripe.acss.pay', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +257,6 @@ class ACSS
|
|||||||
|
|
||||||
$gateway_response = json_decode($request->gateway_response);
|
$gateway_response = json_decode($request->gateway_response);
|
||||||
|
|
||||||
/** @var \App\Models\ClientGatewayToken $cgt */
|
|
||||||
$cgt = ClientGatewayToken::find($this->decodePrimaryKey($request->token));
|
$cgt = ClientGatewayToken::find($this->decodePrimaryKey($request->token));
|
||||||
|
|
||||||
/** @var \Stripe\PaymentIntent $intent */
|
/** @var \Stripe\PaymentIntent $intent */
|
||||||
@ -392,4 +389,13 @@ class ACSS
|
|||||||
return $this->stripe->processInternallyFailedPayment($this->stripe, $e);
|
return $this->stripe->processInternallyFailedPayment($this->stripe, $e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function livewirePaymentView(array $data): string
|
||||||
|
{
|
||||||
|
if (array_key_exists('needs_mandate_generate', $data)) {
|
||||||
|
return 'gateways.stripe.acss.authorize_livewire';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'gateways.stripe.acss.pay_livewire';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,12 +20,13 @@ use App\Models\GatewayType;
|
|||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
use App\Models\SystemLog;
|
use App\Models\SystemLog;
|
||||||
|
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||||
use App\PaymentDrivers\Stripe\Jobs\UpdateCustomer;
|
use App\PaymentDrivers\Stripe\Jobs\UpdateCustomer;
|
||||||
use App\PaymentDrivers\StripePaymentDriver;
|
use App\PaymentDrivers\StripePaymentDriver;
|
||||||
use App\Utils\Number;
|
use App\Utils\Number;
|
||||||
use Stripe\Checkout\Session;
|
use Stripe\Checkout\Session;
|
||||||
|
|
||||||
class BACS
|
class BACS implements LivewireMethodInterface
|
||||||
{
|
{
|
||||||
public $stripe;
|
public $stripe;
|
||||||
|
|
||||||
@ -69,9 +70,7 @@ class BACS
|
|||||||
}
|
}
|
||||||
public function paymentView(array $data)
|
public function paymentView(array $data)
|
||||||
{
|
{
|
||||||
$data['gateway'] = $this->stripe;
|
$data = $this->paymentData($data);
|
||||||
$data['amount'] = $data['total']['amount_with_fee'];
|
|
||||||
$data['payment_hash'] = $this->stripe->payment_hash->hash;
|
|
||||||
|
|
||||||
return render('gateways.stripe.bacs.pay', $data);
|
return render('gateways.stripe.bacs.pay', $data);
|
||||||
}
|
}
|
||||||
@ -187,4 +186,18 @@ class BACS
|
|||||||
return $this->stripe->processInternallyFailedPayment($this->stripe, $e);
|
return $this->stripe->processInternallyFailedPayment($this->stripe, $e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function paymentData(array $data): array
|
||||||
|
{
|
||||||
|
$data['gateway'] = $this->stripe;
|
||||||
|
$data['amount'] = $data['total']['amount_with_fee'];
|
||||||
|
$data['payment_hash'] = $this->stripe->payment_hash->hash;
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function livewirePaymentView(array $data): string
|
||||||
|
{
|
||||||
|
return 'gateways.stripe.bacs.pay_livewire';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,10 @@ use App\Models\GatewayType;
|
|||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
use App\Models\SystemLog;
|
use App\Models\SystemLog;
|
||||||
|
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||||
use App\PaymentDrivers\StripePaymentDriver;
|
use App\PaymentDrivers\StripePaymentDriver;
|
||||||
|
|
||||||
class BECS
|
class BECS implements LivewireMethodInterface
|
||||||
{
|
{
|
||||||
/** @var StripePaymentDriver */
|
/** @var StripePaymentDriver */
|
||||||
public StripePaymentDriver $stripe;
|
public StripePaymentDriver $stripe;
|
||||||
@ -39,33 +40,7 @@ class BECS
|
|||||||
|
|
||||||
public function paymentView(array $data)
|
public function paymentView(array $data)
|
||||||
{
|
{
|
||||||
$this->stripe->init();
|
$data = $this->paymentData($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->getDescription(false),
|
|
||||||
'metadata' => [
|
|
||||||
'payment_hash' => $this->stripe->payment_hash->hash,
|
|
||||||
'gateway_type_id' => GatewayType::BECS,
|
|
||||||
],
|
|
||||||
], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st", true)]));
|
|
||||||
|
|
||||||
$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);
|
return render('gateways.stripe.becs.pay', $data);
|
||||||
}
|
}
|
||||||
@ -161,4 +136,42 @@ class BECS
|
|||||||
return $this->stripe->processInternallyFailedPayment($this->stripe, $e);
|
return $this->stripe->processInternallyFailedPayment($this->stripe, $e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function paymentData(array $data): array
|
||||||
|
{
|
||||||
|
$this->stripe->init();
|
||||||
|
|
||||||
|
$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->getDescription(false),
|
||||||
|
'metadata' => [
|
||||||
|
'payment_hash' => $this->stripe->payment_hash->hash,
|
||||||
|
'gateway_type_id' => GatewayType::BECS,
|
||||||
|
],
|
||||||
|
], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st", true)]));
|
||||||
|
|
||||||
|
$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 $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function livewirePaymentView(array $data): string
|
||||||
|
{
|
||||||
|
return 'gateways.stripe.becs.pay_livewire';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
109
public/build/assets/app-234e3402.js
vendored
109
public/build/assets/app-234e3402.js
vendored
File diff suppressed because one or more lines are too long
109
public/build/assets/app-e0713224.js
vendored
Normal file
109
public/build/assets/app-e0713224.js
vendored
Normal file
File diff suppressed because one or more lines are too long
9
public/build/assets/authorize-stripe-acss-f6bd46c1.js
vendored
Normal file
9
public/build/assets/authorize-stripe-acss-f6bd46c1.js
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import{w as y}from"./wait-8f4ae121.js";/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
|
*/y("#stripe-acss-authorize").then(()=>f());function f(){var i,l,o;let n;const a=(i=document.querySelector('meta[name="stripe-account-id"]'))==null?void 0:i.content,r=(l=document.querySelector('meta[name="stripe-publishable-key"]'))==null?void 0:l.content;a&&a.length>0?n=Stripe(r,{stripeAccount:a}):n=Stripe(r);const c=document.getElementById("acss-name"),s=document.getElementById("acss-email-address"),t=document.getElementById("authorize-acss"),d=(o=document.querySelector('meta[name="stripe-pi-client-secret"]'))==null?void 0:o.content,e=document.getElementById("errors");t.addEventListener("click",async u=>{u.preventDefault(),e.hidden=!0,t.disabled=!0;const m=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;if(s.value.length<3||!s.value.match(m)){e.textContent="Please enter a valid email address.",e.hidden=!1,t.disabled=!1;return}if(c.value.length<3){e.textContent="Please enter a name for the account holder.",e.hidden=!1,t.disabled=!1;return}const{setupIntent:p,error:h}=await n.confirmAcssDebitSetup(d,{payment_method:{billing_details:{name:c.value,email:s.value}}});document.getElementById("gateway_response").value=JSON.stringify(p??h),document.getElementById("server_response").submit()})}
|
@ -1,17 +0,0 @@
|
|||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/function i(...t){return new Promise(n=>{if(!t.length){n([]);return}const e=t.map(d=>document.querySelector(d)).filter(Boolean);if(e.length===t.length){n(e);return}const o=new MutationObserver(()=>{const d=t.map(a=>document.querySelector(a)).filter(Boolean);d.length===t.length&&(o.disconnect(),n(d))});o.observe(document.body,{childList:!0,subtree:!0})})}function c(){const t=document.querySelector('meta[name="instant-payment"]');return!!(t&&t instanceof HTMLMetaElement&&t.content==="yes")}/**
|
|
||||||
* 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://www.elastic.co/licensing/elastic-license
|
|
||||||
*/class r{constructor(){this.tokens=[]}mountFrames(){console.log("Mount checkout frames..")}handlePaymentUsingToken(n){document.getElementById("checkout--container").classList.add("hidden"),document.getElementById("pay-now-with-token--container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=n.target.dataset.token}handlePaymentUsingCreditCard(n){document.getElementById("checkout--container").classList.remove("hidden"),document.getElementById("pay-now-with-token--container").classList.add("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="";const e=document.getElementById("pay-button"),o=document.querySelector('meta[name="public-key"]').content??"",d=document.getElementById("payment-form");Frames.init(o),Frames.addEventHandler(Frames.Events.CARD_VALIDATION_CHANGED,function(a){e.disabled=!Frames.isCardValid()}),Frames.addEventHandler(Frames.Events.CARD_TOKENIZATION_FAILED,function(a){e.disabled=!1}),Frames.addEventHandler(Frames.Events.CARD_TOKENIZED,function(a){e.disabled=!0,document.querySelector('input[name="gateway_response"]').value=JSON.stringify(a),document.querySelector('input[name="store_card"]').value=document.querySelector("input[name=token-billing-checkbox]:checked").value,document.getElementById("server-response").submit()}),d.addEventListener("submit",function(a){a.preventDefault(),e.disabled=!0,Frames.submitCard()})}completePaymentUsingToken(n){let e=document.getElementById("pay-now-with-token");e.disabled=!0,e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()}handle(){this.handlePaymentUsingCreditCard(),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(n=>n.addEventListener("click",this.handlePaymentUsingToken)),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",this.handlePaymentUsingCreditCard),document.getElementById("pay-now-with-token").addEventListener("click",this.completePaymentUsingToken)}}function s(){new r().handle()}c()?s():i("#checkout-credit-card-payment").then(()=>new r().handle());
|
|
9
public/build/assets/checkout-credit-card-fbe72284.js
vendored
Normal file
9
public/build/assets/checkout-credit-card-fbe72284.js
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import{i as s,w as i}from"./wait-8f4ae121.js";/**
|
||||||
|
* 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://www.elastic.co/licensing/elastic-license
|
||||||
|
*/class a{constructor(){this.tokens=[]}mountFrames(){console.log("Mount checkout frames..")}handlePaymentUsingToken(t){document.getElementById("checkout--container").classList.add("hidden"),document.getElementById("pay-now-with-token--container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=t.target.dataset.token}handlePaymentUsingCreditCard(t){document.getElementById("checkout--container").classList.remove("hidden"),document.getElementById("pay-now-with-token--container").classList.add("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="";const e=document.getElementById("pay-button"),d=document.querySelector('meta[name="public-key"]').content??"",o=document.getElementById("payment-form");Frames.init(d),Frames.addEventHandler(Frames.Events.CARD_VALIDATION_CHANGED,function(n){e.disabled=!Frames.isCardValid()}),Frames.addEventHandler(Frames.Events.CARD_TOKENIZATION_FAILED,function(n){e.disabled=!1}),Frames.addEventHandler(Frames.Events.CARD_TOKENIZED,function(n){e.disabled=!0,document.querySelector('input[name="gateway_response"]').value=JSON.stringify(n),document.querySelector('input[name="store_card"]').value=document.querySelector("input[name=token-billing-checkbox]:checked").value,document.getElementById("server-response").submit()}),o.addEventListener("submit",function(n){n.preventDefault(),e.disabled=!0,Frames.submitCard()})}completePaymentUsingToken(t){let e=document.getElementById("pay-now-with-token");e.disabled=!0,e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()}handle(){this.handlePaymentUsingCreditCard(),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(t=>t.addEventListener("click",this.handlePaymentUsingToken)),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",this.handlePaymentUsingCreditCard),document.getElementById("pay-now-with-token").addEventListener("click",this.completePaymentUsingToken)}}function r(){new a().handle()}s()?r():i("#checkout-credit-card-payment").then(()=>new a().handle());
|
9
public/build/assets/stripe-ach-pay-22d14901.js
vendored
Normal file
9
public/build/assets/stripe-ach-pay-22d14901.js
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import{w as g}from"./wait-8f4ae121.js";/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
|
*/g("#stripe-ach-payment").then(()=>f());function f(){let d=document.getElementById("pay-now");d&&(Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(e=>e.addEventListener("click",n=>{document.querySelector("input[name=source]").value=n.target.dataset.token})),d.addEventListener("click",function(){let e=document.getElementById("pay-now");e.disabled=!0,e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()})),document.getElementById("new-bank").addEventListener("click",e=>{var m,y;if(!document.getElementById("accept-terms").checked){errors.textContent="You must accept the mandate terms prior to making payment.",errors.hidden=!1;return}errors.hidden=!0;let n,t=document.querySelector('meta[name="stripe-publishable-key"]').content,o=(m=document.querySelector('meta[name="stripe-account-id"]'))==null?void 0:m.content;o?n=Stripe(t,{stripeAccount:o}):n=Stripe(t);let s=document.getElementById("new-bank");s.disabled=!0,s.querySelector("svg").classList.remove("hidden"),s.querySelector("span").classList.add("hidden"),e.preventDefault();const c=document.getElementById("account-holder-name-field"),r=document.getElementById("email-field"),u=(y=document.querySelector('meta[name="client_secret"]'))==null?void 0:y.content;n.collectBankAccountForPayment({clientSecret:u,params:{payment_method_type:"us_bank_account",payment_method_data:{billing_details:{name:c.value,email:r.value}}},expand:["payment_method"]}).then(({paymentIntent:i,error:l})=>{if(l)console.error(l.message),errors.textContent=l.message,errors.hidden=!1,a();else if(i.status==="requires_payment_method"){errors.textContent="We were unable to process the payment with this account, please try another one.",errors.hidden=!1,a();return}else if(i.status==="requires_confirmation"){let h=document.getElementById("bank_account_response");h.value=JSON.stringify(i),p(n,u)}a()})});function p(e,n){e.confirmUsBankAccountPayment(n).then(({paymentIntent:t,error:o})=>{var s,c;if(console.log(t),o)console.error(o.message);else if(t.status==="requires_payment_method")errors.textContent="We were unable to process the payment with this account, please try another one.",errors.hidden=!1,a();else if(t.status==="processing"){let r=document.getElementById("gateway_response");r.value=JSON.stringify(t),document.getElementById("server-response").submit()}else if(((s=t.next_action)==null?void 0:s.type)==="verify_with_microdeposits"||((c=t.next_action)==null?void 0:c.type)==="requires_source_action"){errors.textContent="You will receive an email with details on how to verify your bank account and process payment.",errors.hidden=!1,document.getElementById("new-bank").style.visibility="hidden";let r=document.getElementById("gateway_response");r.value=JSON.stringify(t),document.getElementById("server-response").submit()}})}function a(){let e=document.getElementById("new-bank");e.disabled=!1,e.querySelector("svg").classList.add("hidden"),e.querySelector("span").classList.remove("hidden")}}
|
9
public/build/assets/wait-8f4ae121.js
vendored
Normal file
9
public/build/assets/wait-8f4ae121.js
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
|
*/function i(...e){return new Promise(n=>{if(!e.length){n([]);return}const r=e.map(t=>document.querySelector(t)).filter(Boolean);if(r.length===e.length){n(r);return}const o=new MutationObserver(()=>{const t=e.map(u=>document.querySelector(u)).filter(Boolean);t.length===e.length&&(o.disconnect(),n(t))});o.observe(document.body,{childList:!0,subtree:!0})})}function a(){const e=document.querySelector('meta[name="instant-payment"]');return!!(e&&e instanceof HTMLMetaElement&&e.content==="yes")}export{a as i,i as w};
|
@ -8,8 +8,11 @@
|
|||||||
"__commonjsHelpers-725317a4.js"
|
"__commonjsHelpers-725317a4.js"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"_wait-8f4ae121.js": {
|
||||||
|
"file": "assets/wait-8f4ae121.js"
|
||||||
|
},
|
||||||
"resources/js/app.js": {
|
"resources/js/app.js": {
|
||||||
"file": "assets/app-234e3402.js",
|
"file": "assets/app-e0713224.js",
|
||||||
"imports": [
|
"imports": [
|
||||||
"_index-08e160a7.js",
|
"_index-08e160a7.js",
|
||||||
"__commonjsHelpers-725317a4.js"
|
"__commonjsHelpers-725317a4.js"
|
||||||
@ -45,6 +48,14 @@
|
|||||||
"isEntry": true,
|
"isEntry": true,
|
||||||
"src": "resources/js/clients/payment_methods/authorize-checkout-card.js"
|
"src": "resources/js/clients/payment_methods/authorize-checkout-card.js"
|
||||||
},
|
},
|
||||||
|
"resources/js/clients/payment_methods/authorize-stripe-acss.js": {
|
||||||
|
"file": "assets/authorize-stripe-acss-f6bd46c1.js",
|
||||||
|
"imports": [
|
||||||
|
"_wait-8f4ae121.js"
|
||||||
|
],
|
||||||
|
"isEntry": true,
|
||||||
|
"src": "resources/js/clients/payment_methods/authorize-stripe-acss.js"
|
||||||
|
},
|
||||||
"resources/js/clients/payment_methods/braintree-ach.js": {
|
"resources/js/clients/payment_methods/braintree-ach.js": {
|
||||||
"file": "assets/braintree-ach-b29d040e.js",
|
"file": "assets/braintree-ach-b29d040e.js",
|
||||||
"isEntry": true,
|
"isEntry": true,
|
||||||
@ -71,7 +82,10 @@
|
|||||||
"src": "resources/js/clients/payments/braintree-paypal.js"
|
"src": "resources/js/clients/payments/braintree-paypal.js"
|
||||||
},
|
},
|
||||||
"resources/js/clients/payments/checkout-credit-card.js": {
|
"resources/js/clients/payments/checkout-credit-card.js": {
|
||||||
"file": "assets/checkout-credit-card-d1d5f794.js",
|
"file": "assets/checkout-credit-card-fbe72284.js",
|
||||||
|
"imports": [
|
||||||
|
"_wait-8f4ae121.js"
|
||||||
|
],
|
||||||
"isEntry": true,
|
"isEntry": true,
|
||||||
"src": "resources/js/clients/payments/checkout-credit-card.js"
|
"src": "resources/js/clients/payments/checkout-credit-card.js"
|
||||||
},
|
},
|
||||||
@ -110,6 +124,14 @@
|
|||||||
"isEntry": true,
|
"isEntry": true,
|
||||||
"src": "resources/js/clients/payments/square-credit-card.js"
|
"src": "resources/js/clients/payments/square-credit-card.js"
|
||||||
},
|
},
|
||||||
|
"resources/js/clients/payments/stripe-ach-pay.js": {
|
||||||
|
"file": "assets/stripe-ach-pay-22d14901.js",
|
||||||
|
"imports": [
|
||||||
|
"_wait-8f4ae121.js"
|
||||||
|
],
|
||||||
|
"isEntry": true,
|
||||||
|
"src": "resources/js/clients/payments/stripe-ach-pay.js"
|
||||||
|
},
|
||||||
"resources/js/clients/payments/stripe-ach.js": {
|
"resources/js/clients/payments/stripe-ach.js": {
|
||||||
"file": "assets/stripe-ach-fe366ca7.js",
|
"file": "assets/stripe-ach-fe366ca7.js",
|
||||||
"isEntry": true,
|
"isEntry": true,
|
||||||
|
@ -50,6 +50,8 @@ export default defineConfig({
|
|||||||
'resources/js/clients/payments/stripe-przelewy24.js',
|
'resources/js/clients/payments/stripe-przelewy24.js',
|
||||||
'resources/js/clients/payments/stripe-browserpay.js',
|
'resources/js/clients/payments/stripe-browserpay.js',
|
||||||
'resources/js/clients/payments/stripe-fpx.js',
|
'resources/js/clients/payments/stripe-fpx.js',
|
||||||
|
'resources/js/clients/payments/stripe-ach-pay.js',
|
||||||
|
'resources/js/clients/payment_methods/authorize-stripe-acss.js',
|
||||||
]),
|
]),
|
||||||
viteStaticCopy({
|
viteStaticCopy({
|
||||||
targets: [
|
targets: [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user