From bc614ae17863039bebf9c3119d17fafad7bc268a Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 7 Nov 2022 21:44:07 +1100 Subject: [PATCH] Tests for gocardless webhooks --- .../GoCardlessInstantBankPaymentTest.php | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/tests/Feature/GoCardlessInstantBankPaymentTest.php b/tests/Feature/GoCardlessInstantBankPaymentTest.php index 1e4b665c91e6..7a7148f35754 100644 --- a/tests/Feature/GoCardlessInstantBankPaymentTest.php +++ b/tests/Feature/GoCardlessInstantBankPaymentTest.php @@ -52,10 +52,10 @@ class GoCardlessInstantBankPaymentTest extends TestCase 'id' => 'EV032JF67TF2', 'links' => [ - 'customer' => 'CU001ZDXYDR3', - 'billing_request' => 'BRQ0005YJ7GHF', - 'customer_bank_account' => 'BA001V2111PK', - 'mandate_request_mandate' => 'MD001W5RP7GA', + 'customer' => 'CU001DXYDR3', + 'billing_request' => 'BRQ005YJ7GHF', + 'customer_bank_account' => 'BA00V2111PK', + 'mandate_request_mandate' => 'MD01W5RP7GA', ], 'action' => 'fulfilled', 'details' => @@ -105,6 +105,23 @@ class GoCardlessInstantBankPaymentTest extends TestCase { $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 + + } }