paypal-server-sdk 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +42 -36
- data/lib/paypal_server_sdk/controllers/base_controller.rb +1 -1
- data/lib/paypal_server_sdk/controllers/orders_controller.rb +211 -171
- data/lib/paypal_server_sdk/controllers/payments_controller.rb +95 -92
- data/lib/paypal_server_sdk/controllers/vault_controller.rb +81 -81
- data/lib/paypal_server_sdk/exceptions/error_exception.rb +5 -3
- data/lib/paypal_server_sdk/exceptions/o_auth_provider_exception.rb +5 -3
- data/lib/paypal_server_sdk/models/apple_pay_attributes.rb +2 -1
- data/lib/paypal_server_sdk/models/apple_pay_experience_context.rb +68 -0
- data/lib/paypal_server_sdk/models/apple_pay_request.rb +18 -4
- data/lib/paypal_server_sdk/models/callback_configuration.rb +1 -2
- data/lib/paypal_server_sdk/models/card_brand.rb +1 -1
- data/lib/paypal_server_sdk/models/card_customer_information.rb +14 -4
- data/lib/paypal_server_sdk/models/customer_information.rb +16 -5
- data/lib/paypal_server_sdk/models/customer_response.rb +1 -2
- data/lib/paypal_server_sdk/models/google_pay_experience_context.rb +68 -0
- data/lib/paypal_server_sdk/models/google_pay_request.rb +17 -4
- data/lib/paypal_server_sdk/models/item.rb +14 -4
- data/lib/paypal_server_sdk/models/line_item.rb +22 -11
- data/lib/paypal_server_sdk/models/order_billing_plan.rb +93 -0
- data/lib/paypal_server_sdk/models/order_status.rb +5 -5
- data/lib/paypal_server_sdk/models/payment_token_response.rb +1 -2
- data/lib/paypal_server_sdk/models/paypal_wallet_contact_preference.rb +34 -0
- data/lib/paypal_server_sdk/models/paypal_wallet_customer.rb +14 -4
- data/lib/paypal_server_sdk/models/paypal_wallet_customer_request.rb +14 -4
- data/lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb +20 -6
- data/lib/paypal_server_sdk/models/shipping_options_purchase_unit.rb +24 -5
- data/lib/paypal_server_sdk/models/vault_customer.rb +15 -5
- data/lib/paypal_server_sdk/models/vault_response.rb +2 -1
- data/lib/paypal_server_sdk/models/vault_response_customer.rb +1 -1
- data/lib/paypal_server_sdk/models/venmo_wallet_customer_information.rb +24 -4
- data/lib/paypal_server_sdk.rb +149 -145
- metadata +6 -2
@@ -0,0 +1,93 @@
|
|
1
|
+
# paypal_server_sdk
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module PaypalServerSdk
|
7
|
+
# Metadata for merchant-managed recurring billing plans. Valid only during the
|
8
|
+
# saved payment method token or billing agreement creation.
|
9
|
+
class OrderBillingPlan < BaseModel
|
10
|
+
SKIP = Object.new
|
11
|
+
private_constant :SKIP
|
12
|
+
|
13
|
+
# An array of billing cycles for trial billing and regular billing. A plan
|
14
|
+
# can have at most two trial cycles and only one regular cycle.
|
15
|
+
# @return [Array[BillingCycle]]
|
16
|
+
attr_accessor :billing_cycles
|
17
|
+
|
18
|
+
# The currency and amount for a financial transaction, such as a balance or
|
19
|
+
# payment due.
|
20
|
+
# @return [Money]
|
21
|
+
attr_accessor :setup_fee
|
22
|
+
|
23
|
+
# Name of the recurring plan.
|
24
|
+
# @return [String]
|
25
|
+
attr_accessor :name
|
26
|
+
|
27
|
+
# A mapping from model property names to API property names.
|
28
|
+
def self.names
|
29
|
+
@_hash = {} if @_hash.nil?
|
30
|
+
@_hash['billing_cycles'] = 'billing_cycles'
|
31
|
+
@_hash['setup_fee'] = 'setup_fee'
|
32
|
+
@_hash['name'] = 'name'
|
33
|
+
@_hash
|
34
|
+
end
|
35
|
+
|
36
|
+
# An array for optional fields
|
37
|
+
def self.optionals
|
38
|
+
%w[
|
39
|
+
setup_fee
|
40
|
+
name
|
41
|
+
]
|
42
|
+
end
|
43
|
+
|
44
|
+
# An array for nullable fields
|
45
|
+
def self.nullables
|
46
|
+
[]
|
47
|
+
end
|
48
|
+
|
49
|
+
def initialize(billing_cycles:, setup_fee: SKIP, name: SKIP)
|
50
|
+
@billing_cycles = billing_cycles
|
51
|
+
@setup_fee = setup_fee unless setup_fee == SKIP
|
52
|
+
@name = name unless name == SKIP
|
53
|
+
end
|
54
|
+
|
55
|
+
# Creates an instance of the object from a hash.
|
56
|
+
def self.from_hash(hash)
|
57
|
+
return nil unless hash
|
58
|
+
|
59
|
+
# Extract variables from the hash.
|
60
|
+
# Parameter is an array, so we need to iterate through it
|
61
|
+
billing_cycles = nil
|
62
|
+
unless hash['billing_cycles'].nil?
|
63
|
+
billing_cycles = []
|
64
|
+
hash['billing_cycles'].each do |structure|
|
65
|
+
billing_cycles << (BillingCycle.from_hash(structure) if structure)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
billing_cycles = nil unless hash.key?('billing_cycles')
|
70
|
+
setup_fee = Money.from_hash(hash['setup_fee']) if hash['setup_fee']
|
71
|
+
name = hash.key?('name') ? hash['name'] : SKIP
|
72
|
+
|
73
|
+
# Create object from extracted values.
|
74
|
+
OrderBillingPlan.new(billing_cycles: billing_cycles,
|
75
|
+
setup_fee: setup_fee,
|
76
|
+
name: name)
|
77
|
+
end
|
78
|
+
|
79
|
+
# Provides a human-readable string representation of the object.
|
80
|
+
def to_s
|
81
|
+
class_name = self.class.name.split('::').last
|
82
|
+
"<#{class_name} billing_cycles: #{@billing_cycles}, setup_fee: #{@setup_fee}, name:"\
|
83
|
+
" #{@name}>"
|
84
|
+
end
|
85
|
+
|
86
|
+
# Provides a debugging-friendly string with detailed object information.
|
87
|
+
def inspect
|
88
|
+
class_name = self.class.name.split('::').last
|
89
|
+
"<#{class_name} billing_cycles: #{@billing_cycles.inspect}, setup_fee:"\
|
90
|
+
" #{@setup_fee.inspect}, name: #{@name.inspect}>"
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -23,11 +23,11 @@ module PaypalServerSdk
|
|
23
23
|
# All purchase units in the order are voided.
|
24
24
|
VOIDED = 'VOIDED'.freeze,
|
25
25
|
|
26
|
-
# The intent of the
|
27
|
-
# created.
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
26
|
+
# The intent of the order was completed and a `payments` resource was
|
27
|
+
# created. Important: Check the payment status in
|
28
|
+
# `purchase_units[].payments.captures[].status` before fulfilling the
|
29
|
+
# order. A completed order can indicate a payment was authorized, an
|
30
|
+
# authorized payment was captured, or a payment was declined.
|
31
31
|
COMPLETED = 'COMPLETED'.freeze,
|
32
32
|
|
33
33
|
# The order requires an action from the payer (e.g. 3DS authentication).
|
@@ -13,8 +13,7 @@ module PaypalServerSdk
|
|
13
13
|
# @return [String]
|
14
14
|
attr_accessor :id
|
15
15
|
|
16
|
-
#
|
17
|
-
# profiles, save payment methods and contact details.
|
16
|
+
# Customer in merchant's or partner's system of records.
|
18
17
|
# @return [CustomerResponse]
|
19
18
|
attr_accessor :customer
|
20
19
|
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# paypal_server_sdk
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module PaypalServerSdk
|
7
|
+
# The preference to display the contact information (buyer’s shipping email &
|
8
|
+
# phone number) on PayPal's checkout for easy merchant-buyer communication.
|
9
|
+
class PaypalWalletContactPreference
|
10
|
+
PAYPAL_WALLET_CONTACT_PREFERENCE = [
|
11
|
+
# The merchant can opt out of showing buyer's contact information on
|
12
|
+
# PayPal checkout.
|
13
|
+
NO_CONTACT_INFO = 'NO_CONTACT_INFO'.freeze,
|
14
|
+
|
15
|
+
# The merchant allows buyer to add or update shipping contact information
|
16
|
+
# on the PayPal checkout. Please ensure to use this updated information
|
17
|
+
# returned in shipping.email_address and shipping.phone_number to contact
|
18
|
+
# your buyers.
|
19
|
+
UPDATE_CONTACT_INFO = 'UPDATE_CONTACT_INFO'.freeze,
|
20
|
+
|
21
|
+
# The buyer can only see but can not override merchant passed contact
|
22
|
+
# information (shipping.email_address and shipping.phone_number) on PayPal
|
23
|
+
# checkout. NOTE: If you don't pass the contact information, the behavior
|
24
|
+
# is the same as NO_CONTACT_INFO preference.
|
25
|
+
RETAIN_CONTACT_INFO = 'RETAIN_CONTACT_INFO'.freeze
|
26
|
+
].freeze
|
27
|
+
|
28
|
+
def self.validate(value)
|
29
|
+
return false if value.nil?
|
30
|
+
|
31
|
+
true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -24,6 +24,10 @@ module PaypalServerSdk
|
|
24
24
|
# @return [PhoneWithType]
|
25
25
|
attr_accessor :phone
|
26
26
|
|
27
|
+
# The name of the party.
|
28
|
+
# @return [Name]
|
29
|
+
attr_accessor :name
|
30
|
+
|
27
31
|
# Merchants and partners may already have a data-store where their customer
|
28
32
|
# information is persisted. Use merchant_customer_id to associate the
|
29
33
|
# PayPal-generated customer.id to your representation of a customer.
|
@@ -36,6 +40,7 @@ module PaypalServerSdk
|
|
36
40
|
@_hash['id'] = 'id'
|
37
41
|
@_hash['email_address'] = 'email_address'
|
38
42
|
@_hash['phone'] = 'phone'
|
43
|
+
@_hash['name'] = 'name'
|
39
44
|
@_hash['merchant_customer_id'] = 'merchant_customer_id'
|
40
45
|
@_hash
|
41
46
|
end
|
@@ -46,6 +51,7 @@ module PaypalServerSdk
|
|
46
51
|
id
|
47
52
|
email_address
|
48
53
|
phone
|
54
|
+
name
|
49
55
|
merchant_customer_id
|
50
56
|
]
|
51
57
|
end
|
@@ -55,11 +61,12 @@ module PaypalServerSdk
|
|
55
61
|
[]
|
56
62
|
end
|
57
63
|
|
58
|
-
def initialize(id: SKIP, email_address: SKIP, phone: SKIP,
|
64
|
+
def initialize(id: SKIP, email_address: SKIP, phone: SKIP, name: SKIP,
|
59
65
|
merchant_customer_id: SKIP)
|
60
66
|
@id = id unless id == SKIP
|
61
67
|
@email_address = email_address unless email_address == SKIP
|
62
68
|
@phone = phone unless phone == SKIP
|
69
|
+
@name = name unless name == SKIP
|
63
70
|
@merchant_customer_id = merchant_customer_id unless merchant_customer_id == SKIP
|
64
71
|
end
|
65
72
|
|
@@ -71,6 +78,7 @@ module PaypalServerSdk
|
|
71
78
|
id = hash.key?('id') ? hash['id'] : SKIP
|
72
79
|
email_address = hash.key?('email_address') ? hash['email_address'] : SKIP
|
73
80
|
phone = PhoneWithType.from_hash(hash['phone']) if hash['phone']
|
81
|
+
name = Name.from_hash(hash['name']) if hash['name']
|
74
82
|
merchant_customer_id =
|
75
83
|
hash.key?('merchant_customer_id') ? hash['merchant_customer_id'] : SKIP
|
76
84
|
|
@@ -78,21 +86,23 @@ module PaypalServerSdk
|
|
78
86
|
PaypalWalletCustomer.new(id: id,
|
79
87
|
email_address: email_address,
|
80
88
|
phone: phone,
|
89
|
+
name: name,
|
81
90
|
merchant_customer_id: merchant_customer_id)
|
82
91
|
end
|
83
92
|
|
84
93
|
# Provides a human-readable string representation of the object.
|
85
94
|
def to_s
|
86
95
|
class_name = self.class.name.split('::').last
|
87
|
-
"<#{class_name} id: #{@id}, email_address: #{@email_address}, phone: #{@phone},"\
|
88
|
-
" merchant_customer_id: #{@merchant_customer_id}>"
|
96
|
+
"<#{class_name} id: #{@id}, email_address: #{@email_address}, phone: #{@phone}, name:"\
|
97
|
+
" #{@name}, merchant_customer_id: #{@merchant_customer_id}>"
|
89
98
|
end
|
90
99
|
|
91
100
|
# Provides a debugging-friendly string with detailed object information.
|
92
101
|
def inspect
|
93
102
|
class_name = self.class.name.split('::').last
|
94
103
|
"<#{class_name} id: #{@id.inspect}, email_address: #{@email_address.inspect}, phone:"\
|
95
|
-
" #{@phone.inspect},
|
104
|
+
" #{@phone.inspect}, name: #{@name.inspect}, merchant_customer_id:"\
|
105
|
+
" #{@merchant_customer_id.inspect}>"
|
96
106
|
end
|
97
107
|
end
|
98
108
|
end
|
@@ -24,6 +24,10 @@ module PaypalServerSdk
|
|
24
24
|
# @return [PhoneWithType]
|
25
25
|
attr_accessor :phone
|
26
26
|
|
27
|
+
# The name of the party.
|
28
|
+
# @return [Name]
|
29
|
+
attr_accessor :name
|
30
|
+
|
27
31
|
# Merchants and partners may already have a data-store where their customer
|
28
32
|
# information is persisted. Use merchant_customer_id to associate the
|
29
33
|
# PayPal-generated customer.id to your representation of a customer.
|
@@ -36,6 +40,7 @@ module PaypalServerSdk
|
|
36
40
|
@_hash['id'] = 'id'
|
37
41
|
@_hash['email_address'] = 'email_address'
|
38
42
|
@_hash['phone'] = 'phone'
|
43
|
+
@_hash['name'] = 'name'
|
39
44
|
@_hash['merchant_customer_id'] = 'merchant_customer_id'
|
40
45
|
@_hash
|
41
46
|
end
|
@@ -46,6 +51,7 @@ module PaypalServerSdk
|
|
46
51
|
id
|
47
52
|
email_address
|
48
53
|
phone
|
54
|
+
name
|
49
55
|
merchant_customer_id
|
50
56
|
]
|
51
57
|
end
|
@@ -55,11 +61,12 @@ module PaypalServerSdk
|
|
55
61
|
[]
|
56
62
|
end
|
57
63
|
|
58
|
-
def initialize(id: SKIP, email_address: SKIP, phone: SKIP,
|
64
|
+
def initialize(id: SKIP, email_address: SKIP, phone: SKIP, name: SKIP,
|
59
65
|
merchant_customer_id: SKIP)
|
60
66
|
@id = id unless id == SKIP
|
61
67
|
@email_address = email_address unless email_address == SKIP
|
62
68
|
@phone = phone unless phone == SKIP
|
69
|
+
@name = name unless name == SKIP
|
63
70
|
@merchant_customer_id = merchant_customer_id unless merchant_customer_id == SKIP
|
64
71
|
end
|
65
72
|
|
@@ -71,6 +78,7 @@ module PaypalServerSdk
|
|
71
78
|
id = hash.key?('id') ? hash['id'] : SKIP
|
72
79
|
email_address = hash.key?('email_address') ? hash['email_address'] : SKIP
|
73
80
|
phone = PhoneWithType.from_hash(hash['phone']) if hash['phone']
|
81
|
+
name = Name.from_hash(hash['name']) if hash['name']
|
74
82
|
merchant_customer_id =
|
75
83
|
hash.key?('merchant_customer_id') ? hash['merchant_customer_id'] : SKIP
|
76
84
|
|
@@ -78,21 +86,23 @@ module PaypalServerSdk
|
|
78
86
|
PaypalWalletCustomerRequest.new(id: id,
|
79
87
|
email_address: email_address,
|
80
88
|
phone: phone,
|
89
|
+
name: name,
|
81
90
|
merchant_customer_id: merchant_customer_id)
|
82
91
|
end
|
83
92
|
|
84
93
|
# Provides a human-readable string representation of the object.
|
85
94
|
def to_s
|
86
95
|
class_name = self.class.name.split('::').last
|
87
|
-
"<#{class_name} id: #{@id}, email_address: #{@email_address}, phone: #{@phone},"\
|
88
|
-
" merchant_customer_id: #{@merchant_customer_id}>"
|
96
|
+
"<#{class_name} id: #{@id}, email_address: #{@email_address}, phone: #{@phone}, name:"\
|
97
|
+
" #{@name}, merchant_customer_id: #{@merchant_customer_id}>"
|
89
98
|
end
|
90
99
|
|
91
100
|
# Provides a debugging-friendly string with detailed object information.
|
92
101
|
def inspect
|
93
102
|
class_name = self.class.name.split('::').last
|
94
103
|
"<#{class_name} id: #{@id.inspect}, email_address: #{@email_address.inspect}, phone:"\
|
95
|
-
" #{@phone.inspect},
|
104
|
+
" #{@phone.inspect}, name: #{@name.inspect}, merchant_customer_id:"\
|
105
|
+
" #{@merchant_customer_id.inspect}>"
|
96
106
|
end
|
97
107
|
end
|
98
108
|
end
|
@@ -33,6 +33,12 @@ module PaypalServerSdk
|
|
33
33
|
# @return [PaypalWalletContextShippingPreference]
|
34
34
|
attr_accessor :shipping_preference
|
35
35
|
|
36
|
+
# The preference to display the contact information (buyer’s shipping email
|
37
|
+
# & phone number) on PayPal's checkout for easy merchant-buyer
|
38
|
+
# communication.
|
39
|
+
# @return [PaypalWalletContactPreference]
|
40
|
+
attr_accessor :contact_preference
|
41
|
+
|
36
42
|
# Describes the URL.
|
37
43
|
# @return [String]
|
38
44
|
attr_accessor :return_url
|
@@ -63,6 +69,7 @@ module PaypalServerSdk
|
|
63
69
|
@_hash['brand_name'] = 'brand_name'
|
64
70
|
@_hash['locale'] = 'locale'
|
65
71
|
@_hash['shipping_preference'] = 'shipping_preference'
|
72
|
+
@_hash['contact_preference'] = 'contact_preference'
|
66
73
|
@_hash['return_url'] = 'return_url'
|
67
74
|
@_hash['cancel_url'] = 'cancel_url'
|
68
75
|
@_hash['landing_page'] = 'landing_page'
|
@@ -78,6 +85,7 @@ module PaypalServerSdk
|
|
78
85
|
brand_name
|
79
86
|
locale
|
80
87
|
shipping_preference
|
88
|
+
contact_preference
|
81
89
|
return_url
|
82
90
|
cancel_url
|
83
91
|
landing_page
|
@@ -95,6 +103,7 @@ module PaypalServerSdk
|
|
95
103
|
def initialize(
|
96
104
|
brand_name: SKIP, locale: SKIP,
|
97
105
|
shipping_preference: PaypalWalletContextShippingPreference::GET_FROM_FILE,
|
106
|
+
contact_preference: PaypalWalletContactPreference::NO_CONTACT_INFO,
|
98
107
|
return_url: SKIP, cancel_url: SKIP,
|
99
108
|
landing_page: PaypalExperienceLandingPage::NO_PREFERENCE,
|
100
109
|
user_action: PaypalExperienceUserAction::CONTINUE,
|
@@ -104,6 +113,7 @@ module PaypalServerSdk
|
|
104
113
|
@brand_name = brand_name unless brand_name == SKIP
|
105
114
|
@locale = locale unless locale == SKIP
|
106
115
|
@shipping_preference = shipping_preference unless shipping_preference == SKIP
|
116
|
+
@contact_preference = contact_preference unless contact_preference == SKIP
|
107
117
|
@return_url = return_url unless return_url == SKIP
|
108
118
|
@cancel_url = cancel_url unless cancel_url == SKIP
|
109
119
|
@landing_page = landing_page unless landing_page == SKIP
|
@@ -127,6 +137,8 @@ module PaypalServerSdk
|
|
127
137
|
locale = hash.key?('locale') ? hash['locale'] : SKIP
|
128
138
|
shipping_preference =
|
129
139
|
hash['shipping_preference'] ||= PaypalWalletContextShippingPreference::GET_FROM_FILE
|
140
|
+
contact_preference =
|
141
|
+
hash['contact_preference'] ||= PaypalWalletContactPreference::NO_CONTACT_INFO
|
130
142
|
return_url = hash.key?('return_url') ? hash['return_url'] : SKIP
|
131
143
|
cancel_url = hash.key?('cancel_url') ? hash['cancel_url'] : SKIP
|
132
144
|
landing_page =
|
@@ -142,6 +154,7 @@ module PaypalServerSdk
|
|
142
154
|
PaypalWalletExperienceContext.new(brand_name: brand_name,
|
143
155
|
locale: locale,
|
144
156
|
shipping_preference: shipping_preference,
|
157
|
+
contact_preference: contact_preference,
|
145
158
|
return_url: return_url,
|
146
159
|
cancel_url: cancel_url,
|
147
160
|
landing_page: landing_page,
|
@@ -154,18 +167,19 @@ module PaypalServerSdk
|
|
154
167
|
def to_s
|
155
168
|
class_name = self.class.name.split('::').last
|
156
169
|
"<#{class_name} brand_name: #{@brand_name}, locale: #{@locale}, shipping_preference:"\
|
157
|
-
" #{@shipping_preference},
|
158
|
-
"
|
159
|
-
" #{@
|
160
|
-
" #{@order_update_callback_config}>"
|
170
|
+
" #{@shipping_preference}, contact_preference: #{@contact_preference}, return_url:"\
|
171
|
+
" #{@return_url}, cancel_url: #{@cancel_url}, landing_page: #{@landing_page}, user_action:"\
|
172
|
+
" #{@user_action}, payment_method_preference: #{@payment_method_preference},"\
|
173
|
+
" order_update_callback_config: #{@order_update_callback_config}>"
|
161
174
|
end
|
162
175
|
|
163
176
|
# Provides a debugging-friendly string with detailed object information.
|
164
177
|
def inspect
|
165
178
|
class_name = self.class.name.split('::').last
|
166
179
|
"<#{class_name} brand_name: #{@brand_name.inspect}, locale: #{@locale.inspect},"\
|
167
|
-
" shipping_preference: #{@shipping_preference.inspect},
|
168
|
-
"
|
180
|
+
" shipping_preference: #{@shipping_preference.inspect}, contact_preference:"\
|
181
|
+
" #{@contact_preference.inspect}, return_url: #{@return_url.inspect}, cancel_url:"\
|
182
|
+
" #{@cancel_url.inspect}, landing_page: #{@landing_page.inspect}, user_action:"\
|
169
183
|
" #{@user_action.inspect}, payment_method_preference: #{@payment_method_preference.inspect},"\
|
170
184
|
" order_update_callback_config: #{@order_update_callback_config.inspect}>"
|
171
185
|
end
|
@@ -27,6 +27,10 @@ module PaypalServerSdk
|
|
27
27
|
# @return [AmountWithBreakdown]
|
28
28
|
attr_accessor :amount
|
29
29
|
|
30
|
+
# An array of items that the customer purchases from the merchant.
|
31
|
+
# @return [Array[Item]]
|
32
|
+
attr_accessor :items
|
33
|
+
|
30
34
|
# An array of shipping options that the payee or merchant offers to the
|
31
35
|
# payer to ship or pick up their items.
|
32
36
|
# @return [Array[ShippingOption]]
|
@@ -37,6 +41,7 @@ module PaypalServerSdk
|
|
37
41
|
@_hash = {} if @_hash.nil?
|
38
42
|
@_hash['reference_id'] = 'reference_id'
|
39
43
|
@_hash['amount'] = 'amount'
|
44
|
+
@_hash['items'] = 'items'
|
40
45
|
@_hash['shipping_options'] = 'shipping_options'
|
41
46
|
@_hash
|
42
47
|
end
|
@@ -46,6 +51,7 @@ module PaypalServerSdk
|
|
46
51
|
%w[
|
47
52
|
reference_id
|
48
53
|
amount
|
54
|
+
items
|
49
55
|
shipping_options
|
50
56
|
]
|
51
57
|
end
|
@@ -55,9 +61,11 @@ module PaypalServerSdk
|
|
55
61
|
[]
|
56
62
|
end
|
57
63
|
|
58
|
-
def initialize(reference_id: SKIP, amount: SKIP,
|
64
|
+
def initialize(reference_id: SKIP, amount: SKIP, items: SKIP,
|
65
|
+
shipping_options: SKIP)
|
59
66
|
@reference_id = reference_id unless reference_id == SKIP
|
60
67
|
@amount = amount unless amount == SKIP
|
68
|
+
@items = items unless items == SKIP
|
61
69
|
@shipping_options = shipping_options unless shipping_options == SKIP
|
62
70
|
end
|
63
71
|
|
@@ -69,6 +77,16 @@ module PaypalServerSdk
|
|
69
77
|
reference_id = hash.key?('reference_id') ? hash['reference_id'] : SKIP
|
70
78
|
amount = AmountWithBreakdown.from_hash(hash['amount']) if hash['amount']
|
71
79
|
# Parameter is an array, so we need to iterate through it
|
80
|
+
items = nil
|
81
|
+
unless hash['items'].nil?
|
82
|
+
items = []
|
83
|
+
hash['items'].each do |structure|
|
84
|
+
items << (Item.from_hash(structure) if structure)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
items = SKIP unless hash.key?('items')
|
89
|
+
# Parameter is an array, so we need to iterate through it
|
72
90
|
shipping_options = nil
|
73
91
|
unless hash['shipping_options'].nil?
|
74
92
|
shipping_options = []
|
@@ -82,21 +100,22 @@ module PaypalServerSdk
|
|
82
100
|
# Create object from extracted values.
|
83
101
|
ShippingOptionsPurchaseUnit.new(reference_id: reference_id,
|
84
102
|
amount: amount,
|
103
|
+
items: items,
|
85
104
|
shipping_options: shipping_options)
|
86
105
|
end
|
87
106
|
|
88
107
|
# Provides a human-readable string representation of the object.
|
89
108
|
def to_s
|
90
109
|
class_name = self.class.name.split('::').last
|
91
|
-
"<#{class_name} reference_id: #{@reference_id}, amount: #{@amount},
|
92
|
-
" #{@shipping_options}>"
|
110
|
+
"<#{class_name} reference_id: #{@reference_id}, amount: #{@amount}, items: #{@items},"\
|
111
|
+
" shipping_options: #{@shipping_options}>"
|
93
112
|
end
|
94
113
|
|
95
114
|
# Provides a debugging-friendly string with detailed object information.
|
96
115
|
def inspect
|
97
116
|
class_name = self.class.name.split('::').last
|
98
|
-
"<#{class_name} reference_id: #{@reference_id.inspect}, amount: #{@amount.inspect},"\
|
99
|
-
" shipping_options: #{@shipping_options.inspect}>"
|
117
|
+
"<#{class_name} reference_id: #{@reference_id.inspect}, amount: #{@amount.inspect}, items:"\
|
118
|
+
" #{@items.inspect}, shipping_options: #{@shipping_options.inspect}>"
|
100
119
|
end
|
101
120
|
end
|
102
121
|
end
|
@@ -4,7 +4,8 @@
|
|
4
4
|
# ( https://apimatic.io ).
|
5
5
|
|
6
6
|
module PaypalServerSdk
|
7
|
-
#
|
7
|
+
# This object represents a merchant’s customer, allowing them to store contact
|
8
|
+
# details, and track all payments associated with the same customer.
|
8
9
|
class VaultCustomer < BaseModel
|
9
10
|
SKIP = Object.new
|
10
11
|
private_constant :SKIP
|
@@ -13,10 +14,15 @@ module PaypalServerSdk
|
|
13
14
|
# @return [String]
|
14
15
|
attr_accessor :id
|
15
16
|
|
17
|
+
# The name of the party.
|
18
|
+
# @return [Name]
|
19
|
+
attr_accessor :name
|
20
|
+
|
16
21
|
# A mapping from model property names to API property names.
|
17
22
|
def self.names
|
18
23
|
@_hash = {} if @_hash.nil?
|
19
24
|
@_hash['id'] = 'id'
|
25
|
+
@_hash['name'] = 'name'
|
20
26
|
@_hash
|
21
27
|
end
|
22
28
|
|
@@ -24,6 +30,7 @@ module PaypalServerSdk
|
|
24
30
|
def self.optionals
|
25
31
|
%w[
|
26
32
|
id
|
33
|
+
name
|
27
34
|
]
|
28
35
|
end
|
29
36
|
|
@@ -32,8 +39,9 @@ module PaypalServerSdk
|
|
32
39
|
[]
|
33
40
|
end
|
34
41
|
|
35
|
-
def initialize(id: SKIP)
|
42
|
+
def initialize(id: SKIP, name: SKIP)
|
36
43
|
@id = id unless id == SKIP
|
44
|
+
@name = name unless name == SKIP
|
37
45
|
end
|
38
46
|
|
39
47
|
# Creates an instance of the object from a hash.
|
@@ -42,21 +50,23 @@ module PaypalServerSdk
|
|
42
50
|
|
43
51
|
# Extract variables from the hash.
|
44
52
|
id = hash.key?('id') ? hash['id'] : SKIP
|
53
|
+
name = Name.from_hash(hash['name']) if hash['name']
|
45
54
|
|
46
55
|
# Create object from extracted values.
|
47
|
-
VaultCustomer.new(id: id
|
56
|
+
VaultCustomer.new(id: id,
|
57
|
+
name: name)
|
48
58
|
end
|
49
59
|
|
50
60
|
# Provides a human-readable string representation of the object.
|
51
61
|
def to_s
|
52
62
|
class_name = self.class.name.split('::').last
|
53
|
-
"<#{class_name} id: #{@id}>"
|
63
|
+
"<#{class_name} id: #{@id}, name: #{@name}>"
|
54
64
|
end
|
55
65
|
|
56
66
|
# Provides a debugging-friendly string with detailed object information.
|
57
67
|
def inspect
|
58
68
|
class_name = self.class.name.split('::').last
|
59
|
-
"<#{class_name} id: #{@id.inspect}>"
|
69
|
+
"<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}>"
|
60
70
|
end
|
61
71
|
end
|
62
72
|
end
|
@@ -17,7 +17,8 @@ module PaypalServerSdk
|
|
17
17
|
# @return [VaultStatus]
|
18
18
|
attr_accessor :status
|
19
19
|
|
20
|
-
#
|
20
|
+
# This object represents a merchant’s customer, allowing them to store
|
21
|
+
# contact details, and track all payments associated with the same customer.
|
21
22
|
# @return [VaultCustomer]
|
22
23
|
attr_accessor :customer
|
23
24
|
|
@@ -20,11 +20,21 @@ module PaypalServerSdk
|
|
20
20
|
# @return [String]
|
21
21
|
attr_accessor :email_address
|
22
22
|
|
23
|
+
# The phone information.
|
24
|
+
# @return [PhoneWithType]
|
25
|
+
attr_accessor :phone
|
26
|
+
|
27
|
+
# The name of the party.
|
28
|
+
# @return [Name]
|
29
|
+
attr_accessor :name
|
30
|
+
|
23
31
|
# A mapping from model property names to API property names.
|
24
32
|
def self.names
|
25
33
|
@_hash = {} if @_hash.nil?
|
26
34
|
@_hash['id'] = 'id'
|
27
35
|
@_hash['email_address'] = 'email_address'
|
36
|
+
@_hash['phone'] = 'phone'
|
37
|
+
@_hash['name'] = 'name'
|
28
38
|
@_hash
|
29
39
|
end
|
30
40
|
|
@@ -33,6 +43,8 @@ module PaypalServerSdk
|
|
33
43
|
%w[
|
34
44
|
id
|
35
45
|
email_address
|
46
|
+
phone
|
47
|
+
name
|
36
48
|
]
|
37
49
|
end
|
38
50
|
|
@@ -41,9 +53,11 @@ module PaypalServerSdk
|
|
41
53
|
[]
|
42
54
|
end
|
43
55
|
|
44
|
-
def initialize(id: SKIP, email_address: SKIP)
|
56
|
+
def initialize(id: SKIP, email_address: SKIP, phone: SKIP, name: SKIP)
|
45
57
|
@id = id unless id == SKIP
|
46
58
|
@email_address = email_address unless email_address == SKIP
|
59
|
+
@phone = phone unless phone == SKIP
|
60
|
+
@name = name unless name == SKIP
|
47
61
|
end
|
48
62
|
|
49
63
|
# Creates an instance of the object from a hash.
|
@@ -53,22 +67,28 @@ module PaypalServerSdk
|
|
53
67
|
# Extract variables from the hash.
|
54
68
|
id = hash.key?('id') ? hash['id'] : SKIP
|
55
69
|
email_address = hash.key?('email_address') ? hash['email_address'] : SKIP
|
70
|
+
phone = PhoneWithType.from_hash(hash['phone']) if hash['phone']
|
71
|
+
name = Name.from_hash(hash['name']) if hash['name']
|
56
72
|
|
57
73
|
# Create object from extracted values.
|
58
74
|
VenmoWalletCustomerInformation.new(id: id,
|
59
|
-
email_address: email_address
|
75
|
+
email_address: email_address,
|
76
|
+
phone: phone,
|
77
|
+
name: name)
|
60
78
|
end
|
61
79
|
|
62
80
|
# Provides a human-readable string representation of the object.
|
63
81
|
def to_s
|
64
82
|
class_name = self.class.name.split('::').last
|
65
|
-
"<#{class_name} id: #{@id}, email_address: #{@email_address}
|
83
|
+
"<#{class_name} id: #{@id}, email_address: #{@email_address}, phone: #{@phone}, name:"\
|
84
|
+
" #{@name}>"
|
66
85
|
end
|
67
86
|
|
68
87
|
# Provides a debugging-friendly string with detailed object information.
|
69
88
|
def inspect
|
70
89
|
class_name = self.class.name.split('::').last
|
71
|
-
"<#{class_name} id: #{@id.inspect}, email_address: #{@email_address.inspect}
|
90
|
+
"<#{class_name} id: #{@id.inspect}, email_address: #{@email_address.inspect}, phone:"\
|
91
|
+
" #{@phone.inspect}, name: #{@name.inspect}>"
|
72
92
|
end
|
73
93
|
end
|
74
94
|
end
|