Skip to content

Commit

Permalink
fix(stripe): Default payment methods (#1218)
Browse files Browse the repository at this point in the history
* fix(stripe): Default payment methods

* add specs

---------

Co-authored-by: Jeremy Denquin <[email protected]>
  • Loading branch information
jdenquin and jdenquin authored Aug 4, 2023
1 parent 6ba40ab commit 2d919ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions app/services/payment_provider_customers/create_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ def create_or_update(customer_class:, payment_provider_id:, params:, async: true
if provider_customer.is_a?(PaymentProviderCustomers::StripeCustomer)
if provider_customer.persisted? && (provider_payment_methods = (params || {})[:provider_payment_methods]).present?
provider_customer.provider_payment_methods = provider_payment_methods
elsif (provider_payment_methods = (params || {})[:provider_payment_methods]).present?
provider_customer.provider_payment_methods = provider_payment_methods
else
if (provider_payment_methods = (params || {})[:provider_payment_methods]).present?
provider_customer.provider_payment_methods = provider_payment_methods
else
provider_customer.provider_payment_methods = PaymentProviderCustomers::StripeCustomer::PAYMENT_METHODS
end
provider_customer.provider_payment_methods = %w[card]
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/requests/api/v1/customers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
expect(billing[:invoice_grace_period]).to eq(3)
expect(billing[:vat_rate]).to eq(20)
expect(billing[:document_locale]).to eq('fr')
expect(billing[:provider_payment_methods]).to eq(%w[card sepa_debit])
expect(billing[:provider_payment_methods]).to eq(%w[card])
end
end
end
Expand Down

0 comments on commit 2d919ef

Please sign in to comment.