Tests for gocardless webhooks

This commit is contained in:
David Bomba 2022-11-07 21:44:07 +11:00
parent c3f84a6736
commit bc614ae178

View File

@ -52,10 +52,10 @@ class GoCardlessInstantBankPaymentTest extends TestCase
'id' => 'EV032JF67TF2', 'id' => 'EV032JF67TF2',
'links' => 'links' =>
[ [
'customer' => 'CU001ZDXYDR3', 'customer' => 'CU001DXYDR3',
'billing_request' => 'BRQ0005YJ7GHF', 'billing_request' => 'BRQ005YJ7GHF',
'customer_bank_account' => 'BA001V2111PK', 'customer_bank_account' => 'BA00V2111PK',
'mandate_request_mandate' => 'MD001W5RP7GA', 'mandate_request_mandate' => 'MD01W5RP7GA',
], ],
'action' => 'fulfilled', 'action' => 'fulfilled',
'details' => 'details' =>
@ -105,6 +105,23 @@ class GoCardlessInstantBankPaymentTest extends TestCase
{ {
$this->assertIsArray($this->mock); $this->assertIsArray($this->mock);
foreach($this->mock['events'] as $event)
{
if($event['action'] == 'fulfilled' && array_key_exists('billing_request', $event['links'])) {
$this->assertEquals('CU001DXYDR3', $event['links']['customer']);
$this->assertEquals('BRQ005YJ7GHF', $event['links']['billing_request']);
$this->assertEquals('BA00V2111PK', $event['links']['customer_bank_account']);
}
}
// mock the invoice and the payment hash
} }
} }