mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Working on bank transfers for stripe
This commit is contained in:
parent
5a61eeb02d
commit
d51221c10e
@ -126,17 +126,13 @@ class BankTransfer
|
||||
|
||||
/* Create a pending payment */
|
||||
if($pi->status == 'requires_action' && $pi->next_action->type == 'display_bank_transfer_instructions') {
|
||||
|
||||
$data = [
|
||||
'amount' => Number::formatMoney($this->stripe->convertFromStripeAmount($pi->next_action->display_bank_transfer_instructions->amount_remaining, $this->stripe->client->currency()->precision, $this->stripe->client->currency()), $this->stripe->client),
|
||||
'account_holder_name' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->sort_code->account_holder_name,
|
||||
'account_number' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->sort_code->account_number,
|
||||
'sort_code' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->sort_code->sort_code,
|
||||
'reference' => $pi->next_action->display_bank_transfer_instructions->reference,
|
||||
'description' => $pi->description,
|
||||
'gateway' => $this->stripe->company_gateway,
|
||||
|
||||
];
|
||||
nlog($pi);
|
||||
match($pi->next_action->display_bank_transfer_instructions->currency){
|
||||
'mxn' => $data = $this->formatDataforMx($pi),
|
||||
'gbp' => $data = $this->formatDataforUk($pi),
|
||||
'eur' => $data = $this->formatDataforEur($pi),
|
||||
'jpy' => $data = $this->formatDataforJp($pi),
|
||||
};
|
||||
|
||||
return render('gateways.stripe.bank_transfer.bank_details', $data);
|
||||
|
||||
@ -170,6 +166,86 @@ class BankTransfer
|
||||
|
||||
}
|
||||
|
||||
private function formatDataForUk(PaymentIntent $pi): array
|
||||
{
|
||||
|
||||
return [
|
||||
'amount' => Number::formatMoney($this->stripe->convertFromStripeAmount($pi->next_action->display_bank_transfer_instructions->amount_remaining, $this->stripe->client->currency()->precision, $this->stripe->client->currency()), $this->stripe->client),
|
||||
'account_holder_name' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->sort_code->account_holder_name,
|
||||
'account_number' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->sort_code->account_number,
|
||||
'sort_code' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->sort_code->sort_code,
|
||||
'reference' => $pi->next_action->display_bank_transfer_instructions->reference,
|
||||
'description' => $pi->description,
|
||||
'gateway' => $this->stripe->company_gateway,
|
||||
'currency' => $pi->next_action->display_bank_transfer_instructions->currency,
|
||||
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
private function formatDataforMx(PaymentIntent $pi): array
|
||||
{
|
||||
|
||||
return [
|
||||
'amount' => Number::formatMoney($this->stripe->convertFromStripeAmount($pi->next_action->display_bank_transfer_instructions->amount_remaining, $this->stripe->client->currency()->precision, $this->stripe->client->currency()), $this->stripe->client),
|
||||
'account_holder_name' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->spei->bank_name,
|
||||
'account_number' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->spei->bank_code,
|
||||
'sort_code' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->spei->clabe,
|
||||
'reference' => $pi->next_action->display_bank_transfer_instructions->reference,
|
||||
'description' => $pi->description,
|
||||
'gateway' => $this->stripe->company_gateway,
|
||||
'currency' => $pi->next_action->display_bank_transfer_instructions->currency,
|
||||
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
private function formatDataforEur(PaymentIntent $pi): array
|
||||
{
|
||||
|
||||
return [
|
||||
'amount' => Number::formatMoney($this->stripe->convertFromStripeAmount($pi->next_action->display_bank_transfer_instructions->amount_remaining, $this->stripe->client->currency()->precision, $this->stripe->client->currency()), $this->stripe->client),
|
||||
'account_holder_name' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->sort_code->account_holder_name,
|
||||
'account_number' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->sort_code->account_number,
|
||||
'sort_code' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->sort_code->sort_code,
|
||||
'reference' => $pi->next_action->display_bank_transfer_instructions->reference,
|
||||
'description' => $pi->description,
|
||||
'gateway' => $this->stripe->company_gateway,
|
||||
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param PaymentIntent $pi
|
||||
* @return array
|
||||
*/
|
||||
private function formatDataforJp(PaymentIntent $pi): array
|
||||
{
|
||||
|
||||
return [
|
||||
'amount' => Number::formatMoney($this->stripe->convertFromStripeAmount($pi->next_action->display_bank_transfer_instructions->amount_remaining, $this->stripe->client->currency()->precision, $this->stripe->client->currency()), $this->stripe->client),
|
||||
'account_holder_name' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->zengin->account_holder_name,
|
||||
'account_number' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->zengin->account_number,
|
||||
'account_type' =>$pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->zengin->account_type,
|
||||
'bank_code' =>$pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->zengin->bank_code,
|
||||
'bank_name' =>$pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->zengin->bank_name,
|
||||
'branch_code' =>$pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->zengin->branch_code,
|
||||
'branch_name' =>$pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->zengin->branch_name,
|
||||
'sort_code' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->zengin->sort_code,
|
||||
'reference' => $pi->next_action->display_bank_transfer_instructions->reference,
|
||||
'description' => $pi->description,
|
||||
'gateway' => $this->stripe->company_gateway,
|
||||
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function processSuccesfulRedirect($payment_intent)
|
||||
{
|
||||
$this->stripe->init();
|
||||
|
@ -5002,6 +5002,7 @@ $LANG = array(
|
||||
'gateway_payment_text_no_invoice' => 'Payment with no invoice for amount :amount for client :client',
|
||||
'click_to_variables' => 'Client here to see all variables.',
|
||||
'ship_to' => 'Ship to',
|
||||
'stripe_direct_debit_details' => 'Please transfer into the nominated bank account above.'
|
||||
);
|
||||
|
||||
|
||||
|
@ -2,14 +2,15 @@
|
||||
|
||||
@section('gateway_content')
|
||||
<div class="container mx-auto">
|
||||
|
||||
<div class="px-4 py-5 bg-white sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||
|
||||
@if($currency == 'gbp')
|
||||
|
||||
<dt class="text-sm font-medium leading-5 text-gray-500">
|
||||
{{ ctrans('texts.account_name') }}
|
||||
{{ ctrans('texts.sort') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ $account_holder_name }}
|
||||
{{ $sort_code }}
|
||||
</dd>
|
||||
|
||||
<dt class="text-sm font-medium leading-5 text-gray-500">
|
||||
@ -20,12 +21,13 @@
|
||||
</dd>
|
||||
|
||||
<dt class="text-sm font-medium leading-5 text-gray-500">
|
||||
{{ ctrans('texts.sort') }}
|
||||
{{ ctrans('texts.account_name') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ $sort_code }}
|
||||
{{ $account_holder_name }}
|
||||
</dd>
|
||||
|
||||
|
||||
<dt class="text-sm font-medium leading-5 text-gray-500">
|
||||
{{ ctrans('texts.reference') }}
|
||||
</dt>
|
||||
@ -41,6 +43,59 @@
|
||||
{{ $amount }}
|
||||
</dd>
|
||||
|
||||
<dt class="text-sm font-medium leading-5 text-gray-500">
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ ctrans('texts.stripe_direct_debit_details') }}
|
||||
</dd>
|
||||
|
||||
@elseif($currency == 'mxn')
|
||||
|
||||
<dt class="text-sm font-medium leading-5 text-gray-500">
|
||||
Clabe
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ $sort_code }}
|
||||
</dd>
|
||||
|
||||
<dt class="text-sm font-medium leading-5 text-gray-500">
|
||||
{{ ctrans('texts.account_number') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ $account_number }}
|
||||
</dd>
|
||||
|
||||
<dt class="text-sm font-medium leading-5 text-gray-500">
|
||||
{{ ctrans('texts.account_name') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ $account_holder_name }}
|
||||
</dd>
|
||||
|
||||
|
||||
<dt class="text-sm font-medium leading-5 text-gray-500">
|
||||
{{ ctrans('texts.reference') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ $reference }}
|
||||
</dd>
|
||||
|
||||
|
||||
<dt class="text-sm font-medium leading-5 text-gray-500">
|
||||
{{ ctrans('texts.balance_due') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ $amount }}
|
||||
</dd>
|
||||
|
||||
<dt class="text-sm font-medium leading-5 text-gray-500">
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ ctrans('texts.stripe_direct_debit_details') }}
|
||||
</dd>
|
||||
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
@ -17,7 +17,7 @@
|
||||
<form action="{{ route('client.payments.response') }}" method="post" id="payment-form">
|
||||
@csrf
|
||||
|
||||
<div id="payment-element">
|
||||
<div id="payment-element" style="padding:40px;">
|
||||
<!-- Elements will create form elements here -->
|
||||
</div>
|
||||
|
||||
@ -46,16 +46,19 @@
|
||||
<script>
|
||||
const options = {
|
||||
clientSecret: '{{ $client_secret }}',
|
||||
style: {
|
||||
base: {
|
||||
padding: '10px 12px',
|
||||
color: '#32325d',
|
||||
fontSize: '16px',
|
||||
'::placeholder': {
|
||||
color: '#aab7c4'
|
||||
},
|
||||
},
|
||||
},
|
||||
appearance : {
|
||||
theme: 'stripe',
|
||||
variables: {
|
||||
colorPrimary: '#0570de',
|
||||
colorBackground: '#ffffff',
|
||||
colorText: '#30313d',
|
||||
colorDanger: '#df1b41',
|
||||
fontFamily: 'Ideal Sans, system-ui, sans-serif',
|
||||
spacingUnit: '2px',
|
||||
borderRadius: '4px',
|
||||
// See all possible variables below
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
$token_billing_string = 'false';
|
||||
}
|
||||
|
||||
|
||||
@endphp
|
||||
|
||||
@section('gateway_head')
|
||||
|
Loading…
x
Reference in New Issue
Block a user