This commit is contained in:
Lars Kusch 2023-01-16 14:58:38 +01:00
parent 2ca27f7602
commit 07d9149ec3
2 changed files with 4 additions and 16 deletions

View File

@ -128,31 +128,18 @@ class BACS
{ {
UpdateCustomer::dispatch($this->stripe->company_gateway->company->company_key, $this->stripe->company_gateway->id, $this->stripe->client->id); UpdateCustomer::dispatch($this->stripe->company_gateway->company->company_key, $this->stripe->company_gateway->id, $this->stripe->client->id);
$stripe_method = $this->stripe->getStripePaymentMethod($this->stripe->payment_hash->data->server_response->payment_method);
$data = [ $data = [
'payment_method' => $this->stripe->payment_hash->data->server_response->payment_method, 'payment_method' => $this->stripe->payment_hash->data->server_response->payment_method,
'payment_type' => PaymentType::parseCardType(strtolower($stripe_method->card->brand)) ?: PaymentType::CREDIT_CARD_OTHER, 'payment_type' => PaymentType::BACS,
'amount' => $this->stripe->convertFromStripeAmount($this->stripe->payment_hash->data->server_response->amount, $this->stripe->client->currency()->precision, $this->stripe->client->currency()), 'amount' => $this->stripe->convertFromStripeAmount($this->stripe->payment_hash->data->server_response->amount, $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
'transaction_reference' => isset($this->stripe->payment_hash->data->payment_intent->latest_charge) ? $this->stripe->payment_hash->data->payment_intent->latest_charge : optional($this->stripe->payment_hash->data->payment_intent->charges->data[0])->id, 'transaction_reference' => isset($this->stripe->payment_hash->data->payment_intent->latest_charge) ? $this->stripe->payment_hash->data->payment_intent->latest_charge : optional($this->stripe->payment_hash->data->payment_intent->charges->data[0])->id,
'gateway_type_id' => GatewayType::CREDIT_CARD, 'gateway_type_id' => GatewayType::BACS,
]; ];
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['amount' => $data['amount']]); $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['amount' => $data['amount']]);
$this->stripe->payment_hash->save(); $this->stripe->payment_hash->save();
if ($this->stripe->payment_hash->data->store_card) { $payment = $this->stripe->createPayment($data, Payment::STATUS_PENDING);
$customer = new \stdClass;
$customer->id = $this->stripe->payment_hash->data->customer;
$this->stripe->attach($this->stripe->payment_hash->data->server_response->payment_method, $customer);
$stripe_method = $this->stripe->getStripePaymentMethod($this->stripe->payment_hash->data->server_response->payment_method);
$this->storePaymentMethod($stripe_method, $this->stripe->payment_hash->data->payment_method_id, $customer);
}
$payment = $this->stripe->createPayment($data, Payment::STATUS_COMPLETED);
SystemLogger::dispatch( SystemLogger::dispatch(
['response' => $this->stripe->payment_hash->data->server_response, 'data' => $data], ['response' => $this->stripe->payment_hash->data->server_response, 'data' => $data],

View File

@ -14,6 +14,7 @@
<form action="{{ route('client.payments.response') }}" method="post" id="server-response"> <form action="{{ route('client.payments.response') }}" method="post" id="server-response">
@csrf @csrf
<input type="hidden" name="company_gateway_id" value="{{ $gateway->getCompanyGatewayId() }}"> <input type="hidden" name="company_gateway_id" value="{{ $gateway->getCompanyGatewayId() }}">
<input type="hidden" name="payment_method_id" value="{{ $payment_method_id }}">
<input type="hidden" name="token"> <input type="hidden" name="token">
<input type="hidden" name="payment_hash" value="{{ $payment_hash }}"> <input type="hidden" name="payment_hash" value="{{ $payment_hash }}">
<input type="hidden" name="amount" value={{ $amount }}> <input type="hidden" name="amount" value={{ $amount }}>