Minor fixes

This commit is contained in:
Lars Kusch 2023-01-30 08:46:39 +01:00
parent 0c11e1a932
commit 9c672e9bb1
3 changed files with 10 additions and 8 deletions

View File

@ -113,25 +113,25 @@ class BACS
return $this->processSuccessfulPayment($state['payment_intent']);
}
return $this->processUnsuccessfulPayment("");
return $this->processUnsuccessfulPayment("An unknown error occured.");
}
public function processSuccessfulPayment($payment_id)
public function processSuccessfulPayment($payment_intent)
{
UpdateCustomer::dispatch($this->stripe->company_gateway->company->company_key, $this->stripe->company_gateway->id, $this->stripe->client->id);
$data = [
'payment_method' => $payment_id['id'],
'payment_method' => $payment_intent['id'],
'payment_type' => PaymentType::BACS,
'amount' => $this->stripe->convertFromStripeAmount($payment_id->amount, $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
'transaction_reference' => $payment_id['id'],
'amount' => $this->stripe->convertFromStripeAmount($payment_intent->amount, $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
'transaction_reference' => $payment_intent['id'],
'gateway_type_id' => GatewayType::BACS,
];
$payment = $this->stripe->createPayment($data, Payment::STATUS_PENDING);
SystemLogger::dispatch(
['response' => $payment_id, 'data' => $data],
['response' => $payment_intent, 'data' => $data],
SystemLog::CATEGORY_GATEWAY_RESPONSE,
SystemLog::EVENT_GATEWAY_SUCCESS,
SystemLog::TYPE_STRIPE,

View File

@ -263,7 +263,7 @@ class StripePaymentDriver extends BaseDriver
&& $this->client->currency()
&& in_array($this->client->currency()->code, ['EUR', 'DKK', 'GBP', 'NOK', 'SEK', 'AUD', 'NZD', 'CAD', 'PLN', 'CHF', 'USD'])
&& isset($this->client->country)
&& in_array($this->client->company->country()->getID(), ['840'])
&& in_array($this->client->company->country()->id, ['840'])
&& in_array($this->client->country->iso_3166_3, ['AUT','BEL','DNK','FIN','FRA','DEU','IRL','ITA','NLD','NOR','ESP','SWE','GBR','USA'])) {
$types[] = GatewayType::KLARNA;
}

View File

@ -23,7 +23,9 @@
</form>
<div class="alert alert-failure mb-4" hidden id="errors"></div>
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.method')])
{{ ctrans('texts.bacs') }}
@endcomponent
@component('portal.ninja2020.gateways.includes.pay_now', ['id' => 'authorize-bacs'])
{{ ctrans('texts.add_payment_method') }}
@endcomponent