Module: SolidusBraintree::BraintreeCheckoutHelper
- Defined in:
- lib/generators/solidus_braintree/install/templates/app/helpers/solidus_braintree/braintree_checkout_helper.rb
Instance Method Summary collapse
- #braintree_3ds_options_for(order) ⇒ Object
- #paypal_button_preference(key, store:) ⇒ Object
- #venmo_button_asset_url(style, active: false) ⇒ Object
- #venmo_button_style(store) ⇒ Object
Instance Method Details
#braintree_3ds_options_for(order) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/generators/solidus_braintree/install/templates/app/helpers/solidus_braintree/braintree_checkout_helper.rb', line 5 def (order) ship_address = SolidusBraintree::Address.new(order.ship_address) bill_address = SolidusBraintree::Address.new(order.bill_address) { nonce: nil, # populated after tokenization bin: nil, # populated after tokenization onLookupComplete: nil, # populated after tokenization amount: order.total, email: order.email, billingAddress: { givenName: bill_address.firstname, surname: bill_address.lastname, phoneNumber: bill_address.phone, streetAddress: bill_address.address1, extendedAddress: bill_address.address2, locality: bill_address.city, region: bill_address.state&.abbr, postalCode: bill_address.zipcode, countryCodeAlpha2: bill_address.country&.iso, }, additionalInformation: { shippingGivenName: ship_address.firstname, shippingSurname: ship_address.lastname, shippingPhone: ship_address.phone, shippingAddress: { streedAddress: ship_address.address1, extendedAddress: ship_address.address2, locality: ship_address.city, region: ship_address.state&.abbr, postalCode: ship_address.zipcode, countryCodeAlpha2: ship_address.country&.iso, } } } end |
#paypal_button_preference(key, store:) ⇒ Object
41 42 43 |
# File 'lib/generators/solidus_braintree/install/templates/app/helpers/solidus_braintree/braintree_checkout_helper.rb', line 41 def (key, store:) store.braintree_configuration.preferences[key] end |
#venmo_button_asset_url(style, active: false) ⇒ Object
53 54 55 56 57 58 |
# File 'lib/generators/solidus_braintree/install/templates/app/helpers/solidus_braintree/braintree_checkout_helper.rb', line 53 def (style, active: false) prefix = 'solidus_braintree/venmo/venmo_' active_string = active ? 'active_' : '' path = "#{prefix}#{active_string}#{style[:color]}_button_#{style[:width]}x48.svg" asset_path(path) end |
#venmo_button_style(store) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/generators/solidus_braintree/install/templates/app/helpers/solidus_braintree/braintree_checkout_helper.rb', line 45 def (store) configuration = store.braintree_configuration color = configuration. width = configuration. { width: width, color: color } end |