From 8105f0ebf3b8aeceb36d3e9def9a897cf2bc973a Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Tue, 30 Nov 2021 13:25:42 +0000 Subject: [PATCH] Simplify partial selecting and rename stripe_sca partial --- app/views/split_checkout/_payment.html.haml | 7 ++----- .../payment/{_stripe.html.haml => _stripe_sca.html.haml} | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) rename app/views/split_checkout/payment/{_stripe.html.haml => _stripe_sca.html.haml} (95%) diff --git a/app/views/split_checkout/_payment.html.haml b/app/views/split_checkout/_payment.html.haml index 32c0478671..18459a21a2 100644 --- a/app/views/split_checkout/_payment.html.haml +++ b/app/views/split_checkout/_payment.html.haml @@ -21,12 +21,9 @@ - if payment_method.description && !payment_method.description.empty? .paymentmethod-description.panel #{payment_method.description} + .paymentmethod-form - - if payment_method.method_type == "stripe_sca" - - method = "stripe" - -else - - method = payment_method.method_type - = render partial: "split_checkout/payment/#{method}", locals: { payment_method: payment_method, f: f } + = render partial: "split_checkout/payment/#{payment_method.method_type}", locals: { payment_method: payment_method, f: f } %div.checkout-substep = t("split_checkout.step2.explaination") diff --git a/app/views/split_checkout/payment/_stripe.html.haml b/app/views/split_checkout/payment/_stripe_sca.html.haml similarity index 95% rename from app/views/split_checkout/payment/_stripe.html.haml rename to app/views/split_checkout/payment/_stripe_sca.html.haml index a52152ad1f..0931b81e64 100644 --- a/app/views/split_checkout/payment/_stripe.html.haml +++ b/app/views/split_checkout/payment/_stripe_sca.html.haml @@ -8,7 +8,7 @@ .checkout-input %label = t('split_checkout.step2.form.stripe.use_saved_card') - = select_tag :card, options_for_select(@saved_credit_cards.map {|cc| [ "#{cc.brand} #{cc.last_digits} #{I18n.t(:card_expiry_abbreviation)}:#{cc.month.to_s.rjust(2, '0')}/#{cc.year}", cc.id ] } + [[t('split_checkout.step2.form.stripe.create_new_card'), ""]], @selected_card), { "data-action": "change->stripe#onSelectCard", "data-stripe-target": "select" } + = select_tag :card, options_for_select(@saved_credit_cards.map {|cc| [ "#{cc.brand} #{cc.last_digits} #{I18n.t(:card_expiry_abbreviation)}:#{cc.month.to_s.rjust(2, '0')}/#{cc.year}", cc.id ] } + [[t('split_checkout.step2.form.stripe.create_new_card'), ""]], @selected_card), { "data-action": "change->stripe#onSelectCard", "data-stripe-target": "select" } .checkout-input{"data-stripe-target": "stripeelements"} - if @saved_credit_cards.length == 0