Merge new payment flow v2

This commit is contained in:
David Bomba 2024-09-05 11:34:29 +10:00
commit 5b290a99b4
112 changed files with 987 additions and 423 deletions

View File

@ -522,8 +522,6 @@ class CompanySettings extends BaseSettings
public string $email_template_payment_failed = ''; public string $email_template_payment_failed = '';
public static $casts = [ public static $casts = [
'email_template_payment_failed' => 'string',
'email_subject_payment_failed' => 'string',
'payment_flow' => 'string', 'payment_flow' => 'string',
'enable_quote_reminder1' => 'bool', 'enable_quote_reminder1' => 'bool',
'quote_num_days_reminder1' => 'int', 'quote_num_days_reminder1' => 'int',
@ -774,6 +772,8 @@ class CompanySettings extends BaseSettings
'portal_custom_js' => 'string', 'portal_custom_js' => 'string',
'client_portal_enable_uploads' => 'bool', 'client_portal_enable_uploads' => 'bool',
'purchase_order_number_counter' => 'integer', 'purchase_order_number_counter' => 'integer',
'email_template_payment_failed' => 'string',
'email_subject_payment_failed' => 'string',
]; ];
public static $free_plan_casts = [ public static $free_plan_casts = [

View File

@ -41,7 +41,7 @@ class InvoicePay extends Component
'client_postal_code' => 'postal_code', 'client_postal_code' => 'postal_code',
'client_country_id' => 'country_id', 'client_country_id' => 'country_id',
'client_shipping_address_line_1' => 'shipping_address1', 'client_shipping_address_line_1' => 'shipping_address1',
'client_shipping_address_line_2' => 'shipping_address2', 'client_shipping_address_line_2' => 'shipping_address2',
'client_shipping_city' => 'shipping_city', 'client_shipping_city' => 'shipping_city',
'client_shipping_state' => 'shipping_state', 'client_shipping_state' => 'shipping_state',
@ -188,7 +188,7 @@ class InvoicePay extends Component
} }
} }
} }
return $this->required_fields = false; return $this->required_fields = false;
} }
@ -241,10 +241,9 @@ class InvoicePay extends Component
nlog($this->invoices); nlog($this->invoices);
if(is_array($this->invoices)) { if(is_array($this->invoices))
$this->invoices = Invoice::find($this->transformKeys($this->invoices)); $this->invoices = Invoice::find($this->transformKeys($this->invoices));
}
$invoices = $this->invoices->filter(function ($i) { $invoices = $this->invoices->filter(function ($i) {
$i = $i->service() $i = $i->service()
->markSent() ->markSent()

View File

@ -42,6 +42,6 @@ class InvoiceSummary extends Component
'invoice' => $this->invoices, 'invoice' => $this->invoices,
'client' => $this->invoices->first()->client, 'client' => $this->invoices->first()->client,
]); ]);
} }
} }

View File

@ -64,7 +64,7 @@ class ProcessPayment extends Component
->setPaymentHash($responder_data['payload']['ph']); ->setPaymentHash($responder_data['payload']['ph']);
$this->payment_data_payload = $driver->processPaymentViewData($responder_data['payload']); $this->payment_data_payload = $driver->processPaymentViewData($responder_data['payload']);
$this->payment_view = $driver->livewirePaymentView( $this->payment_view = $driver->livewirePaymentView(
$this->payment_data_payload, $this->payment_data_payload,
); );

View File

@ -113,7 +113,7 @@ class RequiredFields extends Component
$rff = new RFFService( $rff = new RFFService(
fields: $this->fields, fields: $this->fields,
database: $this->getContext()['db'], database: $this->getContext()['db'],
company_gateway_id: (string) $this->company_gateway->id, company_gateway_id: (string)$this->company_gateway->id,
); );
$contact = auth()->guard('contact')->user(); $contact = auth()->guard('contact')->user();

View File

@ -18,6 +18,7 @@ use Livewire\Component;
class UnderOverPayment extends Component class UnderOverPayment extends Component
{ {
use WithSecureContext; use WithSecureContext;
public $payableAmount; public $payableAmount;
@ -44,28 +45,29 @@ class UnderOverPayment extends Component
$settings = $this->getContext()['settings']; $settings = $this->getContext()['settings'];
foreach($payableInvoices as $key => $invoice) { foreach($payableInvoices as $key => $invoice){
$payableInvoices[$key]['amount'] = Number::parseFloat($invoice['formatted_amount']); $payableInvoices[$key]['amount'] = Number::parseFloat($invoice['formatted_amount']);
} }
$input_amount = collect($payableInvoices)->sum('amount'); $input_amount = collect($payableInvoices)->sum('amount');
if($settings->client_portal_allow_under_payment && $settings->client_portal_under_payment_minimum != 0) { if($settings->client_portal_allow_under_payment && $settings->client_portal_under_payment_minimum != 0)
if($input_amount <= $settings->client_portal_under_payment_minimum) { {
if($input_amount <= $settings->client_portal_under_payment_minimum){
// return error message under payment too low. // return error message under payment too low.
$this->errors = ctrans('texts.minimum_required_payment', ['amount' => $settings->client_portal_under_payment_minimum]); $this->errors = ctrans('texts.minimum_required_payment', ['amount' => $settings->client_portal_under_payment_minimum]);
$this->dispatch('errorMessageUpdate', errors: $this->errors); $this->dispatch('errorMessageUpdate', errors: $this->errors);
} }
} }
if(!$settings->client_portal_allow_over_payment && ($input_amount > $this->invoice_amount)) { if(!$settings->client_portal_allow_over_payment && ($input_amount > $this->invoice_amount)){
$this->errors = ctrans('texts.over_payments_disabled'); $this->errors = ctrans('texts.over_payments_disabled');
$this->dispatch('errorMessageUpdate', errors: $this->errors); $this->dispatch('errorMessageUpdate', errors: $this->errors);
} }
if(!$this->errors) { if(!$this->errors){
$this->setContext('payable_invoices', $payableInvoices); $this->setContext('payable_invoices', $payableInvoices);
$this->dispatch('payable-amount', payable_amount: $input_amount); $this->dispatch('payable-amount', payable_amount: $input_amount );
} }
} }

View File

@ -21,6 +21,7 @@ use App\Models\PaymentHash;
use App\Models\PaymentType; use App\Models\PaymentType;
use App\Models\SystemLog; use App\Models\SystemLog;
use App\PaymentDrivers\AuthorizePaymentDriver; use App\PaymentDrivers\AuthorizePaymentDriver;
use App\PaymentDrivers\Common\LivewireMethodInterface;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use net\authorize\api\contract\v1\DeleteCustomerPaymentProfileRequest; use net\authorize\api\contract\v1\DeleteCustomerPaymentProfileRequest;
use net\authorize\api\contract\v1\DeleteCustomerProfileRequest; use net\authorize\api\contract\v1\DeleteCustomerProfileRequest;
@ -30,7 +31,7 @@ use net\authorize\api\controller\DeleteCustomerProfileController;
/** /**
* Class AuthorizeCreditCard. * Class AuthorizeCreditCard.
*/ */
class AuthorizeCreditCard class AuthorizeCreditCard implements LivewireMethodInterface
{ {
use MakesHash; use MakesHash;
@ -41,7 +42,7 @@ class AuthorizeCreditCard
$this->authorize = $authorize; $this->authorize = $authorize;
} }
public function processPaymentView($data) public function paymentData(array $data): array
{ {
$tokens = ClientGatewayToken::where('client_id', $this->authorize->client->id) $tokens = ClientGatewayToken::where('client_id', $this->authorize->client->id)
->where('company_gateway_id', $this->authorize->company_gateway->id) ->where('company_gateway_id', $this->authorize->company_gateway->id)
@ -54,6 +55,13 @@ class AuthorizeCreditCard
$data['public_client_id'] = $this->authorize->init()->getPublicClientKey(); $data['public_client_id'] = $this->authorize->init()->getPublicClientKey();
$data['api_login_id'] = $this->authorize->company_gateway->getConfigField('apiLoginId'); $data['api_login_id'] = $this->authorize->company_gateway->getConfigField('apiLoginId');
return $data;
}
public function processPaymentView($data)
{
$data = $this->paymentData($data);
return render('gateways.authorize.credit_card.pay', $data); return render('gateways.authorize.credit_card.pay', $data);
} }
@ -313,4 +321,9 @@ class AuthorizeCreditCard
'invoices' => $vars['invoices'], 'invoices' => $vars['invoices'],
]; ];
} }
public function livewirePaymentView(array $data): string
{
return 'gateways.authorize.credit_card.pay_livewire';
}
} }

View File

@ -14,6 +14,7 @@ namespace App\PaymentDrivers\BTCPay;
use App\Models\Payment; use App\Models\Payment;
use App\PaymentDrivers\BTCPayPaymentDriver; use App\PaymentDrivers\BTCPayPaymentDriver;
use App\PaymentDrivers\Common\LivewireMethodInterface;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use App\PaymentDrivers\Common\MethodInterface; use App\PaymentDrivers\Common\MethodInterface;
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest; use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
@ -24,7 +25,7 @@ use App\Services\Email\EmailObject;
use App\Services\Email\Email; use App\Services\Email\Email;
use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\App;
class BTCPay implements MethodInterface class BTCPay implements MethodInterface, LivewireMethodInterface
{ {
use MakesHash; use MakesHash;
@ -49,9 +50,7 @@ class BTCPay implements MethodInterface
public function paymentView($data) public function paymentView($data)
{ {
$data['gateway'] = $this->driver_class; $data = $this->paymentData($data);
$data['amount'] = $data['total']['amount_with_fee'];
$data['currency'] = $this->driver_class->client->getCurrencyCode();
return render('gateways.btcpay.pay', $data); return render('gateways.btcpay.pay', $data);
} }
@ -176,4 +175,24 @@ class BTCPay implements MethodInterface
throw new PaymentFailed('Error during BTCPay refund : ' . $e->getMessage()); throw new PaymentFailed('Error during BTCPay refund : ' . $e->getMessage());
} }
} }
/**
* @inheritDoc
*/
public function livewirePaymentView(array $data): string
{
return 'gateways.btcpay.pay_livewire';
}
/**
* @inheritDoc
*/
public function paymentData(array $data): array
{
$data['gateway'] = $this->driver_class;
$data['amount'] = $data['total']['amount_with_fee'];
$data['currency'] = $this->driver_class->client->getCurrencyCode();
return $data;
}
} }

View File

@ -20,11 +20,12 @@ use App\Models\Payment;
use App\Models\PaymentType; use App\Models\PaymentType;
use App\Models\SystemLog; use App\Models\SystemLog;
use App\PaymentDrivers\BraintreePaymentDriver; use App\PaymentDrivers\BraintreePaymentDriver;
use App\PaymentDrivers\Common\LivewireMethodInterface;
use App\PaymentDrivers\Common\MethodInterface; use App\PaymentDrivers\Common\MethodInterface;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class ACH implements MethodInterface class ACH implements MethodInterface, LivewireMethodInterface
{ {
use MakesHash; use MakesHash;
@ -97,10 +98,7 @@ class ACH implements MethodInterface
public function paymentView(array $data) public function paymentView(array $data)
{ {
$data['gateway'] = $this->braintree; $data = $this->paymentData($data);
$data['currency'] = $this->braintree->client->getCurrencyCode();
$data['payment_method_id'] = GatewayType::BANK_TRANSFER;
$data['amount'] = $this->braintree->payment_hash->data->amount_with_fee;
return render('gateways.braintree.ach.pay', $data); return render('gateways.braintree.ach.pay', $data);
} }
@ -181,4 +179,24 @@ class ACH implements MethodInterface
throw new PaymentFailed($response->transaction->additionalProcessorResponse, $response->transaction->processorResponseCode); throw new PaymentFailed($response->transaction->additionalProcessorResponse, $response->transaction->processorResponseCode);
} }
/**
* @inheritDoc
*/
public function livewirePaymentView(array $data): string
{
return 'gateways.braintree.ach.pay_livewire';
}
/**
* @inheritDoc
*/
public function paymentData(array $data): array
{
$data['gateway'] = $this->braintree;
$data['currency'] = $this->braintree->client->getCurrencyCode();
$data['payment_method_id'] = GatewayType::BANK_TRANSFER;
$data['amount'] = $this->braintree->payment_hash->data->amount_with_fee;
return $data;
}
} }

View File

@ -21,8 +21,9 @@ use App\Models\Payment;
use App\Models\PaymentType; use App\Models\PaymentType;
use App\Models\SystemLog; use App\Models\SystemLog;
use App\PaymentDrivers\BraintreePaymentDriver; use App\PaymentDrivers\BraintreePaymentDriver;
use App\PaymentDrivers\Common\LivewireMethodInterface;
class CreditCard class CreditCard implements LivewireMethodInterface
{ {
/** /**
* @var BraintreePaymentDriver * @var BraintreePaymentDriver
@ -76,17 +77,7 @@ class CreditCard
public function paymentView(array $data) public function paymentView(array $data)
{ {
$data['gateway'] = $this->braintree; $data = $this->paymentData($data);
$data['client_token'] = $this->braintree->gateway->clientToken()->generate();
$data['threeds'] = $this->threeDParameters($data);
$data['threeds_enable'] = $this->braintree->company_gateway->getConfigField('threeds') ? "true" : "false";
if ($this->braintree->company_gateway->getConfigField('merchantAccountId')) {
/** https://developer.paypal.com/braintree/docs/reference/request/client-token/generate#merchant_account_id */
$data['client_token'] = $this->braintree->gateway->clientToken()->generate([ //@phpstan-ignore-line
'merchantAccountId' => $this->braintree->company_gateway->getConfigField('merchantAccountId'),
]);
}
return render('gateways.braintree.credit_card.pay', $data); return render('gateways.braintree.credit_card.pay', $data);
} }
@ -278,4 +269,32 @@ class CreditCard
return $this->braintree->processInternallyFailedPayment($this->braintree, $e); return $this->braintree->processInternallyFailedPayment($this->braintree, $e);
} }
} }
/**
* @inheritDoc
*/
public function livewirePaymentView(array $data): string
{
return 'gateways.braintree.credit_card.pay_livewire';
}
/**
* @inheritDoc
*/
public function paymentData(array $data): array
{
$data['gateway'] = $this->braintree;
$data['client_token'] = $this->braintree->gateway->clientToken()->generate();
$data['threeds'] = $this->threeDParameters($data);
$data['threeds_enable'] = $this->braintree->company_gateway->getConfigField('threeds') ? "true" : "false";
if ($this->braintree->company_gateway->getConfigField('merchantAccountId')) {
/** https://developer.paypal.com/braintree/docs/reference/request/client-token/generate#merchant_account_id */
$data['client_token'] = $this->braintree->gateway->clientToken()->generate([ // @phpstan-ignore-line
'merchantAccountId' => $this->braintree->company_gateway->getConfigField('merchantAccountId'),
]);
}
return $data;
}
} }

View File

@ -10,8 +10,9 @@ use App\Models\Payment;
use App\Models\PaymentType; use App\Models\PaymentType;
use App\Models\SystemLog; use App\Models\SystemLog;
use App\PaymentDrivers\BraintreePaymentDriver; use App\PaymentDrivers\BraintreePaymentDriver;
use App\PaymentDrivers\Common\LivewireMethodInterface;
class PayPal class PayPal implements LivewireMethodInterface
{ {
/** /**
* @var BraintreePaymentDriver * @var BraintreePaymentDriver
@ -45,8 +46,7 @@ class PayPal
*/ */
public function paymentView(array $data) public function paymentView(array $data)
{ {
$data['gateway'] = $this->braintree; $data = $this->paymentData($data);
$data['client_token'] = $this->braintree->gateway->clientToken()->generate();
return render('gateways.braintree.paypal.pay', $data); return render('gateways.braintree.paypal.pay', $data);
} }
@ -188,4 +188,23 @@ class PayPal
return $this->braintree->processInternallyFailedPayment($this->braintree, $e); return $this->braintree->processInternallyFailedPayment($this->braintree, $e);
} }
} }
/**
* @inheritDoc
*/
public function livewirePaymentView(array $data): string
{
return 'gateways.braintree.paypal.pay_livewire';
}
/**
* @inheritDoc
*/
public function paymentData(array $data): array
{
$data['gateway'] = $this->braintree;
$data['client_token'] = $this->braintree->gateway->clientToken()->generate();
return $data;
}
} }

View File

@ -19,6 +19,7 @@ use App\Models\ClientGatewayToken;
use App\Models\GatewayType; use App\Models\GatewayType;
use App\Models\SystemLog; use App\Models\SystemLog;
use App\PaymentDrivers\CheckoutComPaymentDriver; use App\PaymentDrivers\CheckoutComPaymentDriver;
use App\PaymentDrivers\Common\LivewireMethodInterface;
use App\PaymentDrivers\Common\MethodInterface; use App\PaymentDrivers\Common\MethodInterface;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use Checkout\CheckoutApiException; use Checkout\CheckoutApiException;
@ -32,7 +33,7 @@ use Illuminate\Contracts\View\Factory;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\View\View; use Illuminate\View\View;
class CreditCard implements MethodInterface class CreditCard implements MethodInterface, LivewireMethodInterface
{ {
use Utilities; use Utilities;
use MakesHash; use MakesHash;
@ -140,7 +141,7 @@ class CreditCard implements MethodInterface
} }
} }
public function paymentView($data) public function paymentData(array $data): array
{ {
$data['gateway'] = $this->checkout; $data['gateway'] = $this->checkout;
$data['company_gateway'] = $this->checkout->company_gateway; $data['company_gateway'] = $this->checkout->company_gateway;
@ -150,6 +151,17 @@ class CreditCard implements MethodInterface
$data['raw_value'] = $data['total']['amount_with_fee']; $data['raw_value'] = $data['total']['amount_with_fee'];
$data['customer_email'] = $this->checkout->client->present()->email(); $data['customer_email'] = $this->checkout->client->present()->email();
return $data;
}
public function paymentView($data, $livewire = false)
{
$data = $this->paymentData($data);
if ($livewire) {
return render('gateways.checkout.credit_card.pay_livewire', $data);
}
return render('gateways.checkout.credit_card.pay', $data); return render('gateways.checkout.credit_card.pay', $data);
} }

View File

@ -17,10 +17,11 @@ use App\Jobs\Util\SystemLogger;
use App\Models\GatewayType; use App\Models\GatewayType;
use App\Models\PaymentType; use App\Models\PaymentType;
use App\Models\SystemLog; use App\Models\SystemLog;
use App\PaymentDrivers\Common\LivewireMethodInterface;
use App\PaymentDrivers\EwayPaymentDriver; use App\PaymentDrivers\EwayPaymentDriver;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
class CreditCard class CreditCard implements LivewireMethodInterface
{ {
use MakesHash; use MakesHash;
@ -102,11 +103,18 @@ class CreditCard
return $token; return $token;
} }
public function paymentView($data) public function paymentData(array $data): array
{ {
$data['gateway'] = $this->eway_driver; $data['gateway'] = $this->eway_driver;
$data['public_api_key'] = $this->eway_driver->company_gateway->getConfigField('publicApiKey'); $data['public_api_key'] = $this->eway_driver->company_gateway->getConfigField('publicApiKey');
return $data;
}
public function paymentView($data)
{
$data = $this->paymentData($data);
return render('gateways.eway.pay', $data); return render('gateways.eway.pay', $data);
} }
@ -276,4 +284,8 @@ class CreditCard
return $payment; return $payment;
} }
public function livewirePaymentView(array $data): string
{
return 'gateways.eway.pay_livewire';
}
} }

View File

@ -19,11 +19,12 @@ use App\Models\Payment;
use App\Models\PaymentHash; use App\Models\PaymentHash;
use App\Models\PaymentType; use App\Models\PaymentType;
use App\Models\SystemLog; use App\Models\SystemLog;
use App\PaymentDrivers\Common\LivewireMethodInterface;
use App\PaymentDrivers\FortePaymentDriver; use App\PaymentDrivers\FortePaymentDriver;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
class ACH class ACH implements LivewireMethodInterface
{ {
use MakesHash; use MakesHash;
@ -79,10 +80,8 @@ class ACH
public function paymentView(array $data) public function paymentView(array $data)
{ {
$this->forte->payment_hash->data = array_merge((array) $this->forte->payment_hash->data, $data); $data = $this->paymentData($data);
$this->forte->payment_hash->save();
$data['gateway'] = $this->forte;
return render('gateways.forte.ach.pay', $data); return render('gateways.forte.ach.pay', $data);
} }
@ -175,4 +174,25 @@ class ACH
return redirect()->route('client.payments.show', ['payment' => $payment->hashed_id]); return redirect()->route('client.payments.show', ['payment' => $payment->hashed_id]);
} }
/**
* @inheritDoc
*/
public function livewirePaymentView(array $data): string
{
return 'gateways.forte.ach.pay_livewire';
}
/**
* @inheritDoc
*/
public function paymentData(array $data): array
{
$this->forte->payment_hash->data = array_merge((array) $this->forte->payment_hash->data, $data);
$this->forte->payment_hash->save();
$data['gateway'] = $this->forte;
return $data;
}
} }

View File

@ -20,11 +20,12 @@ use App\Models\Payment;
use App\Models\PaymentHash; use App\Models\PaymentHash;
use App\Models\PaymentType; use App\Models\PaymentType;
use App\Models\SystemLog; use App\Models\SystemLog;
use App\PaymentDrivers\Common\LivewireMethodInterface;
use App\PaymentDrivers\FortePaymentDriver; use App\PaymentDrivers\FortePaymentDriver;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
class CreditCard class CreditCard implements LivewireMethodInterface
{ {
use MakesHash; use MakesHash;
@ -157,10 +158,8 @@ class CreditCard
public function paymentView(array $data) public function paymentView(array $data)
{ {
$this->forte->payment_hash->data = array_merge((array) $this->forte->payment_hash->data, $data); $data = $this->paymentData($data);
$this->forte->payment_hash->save();
$data['gateway'] = $this->forte;
return render('gateways.forte.credit_card.pay', $data); return render('gateways.forte.credit_card.pay', $data);
} }
@ -287,4 +286,25 @@ class CreditCard
return redirect()->route('client.payments.show', ['payment' => $payment->hashed_id]); return redirect()->route('client.payments.show', ['payment' => $payment->hashed_id]);
} }
/**
* @inheritDoc
*/
public function livewirePaymentView(array $data): string
{
return 'gateways.forte.credit_card.pay_livewire';
}
/**
* @inheritDoc
*/
public function paymentData(array $data): array
{
$this->forte->payment_hash->data = array_merge((array) $this->forte->payment_hash->data, $data);
$this->forte->payment_hash->save();
$data['gateway'] = $this->forte;
return $data;
}
} }

View File

@ -20,6 +20,7 @@ use App\Models\Invoice;
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\Common\MethodInterface; use App\PaymentDrivers\Common\MethodInterface;
use App\PaymentDrivers\GoCardlessPaymentDriver; use App\PaymentDrivers\GoCardlessPaymentDriver;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
@ -31,7 +32,7 @@ use Illuminate\Routing\Redirector;
use Illuminate\View\View; use Illuminate\View\View;
//@deprecated //@deprecated
class ACH implements MethodInterface class ACH implements MethodInterface, LivewireMethodInterface
{ {
use MakesHash; use MakesHash;
@ -146,9 +147,7 @@ class ACH implements MethodInterface
*/ */
public function paymentView(array $data): View public function paymentView(array $data): View
{ {
$data['gateway'] = $this->go_cardless; $data = $this->paymentData($data);
$data['amount'] = $this->go_cardless->convertToGoCardlessAmount($data['total']['amount_with_fee'], $this->go_cardless->client->currency()->precision);
$data['currency'] = $this->go_cardless->client->getCurrencyCode();
return render('gateways.gocardless.ach.pay', $data); return render('gateways.gocardless.ach.pay', $data);
} }
@ -257,4 +256,23 @@ class ACH implements MethodInterface
throw new PaymentFailed('Failed to process the payment.', 500); throw new PaymentFailed('Failed to process the payment.', 500);
} }
/**
* @inheritDoc
*/
public function livewirePaymentView(array $data): string
{
return 'gateways.gocardless.ach.pay_livewire';
}
/**
* @inheritDoc
*/
public function paymentData(array $data): array
{
$data['gateway'] = $this->go_cardless;
$data['amount'] = $this->go_cardless->convertToGoCardlessAmount($data['total']['amount_with_fee'], $this->go_cardless->client->currency()->precision);
$data['currency'] = $this->go_cardless->client->getCurrencyCode();
return $data;
}
} }

View File

@ -21,6 +21,7 @@ use App\Models\Invoice;
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\Common\MethodInterface; use App\PaymentDrivers\Common\MethodInterface;
use App\PaymentDrivers\GoCardlessPaymentDriver; use App\PaymentDrivers\GoCardlessPaymentDriver;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
@ -29,7 +30,7 @@ use Illuminate\Http\Request;
use Illuminate\Routing\Redirector; use Illuminate\Routing\Redirector;
use Illuminate\View\View; use Illuminate\View\View;
class DirectDebit implements MethodInterface class DirectDebit implements MethodInterface, LivewireMethodInterface
{ {
use MakesHash; use MakesHash;
@ -218,9 +219,7 @@ class DirectDebit implements MethodInterface
*/ */
public function paymentView(array $data): View public function paymentView(array $data): View
{ {
$data['gateway'] = $this->go_cardless; $data = $this->paymentData($data);
$data['amount'] = $this->go_cardless->convertToGoCardlessAmount($data['total']['amount_with_fee'], $this->go_cardless->client->currency()->precision);
$data['currency'] = $this->go_cardless->client->getCurrencyCode();
return render('gateways.gocardless.direct_debit.pay', $data); return render('gateways.gocardless.direct_debit.pay', $data);
} }
@ -330,4 +329,24 @@ class DirectDebit implements MethodInterface
throw new PaymentFailed('Failed to process the payment.', 500); throw new PaymentFailed('Failed to process the payment.', 500);
} }
/**
* @inheritDoc
*/
public function livewirePaymentView(array $data): string
{
return 'gateways.gocardless.direct_debit.pay_livewire';
}
/**
* @inheritDoc
*/
public function paymentData(array $data): array
{
$data['gateway'] = $this->go_cardless;
$data['amount'] = $this->go_cardless->convertToGoCardlessAmount($data['total']['amount_with_fee'], $this->go_cardless->client->currency()->precision);
$data['currency'] = $this->go_cardless->client->getCurrencyCode();
return $data;
}
} }

View File

@ -9,13 +9,14 @@ 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\Common\MethodInterface; use App\PaymentDrivers\Common\MethodInterface;
use App\PaymentDrivers\GoCardlessPaymentDriver; use App\PaymentDrivers\GoCardlessPaymentDriver;
use Illuminate\Contracts\Container\BindingResolutionException; use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class InstantBankPay implements MethodInterface class InstantBankPay implements MethodInterface, LivewireMethodInterface
{ {
protected GoCardlessPaymentDriver $go_cardless; protected GoCardlessPaymentDriver $go_cardless;
@ -120,7 +121,7 @@ class InstantBankPay implements MethodInterface
return $this->processPendingPayment($payment); return $this->processPendingPayment($payment);
} }
return $this->processUnsuccessfulPayment($payment); $this->processUnsuccessfulPayment($payment);
} catch (\Exception $exception) { } catch (\Exception $exception) {
throw new PaymentFailed( throw new PaymentFailed(
$exception->getMessage(), $exception->getMessage(),
@ -197,9 +198,8 @@ class InstantBankPay implements MethodInterface
* Process unsuccessful payments for Direct Debit. * Process unsuccessful payments for Direct Debit.
* *
* @param ResourcesPayment $payment * @param ResourcesPayment $payment
* @return never
*/ */
public function processUnsuccessfulPayment(\GoCardlessPro\Resources\Payment $payment) public function processUnsuccessfulPayment(\GoCardlessPro\Resources\Payment $payment): void
{ {
PaymentFailureMailer::dispatch($this->go_cardless->client, $payment->status, $this->go_cardless->client->company, $this->go_cardless->payment_hash->data->amount_with_fee); PaymentFailureMailer::dispatch($this->go_cardless->client, $payment->status, $this->go_cardless->client->company, $this->go_cardless->payment_hash->data->amount_with_fee);
@ -224,4 +224,24 @@ class InstantBankPay implements MethodInterface
$this->go_cardless->client->company, $this->go_cardless->client->company,
); );
} }
/**
* @inheritDoc
*/
public function livewirePaymentView(array $data): string
{
// not supported, this is offsite payment method.
return '';
}
/**
* @inheritDoc
*/
public function paymentData(array $data): array
{
$this->paymentView($data);
return $data;
}
} }

View File

@ -20,6 +20,7 @@ use App\Models\Invoice;
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\Common\MethodInterface; use App\PaymentDrivers\Common\MethodInterface;
use App\PaymentDrivers\GoCardlessPaymentDriver; use App\PaymentDrivers\GoCardlessPaymentDriver;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
@ -29,7 +30,7 @@ use Illuminate\Http\Request;
use Illuminate\Routing\Redirector; use Illuminate\Routing\Redirector;
use Illuminate\View\View; use Illuminate\View\View;
class SEPA implements MethodInterface class SEPA implements MethodInterface, LivewireMethodInterface
{ {
use MakesHash; use MakesHash;
@ -145,9 +146,7 @@ class SEPA implements MethodInterface
*/ */
public function paymentView(array $data): View public function paymentView(array $data): View
{ {
$data['gateway'] = $this->go_cardless; $data = $this->paymentData($data);
$data['amount'] = $this->go_cardless->convertToGoCardlessAmount($data['total']['amount_with_fee'], $this->go_cardless->client->currency()->precision);
$data['currency'] = $this->go_cardless->client->getCurrencyCode();
return render('gateways.gocardless.sepa.pay', $data); return render('gateways.gocardless.sepa.pay', $data);
} }
@ -257,4 +256,24 @@ class SEPA implements MethodInterface
throw new PaymentFailed('Failed to process the payment.', 500); throw new PaymentFailed('Failed to process the payment.', 500);
} }
/**
* @inheritDoc
*/
public function livewirePaymentView(array $data): string
{
return 'gateways.gocardless.sepa.pay_livewire';
}
/**
* @inheritDoc
*/
public function paymentData(array $data): array
{
$data['gateway'] = $this->go_cardless;
$data['amount'] = $this->go_cardless->convertToGoCardlessAmount($data['total']['amount_with_fee'], $this->go_cardless->client->currency()->precision);
$data['currency'] = $this->go_cardless->client->getCurrencyCode();
return $data;
}
} }

View File

@ -19,13 +19,14 @@ 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\Common\MethodInterface; use App\PaymentDrivers\Common\MethodInterface;
use App\PaymentDrivers\MolliePaymentDriver; use App\PaymentDrivers\MolliePaymentDriver;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\View\View; use Illuminate\View\View;
class Bancontact implements MethodInterface class Bancontact implements MethodInterface, LivewireMethodInterface
{ {
protected MolliePaymentDriver $mollie; protected MolliePaymentDriver $mollie;
@ -209,4 +210,24 @@ class Bancontact implements MethodInterface
{ {
return $this->processSuccessfulPayment($payment, 'open'); return $this->processSuccessfulPayment($payment, 'open');
} }
/**
* @inheritDoc
*/
public function livewirePaymentView(array $data): string
{
// Doesn't support, it's offsite payment method.
return '';
}
/**
* @inheritDoc
*/
public function paymentData(array $data): array
{
$this->paymentView($data);
return $data;
}
} }

View File

@ -19,6 +19,7 @@ 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\Common\MethodInterface; use App\PaymentDrivers\Common\MethodInterface;
use App\PaymentDrivers\MolliePaymentDriver; use App\PaymentDrivers\MolliePaymentDriver;
use Exception; use Exception;
@ -28,7 +29,7 @@ use Illuminate\Routing\Redirector;
use Illuminate\View\View; use Illuminate\View\View;
use Mollie\Api\Resources\Payment as ResourcesPayment; use Mollie\Api\Resources\Payment as ResourcesPayment;
class BankTransfer implements MethodInterface class BankTransfer implements MethodInterface, LivewireMethodInterface
{ {
protected MolliePaymentDriver $mollie; protected MolliePaymentDriver $mollie;
@ -206,4 +207,24 @@ class BankTransfer implements MethodInterface
{ {
return $this->processSuccessfulPayment($payment, 'open'); return $this->processSuccessfulPayment($payment, 'open');
} }
/**
* @inheritDoc
*/
public function livewirePaymentView(array $data): string
{
// Doesn't support, it's offsite payment method.
return '';
}
/**
* @inheritDoc
*/
public function paymentData(array $data): array
{
$this->paymentView($data);
return $data;
}
} }

View File

@ -10,12 +10,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\MolliePaymentDriver; use App\PaymentDrivers\MolliePaymentDriver;
use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\View\View; use Illuminate\View\View;
class CreditCard class CreditCard implements LivewireMethodInterface
{ {
/** /**
* @var MolliePaymentDriver * @var MolliePaymentDriver
@ -37,7 +38,7 @@ class CreditCard
*/ */
public function paymentView(array $data) public function paymentView(array $data)
{ {
$data['gateway'] = $this->mollie; $data = $this->paymentData($data);
return render('gateways.mollie.credit_card.pay', $data); return render('gateways.mollie.credit_card.pay', $data);
} }
@ -257,4 +258,22 @@ class CreditCard
{ {
return redirect()->route('client.payment_methods.index'); return redirect()->route('client.payment_methods.index');
} }
/**
* @inheritDoc
*/
public function livewirePaymentView(array $data): string
{
return 'gateways.mollie.credit_card.pay_livewire';
}
/**
* @inheritDoc
*/
public function paymentData(array $data): array
{
$data['gateway'] = $this->mollie;
return $data;
}
} }

View File

@ -19,13 +19,14 @@ 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\Common\MethodInterface; use App\PaymentDrivers\Common\MethodInterface;
use App\PaymentDrivers\MolliePaymentDriver; use App\PaymentDrivers\MolliePaymentDriver;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\View\View; use Illuminate\View\View;
class IDEAL implements MethodInterface class IDEAL implements MethodInterface, LivewireMethodInterface
{ {
protected MolliePaymentDriver $mollie; protected MolliePaymentDriver $mollie;
@ -209,4 +210,24 @@ class IDEAL implements MethodInterface
{ {
return $this->processSuccessfulPayment($payment, 'open'); return $this->processSuccessfulPayment($payment, 'open');
} }
/**
* @inheritDoc
*/
public function livewirePaymentView(array $data): string
{
// Doesn't support, it's offsite payment method.
return '';
}
/**
* @inheritDoc
*/
public function paymentData(array $data): array
{
$this->paymentView($data);
return $data;
}
} }

View File

@ -19,13 +19,14 @@ 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\Common\MethodInterface; use App\PaymentDrivers\Common\MethodInterface;
use App\PaymentDrivers\MolliePaymentDriver; use App\PaymentDrivers\MolliePaymentDriver;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\View\View; use Illuminate\View\View;
class KBC implements MethodInterface class KBC implements MethodInterface, LivewireMethodInterface
{ {
protected MolliePaymentDriver $mollie; protected MolliePaymentDriver $mollie;
@ -193,4 +194,24 @@ class KBC implements MethodInterface
return redirect()->route('client.payments.show', ['payment' => $this->mollie->encodePrimaryKey($payment_record->id)]); return redirect()->route('client.payments.show', ['payment' => $this->mollie->encodePrimaryKey($payment_record->id)]);
} }
/**
* @inheritDoc
*/
public function livewirePaymentView(array $data): string
{
// Doesn't support, it's offsite payment method.
return '';
}
/**
* @inheritDoc
*/
public function paymentData(array $data): array
{
$this->paymentView($data);
return $data;
}
} }

View File

@ -18,12 +18,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\PayFastPaymentDriver; use App\PaymentDrivers\PayFastPaymentDriver;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str; use Illuminate\Support\Str;
class CreditCard class CreditCard implements LivewireMethodInterface
{ {
public $payfast; public $payfast;
@ -158,24 +159,9 @@ class CreditCard
public function paymentView($data) public function paymentView($data)
{ {
$payfast_data = [ $data = $this->paymentData($data);
'merchant_id' => $this->payfast->company_gateway->getConfigField('merchantId'),
'merchant_key' => $this->payfast->company_gateway->getConfigField('merchantKey'),
'return_url' => route('client.payments.index'),
'cancel_url' => route('client.payment_methods.index'),
'notify_url' => $this->payfast->genericWebhookUrl(),
'm_payment_id' => $data['payment_hash'],
'amount' => $data['amount_with_fee'],
'item_name' => 'purchase',
'item_description' => ctrans('texts.invoices').': '.collect($data['invoices'])->pluck('invoice_number'),
'passphrase' => $this->payfast->company_gateway->getConfigField('passphrase'),
];
$payfast_data['signature'] = $this->payfast->generateSignature($payfast_data); return render('gateways.payfast.pay', array_merge($data));
$payfast_data['gateway'] = $this->payfast;
$payfast_data['payment_endpoint_url'] = $this->payfast->endpointUrl();
return render('gateways.payfast.pay', array_merge($data, $payfast_data));
} }
/* /*
@ -263,4 +249,36 @@ class CreditCard
throw new PaymentFailed('Failed to process the payment.', 500); throw new PaymentFailed('Failed to process the payment.', 500);
} }
/**
* @inheritDoc
*/
public function livewirePaymentView(array $data): string
{
return 'gateways.payfast.pay_livewire';
}
/**
* @inheritDoc
*/
public function paymentData(array $data): array
{
$payfast_data = [
'merchant_id' => $this->payfast->company_gateway->getConfigField('merchantId'),
'merchant_key' => $this->payfast->company_gateway->getConfigField('merchantKey'),
'return_url' => route('client.payments.index'),
'cancel_url' => route('client.payment_methods.index'),
'notify_url' => $this->payfast->genericWebhookUrl(),
'm_payment_id' => $data['payment_hash'],
'amount' => $data['amount_with_fee'],
'item_name' => 'purchase',
'item_description' => ctrans('texts.invoices').': '.collect($data['invoices'])->pluck('invoice_number'),
'passphrase' => $this->payfast->company_gateway->getConfigField('passphrase'),
];
$payfast_data['signature'] = $this->payfast->generateSignature($payfast_data);
$payfast_data['gateway'] = $this->payfast;
$payfast_data['payment_endpoint_url'] = $this->payfast->endpointUrl();
return array_merge($data, $payfast_data);
}
} }

View File

@ -85,30 +85,13 @@ class PayPalPPCPPaymentDriver extends PayPalBasePaymentDriver
*/ */
public function processPaymentView($data) public function processPaymentView($data)
{ {
$data = $this->processPaymentViewData($data);
$this->init()->checkPaymentsReceivable();
$data['gateway'] = $this;
$this->payment_hash->data = array_merge((array) $this->payment_hash->data, ['amount' => $data['total']['amount_with_fee']]);
$this->payment_hash->save();
$data['client_id'] = config('ninja.paypal.client_id');
$data['token'] = $this->getClientToken();
$data['order_id'] = $this->createOrder($data);
$data['funding_source'] = $this->paypal_payment_method;
$data['gateway_type_id'] = $this->gateway_type_id;
$data['merchantId'] = $this->company_gateway->getConfigField('merchantId');
$data['currency'] = $this->client->currency()->code;
$data['guid'] = $this->risk_guid;
$data['identifier'] = "s:INN_".$this->company_gateway->getConfigField('merchantId')."_CHCK";
$data['pp_client_reference'] = $this->getClientHash();
if($this->gateway_type_id == 29) { if($this->gateway_type_id == 29) {
return render('gateways.paypal.ppcp.card', $data); return render('gateways.paypal.ppcp.card', $data);
} else { } else {
return render('gateways.paypal.ppcp.pay', $data); return render('gateways.paypal.ppcp.pay', $data);
} }
} }
/** /**
@ -480,7 +463,34 @@ class PayPalPPCPPaymentDriver extends PayPalBasePaymentDriver
} }
public function processPaymentViewData(array $data): array
{
$this->init()->checkPaymentsReceivable();
$data['gateway'] = $this;
$this->payment_hash->data = array_merge((array) $this->payment_hash->data, ['amount' => $data['total']['amount_with_fee']]);
$this->payment_hash->save();
$data['client_id'] = config('ninja.paypal.client_id');
$data['token'] = $this->getClientToken();
$data['order_id'] = $this->createOrder($data);
$data['funding_source'] = $this->paypal_payment_method;
$data['gateway_type_id'] = $this->gateway_type_id;
$data['merchantId'] = $this->company_gateway->getConfigField('merchantId');
$data['currency'] = $this->client->currency()->code;
$data['guid'] = $this->risk_guid;
$data['identifier'] = "s:INN_".$this->company_gateway->getConfigField('merchantId')."_CHCK";
$data['pp_client_reference'] = $this->getClientHash();
return $data;
}
public function livewirePaymentView(array $data): string
{
if ($this->gateway_type_id == 29) {
return 'gateways.paypal.ppcp.card_livewire';
}
return 'gateways.paypal.ppcp.pay_livewire';
}
} }

View File

@ -31,30 +31,13 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
public function processPaymentView($data) public function processPaymentView($data)
{ {
$data = $this->processPaymentViewData($data);
$this->init();
$data['gateway'] = $this;
$this->payment_hash->data = array_merge((array) $this->payment_hash->data, ['amount' => $data['total']['amount_with_fee']]);
$this->payment_hash->save();
$data['client_id'] = $this->company_gateway->getConfigField('clientId');
$data['token'] = $this->getClientToken();
$data['order_id'] = $this->createOrder($data);
$data['funding_source'] = $this->paypal_payment_method;
$data['gateway_type_id'] = $this->gateway_type_id;
$data['currency'] = $this->client->currency()->code;
$data['guid'] = $this->risk_guid;
$data['identifier'] = "s:INN_ACDC_CHCK";
$data['pp_client_reference'] = $this->getClientHash();
if($this->gateway_type_id == 29) { if($this->gateway_type_id == 29) {
return render('gateways.paypal.ppcp.card', $data); return render('gateways.paypal.ppcp.card', $data);
} else { } else {
return render('gateways.paypal.pay', $data); return render('gateways.paypal.pay', $data);
} }
} }
/** /**
@ -434,4 +417,35 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
SystemLogger::dispatch($response, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_PAYPAL, $this->client, $this->client->company); SystemLogger::dispatch($response, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_PAYPAL, $this->client, $this->client->company);
} }
public function processPaymentViewData(array $data): array
{
$this->init();
$data['gateway'] = $this;
$this->payment_hash->data = array_merge((array) $this->payment_hash->data, ['amount' => $data['total']['amount_with_fee']]);
$this->payment_hash->save();
$data['client_id'] = $this->company_gateway->getConfigField('clientId');
$data['token'] = $this->getClientToken();
$data['order_id'] = $this->createOrder($data);
$data['funding_source'] = $this->paypal_payment_method;
$data['gateway_type_id'] = $this->gateway_type_id;
$data['currency'] = $this->client->currency()->code;
$data['guid'] = $this->risk_guid;
$data['identifier'] = "s:INN_ACDC_CHCK";
$data['pp_client_reference'] = $this->getClientHash();
return $data;
}
public function livewirePaymentView(array $data): string
{
if ($this->gateway_type_id == 29) {
return 'gateways.paypal.ppcp.card_livewire';
}
return 'gateways.paypal.pay_livewire';
}
} }

View File

@ -18,12 +18,13 @@ use App\Models\Invoice;
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\PaytracePaymentDriver; use App\PaymentDrivers\PaytracePaymentDriver;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Str; use Illuminate\Support\Str;
class CreditCard class CreditCard implements LivewireMethodInterface
{ {
use MakesHash; use MakesHash;
@ -36,9 +37,8 @@ class CreditCard
public function authorizeView($data) public function authorizeView($data)
{ {
$data['client_key'] = $this->paytrace->getAuthToken(); $data = $this->paymentData($data);
$data['gateway'] = $this->paytrace;
return render('gateways.paytrace.authorize', $data); return render('gateways.paytrace.authorize', $data);
} }
@ -239,5 +239,24 @@ class CreditCard
]; ];
return $this->paytrace->processUnsuccessfulTransaction($data); return $this->paytrace->processUnsuccessfulTransaction($data);
}
/**
* @inheritDoc
*/
public function livewirePaymentView(array $data): string
{
return 'gateways.paytrace.pay_livewire';
}
/**
* @inheritDoc
*/
public function paymentData(array $data): array
{
$data['client_key'] = $this->paytrace->getAuthToken();
$data['gateway'] = $this->paytrace;
return $data;
} }
} }

View File

@ -19,6 +19,7 @@ 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\Common\MethodInterface; use App\PaymentDrivers\Common\MethodInterface;
use App\PaymentDrivers\RazorpayPaymentDriver; use App\PaymentDrivers\RazorpayPaymentDriver;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
@ -26,7 +27,7 @@ use Illuminate\Http\Request;
use Illuminate\View\View; use Illuminate\View\View;
use Razorpay\Api\Errors\SignatureVerificationError; use Razorpay\Api\Errors\SignatureVerificationError;
class Hosted implements MethodInterface class Hosted implements MethodInterface, LivewireMethodInterface
{ {
protected RazorpayPaymentDriver $razorpay; protected RazorpayPaymentDriver $razorpay;
@ -67,23 +68,7 @@ class Hosted implements MethodInterface
*/ */
public function paymentView(array $data): View public function paymentView(array $data): View
{ {
$order = $this->razorpay->gateway->order->create([ $data = $this->paymentData($data);
'currency' => $this->razorpay->client->currency()->code,
'amount' => $this->razorpay->convertToRazorpayAmount((float) $this->razorpay->payment_hash->data->amount_with_fee),
]);
$this->razorpay->payment_hash->withData('order_id', $order->id);
$this->razorpay->payment_hash->withData('order_amount', $order->amount);
$data['gateway'] = $this->razorpay;
$data['options'] = [
'key' => $this->razorpay->company_gateway->getConfigField('apiKey'),
'amount' => $this->razorpay->convertToRazorpayAmount((float) $this->razorpay->payment_hash->data->amount_with_fee),
'currency' => $this->razorpay->client->currency()->code,
'name' => $this->razorpay->company_gateway->company->present()->name(),
'order_id' => $order->id,
];
return render('gateways.razorpay.hosted.pay', $data); return render('gateways.razorpay.hosted.pay', $data);
} }
@ -174,4 +159,38 @@ class Hosted implements MethodInterface
throw new PaymentFailed($exception->getMessage(), $exception->getCode()); throw new PaymentFailed($exception->getMessage(), $exception->getCode());
} }
/**
* @inheritDoc
*/
public function livewirePaymentView(array $data): string
{
return 'gateways.razorpay.hosted.pay_livewire';
}
/**
* @inheritDoc
*/
public function paymentData(array $data): array
{
$order = $this->razorpay->gateway->order->create([
'currency' => $this->razorpay->client->currency()->code,
'amount' => $this->razorpay->convertToRazorpayAmount((float) $this->razorpay->payment_hash->data->amount_with_fee),
]);
$this->razorpay->payment_hash->withData('order_id', $order->id);
$this->razorpay->payment_hash->withData('order_amount', $order->amount);
$data['gateway'] = $this->razorpay;
$data['options'] = [
'key' => $this->razorpay->company_gateway->getConfigField('apiKey'),
'amount' => $this->razorpay->convertToRazorpayAmount((float) $this->razorpay->payment_hash->data->amount_with_fee),
'currency' => $this->razorpay->client->currency()->code,
'name' => $this->razorpay->company_gateway->company->present()->name(),
'order_id' => $order->id,
];
return $data;
}
} }

View File

@ -21,6 +21,7 @@ use App\Models\Invoice;
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\Common\MethodInterface; use App\PaymentDrivers\Common\MethodInterface;
use App\PaymentDrivers\SquarePaymentDriver; use App\PaymentDrivers\SquarePaymentDriver;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
@ -29,7 +30,7 @@ use Illuminate\Http\Request;
use Illuminate\View\View; use Illuminate\View\View;
use Square\Http\ApiResponse; use Square\Http\ApiResponse;
class CreditCard implements MethodInterface class CreditCard implements MethodInterface, LivewireMethodInterface
{ {
use MakesHash; use MakesHash;
@ -64,10 +65,7 @@ class CreditCard implements MethodInterface
public function paymentView($data) public function paymentView($data)
{ {
$data['gateway'] = $this->square_driver; $data = $this->paymentData($data);
$data['amount'] = $this->square_driver->payment_hash->data->amount_with_fee;
$data['currencyCode'] = $this->square_driver->client->getCurrencyCode();
$data['square_contact'] = $this->buildClientObject();
return render('gateways.square.credit_card.pay', $data); return render('gateways.square.credit_card.pay', $data);
} }
@ -238,5 +236,24 @@ class CreditCard implements MethodInterface
return false; return false;
} }
/**
* @inheritDoc
*/
public function livewirePaymentView(array $data): string
{
return 'gateways.square.credit_card.pay_livewire';
}
/**
* @inheritDoc
*/
public function paymentData(array $data): array
{
$data['gateway'] = $this->square_driver;
$data['amount'] = $this->square_driver->payment_hash->data->amount_with_fee;
$data['currencyCode'] = $this->square_driver->client->getCurrencyCode();
$data['square_contact'] = $this->buildClientObject();
return $data;
}
} }

View File

@ -205,59 +205,6 @@ class ACH implements LivewireMethodInterface
return render('gateways.stripe.ach.pay', $data); return render('gateways.stripe.ach.pay', $data);
} }
public function livewirePaymentView(array $data): string
{
return 'gateways.stripe.ach.pay_livewire';
}
public function paymentData(array $data): array
{
$data['gateway'] = $this->stripe;
$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 $data;
}
public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash) public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash)
{ {
$amount = array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total; $amount = array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total;
@ -642,4 +589,56 @@ class ACH implements LivewireMethodInterface
return $this->stripe->processInternallyFailedPayment($this->stripe, $e); return $this->stripe->processInternallyFailedPayment($this->stripe, $e);
} }
} }
public function livewirePaymentView(array $data): string
{
return 'gateways.stripe.ach.pay_livewire';
}
public function paymentData(array $data): array
{
$data['gateway'] = $this->stripe;
$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 $data;
}
} }

View File

@ -164,7 +164,7 @@ class ACSS implements LivewireMethodInterface
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);
@ -176,7 +176,7 @@ class ACSS implements LivewireMethodInterface
$data['company_gateway'] = $this->stripe->company_gateway; $data['company_gateway'] = $this->stripe->company_gateway;
$data['customer'] = $this->stripe->findOrCreateCustomer()->id; $data['customer'] = $this->stripe->findOrCreateCustomer()->id;
$data['country'] = $this->stripe->client->country->iso_3166_2; $data['country'] = $this->stripe->client->country->iso_3166_2;
$intent = \Stripe\SetupIntent::create([ $intent = \Stripe\SetupIntent::create([
'usage' => 'off_session', 'usage' => 'off_session',
'payment_method_types' => ['acss_debit'], 'payment_method_types' => ['acss_debit'],
@ -193,7 +193,7 @@ class ACSS implements LivewireMethodInterface
], ],
], ],
], $this->stripe->stripe_connect_auth); ], $this->stripe->stripe_connect_auth);
$data['pi_client_secret'] = $intent->client_secret; $data['pi_client_secret'] = $intent->client_secret;
return $data; return $data;
@ -389,8 +389,8 @@ class ACSS implements LivewireMethodInterface
return $this->stripe->processInternallyFailedPayment($this->stripe, $e); return $this->stripe->processInternallyFailedPayment($this->stripe, $e);
} }
} }
public function livewirePaymentView(array $data): string public function livewirePaymentView(array $data): string
{ {
if (array_key_exists('needs_mandate_generate', $data)) { if (array_key_exists('needs_mandate_generate', $data)) {
return 'gateways.stripe.acss.authorize_livewire'; return 'gateways.stripe.acss.authorize_livewire';

View File

@ -39,6 +39,7 @@ class Bancontact implements LivewireMethodInterface
public function paymentView(array $data) public function paymentView(array $data)
{ {
$data = $this->paymentData($data); $data = $this->paymentData($data);
$data = $this->paymentData($data);
return render('gateways.stripe.bancontact.pay', $data); return render('gateways.stripe.bancontact.pay', $data);
} }

View File

@ -40,6 +40,7 @@ class BankTransfer implements LivewireMethodInterface
public function paymentView(array $data) public function paymentView(array $data)
{ {
$data = $this->paymentData($data); $data = $this->paymentData($data);
$data = $this->paymentData($data);
return render('gateways.stripe.bank_transfer.pay', $data); return render('gateways.stripe.bank_transfer.pay', $data);
} }

View File

@ -162,6 +162,22 @@ class SEPA implements LivewireMethodInterface
$data['country'] = $this->stripe->client->country->iso_3166_2; $data['country'] = $this->stripe->client->country->iso_3166_2;
$data['payment_hash'] = $this->stripe->payment_hash->hash; $data['payment_hash'] = $this->stripe->payment_hash->hash;
/** if the iban and client country don't match (OR UK IBAN) - need to inject billing details also */
// $data['billing_details'] = [
// 'name' => $this->stripe->client->present()->name(),
// 'email' => $this->stripe->client->present()->email(),
// 'address' => [
// 'line1' => $this->stripe->client->address1 ?? '',
// 'line2' => $this->stripe->client->address2 ?? '',
// 'city' => $this->stripe->client->city ?? '',
// 'state' => $this->stripe->client->state ?? '',
// 'postal_code' => $this->stripe->client->postal_code ?? '',
// 'country' => $this->stripe->client->country->iso_3166_2 ?? 'DE',
// ]
// ];
$intent_data = [ $intent_data = [
'amount' => $data['stripe_amount'], 'amount' => $data['stripe_amount'],
'currency' => 'eur', 'currency' => 'eur',
@ -185,7 +201,7 @@ class SEPA implements LivewireMethodInterface
return $data; return $data;
} }
public function livewirePaymentView(array $data): string public function livewirePaymentView(array $data): string
{ {
return 'gateways.stripe.sepa.pay_livewire'; return 'gateways.stripe.sepa.pay_livewire';
} }

View File

@ -39,6 +39,7 @@ class SOFORT implements LivewireMethodInterface
public function paymentView(array $data) public function paymentView(array $data)
{ {
$data = $this->paymentData($data); $data = $this->paymentData($data);
$data = $this->paymentData($data);
return render('gateways.stripe.sofort.pay', $data); return render('gateways.stripe.sofort.pay', $data);
} }

View File

@ -126,8 +126,8 @@ class StripePaymentDriver extends BaseDriver
); );
Stripe::setApiKey($this->company_gateway->getConfigField('apiKey')); Stripe::setApiKey($this->company_gateway->getConfigField('apiKey'));
Stripe::setApiVersion('2022-11-15'); // Stripe::setApiVersion('2022-11-15');
// Stripe::setAPiVersion('2023-08-16'); Stripe::setAPiVersion('2023-08-16');
} }
return $this; return $this;
@ -419,6 +419,33 @@ class StripePaymentDriver extends BaseDriver
return $this->payment_method->paymentView($data); return $this->payment_method->paymentView($data);
} }
public function processPaymentViewData(array $data): array
{
$data = $this->payment_method->paymentData($data);
$data['stripe_account_id'] = $this->company_gateway->getConfigField('account_id');
if (array_key_exists('intent', $data)) {
$data['client_secret'] = $data['intent']->client_secret;
}
unset($data['intent']);
$token_billing_string = 'true';
if($this->company_gateway->token_billing == 'off' || $this->company_gateway->token_billing == 'optin') {
$token_billing_string = 'false';
}
if (isset($data['pre_payment']) && $data['pre_payment'] == '1' && isset($data['is_recurring']) && $data['is_recurring'] == '1') {
$token_billing_string = 'true';
}
$data['token_billing_string'] = $token_billing_string;
return $data;
}
public function processPaymentResponse($request) public function processPaymentResponse($request)
{ {
return $this->payment_method->paymentResponse($request); return $this->payment_method->paymentResponse($request);
@ -1022,30 +1049,5 @@ class StripePaymentDriver extends BaseDriver
} }
public function processPaymentViewData(array $data): array
{
$data = $this->payment_method->paymentData($data);
$data['stripe_account_id'] = $this->company_gateway->getConfigField('account_id');
if (array_key_exists('intent', $data)) {
$data['client_secret'] = $data['intent']->client_secret;
}
unset($data['intent']);
$token_billing_string = 'true';
if($this->company_gateway->token_billing == 'off' || $this->company_gateway->token_billing == 'optin') {
$token_billing_string = 'false';
}
if (isset($data['pre_payment']) && $data['pre_payment'] == '1' && isset($data['is_recurring']) && $data['is_recurring'] == '1') {
$token_billing_string = 'true';
}
$data['token_billing_string'] = $token_billing_string;
return $data;
}
} }

View File

@ -183,6 +183,14 @@ class PaymentMethod
} }
} }
} }
if (($this->client->getSetting('use_credits_payment') == 'option' || $this->client->getSetting('use_credits_payment') == 'always') && $this->client->service()->getCreditBalance() > 0) {
$this->payment_urls[] = [
'label' => ctrans('texts.apply_credit'),
'company_gateway_id' => CompanyGateway::GATEWAY_CREDIT,
'gateway_type_id' => GatewayType::CREDIT,
];
}
if (($this->client->getSetting('use_credits_payment') == 'option' || $this->client->getSetting('use_credits_payment') == 'always') && $this->client->service()->getCreditBalance() > 0) { if (($this->client->getSetting('use_credits_payment') == 'option' || $this->client->getSetting('use_credits_payment') == 'always') && $this->client->service()->getCreditBalance() > 0) {
// Show credits as only payment option if both statements are true. // Show credits as only payment option if both statements are true.

View File

@ -108,7 +108,6 @@ class RFFService
if ($return_errors) { if ($return_errors) {
return $validator->getMessageBag()->getMessages(); return $validator->getMessageBag()->getMessages();
} }
session()->flash('validation_errors', $validator->getMessageBag()->getMessages()); session()->flash('validation_errors', $validator->getMessageBag()->getMessages());
return false; return false;
@ -129,7 +128,7 @@ class RFFService
$contact = []; $contact = [];
MultiDB::setDb($this->database); MultiDB::setDb($this->database);
foreach ($data as $field => $value) { foreach ($data as $field => $value) {
if (Str::startsWith($field, 'client_')) { if (Str::startsWith($field, 'client_')) {
$client[$this->mappings[$field]] = $value; $client[$this->mappings[$field]] = $value;

View File

@ -56,7 +56,6 @@ class LivewireInstantPayment
'payload' => [], 'payload' => [],
'component' => '', 'component' => '',
]; ];
/** /**
* is_credit_payment * is_credit_payment
* *
@ -64,7 +63,6 @@ class LivewireInstantPayment
* @var bool * @var bool
*/ */
private $is_credit_payment = false; private $is_credit_payment = false;
/** /**
* __construct * __construct
* *
@ -98,7 +96,6 @@ class LivewireInstantPayment
} }
$payable_invoices = collect($this->data['payable_invoices']); $payable_invoices = collect($this->data['payable_invoices']);
$tokens = []; $tokens = [];
$invoices = Invoice::query() $invoices = Invoice::query()
@ -239,7 +236,6 @@ class LivewireInstantPayment
$this->mergeResponder(['success' => true, 'component' => 'CreditPaymentComponent', 'payload' => $data]); $this->mergeResponder(['success' => true, 'component' => 'CreditPaymentComponent', 'payload' => $data]);
return $this->getResponder(); return $this->getResponder();
} }
$this->mergeResponder(['success' => true, 'payload' => $data]); $this->mergeResponder(['success' => true, 'payload' => $data]);

View File

@ -1,4 +1,4 @@
import{i as l,w as s}from"./wait-8f4ae121.js";/** import{i as s,w as u}from"./wait-8f4ae121.js";/**
* Invoice Ninja (https://invoiceninja.com). * Invoice Ninja (https://invoiceninja.com).
* *
* @link https://github.com/invoiceninja/invoiceninja source repository * @link https://github.com/invoiceninja/invoiceninja source repository
@ -6,4 +6,4 @@ import{i as l,w as s}from"./wait-8f4ae121.js";/**
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com) * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
* *
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/class a{initBraintreeDataCollector(){window.braintree.client.create({authorization:document.querySelector("meta[name=client-token]").content},function(e,t){window.braintree.dataCollector.create({client:t,paypal:!0},function(n,o){n||(document.querySelector("input[name=client-data]").value=o.deviceData)})})}static getPaymentDetails(){return{flow:"vault"}}static handleErrorMessage(e){let t=document.getElementById("errors");t.innerText=e,t.hidden=!1}handlePaymentWithToken(){Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(t=>t.addEventListener("click",n=>{document.getElementById("paypal-button").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=n.target.dataset.token,document.getElementById("pay-now-with-token").classList.remove("hidden"),document.getElementById("pay-now").classList.add("hidden")}));let e=document.getElementById("pay-now-with-token");e.addEventListener("click",t=>{e.disabled=!0,e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()})}handle(){this.initBraintreeDataCollector(),this.handlePaymentWithToken(),braintree.client.create({authorization:document.querySelector("meta[name=client-token]").content}).then(function(e){return braintree.paypalCheckout.create({client:e})}).then(function(e){return e.loadPayPalSDK({vault:!0}).then(function(t){return paypal.Buttons({fundingSource:paypal.FUNDING.PAYPAL,createBillingAgreement:function(){return t.createPayment(a.getPaymentDetails())},onApprove:function(n,o){return t.tokenizePayment(n).then(function(c){let r=document.querySelector('input[name="token-billing-checkbox"]:checked');r&&(document.querySelector('input[name="store_card"]').value=r.value),document.querySelector("input[name=gateway_response]").value=JSON.stringify(c),document.getElementById("server-response").submit()})},onCancel:function(n){},onError:function(n){console.log(n.message),a.handleErrorMessage(n.message)}}).render("#paypal-button")})}).catch(function(e){console.log(e.message),a.handleErrorMessage(e.message)})}}function i(){new a().handle()}l()?i():s("#braintree-paypal-payment").then(()=>i()); */class a{initBraintreeDataCollector(){window.braintree.client.create({authorization:document.querySelector("meta[name=client-token]").content},function(e,t){window.braintree.dataCollector.create({client:t,paypal:!0},function(n,o){n||(document.querySelector("input[name=client-data]").value=o.deviceData)})})}static getPaymentDetails(){return{flow:"vault"}}static handleErrorMessage(e){let t=document.getElementById("errors");t.innerText=e,t.hidden=!1}handlePaymentWithToken(){Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(t=>t.addEventListener("click",n=>{document.getElementById("paypal-button").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=n.target.dataset.token,document.getElementById("pay-now-with-token").classList.remove("hidden"),document.getElementById("pay-now").classList.add("hidden")}));let e=document.getElementById("pay-now-with-token");e.addEventListener("click",t=>{e.disabled=!0,e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()})}handle(){this.initBraintreeDataCollector(),this.handlePaymentWithToken(),braintree.client.create({authorization:document.querySelector("meta[name=client-token]").content}).then(function(e){return braintree.paypalCheckout.create({client:e})}).then(function(e){return e.loadPayPalSDK({vault:!0}).then(function(t){return paypal.Buttons({fundingSource:paypal.FUNDING.PAYPAL,createBillingAgreement:function(){return t.createPayment(a.getPaymentDetails())},onApprove:function(n,o){return t.tokenizePayment(n).then(function(d){var i,c;(i=document.querySelector("#paypal-button"))==null||i.classList.add("hidden"),(c=document.querySelector("#paypal-spinner"))==null||c.classList.remove("hidden");let r=document.querySelector('input[name="token-billing-checkbox"]:checked');r&&(document.querySelector('input[name="store_card"]').value=r.value),document.querySelector("input[name=gateway_response]").value=JSON.stringify(d),document.getElementById("server-response").submit()})},onCancel:function(n){},onError:function(n){console.log(n.message),a.handleErrorMessage(n.message)}}).render("#paypal-button")})}).catch(function(e){console.log(e.message),a.handleErrorMessage(e.message)})}}function l(){new a().handle()}s()?l():u("#braintree-paypal-payment").then(()=>l());

View 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=[]}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());

View File

@ -1,9 +0,0 @@
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());

File diff suppressed because one or more lines are too long

View File

@ -1,9 +0,0 @@
import{i as o,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 d{constructor(){var t;this.clientKey=(t=document.querySelector("meta[name=paytrace-client-key]"))==null?void 0:t.content}get creditCardStyles(){return{font_color:"#000",border_color:"#a1b1c9",border_style:"dotted",font_size:"13pt",input_border_radius:"3px",input_border_width:"1px",input_font:"Times New Roman, arial, fantasy",input_font_weight:"400",input_margin:"5px 0px 5px 0px",input_padding:"0px 5px 0px 5px",label_color:"#a0aec0",label_size:"16px",label_width:"150px",label_font:"Times New Roman, sans-serif, serif",label_font_weight:"light",label_margin:"5px 0px 0px 0px",label_padding:"0px 5px 0px 5px",background_color:"white",height:"30px",width:"370px",padding_bottom:"0px"}}get codeStyles(){return{font_color:"#000",border_color:"#a1b1c9",border_style:"dotted",font_size:"13pt",input_border_radius:"2px",input_border_width:"1px",input_font:"serif, cursive, fantasy",input_font_weight:"700",input_margin:"5px 0px 5px 20px",input_padding:"0px 5px 0px 5px",label_color:"#a0aec0",label_size:"16px",label_width:"150px",label_font:"sans-serif, arial, serif",label_font_weight:"bold",label_margin:"5px 0px 0px 20px",label_padding:"2px 5px 2px 5px",background_color:"white",height:"30px",width:"150px",padding_bottom:"2px"}}get expStyles(){return{font_color:"#000",border_color:"#a1b1c9",border_style:"dashed",font_size:"12pt",input_border_radius:"0px",input_border_width:"2px",input_font:"arial, cursive, fantasy",input_font_weight:"400",input_margin:"5px 0px 5px 0px",input_padding:"0px 5px 0px 5px",label_color:"#a0aec0",label_size:"16px",label_width:"150px",label_font:"arial, fantasy, serif",label_font_weight:"normal",label_margin:"5px 0px 0px 0px",label_padding:"2px 5px 2px 5px",background_color:"white",height:"30px",width:"85px",padding_bottom:"2px",type:"dropdown"}}updatePayTraceLabels(){window.PTPayment.getControl("securityCode").label.text(document.querySelector("meta[name=ctrans-cvv]").content),window.PTPayment.getControl("creditCard").label.text(document.querySelector("meta[name=ctrans-card_number]").content),window.PTPayment.getControl("expiration").label.text(document.querySelector("meta[name=ctrans-expires]").content)}setupPayTrace(){return window.PTPayment.setup({styles:{code:this.codeStyles,cc:this.creditCardStyles,exp:this.expStyles},authorization:{clientKey:this.clientKey}})}handlePaymentWithCreditCard(t){t.target.parentElement.disabled=!0,document.getElementById("errors").hidden=!0,window.PTPayment.validate(n=>{if(n.length>=1){let e=document.getElementById("errors");return e.textContent=n[0].description,e.hidden=!1,t.target.parentElement.disabled=!1}this.ptInstance.process().then(e=>{document.getElementById("HPF_Token").value=e.message.hpf_token,document.getElementById("enc_key").value=e.message.enc_key;let a=document.querySelector('input[name="token-billing-checkbox"]:checked');a&&(document.querySelector('input[name="store_card"]').value=a.value),document.getElementById("server_response").submit()}).catch(e=>{document.getElementById("errors").textContent=JSON.stringify(e),document.getElementById("errors").hidden=!1,console.log(e)})})}handlePaymentWithToken(t){t.target.parentElement.disabled=!0,document.getElementById("server_response").submit()}handle(){var t;Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(n=>n.addEventListener("click",e=>{document.getElementById("paytrace--credit-card-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=e.target.dataset.token})),(t=document.getElementById("toggle-payment-with-credit-card"))==null||t.addEventListener("click",n=>{document.getElementById("paytrace--credit-card-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="",this.setupPayTrace().then(e=>{this.ptInstance=e,this.updatePayTraceLabels()})}),document.getElementById("pay-now").addEventListener("click",n=>document.querySelector("input[name=token]").value===""?this.handlePaymentWithCreditCard(n):this.handlePaymentWithToken(n)),Array.from(document.getElementsByClassName("toggle-payment-with-token")).length===0&&!o()&&document.getElementById("toggle-payment-with-credit-card").click()}}function r(){new d().handle()}o()?r():i("#paytrace-credit-card-payment").then(()=>r());

View File

@ -0,0 +1,9 @@
import{i as o,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 l{constructor(){var t;this.clientKey=(t=document.querySelector("meta[name=paytrace-client-key]"))==null?void 0:t.content}get creditCardStyles(){return{font_color:"#000",border_color:"#a1b1c9",border_style:"dotted",font_size:"13pt",input_border_radius:"3px",input_border_width:"1px",input_font:"Times New Roman, arial, fantasy",input_font_weight:"400",input_margin:"5px 0px 5px 0px",input_padding:"0px 5px 0px 5px",label_color:"#a0aec0",label_size:"16px",label_width:"150px",label_font:"Times New Roman, sans-serif, serif",label_font_weight:"light",label_margin:"5px 0px 0px 0px",label_padding:"0px 5px 0px 5px",background_color:"white",height:"30px",width:"370px",padding_bottom:"0px"}}get codeStyles(){return{font_color:"#000",border_color:"#a1b1c9",border_style:"dotted",font_size:"13pt",input_border_radius:"2px",input_border_width:"1px",input_font:"serif, cursive, fantasy",input_font_weight:"700",input_margin:"5px 0px 5px 20px",input_padding:"0px 5px 0px 5px",label_color:"#a0aec0",label_size:"16px",label_width:"150px",label_font:"sans-serif, arial, serif",label_font_weight:"bold",label_margin:"5px 0px 0px 20px",label_padding:"2px 5px 2px 5px",background_color:"white",height:"30px",width:"150px",padding_bottom:"2px"}}get expStyles(){return{font_color:"#000",border_color:"#a1b1c9",border_style:"dashed",font_size:"12pt",input_border_radius:"0px",input_border_width:"2px",input_font:"arial, cursive, fantasy",input_font_weight:"400",input_margin:"5px 0px 5px 0px",input_padding:"0px 5px 0px 5px",label_color:"#a0aec0",label_size:"16px",label_width:"150px",label_font:"arial, fantasy, serif",label_font_weight:"normal",label_margin:"5px 0px 0px 0px",label_padding:"2px 5px 2px 5px",background_color:"white",height:"30px",width:"85px",padding_bottom:"2px",type:"dropdown"}}updatePayTraceLabels(){window.PTPayment.getControl("securityCode").label.text(document.querySelector("meta[name=ctrans-cvv]").content),window.PTPayment.getControl("creditCard").label.text(document.querySelector("meta[name=ctrans-card_number]").content),window.PTPayment.getControl("expiration").label.text(document.querySelector("meta[name=ctrans-expires]").content)}setupPayTrace(){return window.PTPayment.setup({styles:{code:this.codeStyles,cc:this.creditCardStyles,exp:this.expStyles},authorization:{clientKey:this.clientKey}})}handlePaymentWithCreditCard(t){const e=document.getElementById("pay-now");e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden"),t.target.parentElement.disabled=!0,document.getElementById("errors").hidden=!0,window.PTPayment.validate(a=>{if(a.length>=1){let n=document.getElementById("errors");return n.textContent=a[0].description,n.hidden=!1,e.querySelector("svg").classList.add("hidden"),e.querySelector("span").classList.remove("hidden"),t.target.parentElement.disabled=!1}this.ptInstance.process().then(n=>{document.getElementById("HPF_Token").value=n.message.hpf_token,document.getElementById("enc_key").value=n.message.enc_key;let r=document.querySelector('input[name="token-billing-checkbox"]:checked');r&&(document.querySelector('input[name="store_card"]').value=r.value),document.getElementById("server_response").submit()}).catch(n=>{document.getElementById("errors").textContent=JSON.stringify(n),document.getElementById("errors").hidden=!1,e.querySelector("svg").classList.add("hidden"),e.querySelector("span").classList.remove("hidden"),console.log(n)})})}handlePaymentWithToken(t){t.target.parentElement.disabled=!0;const e=document.getElementById("pay-now");e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden"),document.getElementById("server_response").submit()}handle(){var t;Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(e=>e.addEventListener("click",a=>{document.getElementById("paytrace--credit-card-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=a.target.dataset.token})),(t=document.getElementById("toggle-payment-with-credit-card"))==null||t.addEventListener("click",e=>{document.getElementById("paytrace--credit-card-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="",this.setupPayTrace().then(a=>{this.ptInstance=a,this.updatePayTraceLabels()})}),document.getElementById("pay-now").addEventListener("click",e=>document.querySelector("input[name=token]").value===""?this.handlePaymentWithCreditCard(e):this.handlePaymentWithToken(e)),Array.from(document.getElementsByClassName("toggle-payment-with-token")).length===0&&!o()&&document.getElementById("toggle-payment-with-credit-card").click()}}function d(){new l().handle()}o()?d():i("#paytrace-credit-card-payment").then(()=>d());

View File

@ -1,9 +0,0 @@
/**
* 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
*/var a;let n=JSON.parse((a=document.querySelector("meta[name=razorpay-options]"))==null?void 0:a.content);n.handler=function(e){document.getElementById("razorpay_payment_id").value=e.razorpay_payment_id,document.getElementById("razorpay_signature").value=e.razorpay_signature,document.getElementById("server-response").submit()};n.modal={ondismiss:function(){t.disabled=!1}};let o=new Razorpay(n),t=document.getElementById("pay-now");t.onclick=function(e){t.disabled=!0,o.open()};

View File

@ -0,0 +1,9 @@
import{i,w as d}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
*/function o(){var a;let e=JSON.parse((a=document.querySelector("meta[name=razorpay-options]"))==null?void 0:a.content);e.handler=function(n){document.getElementById("razorpay_payment_id").value=n.razorpay_payment_id,document.getElementById("razorpay_signature").value=n.razorpay_signature,document.getElementById("server-response").submit()},e.modal={ondismiss:function(){t.disabled=!1}};let r=new Razorpay(e),t=document.getElementById("pay-now");t.onclick=function(n){t.disabled=!0,r.open()}}i()?o():d("#razorpay-hosted-payment").then(()=>o());

View File

@ -0,0 +1,9 @@
var c=Object.defineProperty;var d=(n,e,t)=>e in n?c(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var o=(n,e,t)=>(d(n,typeof e!="symbol"?e+"":e,t),t);import{i as u,w as l}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 h{constructor(e,t,s){o(this,"setupStripe",()=>(this.stripeConnect?this.stripe=Stripe(this.key,{stripeAccount:this.stripeConnect}):this.stripe=Stripe(this.key),this));o(this,"payment_data");o(this,"handle",()=>{this.onlyAuthorization?document.getElementById("authorize-bacs").addEventListener("click",e=>{document.getElementById("authorize-bacs").disabled=!0,document.querySelector("#authorize-bacs > svg").classList.remove("hidden"),document.querySelector("#authorize-bacs > span").classList.add("hidden"),location.href=document.querySelector("meta[name=stripe-redirect-url]").content}):(this.payNowButton=document.getElementById("pay-now"),document.getElementById("pay-now").addEventListener("click",e=>{this.payNowButton.disabled=!0,this.payNowButton.querySelector("svg").classList.remove("hidden"),this.payNowButton.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()}),this.payment_data=Array.from(document.getElementsByClassName("toggle-payment-with-token")),this.payment_data.length>0?this.payment_data.forEach(e=>e.addEventListener("click",t=>{document.querySelector("input[name=token]").value=t.target.dataset.token})):(this.errors.textContent=document.querySelector("meta[name=translation-payment-method-required]").content,this.errors.hidden=!1,this.payNowButton.disabled=!0,this.payNowButton.querySelector("span").classList.remove("hidden"),this.payNowButton.querySelector("svg").classList.add("hidden")))});this.key=e,this.errors=document.getElementById("errors"),this.stripeConnect=t,this.onlyAuthorization=s}}function a(){var s,i,r;const n=((s=document.querySelector('meta[name="stripe-publishable-key"]'))==null?void 0:s.content)??"",e=((i=document.querySelector('meta[name="stripe-account-id"]'))==null?void 0:i.content)??"",t=((r=document.querySelector('meta[name="only-authorization"]'))==null?void 0:r.content)??"";new h(n,e,t).setupStripe().handle()}u()?a():l("#stripe-bacs-payment").then(()=>a());

View File

@ -1,9 +0,0 @@
var a=Object.defineProperty;var c=(n,e,t)=>e in n?a(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var s=(n,e,t)=>(c(n,typeof e!="symbol"?e+"":e,t),t);import{i as d,w as u}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 l{constructor(e,t){s(this,"setupStripe",()=>(this.stripeConnect?this.stripe=Stripe(this.key,{stripeAccount:this.stripeConnect}):this.stripe=Stripe(this.key),this));s(this,"payment_data");s(this,"handle",()=>{this.onlyAuthorization?document.getElementById("authorize-bacs").addEventListener("click",e=>{document.getElementById("authorize-bacs").disabled=!0,document.querySelector("#authorize-bacs > svg").classList.remove("hidden"),document.querySelector("#authorize-bacs > span").classList.add("hidden"),location.href=document.querySelector("meta[name=stripe-redirect-url]").content}):(this.payNowButton=document.getElementById("pay-now"),document.getElementById("pay-now").addEventListener("click",e=>{this.payNowButton.disabled=!0,this.payNowButton.querySelector("svg").classList.remove("hidden"),this.payNowButton.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()}),this.payment_data=Array.from(document.getElementsByClassName("toggle-payment-with-token")),this.payment_data.length>0?this.payment_data.forEach(e=>e.addEventListener("click",t=>{document.querySelector("input[name=token]").value=t.target.dataset.token})):(this.errors.textContent=document.querySelector("meta[name=translation-payment-method-required]").content,this.errors.hidden=!1,this.payNowButton.disabled=!0,this.payNowButton.querySelector("span").classList.remove("hidden"),this.payNowButton.querySelector("svg").classList.add("hidden")))});this.key=e,this.errors=document.getElementById("errors"),this.stripeConnect=t,this.onlyAuthorization=onlyAuthorization}}function r(){var t,o,i;const n=((t=document.querySelector('meta[name="stripe-publishable-key"]'))==null?void 0:t.content)??"",e=((o=document.querySelector('meta[name="stripe-account-id"]'))==null?void 0:o.content)??"";(i=document.querySelector('meta[name="only-authorization"]'))==null||i.content,new l(n,e).setupStripe().handle()}d()?r():u("#stripe-bacs-payment").then(()=>r());

View File

@ -0,0 +1,9 @@
import{i as p,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
*/p()?c():y("#stripe-bank-transfer-payment").then(()=>c());function c(){var r,o,s;const m=(r=document.querySelector('meta[name="stripe-client-secret"]'))==null?void 0:r.content,i=(o=document.querySelector('meta[name="stripe-return-url"]'))==null?void 0:o.content,d={clientSecret:m,appearance:{theme:"stripe",variables:{colorPrimary:"#0570de",colorBackground:"#ffffff",colorText:"#30313d",colorDanger:"#df1b41",fontFamily:"Ideal Sans, system-ui, sans-serif",spacingUnit:"2px",borderRadius:"4px"}}},e=Stripe(document.querySelector('meta[name="stripe-publishable-key"]').getAttribute("content")),t=((s=document.querySelector('meta[name="stripe-account-id"]'))==null?void 0:s.content)??"";t&&(e.stripeAccount=t);const n=e.elements(d);n.create("payment").mount("#payment-element"),document.getElementById("payment-form").addEventListener("submit",async l=>{l.preventDefault(),document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden");const{error:a}=await e.confirmPayment({elements:n,confirmParams:{return_url:i}});if(a){document.getElementById("pay-now").disabled=!1,document.querySelector("svg").classList.remove("hidden"),document.querySelector("span").classList.add("hidden");const u=document.querySelector("#errors");u.textContent=a.message}})}

View File

@ -1,4 +1,4 @@
var s=Object.defineProperty;var a=(n,t,e)=>t in n?s(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var r=(n,t,e)=>(a(n,typeof t!="symbol"?t+"":t,e),e);import{i as l,w as c}from"./wait-8f4ae121.js";/** var l=Object.defineProperty;var c=(n,t,e)=>t in n?l(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var r=(n,t,e)=>(c(n,typeof t!="symbol"?t+"":t,e),e);import{i as a,w as o}from"./wait-8f4ae121.js";/**
* Invoice Ninja (https://invoiceninja.com) * Invoice Ninja (https://invoiceninja.com)
* *
* @link https://github.com/invoiceninja/invoiceninja source repository * @link https://github.com/invoiceninja/invoiceninja source repository
@ -6,4 +6,4 @@ var s=Object.defineProperty;var a=(n,t,e)=>t in n?s(n,t,{enumerable:!0,configura
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com) * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
* *
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/class d{constructor(t,e){r(this,"setupStripe",()=>{this.stripeConnect?this.stripe=Stripe(this.key,{stripeAccount:this.stripeConnect}):this.stripe=Stripe(this.key);let t=this.stripe.elements();var e={style:{base:{padding:"10px 12px",color:"#32325d",fontSize:"16px","::placeholder":{color:"#aab7c4"}}}};return this.ideal=t.create("idealBank",e),this.ideal.mount("#ideal-bank-element"),this});r(this,"handle",()=>{document.getElementById("pay-now").addEventListener("click",t=>{let e=document.getElementById("errors");if(!document.getElementById("ideal-name").value){e.textContent=document.querySelector("meta[name=translation-name-required]").content,e.hidden=!1,console.log("name");return}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=t,this.errors=document.getElementById("errors"),this.stripeConnect=e}}function o(){var e,i;const n=((e=document.querySelector('meta[name="stripe-publishable-key"]'))==null?void 0:e.content)??"",t=((i=document.querySelector('meta[name="stripe-account-id"]'))==null?void 0:i.content)??"";new d(n,t).setupStripe().handle()}l()?o():c("#stripe-ideal-payment").then(()=>o()); */class d{constructor(t,e){r(this,"setupStripe",()=>{this.stripeConnect?this.stripe=Stripe(this.key,{stripeAccount:this.stripeConnect}):this.stripe=Stripe(this.key);let t=this.stripe.elements();var e={style:{base:{padding:"10px 12px",color:"#32325d",fontSize:"16px","::placeholder":{color:"#aab7c4"}}}};return this.ideal=t.create("idealBank",e),this.ideal.mount("#ideal-bank-element"),this});r(this,"handle",()=>{document.getElementById("pay-now").addEventListener("click",t=>{let e=document.getElementById("errors");if(!document.getElementById("ideal-name").value){e.textContent=document.querySelector("meta[name=translation-name-required]").content,e.hidden=!1,console.log("name");return}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=t,this.errors=document.getElementById("errors"),this.stripeConnect=e}}function i(){var e,s;const n=((e=document.querySelector('meta[name="stripe-publishable-key"]'))==null?void 0:e.content)??"",t=((s=document.querySelector('meta[name="stripe-account-id"]'))==null?void 0:s.content)??"";new d(n,t).setupStripe().handle()}a()?i():o("#stripe-ideal-payment").then(()=>i());a()?i():o("#stripe-ideal-payment").then(()=>i());

View File

@ -1,4 +1,4 @@
var c=Object.defineProperty;var m=(n,e,t)=>e in n?c(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var o=(n,e,t)=>(m(n,typeof e!="symbol"?e+"":e,t),t);import{i as d,w as i}from"./wait-8f4ae121.js";/** var d=Object.defineProperty;var i=(n,e,t)=>e in n?d(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var o=(n,e,t)=>(i(n,typeof e!="symbol"?e+"":e,t),t);import{i as c,w as m}from"./wait-8f4ae121.js";/**
* Invoice Ninja (https://invoiceninja.com) * Invoice Ninja (https://invoiceninja.com)
* *
* @link https://github.com/invoiceninja/invoiceninja source repository * @link https://github.com/invoiceninja/invoiceninja source repository
@ -6,4 +6,4 @@ var c=Object.defineProperty;var m=(n,e,t)=>e in n?c(n,e,{enumerable:!0,configura
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com) * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
* *
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/class l{constructor(e,t){o(this,"setupStripe",()=>(this.stripeConnect?this.stripe=Stripe(this.key,{stripeAccount:this.stripeConnect}):this.stripe=Stripe(this.key),this));o(this,"handleError",e=>{document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden"),this.errors.textContent="",this.errors.textContent=e,this.errors.hidden=!1});o(this,"handle",()=>{document.getElementById("pay-now").addEventListener("click",e=>{let t=document.getElementById("errors"),r=document.getElementById("klarna-name").value;/^[A-Za-z\s]*$/.test(r)?(document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),this.stripe.confirmKlarnaPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{billing_details:{name:r,email:document.querySelector("meta[name=email]").content,address:{line1:document.querySelector("meta[name=address-1]").content,line2:document.querySelector("meta[name=address-2]").content,city:document.querySelector("meta[name=city]").content,postal_code:document.querySelector("meta[name=postal_code]").content,state:document.querySelector("meta[name=state]").content,country:document.querySelector("meta[name=country]").content}}},return_url:document.querySelector('meta[name="return-url"]').content}).then(a=>{if(a.hasOwnProperty("error"))return this.handleError(a.error.message)})):(document.getElementById("klarna-name-correction").hidden=!1,document.getElementById("klarna-name").textContent=r.replace(/^[A-Za-z\s]*$/,""),document.getElementById("klarna-name").focus(),t.textContent=document.querySelector("meta[name=translation-name-without-special-characters]").content,t.hidden=!1)})});this.key=e,this.errors=document.getElementById("errors"),this.stripeConnect=t}}function s(){var t,r;const n=((t=document.querySelector('meta[name="stripe-publishable-key"]'))==null?void 0:t.content)??"",e=((r=document.querySelector('meta[name="stripe-account-id"]'))==null?void 0:r.content)??"";new l(n,e).setupStripe().handle()}d()?s():i("#stripe-klarna-payment").then(()=>s()); */class l{constructor(e,t){o(this,"setupStripe",()=>(this.stripeConnect?this.stripe=Stripe(this.key,{stripeAccount:this.stripeConnect}):this.stripe=Stripe(this.key),this));o(this,"handleError",e=>{document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden"),this.errors.textContent="",this.errors.textContent=e,this.errors.hidden=!1});o(this,"handle",()=>{document.getElementById("pay-now").addEventListener("click",e=>{let t=document.getElementById("errors"),r=document.getElementById("klarna-name").value;/^[A-Za-z\s]*$/.test(r)?(document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),this.stripe.confirmKlarnaPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{billing_details:{name:r,email:document.querySelector("meta[name=email]").content,address:{line1:document.querySelector("meta[name=address-1]").content,line2:document.querySelector("meta[name=address-2]").content,city:document.querySelector("meta[name=city]").content,postal_code:document.querySelector("meta[name=postal_code]").content,state:document.querySelector("meta[name=state]").content,country:document.querySelector("meta[name=country]").content}}},return_url:document.querySelector('meta[name="return-url"]').content}).then(s=>{if(s.hasOwnProperty("error"))return this.handleError(s.error.message)})):(document.getElementById("klarna-name-correction").hidden=!1,document.getElementById("klarna-name").textContent=r.replace(/^[A-Za-z\s]*$/,""),document.getElementById("klarna-name").focus(),t.textContent=document.querySelector("meta[name=translation-name-without-special-characters]").content,t.hidden=!1)})});this.key=e,this.errors=document.getElementById("errors"),this.stripeConnect=t}}function a(){var t,r;const n=((t=document.querySelector('meta[name="stripe-publishable-key"]'))==null?void 0:t.content)??"",e=((r=document.querySelector('meta[name="stripe-account-id"]'))==null?void 0:r.content)??"";new l(n,e).setupStripe().handle()}c()?a():m("#stripe-klarna-payment").then(()=>a());c()?a():m("#stripe-klarna-payment").then(()=>a());

View File

@ -1,4 +1,4 @@
var c=Object.defineProperty;var s=(n,t,e)=>t in n?c(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var o=(n,t,e)=>(s(n,typeof t!="symbol"?t+"":t,e),e);import{i as d,w as m}from"./wait-8f4ae121.js";/** var d=Object.defineProperty;var m=(n,t,e)=>t in n?d(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var r=(n,t,e)=>(m(n,typeof t!="symbol"?t+"":t,e),e);import{i as s,w as c}from"./wait-8f4ae121.js";/**
* Invoice Ninja (https://invoiceninja.com) * Invoice Ninja (https://invoiceninja.com)
* *
* @link https://github.com/invoiceninja/invoiceninja source repository * @link https://github.com/invoiceninja/invoiceninja source repository
@ -6,4 +6,4 @@ var c=Object.defineProperty;var s=(n,t,e)=>t in n?c(n,t,{enumerable:!0,configura
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com) * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
* *
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/class i{constructor(t,e){o(this,"setupStripe",()=>{this.stripeConnect?this.stripe=Stripe(this.key,{stripeAccount:this.stripeConnect}):this.stripe=Stripe(this.key);let t=this.stripe.elements();var e={style:{base:{padding:"10px 12px",color:"#32325d",fontSize:"16px","::placeholder":{color:"#aab7c4"}}}};return this.p24bank=t.create("p24Bank",e),this.p24bank.mount("#p24-bank-element"),this});o(this,"handle",()=>{document.getElementById("pay-now").addEventListener("click",t=>{let e=document.getElementById("errors");if(document.getElementById("p24-name").value===""){document.getElementById("p24-name").focus(),e.textContent=document.querySelector("meta[name=translation-name-required]").content,e.hidden=!1;return}if(document.getElementById("p24-email-address").value===""){document.getElementById("p24-email-address").focus(),e.textContent=document.querySelector("meta[name=translation-email-required]").content,e.hidden=!1;return}if(!document.getElementById("p24-mandate-acceptance").checked){document.getElementById("p24-mandate-acceptance").focus(),e.textContent=document.querySelector("meta[name=translation-terms-required]").content,e.hidden=!1;return}document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),this.stripe.confirmP24Payment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{p24:this.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}).then(function(a){a.error?(e.textContent=a.error.message,e.hidden=!1,document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden")):a.paymentIntent.status==="succeeded"&&(window.location=document.querySelector('meta[name="return-url"]').content)})})});this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=e}}function r(){var e,a;const n=((e=document.querySelector('meta[name="stripe-publishable-key"]'))==null?void 0:e.content)??"",t=((a=document.querySelector('meta[name="stripe-account-id"]'))==null?void 0:a.content)??"";new i(n,t).setupStripe().handle()}d()?r():m("#stripe-przelewy24-payment").then(()=>r()); */class i{constructor(t,e){r(this,"setupStripe",()=>{this.stripeConnect?this.stripe=Stripe(this.key,{stripeAccount:this.stripeConnect}):this.stripe=Stripe(this.key);let t=this.stripe.elements();var e={style:{base:{padding:"10px 12px",color:"#32325d",fontSize:"16px","::placeholder":{color:"#aab7c4"}}}};return this.p24bank=t.create("p24Bank",e),this.p24bank.mount("#p24-bank-element"),this});r(this,"handle",()=>{document.getElementById("pay-now").addEventListener("click",t=>{let e=document.getElementById("errors");if(document.getElementById("p24-name").value===""){document.getElementById("p24-name").focus(),e.textContent=document.querySelector("meta[name=translation-name-required]").content,e.hidden=!1;return}if(document.getElementById("p24-email-address").value===""){document.getElementById("p24-email-address").focus(),e.textContent=document.querySelector("meta[name=translation-email-required]").content,e.hidden=!1;return}if(!document.getElementById("p24-mandate-acceptance").checked){document.getElementById("p24-mandate-acceptance").focus(),e.textContent=document.querySelector("meta[name=translation-terms-required]").content,e.hidden=!1;return}document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),this.stripe.confirmP24Payment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{p24:this.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}).then(function(a){a.error?(e.textContent=a.error.message,e.hidden=!1,document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden")):a.paymentIntent.status==="succeeded"&&(window.location=document.querySelector('meta[name="return-url"]').content)})})});this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=e}}function o(){var e,a;const n=((e=document.querySelector('meta[name="stripe-publishable-key"]'))==null?void 0:e.content)??"",t=((a=document.querySelector('meta[name="stripe-account-id"]'))==null?void 0:a.content)??"";new i(n,t).setupStripe().handle()}s()?o():c("#stripe-przelewy24-payment").then(()=>o());s()?o():c("#stripe-przelewy24-payment").then(()=>o());

View File

@ -0,0 +1,9 @@
var i=Object.defineProperty;var l=(a,e,t)=>e in a?i(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var r=(a,e,t)=>(l(a,typeof e!="symbol"?e+"":e,t),t);import{i as s,w as c}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 d{constructor(e,t){r(this,"setupStripe",()=>{this.stripeConnect?this.stripe=Stripe(this.key,{stripeAccount:this.stripeConnect}):this.stripe=Stripe(this.key);const e=this.stripe.elements();var t={base:{color:"#32325d",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',fontSmoothing:"antialiased",fontSize:"16px","::placeholder":{color:"#aab7c4"},":-webkit-autofill":{color:"#32325d"}},invalid:{color:"#fa755a",iconColor:"#fa755a",":-webkit-autofill":{color:"#fa755a"}}},n={style:t,supportedCountries:["SEPA"],placeholderCountry:document.querySelector('meta[name="country"]').content};return this.iban=e.create("iban",n),this.iban.mount("#sepa-iban"),document.getElementById("sepa-name").value=document.querySelector("meta[name=client_name]").content,document.getElementById("sepa-email-address").value=document.querySelector("meta[name=client_email]").content,this});r(this,"handle",()=>{let e=document.getElementById("errors");Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(t=>t.addEventListener("click",n=>{document.getElementById("stripe--payment-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=n.target.dataset.token})),document.getElementById("toggle-payment-with-new-bank-account").addEventListener("click",t=>{document.getElementById("stripe--payment-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value=""}),document.getElementById("pay-now").addEventListener("click",t=>{if(document.querySelector("input[name=token]").value.length!==0)document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),this.stripe.confirmSepaDebitPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:document.querySelector("input[name=token]").value}).then(n=>n.error?this.handleFailure(n.error.message):this.handleSuccess(n));else{if(document.getElementById("sepa-name").value===""){document.getElementById("sepa-name").focus(),e.textContent=document.querySelector("meta[name=translation-name-required]").content,e.hidden=!1;return}if(document.getElementById("sepa-email-address").value===""){document.getElementById("sepa-email-address").focus(),e.textContent=document.querySelector("meta[name=translation-email-required]").content,e.hidden=!1;return}if(!document.getElementById("sepa-mandate-acceptance").checked){e.textContent=document.querySelector("meta[name=translation-terms-required]").content,e.hidden=!1;return}document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),this.stripe.confirmSepaDebitPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{sepa_debit:this.iban,billing_details:{name:document.getElementById("sepa-name").value,email:document.getElementById("sepa-email-address").value}}}).then(n=>n.error?this.handleFailure(n.error.message):this.handleSuccess(n))}})});this.key=e,this.errors=document.getElementById("errors"),this.stripeConnect=t}handleSuccess(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent);let t=document.querySelector('input[name="token-billing-checkbox"]:checked');t&&(document.querySelector('input[name="store_card"]').value=t.value),document.querySelector("input[name=token]").value.length>2&&(document.querySelector('input[name="store_card"]').value=!1),document.getElementById("server-response").submit()}handleFailure(e){let 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")}handleSuccess(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent);let t=document.querySelector('input[name="token-billing-checkbox"]:checked');t&&(document.querySelector('input[name="store_card"]').value=t.value),document.getElementById("server-response").submit()}}function o(){var t,n;const a=((t=document.querySelector('meta[name="stripe-publishable-key"]'))==null?void 0:t.content)??"",e=((n=document.querySelector('meta[name="stripe-account-id"]'))==null?void 0:n.content)??"";new d(a,e).setupStripe().handle()}s()?o():c("#stripe-sepa-payment").then(()=>o());s()?o():c("#stripe-sepa-payment").then(()=>o());

View File

@ -1,4 +1,4 @@
var c=Object.defineProperty;var i=(n,e,t)=>e in n?c(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var r=(n,e,t)=>(i(n,typeof e!="symbol"?e+"":e,t),t);import{i as a,w as u}from"./wait-8f4ae121.js";/** var a=Object.defineProperty;var u=(n,e,t)=>e in n?a(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var o=(n,e,t)=>(u(n,typeof e!="symbol"?e+"":e,t),t);import{i as c,w as i}from"./wait-8f4ae121.js";/**
* Invoice Ninja (https://invoiceninja.com) * Invoice Ninja (https://invoiceninja.com)
* *
* @link https://github.com/invoiceninja/invoiceninja source repository * @link https://github.com/invoiceninja/invoiceninja source repository
@ -6,4 +6,4 @@ var c=Object.defineProperty;var i=(n,e,t)=>e in n?c(n,e,{enumerable:!0,configura
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com) * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
* *
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/class m{constructor(e,t){r(this,"setupStripe",()=>(this.stripeConnect?this.stripe=Stripe(this.key,{stripeAccount:this.stripeConnect}):this.stripe=Stripe(this.key),this));r(this,"handle",()=>{document.getElementById("pay-now").addEventListener("click",e=>{document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),this.stripe.confirmSofortPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{sofort:{country:document.querySelector('meta[name="country"]').content}},return_url:document.querySelector('meta[name="return-url"]').content})})});this.key=e,this.errors=document.getElementById("errors"),this.stripeConnect=t}}function s(){var t,o;const n=((t=document.querySelector('meta[name="stripe-publishable-key"]'))==null?void 0:t.content)??"",e=((o=document.querySelector('meta[name="stripe-account-id"]'))==null?void 0:o.content)??"";new m(n,e).setupStripe().handle()}a()?s():u("#stripe-sofort-payment").then(()=>s()); */class m{constructor(e,t){o(this,"setupStripe",()=>(this.stripeConnect?this.stripe=Stripe(this.key,{stripeAccount:this.stripeConnect}):this.stripe=Stripe(this.key),this));o(this,"handle",()=>{document.getElementById("pay-now").addEventListener("click",e=>{document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),this.stripe.confirmSofortPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{sofort:{country:document.querySelector('meta[name="country"]').content}},return_url:document.querySelector('meta[name="return-url"]').content})})});this.key=e,this.errors=document.getElementById("errors"),this.stripeConnect=t}}function r(){var t,s;const n=((t=document.querySelector('meta[name="stripe-publishable-key"]'))==null?void 0:t.content)??"",e=((s=document.querySelector('meta[name="stripe-account-id"]'))==null?void 0:s.content)??"";new m(n,e).setupStripe().handle()}c()?r():i("#stripe-sofort-payment").then(()=>r());c()?r():i("#stripe-sofort-payment").then(()=>r());

View File

@ -83,7 +83,7 @@
"src": "resources/js/clients/payments/braintree-credit-card.js" "src": "resources/js/clients/payments/braintree-credit-card.js"
}, },
"resources/js/clients/payments/braintree-paypal.js": { "resources/js/clients/payments/braintree-paypal.js": {
"file": "assets/braintree-paypal-16e2f577.js", "file": "assets/braintree-paypal-f78ad64b.js",
"imports": [ "imports": [
"_wait-8f4ae121.js" "_wait-8f4ae121.js"
], ],
@ -91,7 +91,7 @@
"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-fbe72284.js", "file": "assets/checkout-credit-card-2cca8b36.js",
"imports": [ "imports": [
"_wait-8f4ae121.js" "_wait-8f4ae121.js"
], ],
@ -99,7 +99,7 @@
"src": "resources/js/clients/payments/checkout-credit-card.js" "src": "resources/js/clients/payments/checkout-credit-card.js"
}, },
"resources/js/clients/payments/eway-credit-card.js": { "resources/js/clients/payments/eway-credit-card.js": {
"file": "assets/eway-credit-card-0119725d.js", "file": "assets/eway-credit-card-150298fa.js",
"imports": [ "imports": [
"_wait-8f4ae121.js" "_wait-8f4ae121.js"
], ],
@ -131,7 +131,7 @@
"src": "resources/js/clients/payments/mollie-credit-card.js" "src": "resources/js/clients/payments/mollie-credit-card.js"
}, },
"resources/js/clients/payments/paytrace-credit-card.js": { "resources/js/clients/payments/paytrace-credit-card.js": {
"file": "assets/paytrace-credit-card-7f87b811.js", "file": "assets/paytrace-credit-card-d29797c1.js",
"imports": [ "imports": [
"_wait-8f4ae121.js" "_wait-8f4ae121.js"
], ],
@ -139,7 +139,10 @@
"src": "resources/js/clients/payments/paytrace-credit-card.js" "src": "resources/js/clients/payments/paytrace-credit-card.js"
}, },
"resources/js/clients/payments/razorpay-aio.js": { "resources/js/clients/payments/razorpay-aio.js": {
"file": "assets/razorpay-aio-3d02ff1d.js", "file": "assets/razorpay-aio-f8e8c7f0.js",
"imports": [
"_wait-8f4ae121.js"
],
"isEntry": true, "isEntry": true,
"src": "resources/js/clients/payments/razorpay-aio.js" "src": "resources/js/clients/payments/razorpay-aio.js"
}, },
@ -181,7 +184,7 @@
"src": "resources/js/clients/payments/stripe-alipay.js" "src": "resources/js/clients/payments/stripe-alipay.js"
}, },
"resources/js/clients/payments/stripe-bacs.js": { "resources/js/clients/payments/stripe-bacs.js": {
"file": "assets/stripe-bacs-c9a61b93.js", "file": "assets/stripe-bacs-425cb13e.js",
"imports": [ "imports": [
"_wait-8f4ae121.js" "_wait-8f4ae121.js"
], ],
@ -196,6 +199,14 @@
"isEntry": true, "isEntry": true,
"src": "resources/js/clients/payments/stripe-bancontact.js" "src": "resources/js/clients/payments/stripe-bancontact.js"
}, },
"resources/js/clients/payments/stripe-bank-transfer.js": {
"file": "assets/stripe-bank-transfer-4ab58b35.js",
"imports": [
"_wait-8f4ae121.js"
],
"isEntry": true,
"src": "resources/js/clients/payments/stripe-bank-transfer.js"
},
"resources/js/clients/payments/stripe-becs.js": { "resources/js/clients/payments/stripe-becs.js": {
"file": "assets/stripe-becs-483b1b23.js", "file": "assets/stripe-becs-483b1b23.js",
"imports": [ "imports": [
@ -245,7 +256,7 @@
"src": "resources/js/clients/payments/stripe-giropay.js" "src": "resources/js/clients/payments/stripe-giropay.js"
}, },
"resources/js/clients/payments/stripe-ideal.js": { "resources/js/clients/payments/stripe-ideal.js": {
"file": "assets/stripe-ideal-95836518.js", "file": "assets/stripe-ideal-2110e54f.js",
"imports": [ "imports": [
"_wait-8f4ae121.js" "_wait-8f4ae121.js"
], ],
@ -253,7 +264,7 @@
"src": "resources/js/clients/payments/stripe-ideal.js" "src": "resources/js/clients/payments/stripe-ideal.js"
}, },
"resources/js/clients/payments/stripe-klarna.js": { "resources/js/clients/payments/stripe-klarna.js": {
"file": "assets/stripe-klarna-93dcc6f1.js", "file": "assets/stripe-klarna-0c59275f.js",
"imports": [ "imports": [
"_wait-8f4ae121.js" "_wait-8f4ae121.js"
], ],
@ -261,7 +272,7 @@
"src": "resources/js/clients/payments/stripe-klarna.js" "src": "resources/js/clients/payments/stripe-klarna.js"
}, },
"resources/js/clients/payments/stripe-przelewy24.js": { "resources/js/clients/payments/stripe-przelewy24.js": {
"file": "assets/stripe-przelewy24-5db060c5.js", "file": "assets/stripe-przelewy24-07696bca.js",
"imports": [ "imports": [
"_wait-8f4ae121.js" "_wait-8f4ae121.js"
], ],
@ -269,7 +280,7 @@
"src": "resources/js/clients/payments/stripe-przelewy24.js" "src": "resources/js/clients/payments/stripe-przelewy24.js"
}, },
"resources/js/clients/payments/stripe-sepa.js": { "resources/js/clients/payments/stripe-sepa.js": {
"file": "assets/stripe-sepa-9ab85221.js", "file": "assets/stripe-sepa-23154322.js",
"imports": [ "imports": [
"_wait-8f4ae121.js" "_wait-8f4ae121.js"
], ],
@ -277,7 +288,7 @@
"src": "resources/js/clients/payments/stripe-sepa.js" "src": "resources/js/clients/payments/stripe-sepa.js"
}, },
"resources/js/clients/payments/stripe-sofort.js": { "resources/js/clients/payments/stripe-sofort.js": {
"file": "assets/stripe-sofort-fbef42bb.js", "file": "assets/stripe-sofort-92ec46e7.js",
"imports": [ "imports": [
"_wait-8f4ae121.js" "_wait-8f4ae121.js"
], ],

View File

@ -142,4 +142,4 @@ function boot() {
new BraintreeCreditCard().handle(); new BraintreeCreditCard().handle();
} }
instant() ? boot() : wait('#braintree-credit-card-payment', 'meta[name=client-token]').then(() => boot()); instant() ? boot() : wait('#braintree-credit-card-payment', 'meta[name=client-token]').then(() => boot());

View File

@ -88,6 +88,9 @@ class BraintreePayPal {
onApprove: function (data, actions) { onApprove: function (data, actions) {
return paypalCheckoutInstance.tokenizePayment(data).then(function (payload) { return paypalCheckoutInstance.tokenizePayment(data).then(function (payload) {
document.querySelector('#paypal-button')?.classList.add('hidden');
document.querySelector('#paypal-spinner')?.classList.remove('hidden');
let tokenBillingCheckbox = document.querySelector( let tokenBillingCheckbox = document.querySelector(
'input[name="token-billing-checkbox"]:checked' 'input[name="token-billing-checkbox"]:checked'
); );
@ -125,4 +128,4 @@ function boot() {
new BraintreePayPal().handle(); new BraintreePayPal().handle();
} }
instant() ? boot() : wait('#braintree-paypal-payment').then(() => boot()); instant() ? boot() : wait('#braintree-paypal-payment').then(() => boot());

View File

@ -5,7 +5,7 @@
* *
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com) * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
* *
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
import { wait, instant } from '../wait'; import { wait, instant } from '../wait';
@ -15,56 +15,60 @@ class CheckoutCreditCard {
this.tokens = []; this.tokens = [];
} }
mountFrames() {
console.log('Mount checkout frames..');
}
handlePaymentUsingToken(e) { handlePaymentUsingToken(e) {
document.getElementById('checkout--container').classList.add('hidden'); document.getElementById('checkout--container').classList.add('hidden');
document.getElementById('pay-now-with-token--container').classList.remove('hidden'); document
.getElementById('pay-now-with-token--container')
.classList.remove('hidden');
document.getElementById('save-card--container').style.display = 'none'; document.getElementById('save-card--container').style.display = 'none';
document document.querySelector('input[name=token]').value =
.querySelector('input[name=token]') e.target.dataset.token;
.value = e.target.dataset.token;
} }
handlePaymentUsingCreditCard(e) { handlePaymentUsingCreditCard(e) {
document.getElementById('checkout--container').classList.remove('hidden'); document
document.getElementById('pay-now-with-token--container').classList.add('hidden'); .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.getElementById('save-card--container').style.display = 'grid';
document document.querySelector('input[name=token]').value = '';
.querySelector('input[name=token]')
.value = '';
const payButton = document.getElementById('pay-button'); const payButton = document.getElementById('pay-button');
const publicKey = document.querySelector('meta[name="public-key"]').content ?? ''; const publicKey =
document.querySelector('meta[name="public-key"]').content ?? '';
const form = document.getElementById('payment-form'); const form = document.getElementById('payment-form');
Frames.init(publicKey); Frames.init(publicKey);
Frames.addEventHandler(Frames.Events.CARD_VALIDATION_CHANGED, function (event) { Frames.addEventHandler(
payButton.disabled = !Frames.isCardValid(); Frames.Events.CARD_VALIDATION_CHANGED,
}); function (event) {
payButton.disabled = !Frames.isCardValid();
}
);
Frames.addEventHandler(Frames.Events.CARD_TOKENIZATION_FAILED, function (event) { Frames.addEventHandler(
payButton.disabled = false; Frames.Events.CARD_TOKENIZATION_FAILED,
}); function (event) {
payButton.disabled = false;
}
);
Frames.addEventHandler(Frames.Events.CARD_TOKENIZED, function (event) { Frames.addEventHandler(Frames.Events.CARD_TOKENIZED, function (event) {
payButton.disabled = true; payButton.disabled = true;
document.querySelector( document.querySelector('input[name="gateway_response"]').value =
'input[name="gateway_response"]' JSON.stringify(event);
).value = JSON.stringify(event);
document.querySelector( document.querySelector('input[name="store_card"]').value =
'input[name="store_card"]' document.querySelector(
).value = document.querySelector( 'input[name=token-billing-checkbox]:checked'
'input[name=token-billing-checkbox]:checked' ).value;
).value;
document.getElementById('server-response').submit(); document.getElementById('server-response').submit();
}); });
@ -89,9 +93,11 @@ class CheckoutCreditCard {
handle() { handle() {
this.handlePaymentUsingCreditCard(); this.handlePaymentUsingCreditCard();
Array Array.from(
.from(document.getElementsByClassName('toggle-payment-with-token')) document.getElementsByClassName('toggle-payment-with-token')
.forEach((element) => element.addEventListener('click', this.handlePaymentUsingToken)); ).forEach((element) =>
element.addEventListener('click', this.handlePaymentUsingToken)
);
document document
.getElementById('toggle-payment-with-credit-card') .getElementById('toggle-payment-with-credit-card')

View File

@ -433,6 +433,11 @@ class EwayRapid {
completeAuthorization(event) { completeAuthorization(event) {
event.target.parentElement.disabled = true; event.target.parentElement.disabled = true;
const button = document.getElementById('authorize-card');
button.querySelector('svg').classList.remove('hidden');
button.querySelector('span').classList.add('hidden');
document.getElementById('server-response').submit(); document.getElementById('server-response').submit();
} }
@ -499,9 +504,14 @@ class EwayRapid {
}); });
} }
const payNowButton = document.getElementById('pay-now');
document.getElementById('pay-now')?.addEventListener('click', (e) => { document.getElementById('pay-now')?.addEventListener('click', (e) => {
let tokenInput = document.querySelector('input[name=token]'); let tokenInput = document.querySelector('input[name=token]');
payNowButton.querySelector('svg').classList.remove('hidden');
payNowButton.querySelector('span').classList.add('hidden');
if (tokenInput.value) { if (tokenInput.value) {
return this.completePaymentUsingToken(e); return this.completePaymentUsingToken(e);
} }
@ -515,4 +525,4 @@ function boot() {
new EwayRapid().handle(); new EwayRapid().handle();
} }
instant() ? boot() : wait('#eway-credit-card-payment').then(() => boot()); instant() ? boot() : wait('#eway-credit-card-payment').then(() => boot());

View File

@ -8,7 +8,7 @@
* @license https://opensource.org/licenses/AAL * @license https://opensource.org/licenses/AAL
*/ */
import { wait, instant } from '../wait'; import { wait, instant } from '../wait';
class ForteAuthorizeACH { class ForteAuthorizeACH {
constructor(apiLoginId) { constructor(apiLoginId) {
@ -79,9 +79,9 @@ function boot() {
const apiLoginId = document.querySelector( const apiLoginId = document.querySelector(
'meta[name="forte-api-login-id"]' 'meta[name="forte-api-login-id"]'
).content; ).content;
/** @handle */ /** @handle */
new ForteAuthorizeACH(apiLoginId).handle(); new ForteAuthorizeACH(apiLoginId).handle();
} }
instant() ? boot() : wait('#force-ach-payment').then(() => boot()); instant() ? boot() : wait('#force-ach-payment').then(() => boot());

View File

@ -96,4 +96,4 @@ function boot() {
new ForteAuthorizeCard(apiLoginId).handle(); new ForteAuthorizeCard(apiLoginId).handle();
} }
instant() ? boot() : wait('#forte-credit-card-payment').then(() => boot()); instant() ? boot() : wait('#forte-credit-card-payment').then(() => boot());

View File

@ -173,4 +173,4 @@ function boot() {
new _Mollie().handle(); new _Mollie().handle();
} }
instant() ? boot() : wait('#mollie-credit-card-payment').then(() => boot()); instant() ? boot(): wait('#mollie-credit-card-payment').then(() => boot());

View File

@ -124,6 +124,11 @@ class PayTraceCreditCard {
} }
handlePaymentWithCreditCard(event) { handlePaymentWithCreditCard(event) {
const button = document.getElementById('pay-now');
button.querySelector('svg').classList.remove('hidden');
button.querySelector('span').classList.add('hidden');
event.target.parentElement.disabled = true; event.target.parentElement.disabled = true;
document.getElementById('errors').hidden = true; document.getElementById('errors').hidden = true;
@ -134,6 +139,10 @@ class PayTraceCreditCard {
errorsContainer.textContent = errors[0].description; errorsContainer.textContent = errors[0].description;
errorsContainer.hidden = false; errorsContainer.hidden = false;
button.querySelector('svg').classList.add('hidden');
button.querySelector('span').classList.remove('hidden');
return (event.target.parentElement.disabled = false); return (event.target.parentElement.disabled = false);
} }
@ -163,6 +172,9 @@ class PayTraceCreditCard {
).textContent = JSON.stringify(error); ).textContent = JSON.stringify(error);
document.getElementById('errors').hidden = false; document.getElementById('errors').hidden = false;
button.querySelector('svg').classList.add('hidden');
button.querySelector('span').classList.remove('hidden');
console.log(error); console.log(error);
}); });
}); });
@ -171,6 +183,11 @@ class PayTraceCreditCard {
handlePaymentWithToken(event) { handlePaymentWithToken(event) {
event.target.parentElement.disabled = true; event.target.parentElement.disabled = true;
const button = document.getElementById('pay-now');
button.querySelector('svg').classList.remove('hidden');
button.querySelector('span').classList.add('hidden');
document.getElementById('server_response').submit(); document.getElementById('server_response').submit();
} }
@ -230,4 +247,4 @@ function boot() {
new PayTraceCreditCard().handle(); new PayTraceCreditCard().handle();
} }
instant() ? boot() : wait('#paytrace-credit-card-payment').then(() => boot()) instant() ? boot() : wait('#paytrace-credit-card-payment').then(() => boot())

View File

@ -8,29 +8,35 @@
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
let options = JSON.parse( import { wait, instant } from '../wait';
document.querySelector('meta[name=razorpay-options]')?.content
);
options.handler = function (response) { function boot() {
document.getElementById('razorpay_payment_id').value = let options = JSON.parse(
response.razorpay_payment_id; document.querySelector('meta[name=razorpay-options]')?.content
document.getElementById('razorpay_signature').value = );
response.razorpay_signature;
document.getElementById('server-response').submit(); options.handler = function (response) {
}; document.getElementById('razorpay_payment_id').value =
response.razorpay_payment_id;
document.getElementById('razorpay_signature').value =
response.razorpay_signature;
document.getElementById('server-response').submit();
};
options.modal = {
ondismiss: function () {
payNowButton.disabled = false;
},
};
let razorpay = new Razorpay(options);
let payNowButton = document.getElementById('pay-now');
payNowButton.onclick = function (event) {
payNowButton.disabled = true;
razorpay.open();
};
}
options.modal = { instant() ? boot() : wait('#razorpay-hosted-payment').then(() => boot());
ondismiss: function () {
payNowButton.disabled = false;
},
};
let razorpay = new Razorpay(options);
let payNowButton = document.getElementById('pay-now');
payNowButton.onclick = function (event) {
payNowButton.disabled = true;
razorpay.open();
};

View File

@ -149,10 +149,10 @@ function boot() {
const publishableKey = document.querySelector( const publishableKey = document.querySelector(
'meta[name="stripe-publishable-key"]' 'meta[name="stripe-publishable-key"]'
)?.content ?? ''; )?.content ?? '';
const stripeConnect = const stripeConnect =
document.querySelector('meta[name="stripe-account-id"]')?.content ?? ''; document.querySelector('meta[name="stripe-account-id"]')?.content ?? '';
new ProcessACSS(publishableKey, stripeConnect).setupStripe().handle(); new ProcessACSS(publishableKey, stripeConnect).setupStripe().handle();
} }

View File

@ -48,9 +48,10 @@ class ProcessAlipay {
document.querySelector('meta[name=ci_intent]').content, document.querySelector('meta[name=ci_intent]').content,
{ {
// Return URL where the customer should be redirected after the authorization // Return URL where the customer should be redirected after the authorization
return_url: `${document.querySelector('meta[name=return_url]') return_url: `${
document.querySelector('meta[name=return_url]')
.content .content
}`, }`,
} }
); );
@ -82,4 +83,4 @@ function boot() {
new ProcessAlipay(publishableKey, stripeConnect).setupStripe().handle(); new ProcessAlipay(publishableKey, stripeConnect).setupStripe().handle();
} }
instant() ? boot() : wait('#stripe-alipay-payment').then(() => boot()); instant() ? boot() : wait('#stripe-alipay-payment').then(() => boot());

View File

@ -11,7 +11,7 @@
import { instant, wait } from '../wait'; import { instant, wait } from '../wait';
class ProcessBACS { class ProcessBACS {
constructor(key, stripeConnect) { constructor(key, stripeConnect, onlyAuthorization) {
this.key = key; this.key = key;
this.errors = document.getElementById('errors'); this.errors = document.getElementById('errors');
this.stripeConnect = stripeConnect; this.stripeConnect = stripeConnect;
@ -84,13 +84,13 @@ function boot() {
const publishableKey = document.querySelector( const publishableKey = document.querySelector(
'meta[name="stripe-publishable-key"]' 'meta[name="stripe-publishable-key"]'
)?.content ?? ''; )?.content ?? '';
const stripeConnect = const stripeConnect =
document.querySelector('meta[name="stripe-account-id"]')?.content ?? ''; document.querySelector('meta[name="stripe-account-id"]')?.content ?? '';
const onlyAuthorization = const onlyAuthorization =
document.querySelector('meta[name="only-authorization"]')?.content ?? ''; document.querySelector('meta[name="only-authorization"]')?.content ?? '';
new ProcessBACS(publishableKey, stripeConnect).setupStripe().handle(); new ProcessBACS(publishableKey, stripeConnect, onlyAuthorization).setupStripe().handle();
} }
instant() ? boot() : wait('#stripe-bacs-payment').then(() => boot()); instant() ? boot() : wait('#stripe-bacs-payment').then(() => boot());

View File

@ -69,11 +69,11 @@ function boot() {
const publishableKey = document.querySelector( const publishableKey = document.querySelector(
'meta[name="stripe-publishable-key"]' 'meta[name="stripe-publishable-key"]'
)?.content ?? ''; )?.content ?? '';
const stripeConnect = const stripeConnect =
document.querySelector('meta[name="stripe-account-id"]')?.content ?? ''; document.querySelector('meta[name="stripe-account-id"]')?.content ?? '';
new ProcessBANCONTACTPay(publishableKey, stripeConnect).setupStripe().handle(); new ProcessBANCONTACTPay(publishableKey, stripeConnect).setupStripe().handle();
} }
instant() ? boot() : wait('#stripe-bancontact-payment').then(() => boot()); instant() ? boot() : wait('#stripe-bancontact-payment').then(() => boot());

View File

@ -141,11 +141,11 @@ function boot() {
const publishableKey = document.querySelector( const publishableKey = document.querySelector(
'meta[name="stripe-publishable-key"]' 'meta[name="stripe-publishable-key"]'
)?.content ?? ''; )?.content ?? '';
const stripeConnect = const stripeConnect =
document.querySelector('meta[name="stripe-account-id"]')?.content ?? ''; document.querySelector('meta[name="stripe-account-id"]')?.content ?? '';
new ProcessBECS(publishableKey, stripeConnect).setupStripe().handle(); new ProcessBECS(publishableKey, stripeConnect).setupStripe().handle();
} }
instant() ? boot() : wait('#stripe-becs-payment').then(() => boot()); instant() ? boot() : wait('#stripe-becs-payment').then(() => boot());

View File

@ -148,4 +148,4 @@ function boot() {
new StripeBrowserPay().handle() new StripeBrowserPay().handle()
} }
instant() ? boot() : wait('#stripe-browserpay-payment').then(() => boot()) instant() ? boot() : wait('#stripe-browserpay-payment').then(() => boot())

View File

@ -250,4 +250,4 @@ function boot() {
s.handle(); s.handle();
} }
instant() ? boot() : wait('#stripe-credit-card-payment').then(() => boot()); instant() ? boot() : wait('#stripe-credit-card-payment').then(() => boot());

View File

@ -86,11 +86,11 @@ function boot() {
const publishableKey = document.querySelector( const publishableKey = document.querySelector(
'meta[name="stripe-publishable-key"]' 'meta[name="stripe-publishable-key"]'
)?.content ?? ''; )?.content ?? '';
const stripeConnect = const stripeConnect =
document.querySelector('meta[name="stripe-account-id"]')?.content ?? ''; document.querySelector('meta[name="stripe-account-id"]')?.content ?? '';
new ProcessEPSPay(publishableKey, stripeConnect).setupStripe().handle(); new ProcessEPSPay(publishableKey, stripeConnect).setupStripe().handle();
} }
instant() ? boot() : wait('#stripe-eps-payment').then(() => boot()); instant() ? boot() : wait('#stripe-eps-payment').then(() => boot());

View File

@ -87,11 +87,11 @@ function boot() {
const publishableKey = document.querySelector( const publishableKey = document.querySelector(
'meta[name="stripe-publishable-key"]' 'meta[name="stripe-publishable-key"]'
)?.content ?? ''; )?.content ?? '';
const stripeConnect = const stripeConnect =
document.querySelector('meta[name="stripe-account-id"]')?.content ?? ''; document.querySelector('meta[name="stripe-account-id"]')?.content ?? '';
new ProcessFPXPay(publishableKey, stripeConnect).setupStripe().handle(); new ProcessFPXPay(publishableKey, stripeConnect).setupStripe().handle();
} }
instant() ? boot() : wait('#stripe-fpx-payment').then(() => boot()); instant() ? boot() : wait('#stripe-fpx-payment').then(() => boot());

View File

@ -70,10 +70,10 @@ function boot() {
const publishableKey = document.querySelector( const publishableKey = document.querySelector(
'meta[name="stripe-publishable-key"]' 'meta[name="stripe-publishable-key"]'
)?.content ?? ''; )?.content ?? '';
const stripeConnect = const stripeConnect =
document.querySelector('meta[name="stripe-account-id"]')?.content ?? ''; document.querySelector('meta[name="stripe-account-id"]')?.content ?? '';
new ProcessGiroPay(publishableKey, stripeConnect).setupStripe().handle(); new ProcessGiroPay(publishableKey, stripeConnect).setupStripe().handle();
} }

View File

@ -8,7 +8,7 @@
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
import { wait, instant } from '../wait'; import { wait, instant } from '../wait';
class ProcessIDEALPay { class ProcessIDEALPay {
constructor(key, stripeConnect) { constructor(key, stripeConnect) {
@ -87,11 +87,13 @@ function boot() {
const publishableKey = document.querySelector( const publishableKey = document.querySelector(
'meta[name="stripe-publishable-key"]' 'meta[name="stripe-publishable-key"]'
)?.content ?? ''; )?.content ?? '';
const stripeConnect = const stripeConnect =
document.querySelector('meta[name="stripe-account-id"]')?.content ?? ''; document.querySelector('meta[name="stripe-account-id"]')?.content ?? '';
new ProcessIDEALPay(publishableKey, stripeConnect).setupStripe().handle(); new ProcessIDEALPay(publishableKey, stripeConnect).setupStripe().handle();
} }
instant() ? boot() : wait('#stripe-ideal-payment').then(() => boot());
instant() ? boot() : wait('#stripe-ideal-payment').then(() => boot()); instant() ? boot() : wait('#stripe-ideal-payment').then(() => boot());

View File

@ -98,11 +98,13 @@ function boot() {
const publishableKey = document.querySelector( const publishableKey = document.querySelector(
'meta[name="stripe-publishable-key"]' 'meta[name="stripe-publishable-key"]'
)?.content ?? ''; )?.content ?? '';
const stripeConnect = const stripeConnect =
document.querySelector('meta[name="stripe-account-id"]')?.content ?? ''; document.querySelector('meta[name="stripe-account-id"]')?.content ?? '';
new ProcessKlarna(publishableKey, stripeConnect).setupStripe().handle(); new ProcessKlarna(publishableKey, stripeConnect).setupStripe().handle();
} }
instant() ? boot() : wait('#stripe-klarna-payment').then(() => boot());
instant() ? boot() : wait('#stripe-klarna-payment').then(() => boot()); instant() ? boot() : wait('#stripe-klarna-payment').then(() => boot());

View File

@ -119,11 +119,13 @@ function boot() {
const publishableKey = document.querySelector( const publishableKey = document.querySelector(
'meta[name="stripe-publishable-key"]' 'meta[name="stripe-publishable-key"]'
)?.content ?? ''; )?.content ?? '';
const stripeConnect = const stripeConnect =
document.querySelector('meta[name="stripe-account-id"]')?.content ?? ''; document.querySelector('meta[name="stripe-account-id"]')?.content ?? '';
new ProcessPRZELEWY24(publishableKey, stripeConnect).setupStripe().handle(); new ProcessPRZELEWY24(publishableKey, stripeConnect).setupStripe().handle();
} }
instant() ? boot() : wait('#stripe-przelewy24-payment').then(() => boot());
instant() ? boot() : wait('#stripe-przelewy24-payment').then(() => boot()); instant() ? boot() : wait('#stripe-przelewy24-payment').then(() => boot());

View File

@ -149,13 +149,10 @@ class ProcessSEPA {
return; return;
} }
document.getElementById('pay-now').disabled = true; document.getElementById('pay-now').disabled = true;
document.querySelector('#pay-now > svg').classList.remove('hidden'); document.querySelector('#pay-now > svg').classList.remove('hidden');
document.querySelector('#pay-now > span').classList.add('hidden'); document.querySelector('#pay-now > span').classList.add('hidden');
this.stripe this.stripe
.confirmSepaDebitPayment( .confirmSepaDebitPayment(
document.querySelector('meta[name=pi-client-secret') document.querySelector('meta[name=pi-client-secret')
@ -238,7 +235,7 @@ class ProcessSEPA {
function boot() { function boot() {
const publishableKey = const publishableKey =
document.querySelector('meta[name="stripe-publishable-key"]')?.content ?? document.querySelector('meta[name="stripe-publishable-key"]')?.content ??
''; '';
const stripeConnect = const stripeConnect =
document.querySelector('meta[name="stripe-account-id"]')?.content ?? ''; document.querySelector('meta[name="stripe-account-id"]')?.content ?? '';
@ -246,4 +243,6 @@ function boot() {
new ProcessSEPA(publishableKey, stripeConnect).setupStripe().handle(); new ProcessSEPA(publishableKey, stripeConnect).setupStripe().handle();
} }
instant() ? boot() : wait('#stripe-sepa-payment').then(() => boot());
instant() ? boot() : wait('#stripe-sepa-payment').then(() => boot()); instant() ? boot() : wait('#stripe-sepa-payment').then(() => boot());

View File

@ -64,11 +64,13 @@ function boot() {
const publishableKey = document.querySelector( const publishableKey = document.querySelector(
'meta[name="stripe-publishable-key"]' 'meta[name="stripe-publishable-key"]'
)?.content ?? ''; )?.content ?? '';
const stripeConnect = const stripeConnect =
document.querySelector('meta[name="stripe-account-id"]')?.content ?? ''; document.querySelector('meta[name="stripe-account-id"]')?.content ?? '';
new ProcessSOFORT(publishableKey, stripeConnect).setupStripe().handle(); new ProcessSOFORT(publishableKey, stripeConnect).setupStripe().handle();
} }
instant() ? boot() : wait('#stripe-sofort-payment').then(() => boot());
instant() ? boot() : wait('#stripe-sofort-payment').then(() => boot()); instant() ? boot() : wait('#stripe-sofort-payment').then(() => boot());

View File

@ -62,4 +62,4 @@
}); });
</script> </script>
@endscript @endscript
</div> </div>

View File

@ -58,4 +58,4 @@
</div> </div>
</form> </form>
@endif @endif
</div> </div>

View File

@ -3,6 +3,7 @@
@section('gateway_head') @section('gateway_head')
<meta name="authorize-public-key" content="{{ $public_client_id }}"> <meta name="authorize-public-key" content="{{ $public_client_id }}">
<meta name="authorize-login-id" content="{{ $api_login_id }}"> <meta name="authorize-login-id" content="{{ $api_login_id }}">
<meta name="instant-payment" content="yes" />
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script> <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<meta name="authnet-require-cvv" content="{{ $gateway->company_gateway->require_cvv }}"> <meta name="authnet-require-cvv" content="{{ $gateway->company_gateway->require_cvv }}">

View File

@ -2,6 +2,7 @@
@section('gateway_head') @section('gateway_head')
<meta name="client-token" content="{{ $client_token ?? '' }}"/> <meta name="client-token" content="{{ $client_token ?? '' }}"/>
<meta name="instant-payment" content="yes" />
<script src='https://js.braintreegateway.com/web/dropin/1.33.4/js/dropin.min.js'></script> <script src='https://js.braintreegateway.com/web/dropin/1.33.4/js/dropin.min.js'></script>
{{-- <script src="https://js.braintreegateway.com/web/3.76.2/js/client.min.js"></script> --}} {{-- <script src="https://js.braintreegateway.com/web/3.76.2/js/client.min.js"></script> --}}

View File

@ -2,6 +2,7 @@
@section('gateway_head') @section('gateway_head')
<meta name="client-token" content="{{ $client_token ?? '' }}"/> <meta name="client-token" content="{{ $client_token ?? '' }}"/>
<meta name="instant-payment" content="yes" />
<script src="https://js.braintreegateway.com/web/3.76.2/js/client.min.js"></script> <script src="https://js.braintreegateway.com/web/3.76.2/js/client.min.js"></script>
<script src="https://js.braintreegateway.com/web/3.76.2/js/paypal-checkout.min.js"></script> <script src="https://js.braintreegateway.com/web/3.76.2/js/paypal-checkout.min.js"></script>

View File

@ -7,6 +7,7 @@ ctrans('texts.credit_card')])
<meta name="translation-expiry_date" content="{{ ctrans('texts.date') }}"> <meta name="translation-expiry_date" content="{{ ctrans('texts.date') }}">
<meta name="translation-card_number" content="{{ ctrans('texts.card_number') }}"> <meta name="translation-card_number" content="{{ ctrans('texts.card_number') }}">
<meta name="translation-cvv" content="{{ ctrans('texts.cvv') }}"> <meta name="translation-cvv" content="{{ ctrans('texts.cvv') }}">
<meta name="instant-payment" content="yes" />
@endsection @endsection
@section('gateway_content') @section('gateway_content')

View File

@ -2,6 +2,7 @@
@section('gateway_head') @section('gateway_head')
<meta name="forte-api-login-id" content="{{$gateway->company_gateway->getConfigField("apiLoginId")}}"> <meta name="forte-api-login-id" content="{{$gateway->company_gateway->getConfigField("apiLoginId")}}">
<meta name="instant-payment" content="yes" />
@endsection @endsection
@section('gateway_content') @section('gateway_content')

View File

@ -2,6 +2,8 @@
@section('gateway_head') @section('gateway_head')
<meta name="forte-api-login-id" content="{{$gateway->company_gateway->getConfigField("apiLoginId")}}"> <meta name="forte-api-login-id" content="{{$gateway->company_gateway->getConfigField("apiLoginId")}}">
<meta name="instant-payment" content="yes" />
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script> <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
@endsection @endsection

View File

@ -4,6 +4,7 @@ ctrans('texts.credit_card')])
@section('gateway_head') @section('gateway_head')
<meta name="mollie-testmode" content="{{ $gateway->company_gateway->getConfigField('testMode') }}"> <meta name="mollie-testmode" content="{{ $gateway->company_gateway->getConfigField('testMode') }}">
<meta name="mollie-profileId" content="{{ $gateway->company_gateway->getConfigField('profileId') }}"> <meta name="mollie-profileId" content="{{ $gateway->company_gateway->getConfigField('profileId') }}">
<meta name="instant-payment" content="yes">
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script> <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>

View File

@ -3,6 +3,7 @@
@section('gateway_head') @section('gateway_head')
<meta name="contact-email" content="{{ $contact->email }}"> <meta name="contact-email" content="{{ $contact->email }}">
<meta name="client-postal-code" content="{{ $contact->client->postal_code }}"> <meta name="client-postal-code" content="{{ $contact->client->postal_code }}">
<meta name="instant-payment" content="yes" />
@endsection @endsection
@section('gateway_content') @section('gateway_content')

View File

@ -6,6 +6,7 @@
<meta name="ctrans-cvv" content="{{ ctrans('texts.cvv') }}"> <meta name="ctrans-cvv" content="{{ ctrans('texts.cvv') }}">
<meta name="ctrans-card_number" content="{{ ctrans('texts.card_number') }}"> <meta name="ctrans-card_number" content="{{ ctrans('texts.card_number') }}">
<meta name="ctrans-expires" content="{{ ctrans('texts.expires') }}"> <meta name="ctrans-expires" content="{{ ctrans('texts.expires') }}">
<meta name="instant-payment" content="yes" />
@endsection @endsection
@section('gateway_content') @section('gateway_content')

View File

@ -3,6 +3,7 @@ ctrans('texts.aio_checkout')])
@section('gateway_head') @section('gateway_head')
<meta name="razorpay-options" content="{{ \json_encode($options) }}"> <meta name="razorpay-options" content="{{ \json_encode($options) }}">
<meta name="instant-payment" content="yes" />
@endsection @endsection
@section('gateway_content') @section('gateway_content')

View File

@ -7,6 +7,8 @@
<meta name="square_contact" content="{{ json_encode($square_contact) }}"> <meta name="square_contact" content="{{ json_encode($square_contact) }}">
<meta name="amount" content="{{ $amount }}"> <meta name="amount" content="{{ $amount }}">
<meta name="currencyCode" content="{{ $currencyCode }}"> <meta name="currencyCode" content="{{ $currencyCode }}">
<meta name="instant-payment" content="yes" />
<style> <style>
.loader { .loader {
border-top-color: #3498db; border-top-color: #3498db;

View File

@ -8,7 +8,7 @@
@else @else
<meta name="stripe-publishable-key" content="{{ $gateway->getPublishableKey() }}"> <meta name="stripe-publishable-key" content="{{ $gateway->getPublishableKey() }}">
@endif @endif
<meta name="instant-payment" content="yes" />
<meta name="return-url" content="{{ $return_url }}"> <meta name="return-url" content="{{ $return_url }}">
<meta name="amount" content="{{ $stripe_amount }}"> <meta name="amount" content="{{ $stripe_amount }}">
<meta name="country" content="{{ $country }}"> <meta name="country" content="{{ $country }}">
@ -60,5 +60,4 @@
@push('footer') @push('footer')
<script src="https://js.stripe.com/v3/"></script> <script src="https://js.stripe.com/v3/"></script>
@vite('resources/js/clients/payments/stripe-acss.js') @vite('resources/js/clients/payments/stripe-acss.js')
@endpush @endpush

View File

@ -7,9 +7,10 @@
@else @else
<meta name="stripe-publishable-key" content="{{ $gateway->getPublishableKey() }}"> <meta name="stripe-publishable-key" content="{{ $gateway->getPublishableKey() }}">
@endif @endif
<meta name="return_url" content="{{ $return_url }}"> <meta name="return_url" content="{{ $return_url }}">
<meta name="ci_intent" content="{{ $ci_intent }}"> <meta name="ci_intent" content="{{ $ci_intent }}">
<meta name="instant-payment" content="yes" />
@endsection @endsection
@section('gateway_content') @section('gateway_content')

View File

@ -1,7 +1,7 @@
@extends('portal.ninja2020.layout.payments', ['gateway_title' => 'Apple Pay', 'card_title' => 'Apple Pay']) @extends('portal.ninja2020.layout.payments', ['gateway_title' => 'Apple Pay', 'card_title' => 'Apple Pay'])
@section('gateway_head') @section('gateway_head')
<meta name="instant-payment" content="yes" />
@endsection @endsection
@section('gateway_content') @section('gateway_content')

View File

@ -9,6 +9,7 @@
@endif @endif
<meta name="only-authorization" content=""> <meta name="only-authorization" content="">
<meta name="translation-payment-method-required" content="{{ ctrans('texts.missing_payment_method') }}"> <meta name="translation-payment-method-required" content="{{ ctrans('texts.missing_payment_method') }}">
<meta name="instant-payment" content="yes" />
@endsection @endsection
@section('gateway_content') @section('gateway_content')

View File

@ -17,6 +17,8 @@
<meta name="pi-client-secret" content="{{ $pi_client_secret }}"> <meta name="pi-client-secret" content="{{ $pi_client_secret }}">
<meta name="translation-name-required" content="{{ ctrans('texts.missing_account_holder_name') }}"> <meta name="translation-name-required" content="{{ ctrans('texts.missing_account_holder_name') }}">
<meta name="instant-payment" content="yes" />
@endsection @endsection
@section('gateway_content') @section('gateway_content')

View File

@ -8,7 +8,7 @@
<meta name="stripe-publishable-key" content="{{ $gateway->getPublishableKey() }}"> <meta name="stripe-publishable-key" content="{{ $gateway->getPublishableKey() }}">
@endif @endif
<meta name="viewport" content="width=device-width, minimum-scale=1" /> <meta name="viewport" content="width=device-width, minimum-scale=1" />
<meta name="instant-payment" content="yes" />
@endsection @endsection
@section('gateway_content') @section('gateway_content')

Some files were not shown because too many files have changed in this diff Show More