mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Rename Stripe existing_card param key to existing_card_id
This commit is contained in:
@@ -62,7 +62,7 @@ Darkswarm.factory 'Checkout', ($injector, CurrentOrder, ShippingMethods, StripeE
|
||||
if @paymentMethod()?.method_type == 'stripe'
|
||||
if @secrets.selected_card
|
||||
angular.extend munged_order, {
|
||||
existing_card: @secrets.selected_card
|
||||
existing_card_id: @secrets.selected_card
|
||||
}
|
||||
else
|
||||
angular.extend munged_order.payments_attributes[0], {
|
||||
|
||||
@@ -119,7 +119,7 @@ class CheckoutController < Spree::CheckoutController
|
||||
if (params[:order][:payments_attributes])
|
||||
params[:order][:payments_attributes].first[:amount] = @order.total
|
||||
end
|
||||
if params[:order][:existing_card]
|
||||
if params[:order][:existing_card_id]
|
||||
construct_saved_card_attributes
|
||||
end
|
||||
params[:order]
|
||||
@@ -207,7 +207,7 @@ class CheckoutController < Spree::CheckoutController
|
||||
end
|
||||
|
||||
def construct_saved_card_attributes
|
||||
existing_card_id = params[:order].delete(:existing_card)
|
||||
existing_card_id = params[:order].delete(:existing_card_id)
|
||||
return if existing_card_id.blank?
|
||||
|
||||
credit_card = Spree::CreditCard.find(existing_card_id)
|
||||
|
||||
@@ -208,4 +208,4 @@ describe 'Checkout service', ->
|
||||
Checkout.secrets.selected_card = 1
|
||||
source_attributes = Checkout.preprocess()
|
||||
expect(source_attributes).toBeDefined()
|
||||
expect(source_attributes.existing_card).toBe 1
|
||||
expect(source_attributes.existing_card_id).toBe 1
|
||||
|
||||
@@ -176,7 +176,7 @@ describe "Submitting Stripe Connect charge requests", type: :request do
|
||||
let(:charge_response_mock) { { status: 200, body: JSON.generate(id: "ch_1234", object: "charge", amount: 2000) } }
|
||||
|
||||
before do
|
||||
params[:order][:existing_card] = credit_card.id
|
||||
params[:order][:existing_card_id] = credit_card.id
|
||||
quick_login_as(order.user)
|
||||
|
||||
# Requests a token
|
||||
|
||||
Reference in New Issue
Block a user