From 895cc7d926f2578e2378540f883ee9f296c9e914 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 17 Oct 2021 13:59:43 +1100 Subject: [PATCH] Minor fixes for tests --- app/Jobs/Mail/PaymentFailureMailer.php | 2 ++ app/PaymentDrivers/Braintree/CreditCard.php | 12 +++++------- tests/MockAccountData.php | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/Jobs/Mail/PaymentFailureMailer.php b/app/Jobs/Mail/PaymentFailureMailer.php index 4b02e29742d8..a6051962e1d1 100644 --- a/app/Jobs/Mail/PaymentFailureMailer.php +++ b/app/Jobs/Mail/PaymentFailureMailer.php @@ -98,5 +98,7 @@ class PaymentFailureMailer implements ShouldQueue } }); + + //add client payment failures here. } } diff --git a/app/PaymentDrivers/Braintree/CreditCard.php b/app/PaymentDrivers/Braintree/CreditCard.php index d31b771bcf12..2455eb176e59 100644 --- a/app/PaymentDrivers/Braintree/CreditCard.php +++ b/app/PaymentDrivers/Braintree/CreditCard.php @@ -116,6 +116,11 @@ class CreditCard throw new PaymentFailed(ctrans('texts.generic_gateway_error'), $e->getCode()); } + PaymentFailureMailer::dispatch($this->braintree->client, + $e->getMessage(), + $this->braintree->client->company, + $this->braintree->payment_hash->data->amount_with_fee); + throw new PaymentFailed($e->getMessage(), $e->getCode()); } @@ -197,13 +202,6 @@ class CreditCard { PaymentFailureMailer::dispatch($this->braintree->client, $response->transaction->additionalProcessorResponse, $this->braintree->client->company, $this->braintree->payment_hash->data->amount_with_fee); - PaymentFailureMailer::dispatch( - $this->braintree->client, - $response, - $this->braintree->client->company, - $this->braintree->payment_hash->data->amount_with_fee, - ); - $message = [ 'server_response' => $response, 'data' => $this->braintree->payment_hash->data, diff --git a/tests/MockAccountData.php b/tests/MockAccountData.php index 5c2fd1066bc2..4582ab1f2dba 100644 --- a/tests/MockAccountData.php +++ b/tests/MockAccountData.php @@ -397,7 +397,7 @@ trait MockAccountData $this->quote = $this->quote_calc->getQuote(); $this->quote->status_id = Quote::STATUS_SENT; - $this->quote->number = $this->getNextQuoteNumber($this->client); + $this->quote->number = $this->getNextQuoteNumber($this->client, $this->quote); //$this->quote->service()->createInvitations()->markSent(); @@ -448,7 +448,7 @@ trait MockAccountData $this->client->service()->adjustCreditBalance($this->credit->balance)->save(); $this->credit->ledger()->updateCreditBalance($this->credit->balance)->save(); - $this->credit->number = $this->getNextCreditNumber($this->client); + $this->credit->number = $this->getNextCreditNumber($this->client, $this->credit); CreditInvitation::factory()->create([