From 6141c48373b1c59adcc49124ee47d497c5245465 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 6 Jul 2017 12:45:44 +0300 Subject: [PATCH] Enable Mollie webhooks --- app/Ninja/PaymentDrivers/BasePaymentDriver.php | 3 +++ app/Ninja/PaymentDrivers/MolliePaymentDriver.php | 10 ++++++++++ .../views/accounts/account_gateway_wepay.blade.php | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/Ninja/PaymentDrivers/BasePaymentDriver.php b/app/Ninja/PaymentDrivers/BasePaymentDriver.php index b4c8f280af28..09853abe0b02 100644 --- a/app/Ninja/PaymentDrivers/BasePaymentDriver.php +++ b/app/Ninja/PaymentDrivers/BasePaymentDriver.php @@ -650,6 +650,9 @@ class BasePaymentDriver $account = $this->account(); $invitation = $this->invitation; $invoice = $this->invoice(); + if (! $invoice->canBePaid()) { + return false; + } $invoice->markSentIfUnsent(); $payment = Payment::createNew($invitation); diff --git a/app/Ninja/PaymentDrivers/MolliePaymentDriver.php b/app/Ninja/PaymentDrivers/MolliePaymentDriver.php index 2181cd4d6d77..0bc42e5d3d1a 100644 --- a/app/Ninja/PaymentDrivers/MolliePaymentDriver.php +++ b/app/Ninja/PaymentDrivers/MolliePaymentDriver.php @@ -6,6 +6,16 @@ use Exception; class MolliePaymentDriver extends BasePaymentDriver { + protected function paymentDetails($paymentMethod = false) + { + $data = parent::paymentDetails($paymentMethod); + + // Enable the webhooks + $data['notifyUrl'] = $data['returnUrl']; + + return $data; + } + public function completeOffsitePurchase($input) { $details = $this->paymentDetails(); diff --git a/resources/views/accounts/account_gateway_wepay.blade.php b/resources/views/accounts/account_gateway_wepay.blade.php index 97c358541a6e..4093d2f02ce7 100644 --- a/resources/views/accounts/account_gateway_wepay.blade.php +++ b/resources/views/accounts/account_gateway_wepay.blade.php @@ -42,7 +42,7 @@ ->radios([ trans('texts.country_United States') => ['value' => 'US'], trans('texts.country_Canada') => ['value' => 'CA'], - //trans('texts.country_United Kingdom') => ['value' => 'GB'], + trans('texts.country_United Kingdom') => ['value' => 'GB'], ]) !!}