Class: SpreePaypalCheckout::SetupTokenPresenter
- Inherits:
-
Object
- Object
- SpreePaypalCheckout::SetupTokenPresenter
- Defined in:
- app/presenters/spree_paypal_checkout/setup_token_presenter.rb
Overview
Builds the body of a PayPal Vault /v3/vault/setup-tokens request for tokenizing a buyer’s PayPal account without an immediate purchase.
Instance Method Summary collapse
-
#initialize(customer:, return_url:, cancel_url:) ⇒ SetupTokenPresenter
constructor
A new instance of SetupTokenPresenter.
- #to_h ⇒ Object
Constructor Details
#initialize(customer:, return_url:, cancel_url:) ⇒ SetupTokenPresenter
Returns a new instance of SetupTokenPresenter.
5 6 7 8 9 |
# File 'app/presenters/spree_paypal_checkout/setup_token_presenter.rb', line 5 def initialize(customer:, return_url:, cancel_url:) @customer = customer @return_url = return_url @cancel_url = cancel_url end |
Instance Method Details
#to_h ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/presenters/spree_paypal_checkout/setup_token_presenter.rb', line 11 def to_h { 'body' => { 'payment_source' => { 'paypal' => { 'usage_type' => 'MERCHANT', 'experience_context' => { 'return_url' => return_url, 'cancel_url' => cancel_url } } } }.merge(customer_payload) } end |