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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +42 -36
  3. data/lib/paypal_server_sdk/controllers/base_controller.rb +1 -1
  4. data/lib/paypal_server_sdk/controllers/orders_controller.rb +211 -171
  5. data/lib/paypal_server_sdk/controllers/payments_controller.rb +95 -92
  6. data/lib/paypal_server_sdk/controllers/vault_controller.rb +81 -81
  7. data/lib/paypal_server_sdk/exceptions/error_exception.rb +5 -3
  8. data/lib/paypal_server_sdk/exceptions/o_auth_provider_exception.rb +5 -3
  9. data/lib/paypal_server_sdk/models/apple_pay_attributes.rb +2 -1
  10. data/lib/paypal_server_sdk/models/apple_pay_experience_context.rb +68 -0
  11. data/lib/paypal_server_sdk/models/apple_pay_request.rb +18 -4
  12. data/lib/paypal_server_sdk/models/callback_configuration.rb +1 -2
  13. data/lib/paypal_server_sdk/models/card_brand.rb +1 -1
  14. data/lib/paypal_server_sdk/models/card_customer_information.rb +14 -4
  15. data/lib/paypal_server_sdk/models/customer_information.rb +16 -5
  16. data/lib/paypal_server_sdk/models/customer_response.rb +1 -2
  17. data/lib/paypal_server_sdk/models/google_pay_experience_context.rb +68 -0
  18. data/lib/paypal_server_sdk/models/google_pay_request.rb +17 -4
  19. data/lib/paypal_server_sdk/models/item.rb +14 -4
  20. data/lib/paypal_server_sdk/models/line_item.rb +22 -11
  21. data/lib/paypal_server_sdk/models/order_billing_plan.rb +93 -0
  22. data/lib/paypal_server_sdk/models/order_status.rb +5 -5
  23. data/lib/paypal_server_sdk/models/payment_token_response.rb +1 -2
  24. data/lib/paypal_server_sdk/models/paypal_wallet_contact_preference.rb +34 -0
  25. data/lib/paypal_server_sdk/models/paypal_wallet_customer.rb +14 -4
  26. data/lib/paypal_server_sdk/models/paypal_wallet_customer_request.rb +14 -4
  27. data/lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb +20 -6
  28. data/lib/paypal_server_sdk/models/shipping_options_purchase_unit.rb +24 -5
  29. data/lib/paypal_server_sdk/models/vault_customer.rb +15 -5
  30. data/lib/paypal_server_sdk/models/vault_response.rb +2 -1
  31. data/lib/paypal_server_sdk/models/vault_response_customer.rb +1 -1
  32. data/lib/paypal_server_sdk/models/venmo_wallet_customer_information.rb +24 -4
  33. data/lib/paypal_server_sdk.rb +149 -145
  34. metadata +6 -2
@@ -58,6 +58,11 @@ module PaypalServerSdk
58
58
  # @return [ApplePayAttributes]
59
59
  attr_accessor :attributes
60
60
 
61
+ # Customizes the payer experience during the approval process for the
62
+ # payment.
63
+ # @return [ApplePayExperienceContext]
64
+ attr_accessor :experience_context
65
+
61
66
  # A mapping from model property names to API property names.
62
67
  def self.names
63
68
  @_hash = {} if @_hash.nil?
@@ -69,6 +74,7 @@ module PaypalServerSdk
69
74
  @_hash['stored_credential'] = 'stored_credential'
70
75
  @_hash['vault_id'] = 'vault_id'
71
76
  @_hash['attributes'] = 'attributes'
77
+ @_hash['experience_context'] = 'experience_context'
72
78
  @_hash
73
79
  end
74
80
 
@@ -83,6 +89,7 @@ module PaypalServerSdk
83
89
  stored_credential
84
90
  vault_id
85
91
  attributes
92
+ experience_context
86
93
  ]
87
94
  end
88
95
 
@@ -93,7 +100,8 @@ module PaypalServerSdk
93
100
 
94
101
  def initialize(id: SKIP, name: SKIP, email_address: SKIP,
95
102
  phone_number: SKIP, decrypted_token: SKIP,
96
- stored_credential: SKIP, vault_id: SKIP, attributes: SKIP)
103
+ stored_credential: SKIP, vault_id: SKIP, attributes: SKIP,
104
+ experience_context: SKIP)
97
105
  @id = id unless id == SKIP
98
106
  @name = name unless name == SKIP
99
107
  @email_address = email_address unless email_address == SKIP
@@ -102,6 +110,7 @@ module PaypalServerSdk
102
110
  @stored_credential = stored_credential unless stored_credential == SKIP
103
111
  @vault_id = vault_id unless vault_id == SKIP
104
112
  @attributes = attributes unless attributes == SKIP
113
+ @experience_context = experience_context unless experience_context == SKIP
105
114
  end
106
115
 
107
116
  # Creates an instance of the object from a hash.
@@ -119,6 +128,8 @@ module PaypalServerSdk
119
128
  hash['stored_credential']
120
129
  vault_id = hash.key?('vault_id') ? hash['vault_id'] : SKIP
121
130
  attributes = ApplePayAttributes.from_hash(hash['attributes']) if hash['attributes']
131
+ experience_context = ApplePayExperienceContext.from_hash(hash['experience_context']) if
132
+ hash['experience_context']
122
133
 
123
134
  # Create object from extracted values.
124
135
  ApplePayRequest.new(id: id,
@@ -128,7 +139,8 @@ module PaypalServerSdk
128
139
  decrypted_token: decrypted_token,
129
140
  stored_credential: stored_credential,
130
141
  vault_id: vault_id,
131
- attributes: attributes)
142
+ attributes: attributes,
143
+ experience_context: experience_context)
132
144
  end
133
145
 
134
146
  # Provides a human-readable string representation of the object.
@@ -136,7 +148,8 @@ module PaypalServerSdk
136
148
  class_name = self.class.name.split('::').last
137
149
  "<#{class_name} id: #{@id}, name: #{@name}, email_address: #{@email_address}, phone_number:"\
138
150
  " #{@phone_number}, decrypted_token: #{@decrypted_token}, stored_credential:"\
139
- " #{@stored_credential}, vault_id: #{@vault_id}, attributes: #{@attributes}>"
151
+ " #{@stored_credential}, vault_id: #{@vault_id}, attributes: #{@attributes},"\
152
+ " experience_context: #{@experience_context}>"
140
153
  end
141
154
 
142
155
  # Provides a debugging-friendly string with detailed object information.
@@ -145,7 +158,8 @@ module PaypalServerSdk
145
158
  "<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, email_address:"\
146
159
  " #{@email_address.inspect}, phone_number: #{@phone_number.inspect}, decrypted_token:"\
147
160
  " #{@decrypted_token.inspect}, stored_credential: #{@stored_credential.inspect}, vault_id:"\
148
- " #{@vault_id.inspect}, attributes: #{@attributes.inspect}>"
161
+ " #{@vault_id.inspect}, attributes: #{@attributes.inspect}, experience_context:"\
162
+ " #{@experience_context.inspect}>"
149
163
  end
150
164
  end
151
165
  end
@@ -10,8 +10,7 @@ module PaypalServerSdk
10
10
  private_constant :SKIP
11
11
 
12
12
  # An array of callback events merchant can subscribe to for the
13
- # corresponding callback url. The SHIPPING_ADDRESS callback event is
14
- # required.
13
+ # corresponding callback url.
15
14
  # @return [Array[CallbackEvents]]
16
15
  attr_accessor :callback_events
17
16
 
@@ -11,7 +11,7 @@ module PaypalServerSdk
11
11
  # Visa card.
12
12
  VISA = 'VISA'.freeze,
13
13
 
14
- # Mastecard card.
14
+ # Mastercard card.
15
15
  MASTERCARD = 'MASTERCARD'.freeze,
16
16
 
17
17
  # Discover card.
@@ -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
  CardCustomerInformation.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}, merchant_customer_id: #{@merchant_customer_id.inspect}>"
104
+ " #{@phone.inspect}, name: #{@name.inspect}, merchant_customer_id:"\
105
+ " #{@merchant_customer_id.inspect}>"
96
106
  end
97
107
  end
98
108
  end
@@ -4,7 +4,8 @@
4
4
  # ( https://apimatic.io ).
5
5
 
6
6
  module PaypalServerSdk
7
- # The details about a customer in PayPal's system of record.
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 CustomerInformation < BaseModel
9
10
  SKIP = Object.new
10
11
  private_constant :SKIP
@@ -24,12 +25,17 @@ module PaypalServerSdk
24
25
  # @return [PhoneWithType]
25
26
  attr_accessor :phone
26
27
 
28
+ # The name of the party.
29
+ # @return [Name]
30
+ attr_accessor :name
31
+
27
32
  # A mapping from model property names to API property names.
28
33
  def self.names
29
34
  @_hash = {} if @_hash.nil?
30
35
  @_hash['id'] = 'id'
31
36
  @_hash['email_address'] = 'email_address'
32
37
  @_hash['phone'] = 'phone'
38
+ @_hash['name'] = 'name'
33
39
  @_hash
34
40
  end
35
41
 
@@ -39,6 +45,7 @@ module PaypalServerSdk
39
45
  id
40
46
  email_address
41
47
  phone
48
+ name
42
49
  ]
43
50
  end
44
51
 
@@ -47,10 +54,11 @@ module PaypalServerSdk
47
54
  []
48
55
  end
49
56
 
50
- def initialize(id: SKIP, email_address: SKIP, phone: SKIP)
57
+ def initialize(id: SKIP, email_address: SKIP, phone: SKIP, name: SKIP)
51
58
  @id = id unless id == SKIP
52
59
  @email_address = email_address unless email_address == SKIP
53
60
  @phone = phone unless phone == SKIP
61
+ @name = name unless name == SKIP
54
62
  end
55
63
 
56
64
  # Creates an instance of the object from a hash.
@@ -61,24 +69,27 @@ module PaypalServerSdk
61
69
  id = hash.key?('id') ? hash['id'] : SKIP
62
70
  email_address = hash.key?('email_address') ? hash['email_address'] : SKIP
63
71
  phone = PhoneWithType.from_hash(hash['phone']) if hash['phone']
72
+ name = Name.from_hash(hash['name']) if hash['name']
64
73
 
65
74
  # Create object from extracted values.
66
75
  CustomerInformation.new(id: id,
67
76
  email_address: email_address,
68
- phone: phone)
77
+ phone: phone,
78
+ name: name)
69
79
  end
70
80
 
71
81
  # Provides a human-readable string representation of the object.
72
82
  def to_s
73
83
  class_name = self.class.name.split('::').last
74
- "<#{class_name} id: #{@id}, email_address: #{@email_address}, phone: #{@phone}>"
84
+ "<#{class_name} id: #{@id}, email_address: #{@email_address}, phone: #{@phone}, name:"\
85
+ " #{@name}>"
75
86
  end
76
87
 
77
88
  # Provides a debugging-friendly string with detailed object information.
78
89
  def inspect
79
90
  class_name = self.class.name.split('::').last
80
91
  "<#{class_name} id: #{@id.inspect}, email_address: #{@email_address.inspect}, phone:"\
81
- " #{@phone.inspect}>"
92
+ " #{@phone.inspect}, name: #{@name.inspect}>"
82
93
  end
83
94
  end
84
95
  end
@@ -4,8 +4,7 @@
4
4
  # ( https://apimatic.io ).
5
5
 
6
6
  module PaypalServerSdk
7
- # This object defines a customer in your system. Use it to manage customer
8
- # profiles, save payment methods and contact details.
7
+ # Customer in merchant's or partner's system of records.
9
8
  class CustomerResponse < BaseModel
10
9
  SKIP = Object.new
11
10
  private_constant :SKIP
@@ -0,0 +1,68 @@
1
+ # paypal_server_sdk
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module PaypalServerSdk
7
+ # Customizes the payer experience during the approval process for the payment.
8
+ class GooglePayExperienceContext < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Describes the URL.
13
+ # @return [String]
14
+ attr_accessor :return_url
15
+
16
+ # Describes the URL.
17
+ # @return [String]
18
+ attr_accessor :cancel_url
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['return_url'] = 'return_url'
24
+ @_hash['cancel_url'] = 'cancel_url'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ []
31
+ end
32
+
33
+ # An array for nullable fields
34
+ def self.nullables
35
+ []
36
+ end
37
+
38
+ def initialize(return_url:, cancel_url:)
39
+ @return_url = return_url
40
+ @cancel_url = cancel_url
41
+ end
42
+
43
+ # Creates an instance of the object from a hash.
44
+ def self.from_hash(hash)
45
+ return nil unless hash
46
+
47
+ # Extract variables from the hash.
48
+ return_url = hash.key?('return_url') ? hash['return_url'] : nil
49
+ cancel_url = hash.key?('cancel_url') ? hash['cancel_url'] : nil
50
+
51
+ # Create object from extracted values.
52
+ GooglePayExperienceContext.new(return_url: return_url,
53
+ cancel_url: cancel_url)
54
+ end
55
+
56
+ # Provides a human-readable string representation of the object.
57
+ def to_s
58
+ class_name = self.class.name.split('::').last
59
+ "<#{class_name} return_url: #{@return_url}, cancel_url: #{@cancel_url}>"
60
+ end
61
+
62
+ # Provides a debugging-friendly string with detailed object information.
63
+ def inspect
64
+ class_name = self.class.name.split('::').last
65
+ "<#{class_name} return_url: #{@return_url.inspect}, cancel_url: #{@cancel_url.inspect}>"
66
+ end
67
+ end
68
+ end
@@ -41,6 +41,11 @@ module PaypalServerSdk
41
41
  # @return [AssuranceDetails]
42
42
  attr_accessor :assurance_details
43
43
 
44
+ # Customizes the payer experience during the approval process for the
45
+ # payment.
46
+ # @return [GooglePayExperienceContext]
47
+ attr_accessor :experience_context
48
+
44
49
  # A mapping from model property names to API property names.
45
50
  def self.names
46
51
  @_hash = {} if @_hash.nil?
@@ -50,6 +55,7 @@ module PaypalServerSdk
50
55
  @_hash['card'] = 'card'
51
56
  @_hash['decrypted_token'] = 'decrypted_token'
52
57
  @_hash['assurance_details'] = 'assurance_details'
58
+ @_hash['experience_context'] = 'experience_context'
53
59
  @_hash
54
60
  end
55
61
 
@@ -62,6 +68,7 @@ module PaypalServerSdk
62
68
  card
63
69
  decrypted_token
64
70
  assurance_details
71
+ experience_context
65
72
  ]
66
73
  end
67
74
 
@@ -71,13 +78,15 @@ module PaypalServerSdk
71
78
  end
72
79
 
73
80
  def initialize(name: SKIP, email_address: SKIP, phone_number: SKIP,
74
- card: SKIP, decrypted_token: SKIP, assurance_details: SKIP)
81
+ card: SKIP, decrypted_token: SKIP, assurance_details: SKIP,
82
+ experience_context: SKIP)
75
83
  @name = name unless name == SKIP
76
84
  @email_address = email_address unless email_address == SKIP
77
85
  @phone_number = phone_number unless phone_number == SKIP
78
86
  @card = card unless card == SKIP
79
87
  @decrypted_token = decrypted_token unless decrypted_token == SKIP
80
88
  @assurance_details = assurance_details unless assurance_details == SKIP
89
+ @experience_context = experience_context unless experience_context == SKIP
81
90
  end
82
91
 
83
92
  # Creates an instance of the object from a hash.
@@ -94,6 +103,8 @@ module PaypalServerSdk
94
103
  hash['decrypted_token']
95
104
  assurance_details = AssuranceDetails.from_hash(hash['assurance_details']) if
96
105
  hash['assurance_details']
106
+ experience_context = GooglePayExperienceContext.from_hash(hash['experience_context']) if
107
+ hash['experience_context']
97
108
 
98
109
  # Create object from extracted values.
99
110
  GooglePayRequest.new(name: name,
@@ -101,7 +112,8 @@ module PaypalServerSdk
101
112
  phone_number: phone_number,
102
113
  card: card,
103
114
  decrypted_token: decrypted_token,
104
- assurance_details: assurance_details)
115
+ assurance_details: assurance_details,
116
+ experience_context: experience_context)
105
117
  end
106
118
 
107
119
  # Provides a human-readable string representation of the object.
@@ -109,7 +121,7 @@ module PaypalServerSdk
109
121
  class_name = self.class.name.split('::').last
110
122
  "<#{class_name} name: #{@name}, email_address: #{@email_address}, phone_number:"\
111
123
  " #{@phone_number}, card: #{@card}, decrypted_token: #{@decrypted_token}, assurance_details:"\
112
- " #{@assurance_details}>"
124
+ " #{@assurance_details}, experience_context: #{@experience_context}>"
113
125
  end
114
126
 
115
127
  # Provides a debugging-friendly string with detailed object information.
@@ -117,7 +129,8 @@ module PaypalServerSdk
117
129
  class_name = self.class.name.split('::').last
118
130
  "<#{class_name} name: #{@name.inspect}, email_address: #{@email_address.inspect},"\
119
131
  " phone_number: #{@phone_number.inspect}, card: #{@card.inspect}, decrypted_token:"\
120
- " #{@decrypted_token.inspect}, assurance_details: #{@assurance_details.inspect}>"
132
+ " #{@decrypted_token.inspect}, assurance_details: #{@assurance_details.inspect},"\
133
+ " experience_context: #{@experience_context.inspect}>"
121
134
  end
122
135
  end
123
136
  end
@@ -53,6 +53,11 @@ module PaypalServerSdk
53
53
  # @return [UniversalProductCode]
54
54
  attr_accessor :upc
55
55
 
56
+ # Metadata for merchant-managed recurring billing plans. Valid only during
57
+ # the saved payment method token or billing agreement creation.
58
+ # @return [OrderBillingPlan]
59
+ attr_accessor :billing_plan
60
+
56
61
  # A mapping from model property names to API property names.
57
62
  def self.names
58
63
  @_hash = {} if @_hash.nil?
@@ -66,6 +71,7 @@ module PaypalServerSdk
66
71
  @_hash['category'] = 'category'
67
72
  @_hash['image_url'] = 'image_url'
68
73
  @_hash['upc'] = 'upc'
74
+ @_hash['billing_plan'] = 'billing_plan'
69
75
  @_hash
70
76
  end
71
77
 
@@ -79,6 +85,7 @@ module PaypalServerSdk
79
85
  category
80
86
  image_url
81
87
  upc
88
+ billing_plan
82
89
  ]
83
90
  end
84
91
 
@@ -89,7 +96,7 @@ module PaypalServerSdk
89
96
 
90
97
  def initialize(name:, unit_amount:, quantity:, tax: SKIP, description: SKIP,
91
98
  sku: SKIP, url: SKIP, category: SKIP, image_url: SKIP,
92
- upc: SKIP)
99
+ upc: SKIP, billing_plan: SKIP)
93
100
  @name = name
94
101
  @unit_amount = unit_amount
95
102
  @tax = tax unless tax == SKIP
@@ -100,6 +107,7 @@ module PaypalServerSdk
100
107
  @category = category unless category == SKIP
101
108
  @image_url = image_url unless image_url == SKIP
102
109
  @upc = upc unless upc == SKIP
110
+ @billing_plan = billing_plan unless billing_plan == SKIP
103
111
  end
104
112
 
105
113
  # Creates an instance of the object from a hash.
@@ -117,6 +125,7 @@ module PaypalServerSdk
117
125
  category = hash.key?('category') ? hash['category'] : SKIP
118
126
  image_url = hash.key?('image_url') ? hash['image_url'] : SKIP
119
127
  upc = UniversalProductCode.from_hash(hash['upc']) if hash['upc']
128
+ billing_plan = OrderBillingPlan.from_hash(hash['billing_plan']) if hash['billing_plan']
120
129
 
121
130
  # Create object from extracted values.
122
131
  Item.new(name: name,
@@ -128,7 +137,8 @@ module PaypalServerSdk
128
137
  url: url,
129
138
  category: category,
130
139
  image_url: image_url,
131
- upc: upc)
140
+ upc: upc,
141
+ billing_plan: billing_plan)
132
142
  end
133
143
 
134
144
  # Provides a human-readable string representation of the object.
@@ -136,7 +146,7 @@ module PaypalServerSdk
136
146
  class_name = self.class.name.split('::').last
137
147
  "<#{class_name} name: #{@name}, unit_amount: #{@unit_amount}, tax: #{@tax}, quantity:"\
138
148
  " #{@quantity}, description: #{@description}, sku: #{@sku}, url: #{@url}, category:"\
139
- " #{@category}, image_url: #{@image_url}, upc: #{@upc}>"
149
+ " #{@category}, image_url: #{@image_url}, upc: #{@upc}, billing_plan: #{@billing_plan}>"
140
150
  end
141
151
 
142
152
  # Provides a debugging-friendly string with detailed object information.
@@ -145,7 +155,7 @@ module PaypalServerSdk
145
155
  "<#{class_name} name: #{@name.inspect}, unit_amount: #{@unit_amount.inspect}, tax:"\
146
156
  " #{@tax.inspect}, quantity: #{@quantity.inspect}, description: #{@description.inspect},"\
147
157
  " sku: #{@sku.inspect}, url: #{@url.inspect}, category: #{@category.inspect}, image_url:"\
148
- " #{@image_url.inspect}, upc: #{@upc.inspect}>"
158
+ " #{@image_url.inspect}, upc: #{@upc.inspect}, billing_plan: #{@billing_plan.inspect}>"
149
159
  end
150
160
  end
151
161
  end
@@ -41,6 +41,11 @@ module PaypalServerSdk
41
41
  # @return [UniversalProductCode]
42
42
  attr_accessor :upc
43
43
 
44
+ # Metadata for merchant-managed recurring billing plans. Valid only during
45
+ # the saved payment method token or billing agreement creation.
46
+ # @return [OrderBillingPlan]
47
+ attr_accessor :billing_plan
48
+
44
49
  # The currency and amount for a financial transaction, such as a balance or
45
50
  # payment due.
46
51
  # @return [Money]
@@ -87,6 +92,7 @@ module PaypalServerSdk
87
92
  @_hash['url'] = 'url'
88
93
  @_hash['image_url'] = 'image_url'
89
94
  @_hash['upc'] = 'upc'
95
+ @_hash['billing_plan'] = 'billing_plan'
90
96
  @_hash['unit_amount'] = 'unit_amount'
91
97
  @_hash['tax'] = 'tax'
92
98
  @_hash['commodity_code'] = 'commodity_code'
@@ -104,6 +110,7 @@ module PaypalServerSdk
104
110
  url
105
111
  image_url
106
112
  upc
113
+ billing_plan
107
114
  unit_amount
108
115
  tax
109
116
  commodity_code
@@ -119,9 +126,10 @@ module PaypalServerSdk
119
126
  end
120
127
 
121
128
  def initialize(name:, quantity:, description: SKIP, sku: SKIP, url: SKIP,
122
- image_url: SKIP, upc: SKIP, unit_amount: SKIP, tax: SKIP,
123
- commodity_code: SKIP, discount_amount: SKIP,
124
- total_amount: SKIP, unit_of_measure: SKIP)
129
+ image_url: SKIP, upc: SKIP, billing_plan: SKIP,
130
+ unit_amount: SKIP, tax: SKIP, commodity_code: SKIP,
131
+ discount_amount: SKIP, total_amount: SKIP,
132
+ unit_of_measure: SKIP)
125
133
  @name = name
126
134
  @quantity = quantity
127
135
  @description = description unless description == SKIP
@@ -129,6 +137,7 @@ module PaypalServerSdk
129
137
  @url = url unless url == SKIP
130
138
  @image_url = image_url unless image_url == SKIP
131
139
  @upc = upc unless upc == SKIP
140
+ @billing_plan = billing_plan unless billing_plan == SKIP
132
141
  @unit_amount = unit_amount unless unit_amount == SKIP
133
142
  @tax = tax unless tax == SKIP
134
143
  @commodity_code = commodity_code unless commodity_code == SKIP
@@ -149,6 +158,7 @@ module PaypalServerSdk
149
158
  url = hash.key?('url') ? hash['url'] : SKIP
150
159
  image_url = hash.key?('image_url') ? hash['image_url'] : SKIP
151
160
  upc = UniversalProductCode.from_hash(hash['upc']) if hash['upc']
161
+ billing_plan = OrderBillingPlan.from_hash(hash['billing_plan']) if hash['billing_plan']
152
162
  unit_amount = Money.from_hash(hash['unit_amount']) if hash['unit_amount']
153
163
  tax = Money.from_hash(hash['tax']) if hash['tax']
154
164
  commodity_code =
@@ -166,6 +176,7 @@ module PaypalServerSdk
166
176
  url: url,
167
177
  image_url: image_url,
168
178
  upc: upc,
179
+ billing_plan: billing_plan,
169
180
  unit_amount: unit_amount,
170
181
  tax: tax,
171
182
  commodity_code: commodity_code,
@@ -178,10 +189,10 @@ module PaypalServerSdk
178
189
  def to_s
179
190
  class_name = self.class.name.split('::').last
180
191
  "<#{class_name} name: #{@name}, quantity: #{@quantity}, description: #{@description}, sku:"\
181
- " #{@sku}, url: #{@url}, image_url: #{@image_url}, upc: #{@upc}, unit_amount:"\
182
- " #{@unit_amount}, tax: #{@tax}, commodity_code: #{@commodity_code}, discount_amount:"\
183
- " #{@discount_amount}, total_amount: #{@total_amount}, unit_of_measure:"\
184
- " #{@unit_of_measure}>"
192
+ " #{@sku}, url: #{@url}, image_url: #{@image_url}, upc: #{@upc}, billing_plan:"\
193
+ " #{@billing_plan}, unit_amount: #{@unit_amount}, tax: #{@tax}, commodity_code:"\
194
+ " #{@commodity_code}, discount_amount: #{@discount_amount}, total_amount: #{@total_amount},"\
195
+ " unit_of_measure: #{@unit_of_measure}>"
185
196
  end
186
197
 
187
198
  # Provides a debugging-friendly string with detailed object information.
@@ -189,10 +200,10 @@ module PaypalServerSdk
189
200
  class_name = self.class.name.split('::').last
190
201
  "<#{class_name} name: #{@name.inspect}, quantity: #{@quantity.inspect}, description:"\
191
202
  " #{@description.inspect}, sku: #{@sku.inspect}, url: #{@url.inspect}, image_url:"\
192
- " #{@image_url.inspect}, upc: #{@upc.inspect}, unit_amount: #{@unit_amount.inspect}, tax:"\
193
- " #{@tax.inspect}, commodity_code: #{@commodity_code.inspect}, discount_amount:"\
194
- " #{@discount_amount.inspect}, total_amount: #{@total_amount.inspect}, unit_of_measure:"\
195
- " #{@unit_of_measure.inspect}>"
203
+ " #{@image_url.inspect}, upc: #{@upc.inspect}, billing_plan: #{@billing_plan.inspect},"\
204
+ " unit_amount: #{@unit_amount.inspect}, tax: #{@tax.inspect}, commodity_code:"\
205
+ " #{@commodity_code.inspect}, discount_amount: #{@discount_amount.inspect}, total_amount:"\
206
+ " #{@total_amount.inspect}, unit_of_measure: #{@unit_of_measure.inspect}>"
196
207
  end
197
208
  end
198
209
  end