From 2f03a13d34c7e7680cfc991235d4d8ed560ea4ac Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 6 Aug 2024 18:57:19 +1000 Subject: [PATCH] Fixes for paypal in subscriptions --- app/Livewire/BillingPortalPurchase.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/Livewire/BillingPortalPurchase.php b/app/Livewire/BillingPortalPurchase.php index 079a36325e80..ea37099bb55d 100644 --- a/app/Livewire/BillingPortalPurchase.php +++ b/app/Livewire/BillingPortalPurchase.php @@ -356,15 +356,14 @@ class BillingPortalPurchase extends Component $this->methods = $contact->client->service()->getPaymentMethods($this->price); - foreach($this->methods as $method){ - - if($method['is_paypal'] == '1' && !$this->steps['check_rff']){ - $this->rff(); - break; - } - - } + $method_values = array_column($this->methods, 'is_paypal'); + $is_paypal = in_array('1', $method_values); + if($is_paypal && !$this->steps['check_rff']) + $this->rff(); + elseif(!$is_paypal && !$this->steps['check_rff']) + $this->steps['fetched_payment_methods'] = true; + $this->heading_text = ctrans('texts.payment_methods'); return $this;