Arie/serveme

View on GitHub
app/views/orders/_form.html.haml

Summary

Maintainability
Test Coverage
- @products.each do |product|
  .hidden{id: "product-#{product.id}", data: { product_id: product.id, currency: product.currency, price: (product.price * 100).round } }

.card.text-white.bg-primary
  .card-body
    %h5 Payment method
    .btn-group{role: "group"}
      %button{type: "button", class: "btn btn-primary payment-method paypal-button selected"}
        PayPal
      %button{type: "button", class: "btn btn-primary payment-method credit-card-button"}
        Credit or Debit Card

    = simple_form_for(@order, data: { turbo: false }) do |f|
      .row.credit-card-row
        .col-md-12
          #stripe-card
          #stripe-errors

          .row
            .col-md-12.offset-md-4
              .stripe-logo= image_tag "powered_by_stripe.png"

      = f.input :payer_id, as: :hidden

      .row
        .col-md-12
          %h5 Product
          = f.input :product_id, collection: @products, label_method: :list_name, label: false, include_blank: false

          %h5 Gift or personal
          = f.input :gift, as: "radio_buttons", label: "", collection: [["Personal, add premium to my account", false], ["Gift, receive a sharable premium code", true]], checked: false

      .row
        .col-md-12.text-center
          %button.btn.btn-success.submit{type: :submit}
            Buy