Changeset View
Changeset View
Standalone View
Standalone View
src/app/Providers/Payment/Mollie.php
Show First 20 Lines • Show All 430 Lines • ▼ Show 20 Lines | public function webhook(): int | ||||
$payment->save(); | $payment->save(); | ||||
} | } | ||||
if (!empty($credit)) { | if (!empty($credit)) { | ||||
self::creditPayment($payment, $mollie_payment); | self::creditPayment($payment, $mollie_payment); | ||||
} | } | ||||
foreach ($refunds as $refund) { | foreach ($refunds as $refund) { | ||||
$this->storeRefund($payment->wallet, $refund); | $payment->refund($refund); | ||||
} | } | ||||
DB::commit(); | DB::commit(); | ||||
if (!empty($notify)) { | if (!empty($notify)) { | ||||
\App\Jobs\PaymentEmail::dispatch($payment); | \App\Jobs\PaymentEmail::dispatch($payment); | ||||
} | } | ||||
} catch (\Mollie\Api\Exceptions\ApiException $e) { | } catch (\Mollie\Api\Exceptions\ApiException $e) { | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | class Mollie extends \App\Providers\PaymentProvider | ||||
{ | { | ||||
// Extract the payment method for transaction description | // Extract the payment method for transaction description | ||||
$method = self::paymentMethod($mollie_payment, 'Mollie'); | $method = self::paymentMethod($mollie_payment, 'Mollie'); | ||||
// TODO: Localization? | // TODO: Localization? | ||||
$description = $payment->type == self::TYPE_RECURRING ? 'Auto-payment' : 'Payment'; | $description = $payment->type == self::TYPE_RECURRING ? 'Auto-payment' : 'Payment'; | ||||
$description .= " transaction {$payment->id} using {$method}"; | $description .= " transaction {$payment->id} using {$method}"; | ||||
$payment->wallet->credit($payment->amount, $description); | $payment->wallet->credit($payment, $description); | ||||
// Unlock the disabled auto-payment mandate | // Unlock the disabled auto-payment mandate | ||||
if ($payment->wallet->balance >= 0) { | if ($payment->wallet->balance >= 0) { | ||||
$payment->wallet->setSetting('mandate_disabled', null); | $payment->wallet->setSetting('mandate_disabled', null); | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 112 Lines • Show Last 20 Lines |