Doc defensive coding needed by pin payments

[skip ci]
This commit is contained in:
Pau Perez
2020-07-15 16:46:09 +02:00
parent 31e072179b
commit 4e00c45782

View File

@@ -33,6 +33,11 @@ module Checkout
@params[:order][:payments_attributes].first[:source_attributes] = payment_source_params
end
# Ensures cc_type is always passed to the model by inferring the type when
# the frontend didn't provide it. This fixes Pin Payments specifically
# although it might be useful for future payment gateways.
#
# More details: app/assets/javascripts/darkswarm/services/checkout.js.coffee#L70-L98
def fill_in_card_type
return unless payment_source_attributes