Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/services/spree_stripe/create_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def call
when 'customer_balance', 'us_bank_account'
SpreeStripe::PaymentSources::BankTransfer.create!(source_params)
else
raise "[STRIPE] Unknown payment method #{stripe_payment_method_details.type}"
Spree::PaymentSource.create!(source_params)
end
end

Expand Down
20 changes: 20 additions & 0 deletions spec/services/spree_stripe/create_source_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,5 +227,25 @@
expect(subject).to be_a(SpreeStripe::PaymentSources::Link)
end
end

context 'if source is cashapp' do
let(:payment_method_details) { Stripe::StripeObject.construct_from(type: 'cashapp') }

it 'creates a generic PaymentSource' do
expect(subject).to be_a(Spree::PaymentSource)
expect(subject.gateway_payment_profile_id).to eq source_id
expect(subject.payment_method).to eq gateway
end
end

context 'if source is an unknown type' do
let(:payment_method_details) { Stripe::StripeObject.construct_from(type: 'some_future_method') }

it 'creates a generic PaymentSource' do
expect(subject).to be_a(Spree::PaymentSource)
expect(subject.gateway_payment_profile_id).to eq source_id
expect(subject.payment_method).to eq gateway
end
end
end
end
Loading