mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for duplicate mollie requests
This commit is contained in:
parent
5beaa80786
commit
1e5faf2ecd
@ -36,6 +36,7 @@ class InvoiceTransformer extends BaseTransformer
|
|||||||
$invoiceStatusMap = [
|
$invoiceStatusMap = [
|
||||||
'sent' => Invoice::STATUS_SENT,
|
'sent' => Invoice::STATUS_SENT,
|
||||||
'draft' => Invoice::STATUS_DRAFT,
|
'draft' => Invoice::STATUS_DRAFT,
|
||||||
|
'paid' => Invoice::STATUS_PAID,
|
||||||
];
|
];
|
||||||
|
|
||||||
$transformed = [
|
$transformed = [
|
||||||
|
@ -176,6 +176,19 @@ class IDEAL implements MethodInterface, LivewireMethodInterface
|
|||||||
*/
|
*/
|
||||||
public function processSuccessfulPayment(\Mollie\Api\Resources\Payment $payment, string $status = 'paid'): RedirectResponse
|
public function processSuccessfulPayment(\Mollie\Api\Resources\Payment $payment, string $status = 'paid'): RedirectResponse
|
||||||
{
|
{
|
||||||
|
$p = \App\Models\Payment::query()
|
||||||
|
->withTrashed()
|
||||||
|
->where('company_id', $this->mollie->client->company_id)
|
||||||
|
->where('transaction_reference', $payment->id)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if($p) {
|
||||||
|
$p->status_id = Payment::STATUS_COMPLETED;
|
||||||
|
$p->save();
|
||||||
|
|
||||||
|
return redirect()->route('client.payments.show', ['payment' => $p->hashed_id]);
|
||||||
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'gateway_type_id' => GatewayType::IDEAL,
|
'gateway_type_id' => GatewayType::IDEAL,
|
||||||
'amount' => array_sum(array_column($this->mollie->payment_hash->invoices(), 'amount')) + $this->mollie->payment_hash->fee_total,
|
'amount' => array_sum(array_column($this->mollie->payment_hash->invoices(), 'amount')) + $this->mollie->payment_hash->fee_total,
|
||||||
|
@ -287,7 +287,7 @@ class MolliePaymentDriver extends BaseDriver
|
|||||||
{
|
{
|
||||||
// Allow app to catch up with webhook request.
|
// Allow app to catch up with webhook request.
|
||||||
// sleep(4);
|
// sleep(4);
|
||||||
usleep(rand(2800000, 4000000));
|
usleep(rand(1500000, 4000000));
|
||||||
|
|
||||||
$validator = Validator::make($request->all(), [
|
$validator = Validator::make($request->all(), [
|
||||||
'id' => ['required', 'starts_with:tr'],
|
'id' => ['required', 'starts_with:tr'],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user