Class: PaypalServerSdk::SubscriptionApplicationContext
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::SubscriptionApplicationContext
- Defined in:
- lib/paypal_server_sdk/models/subscription_application_context.rb
Overview
The application context, which customizes the payer experience during the subscription approval process with PayPal.
Instance Attribute Summary collapse
-
#brand_name ⇒ String
The label that overrides the business name in the PayPal account on the PayPal site.
-
#cancel_url ⇒ String
The URL where the customer is redirected after the customer cancels the payment.
-
#locale ⇒ String
The BCP 47-formatted locale of pages that the PayPal payment experience shows.
-
#payment_method ⇒ PaymentMethod
The customer and merchant payment preferences.
-
#return_url ⇒ String
The URL where the customer is redirected after the customer approves the payment.
-
#shipping_preference ⇒ ExperienceContextShippingPreference
The location from which the shipping address is derived.
-
#user_action ⇒ ApplicationContextUserAction
Configures the label name to ‘Continue` or `Subscribe Now` for subscription consent experience.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(return_url:, cancel_url:, brand_name: SKIP, locale: SKIP, shipping_preference: ExperienceContextShippingPreference::GET_FROM_FILE, user_action: ApplicationContextUserAction::SUBSCRIBE_NOW, payment_method: SKIP) ⇒ SubscriptionApplicationContext
constructor
A new instance of SubscriptionApplicationContext.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(return_url:, cancel_url:, brand_name: SKIP, locale: SKIP, shipping_preference: ExperienceContextShippingPreference::GET_FROM_FILE, user_action: ApplicationContextUserAction::SUBSCRIBE_NOW, payment_method: SKIP) ⇒ SubscriptionApplicationContext
Returns a new instance of SubscriptionApplicationContext.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/paypal_server_sdk/models/subscription_application_context.rb', line 77 def initialize( return_url:, cancel_url:, brand_name: SKIP, locale: SKIP, shipping_preference: ExperienceContextShippingPreference::GET_FROM_FILE, user_action: ApplicationContextUserAction::SUBSCRIBE_NOW, payment_method: SKIP ) @brand_name = brand_name unless brand_name == SKIP @locale = locale unless locale == SKIP @shipping_preference = shipping_preference unless shipping_preference == SKIP @user_action = user_action unless user_action == SKIP @payment_method = payment_method unless payment_method == SKIP @return_url = return_url @cancel_url = cancel_url end |
Instance Attribute Details
#brand_name ⇒ String
The label that overrides the business name in the PayPal account on the PayPal site.
16 17 18 |
# File 'lib/paypal_server_sdk/models/subscription_application_context.rb', line 16 def brand_name @brand_name end |
#cancel_url ⇒ String
The URL where the customer is redirected after the customer cancels the payment.
46 47 48 |
# File 'lib/paypal_server_sdk/models/subscription_application_context.rb', line 46 def cancel_url @cancel_url end |
#locale ⇒ String
The BCP 47-formatted locale of pages that the PayPal payment experience shows. PayPal supports a five-character code. For example, ‘da-DK`, `he-IL`, `id-ID`, `ja-JP`, `no-NO`, `pt-BR`, `ru-RU`, `sv-SE`, `th-TH`, `zh-CN`, `zh-HK`, or `zh-TW`.
23 24 25 |
# File 'lib/paypal_server_sdk/models/subscription_application_context.rb', line 23 def locale @locale end |
#payment_method ⇒ PaymentMethod
The customer and merchant payment preferences.
36 37 38 |
# File 'lib/paypal_server_sdk/models/subscription_application_context.rb', line 36 def payment_method @payment_method end |
#return_url ⇒ String
The URL where the customer is redirected after the customer approves the payment.
41 42 43 |
# File 'lib/paypal_server_sdk/models/subscription_application_context.rb', line 41 def return_url @return_url end |
#shipping_preference ⇒ ExperienceContextShippingPreference
The location from which the shipping address is derived.
27 28 29 |
# File 'lib/paypal_server_sdk/models/subscription_application_context.rb', line 27 def shipping_preference @shipping_preference end |
#user_action ⇒ ApplicationContextUserAction
Configures the label name to ‘Continue` or `Subscribe Now` for subscription consent experience.
32 33 34 |
# File 'lib/paypal_server_sdk/models/subscription_application_context.rb', line 32 def user_action @user_action end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/paypal_server_sdk/models/subscription_application_context.rb', line 93 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. return_url = hash.key?('return_url') ? hash['return_url'] : nil cancel_url = hash.key?('cancel_url') ? hash['cancel_url'] : nil brand_name = hash.key?('brand_name') ? hash['brand_name'] : SKIP locale = hash.key?('locale') ? hash['locale'] : SKIP shipping_preference = hash['shipping_preference'] ||= ExperienceContextShippingPreference::GET_FROM_FILE user_action = hash['user_action'] ||= ApplicationContextUserAction::SUBSCRIBE_NOW payment_method = PaymentMethod.from_hash(hash['payment_method']) if hash['payment_method'] # Create object from extracted values. SubscriptionApplicationContext.new(return_url: return_url, cancel_url: cancel_url, brand_name: brand_name, locale: locale, shipping_preference: shipping_preference, user_action: user_action, payment_method: payment_method) end |
.names ⇒ Object
A mapping from model property names to API property names.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/paypal_server_sdk/models/subscription_application_context.rb', line 49 def self.names @_hash = {} if @_hash.nil? @_hash['brand_name'] = 'brand_name' @_hash['locale'] = 'locale' @_hash['shipping_preference'] = 'shipping_preference' @_hash['user_action'] = 'user_action' @_hash['payment_method'] = 'payment_method' @_hash['return_url'] = 'return_url' @_hash['cancel_url'] = 'cancel_url' @_hash end |
.nullables ⇒ Object
An array for nullable fields
73 74 75 |
# File 'lib/paypal_server_sdk/models/subscription_application_context.rb', line 73 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
62 63 64 65 66 67 68 69 70 |
# File 'lib/paypal_server_sdk/models/subscription_application_context.rb', line 62 def self.optionals %w[ brand_name locale shipping_preference user_action payment_method ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
126 127 128 129 130 131 132 |
# File 'lib/paypal_server_sdk/models/subscription_application_context.rb', line 126 def inspect class_name = self.class.name.split('::').last "<#{class_name} brand_name: #{@brand_name.inspect}, locale: #{@locale.inspect},"\ " shipping_preference: #{@shipping_preference.inspect}, user_action:"\ " #{@user_action.inspect}, payment_method: #{@payment_method.inspect}, return_url:"\ " #{@return_url.inspect}, cancel_url: #{@cancel_url.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
118 119 120 121 122 123 |
# File 'lib/paypal_server_sdk/models/subscription_application_context.rb', line 118 def to_s class_name = self.class.name.split('::').last "<#{class_name} brand_name: #{@brand_name}, locale: #{@locale}, shipping_preference:"\ " #{@shipping_preference}, user_action: #{@user_action}, payment_method: #{@payment_method},"\ " return_url: #{@return_url}, cancel_url: #{@cancel_url}>" end |