Class: PaypalServerSdk::ApplicationContextUserAction

Inherits:
Object
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/application_context_user_action.rb

Overview

Configures the label name to ‘Continue` or `Subscribe Now` for subscription consent experience.

Constant Summary collapse

APPLICATION_CONTEXT_USER_ACTION =
[
  # After you redirect the customer to the PayPal subscription consent page,

  # a Continue button appears. Use this option when you want to control the

  # activation of the subscription and do not want PayPal to activate the

  # subscription.

  CONTINUE = 'CONTINUE'.freeze,

  # After you redirect the customer to the PayPal subscription consent page,

  # a Subscribe Now button appears. Use this option when you want PayPal to

  # activate the subscription.

  SUBSCRIBE_NOW = 'SUBSCRIBE_NOW'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = CONTINUE) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/paypal_server_sdk/models/application_context_user_action.rb', line 29

def self.from_value(value, default_value = CONTINUE)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'continue' then CONTINUE
  when 'subscribe_now' then SUBSCRIBE_NOW
  else
    default_value
  end
end

.validate(value) ⇒ Object



23
24
25
26
27
# File 'lib/paypal_server_sdk/models/application_context_user_action.rb', line 23

def self.validate(value)
  return false if value.nil?

  true
end