mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
Use idempotency keys for mollie payments to prevent race conditions
This commit is contained in:
parent
d747be4c06
commit
5a53a65e39
@ -329,6 +329,9 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
$client_contact = $this->getContact();
|
||||
$client_contact_id = $client_contact ? $client_contact->id : $this->client->contacts()->first()->id;
|
||||
|
||||
if(isset($data['idempotency_key']))
|
||||
$payment->idempotency_key = $data['idempotency_key'];
|
||||
|
||||
$payment->amount = $data['amount'];
|
||||
$payment->type_id = $data['payment_type'];
|
||||
$payment->transaction_reference = $data['transaction_reference'];
|
||||
|
@ -194,6 +194,7 @@ class IDEAL implements MethodInterface, LivewireMethodInterface
|
||||
'amount' => array_sum(array_column($this->mollie->payment_hash->invoices(), 'amount')) + $this->mollie->payment_hash->fee_total,
|
||||
'payment_type' => PaymentType::IDEAL,
|
||||
'transaction_reference' => $payment->id,
|
||||
'idempotency_key' => substr("{$payment->id}{$this->mollie->payment_hash}",0,64)
|
||||
];
|
||||
|
||||
$payment_record = $this->mollie->createPayment(
|
||||
|
@ -336,6 +336,7 @@ class MolliePaymentDriver extends BaseDriver
|
||||
'amount' => $amount = array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total,
|
||||
'payment_type' => $payment->metadata->payment_type_id,
|
||||
'transaction_reference' => $payment->id,
|
||||
'idempotency_key' => substr("{$payment->id}{$payment_hash->hash}",0,64)
|
||||
];
|
||||
|
||||
$this->confirmGatewayFee($data);
|
||||
|
Loading…
Reference in New Issue
Block a user