Class: PaymentSetupSessions::PaypalCheckout

Inherits:
PaymentSetupSession
  • Object
show all
Defined in:
app/models/spree/payment_setup_sessions/paypal_checkout.rb

Instance Method Summary collapse

Instance Method Details

The approve link the storefront redirects the buyer to.



14
15
16
# File 'app/models/spree/payment_setup_sessions/paypal_checkout.rb', line 14

def approve_link
  Array(external_data&.dig('links')).find { |l| l['rel'] == 'approve' }&.dig('href')
end

#paypal_payment_token_idObject



9
10
11
# File 'app/models/spree/payment_setup_sessions/paypal_checkout.rb', line 9

def paypal_payment_token_id
  external_data&.dig('payment_token', 'id')
end

#paypal_setup_token_idObject

PayPal’s Vault API uses setup tokens (temporary) that get exchanged for permanent payment tokens once the buyer approves on PayPal.



5
6
7
# File 'app/models/spree/payment_setup_sessions/paypal_checkout.rb', line 5

def paypal_setup_token_id
  external_id
end

#successful?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/models/spree/payment_setup_sessions/paypal_checkout.rb', line 18

def successful?
  status == 'completed'
end