mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for Mollie Direct Debit
This commit is contained in:
parent
6129c44421
commit
534367c80e
@ -152,11 +152,8 @@ class DirectDebit implements MethodInterface
|
||||
|
||||
public function paymentResponse(PaymentResponseRequest $request)
|
||||
{
|
||||
$token = ClientGatewayToken::find(
|
||||
$this->decodePrimaryKey($request->source)
|
||||
)->firstOrFail();
|
||||
|
||||
$this->go_cardless->ensureMandateIsReady($token);
|
||||
$this->go_cardless->ensureMandateIsReady($request->source);
|
||||
|
||||
try {
|
||||
$payment = $this->go_cardless->gateway->payments()->create([
|
||||
@ -167,14 +164,14 @@ class DirectDebit implements MethodInterface
|
||||
'payment_hash' => $this->go_cardless->payment_hash->hash,
|
||||
],
|
||||
'links' => [
|
||||
'mandate' => $token->token,
|
||||
'mandate' => $request->source,
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
|
||||
if ($payment->status === 'pending_submission') {
|
||||
return $this->processPendingPayment($payment, ['token' => $token->hashed_id]);
|
||||
return $this->processPendingPayment($payment, ['token' => $request->source]);
|
||||
}
|
||||
|
||||
return $this->processUnsuccessfulPayment($payment);
|
||||
|
@ -265,10 +265,11 @@ class GoCardlessPaymentDriver extends BaseDriver
|
||||
return response()->json([], 200);
|
||||
}
|
||||
|
||||
public function ensureMandateIsReady(ClientGatewayToken $cgt)
|
||||
public function ensureMandateIsReady($token)
|
||||
{
|
||||
try {
|
||||
$mandate = $this->gateway->mandates()->get($cgt->token);
|
||||
$this->init();
|
||||
$mandate = $this->gateway->mandates()->get($token);
|
||||
|
||||
if ($mandate->status !== 'active') {
|
||||
throw new \Exception(ctrans('texts.gocardless_mandate_not_ready'));
|
||||
|
Loading…
x
Reference in New Issue
Block a user