mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for mollie webhooks if a payment isn't created
This commit is contained in:
parent
6c7e150bec
commit
ca2932862d
@ -86,7 +86,9 @@ class Bancontact implements MethodInterface
|
||||
'webhookUrl' => $this->mollie->company_gateway->webhookUrl(),
|
||||
'metadata' => [
|
||||
'client_id' => $this->mollie->client->hashed_id,
|
||||
'hash' => $this->mollie->payment_hash->hash
|
||||
'hash' => $this->mollie->payment_hash->hash,
|
||||
'gateway_type_id' => GatewayType::BANCONTACT,
|
||||
'payment_type_id' => PaymentType::BANCONTACT,
|
||||
],
|
||||
]);
|
||||
|
||||
|
@ -89,7 +89,9 @@ class BankTransfer implements MethodInterface
|
||||
'webhookUrl' => $this->mollie->company_gateway->webhookUrl(),
|
||||
'metadata' => [
|
||||
'client_id' => $this->mollie->client->hashed_id,
|
||||
'hash' => $this->mollie->payment_hash->hash
|
||||
'hash' => $this->mollie->payment_hash->hash,
|
||||
'gateway_type_id' => GatewayType::BANK_TRANSFER,
|
||||
'payment_type_id' => PaymentType::MOLLIE_BANK_TRANSFER,
|
||||
],
|
||||
]);
|
||||
|
||||
|
@ -114,7 +114,7 @@ class CreditCard
|
||||
'name' => $this->mollie->client->name,
|
||||
'email' => $this->mollie->client->present()->email(),
|
||||
'metadata' => [
|
||||
'id' => $this->mollie->client->hashed_id,
|
||||
'id' => $this->mollie->client->hashed_id
|
||||
],
|
||||
]);
|
||||
|
||||
|
@ -86,7 +86,9 @@ class IDEAL implements MethodInterface
|
||||
'webhookUrl' => $this->mollie->company_gateway->webhookUrl(),
|
||||
'metadata' => [
|
||||
'client_id' => $this->mollie->client->hashed_id,
|
||||
'hash' => $this->mollie->payment_hash->hash
|
||||
'hash' => $this->mollie->payment_hash->hash,
|
||||
'gateway_type_id' => GatewayType::IDEAL,
|
||||
'payment_type_id' => PaymentType::IDEAL,
|
||||
],
|
||||
]);
|
||||
|
||||
|
@ -86,7 +86,9 @@ class KBC implements MethodInterface
|
||||
'webhookUrl' => $this->mollie->company_gateway->webhookUrl(),
|
||||
'metadata' => [
|
||||
'client_id' => $this->mollie->client->hashed_id,
|
||||
'hash' => $this->mollie->payment_hash->hash
|
||||
'hash' => $this->mollie->payment_hash->hash,
|
||||
'gateway_type_id' => GatewayType::KBC,
|
||||
'payment_type_id' => PaymentType::KBC,
|
||||
],
|
||||
]);
|
||||
|
||||
|
@ -312,14 +312,32 @@ class MolliePaymentDriver extends BaseDriver
|
||||
$client = $record->client;
|
||||
}
|
||||
else{
|
||||
nlog("mollie webhook");
|
||||
nlog($payment);
|
||||
|
||||
$client = Client::withTrashed()->find($this->decodePrimaryKey($payment->metadata->client_id));
|
||||
|
||||
// sometimes if the user is not returned to the site with a response from Mollie
|
||||
// we may not have a payment record - in these cases we need to re-construct the payment
|
||||
// record from the meta data in the payment hash.
|
||||
|
||||
if($payment && $payment->metadata->payment_hash){
|
||||
|
||||
/* Harvest Payment Hash*/
|
||||
$payment_hash = PaymentHash::where('hash', $payment->metadata->hash)->first();
|
||||
|
||||
|
||||
$data = [
|
||||
'gateway_type_id' => $payment->metadata->gateway_type_id,
|
||||
'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,
|
||||
];
|
||||
|
||||
$record = $this->createPayment(
|
||||
$data,
|
||||
$codes[$payment->status]
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$message = [
|
||||
|
Loading…
x
Reference in New Issue
Block a user