pcp-server-ruby-sdk 1.12.0 → 1.14.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 (181) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/README.md +1 -1
  4. data/api-definition.yaml +693 -40
  5. data/lib/PCP-server-Ruby-SDK/endpoints/pay_by_link_api_client.rb +33 -0
  6. data/lib/PCP-server-Ruby-SDK/endpoints/payment_intent_api_client.rb +37 -0
  7. data/lib/PCP-server-Ruby-SDK/models/address.rb +9 -237
  8. data/lib/PCP-server-Ruby-SDK/models/address_personal.rb +10 -246
  9. data/lib/PCP-server-Ruby-SDK/models/amount_of_money.rb +4 -195
  10. data/lib/PCP-server-Ruby-SDK/models/api_error.rb +27 -232
  11. data/lib/PCP-server-Ruby-SDK/models/apple_payment_data_token_header_information.rb +6 -194
  12. data/lib/PCP-server-Ruby-SDK/models/apple_payment_data_token_information.rb +8 -229
  13. data/lib/PCP-server-Ruby-SDK/models/authentication_token.rb +6 -183
  14. data/lib/PCP-server-Ruby-SDK/models/bank_account_information.rb +11 -207
  15. data/lib/PCP-server-Ruby-SDK/models/bank_payout_method_specific_input.rb +4 -187
  16. data/lib/PCP-server-Ruby-SDK/models/cancel_item.rb +6 -195
  17. data/lib/PCP-server-Ruby-SDK/models/cancel_payment_request.rb +6 -222
  18. data/lib/PCP-server-Ruby-SDK/models/cancel_payment_response.rb +4 -190
  19. data/lib/PCP-server-Ruby-SDK/models/cancel_request.rb +6 -224
  20. data/lib/PCP-server-Ruby-SDK/models/cancel_response.rb +4 -190
  21. data/lib/PCP-server-Ruby-SDK/models/capture_output.rb +9 -214
  22. data/lib/PCP-server-Ruby-SDK/models/capture_payment_request.rb +14 -253
  23. data/lib/PCP-server-Ruby-SDK/models/capture_payment_response.rb +7 -239
  24. data/lib/PCP-server-Ruby-SDK/models/card_fraud_results.rb +29 -184
  25. data/lib/PCP-server-Ruby-SDK/models/card_info.rb +3 -182
  26. data/lib/PCP-server-Ruby-SDK/models/card_payment_details.rb +8 -210
  27. data/lib/PCP-server-Ruby-SDK/models/card_payment_method_specific_input.rb +32 -307
  28. data/lib/PCP-server-Ruby-SDK/models/card_payment_method_specific_output.rb +6 -210
  29. data/lib/PCP-server-Ruby-SDK/models/card_recurrence_details.rb +12 -186
  30. data/lib/PCP-server-Ruby-SDK/models/cart_item_data.rb +10 -0
  31. data/lib/PCP-server-Ruby-SDK/models/cart_item_input.rb +5 -198
  32. data/lib/PCP-server-Ruby-SDK/models/cart_item_invoice_data.rb +5 -184
  33. data/lib/PCP-server-Ruby-SDK/models/cart_item_order_status.rb +4 -213
  34. data/lib/PCP-server-Ruby-SDK/models/cart_item_patch.rb +5 -200
  35. data/lib/PCP-server-Ruby-SDK/models/cart_item_result.rb +5 -200
  36. data/lib/PCP-server-Ruby-SDK/models/cart_item_supplier_references.rb +6 -195
  37. data/lib/PCP-server-Ruby-SDK/models/checkout_references.rb +4 -192
  38. data/lib/PCP-server-Ruby-SDK/models/checkout_response.rb +15 -319
  39. data/lib/PCP-server-Ruby-SDK/models/checkouts_response.rb +4 -193
  40. data/lib/PCP-server-Ruby-SDK/models/company_information.rb +3 -182
  41. data/lib/PCP-server-Ruby-SDK/models/complete_financing_payment_method_specific_input.rb +12 -202
  42. data/lib/PCP-server-Ruby-SDK/models/complete_order_request.rb +3 -181
  43. data/lib/PCP-server-Ruby-SDK/models/complete_payment_method_specific_input.rb +4 -191
  44. data/lib/PCP-server-Ruby-SDK/models/complete_payment_product840_specific_input.rb +7 -226
  45. data/lib/PCP-server-Ruby-SDK/models/complete_payment_request.rb +6 -209
  46. data/lib/PCP-server-Ruby-SDK/models/complete_payment_response.rb +5 -199
  47. data/lib/PCP-server-Ruby-SDK/models/complete_redirect_payment_method_specific_input.rb +4 -192
  48. data/lib/PCP-server-Ruby-SDK/models/contact_details.rb +4 -191
  49. data/lib/PCP-server-Ruby-SDK/models/create_checkout_request.rb +13 -240
  50. data/lib/PCP-server-Ruby-SDK/models/create_checkout_response.rb +16 -307
  51. data/lib/PCP-server-Ruby-SDK/models/create_commerce_case_response.rb +7 -219
  52. data/lib/PCP-server-Ruby-SDK/models/create_pay_by_link_request.rb +12 -0
  53. data/lib/PCP-server-Ruby-SDK/models/create_pay_by_link_response.rb +13 -0
  54. data/lib/PCP-server-Ruby-SDK/models/create_payment_intent.rb +11 -0
  55. data/lib/PCP-server-Ruby-SDK/models/create_payment_intent_request.rb +13 -0
  56. data/lib/PCP-server-Ruby-SDK/models/create_payment_intent_response.rb +10 -0
  57. data/lib/PCP-server-Ruby-SDK/models/create_payment_response.rb +7 -218
  58. data/lib/PCP-server-Ruby-SDK/models/customer.rb +28 -260
  59. data/lib/PCP-server-Ruby-SDK/models/customer_account.rb +10 -44
  60. data/lib/PCP-server-Ruby-SDK/models/customer_device.rb +8 -209
  61. data/lib/PCP-server-Ruby-SDK/models/deliver_item.rb +6 -195
  62. data/lib/PCP-server-Ruby-SDK/models/deliver_request.rb +10 -246
  63. data/lib/PCP-server-Ruby-SDK/models/deliver_response.rb +4 -191
  64. data/lib/PCP-server-Ruby-SDK/models/delivery_information.rb +3 -185
  65. data/lib/PCP-server-Ruby-SDK/models/error_response.rb +4 -193
  66. data/lib/PCP-server-Ruby-SDK/models/financing_payment_method_specific_input.rb +15 -203
  67. data/lib/PCP-server-Ruby-SDK/models/financing_payment_method_specific_output.rb +10 -196
  68. data/lib/PCP-server-Ruby-SDK/models/fund_distribution.rb +12 -263
  69. data/lib/PCP-server-Ruby-SDK/models/fund_split.rb +5 -205
  70. data/lib/PCP-server-Ruby-SDK/models/fund_split_request.rb +3 -147
  71. data/lib/PCP-server-Ruby-SDK/models/fund_split_response.rb +10 -174
  72. data/lib/PCP-server-Ruby-SDK/models/installment_option.rb +13 -273
  73. data/lib/PCP-server-Ruby-SDK/models/link_information.rb +4 -196
  74. data/lib/PCP-server-Ruby-SDK/models/merchant_action.rb +16 -194
  75. data/lib/PCP-server-Ruby-SDK/models/mobile_payment_method_specific_input.rb +13 -246
  76. data/lib/PCP-server-Ruby-SDK/models/mobile_payment_method_specific_output.rb +7 -219
  77. data/lib/PCP-server-Ruby-SDK/models/mobile_payment_three_dsecure.rb +3 -179
  78. data/lib/PCP-server-Ruby-SDK/models/model_base.rb +147 -0
  79. data/lib/PCP-server-Ruby-SDK/models/order.rb +7 -221
  80. data/lib/PCP-server-Ruby-SDK/models/order_item.rb +6 -197
  81. data/lib/PCP-server-Ruby-SDK/models/order_line_details_input.rb +29 -305
  82. data/lib/PCP-server-Ruby-SDK/models/order_line_details_patch.rb +5 -326
  83. data/lib/PCP-server-Ruby-SDK/models/order_line_details_result.rb +5 -326
  84. data/lib/PCP-server-Ruby-SDK/models/order_request.rb +7 -244
  85. data/lib/PCP-server-Ruby-SDK/models/order_response.rb +4 -192
  86. data/lib/PCP-server-Ruby-SDK/models/patch_checkout_request.rb +8 -228
  87. data/lib/PCP-server-Ruby-SDK/models/patch_commerce_case_request.rb +3 -183
  88. data/lib/PCP-server-Ruby-SDK/models/pause_payment_request.rb +2 -165
  89. data/lib/PCP-server-Ruby-SDK/models/pause_payment_response.rb +3 -186
  90. data/lib/PCP-server-Ruby-SDK/models/pay_link_status_value.rb +20 -0
  91. data/lib/PCP-server-Ruby-SDK/models/payee.rb +6 -204
  92. data/lib/PCP-server-Ruby-SDK/models/payment_creation_output.rb +3 -183
  93. data/lib/PCP-server-Ruby-SDK/models/payment_event.rb +19 -274
  94. data/lib/PCP-server-Ruby-SDK/models/payment_execution.rb +29 -335
  95. data/lib/PCP-server-Ruby-SDK/models/payment_execution_request.rb +4 -191
  96. data/lib/PCP-server-Ruby-SDK/models/payment_execution_specific_input.rb +6 -212
  97. data/lib/PCP-server-Ruby-SDK/models/payment_information_refund_request.rb +7 -205
  98. data/lib/PCP-server-Ruby-SDK/models/payment_information_refund_response.rb +5 -196
  99. data/lib/PCP-server-Ruby-SDK/models/payment_information_request.rb +10 -249
  100. data/lib/PCP-server-Ruby-SDK/models/payment_information_response.rb +34 -314
  101. data/lib/PCP-server-Ruby-SDK/models/payment_instructions.rb +8 -214
  102. data/lib/PCP-server-Ruby-SDK/models/payment_intent_output.rb +13 -0
  103. data/lib/PCP-server-Ruby-SDK/models/payment_intent_response.rb +13 -0
  104. data/lib/PCP-server-Ruby-SDK/models/payment_intent_response_data.rb +12 -0
  105. data/lib/PCP-server-Ruby-SDK/models/payment_link_order.rb +10 -0
  106. data/lib/PCP-server-Ruby-SDK/models/payment_link_specific_input.rb +19 -0
  107. data/lib/PCP-server-Ruby-SDK/models/payment_method_specific_input.rb +9 -261
  108. data/lib/PCP-server-Ruby-SDK/models/payment_method_specific_input_for_intent.rb +9 -0
  109. data/lib/PCP-server-Ruby-SDK/models/payment_output.rb +11 -255
  110. data/lib/PCP-server-Ruby-SDK/models/payment_product302_specific_input.rb +11 -225
  111. data/lib/PCP-server-Ruby-SDK/models/payment_product3391_specific_input.rb +6 -197
  112. data/lib/PCP-server-Ruby-SDK/models/payment_product3391_specific_output.rb +3 -185
  113. data/lib/PCP-server-Ruby-SDK/models/payment_product3392_specific_input.rb +3 -185
  114. data/lib/PCP-server-Ruby-SDK/models/payment_product5002_specific_input.rb +7 -203
  115. data/lib/PCP-server-Ruby-SDK/models/payment_product771_specific_output.rb +3 -183
  116. data/lib/PCP-server-Ruby-SDK/models/payment_product840_customer_account.rb +6 -210
  117. data/lib/PCP-server-Ruby-SDK/models/payment_product840_customer_account_for_intent.rb +12 -0
  118. data/lib/PCP-server-Ruby-SDK/models/payment_product840_specific_output.rb +6 -211
  119. data/lib/PCP-server-Ruby-SDK/models/payment_product840_specific_output_for_intent.rb +12 -0
  120. data/lib/PCP-server-Ruby-SDK/models/payment_references.rb +6 -184
  121. data/lib/PCP-server-Ruby-SDK/models/payment_references_for_payment_intent.rb +11 -0
  122. data/lib/PCP-server-Ruby-SDK/models/payment_references_for_refund.rb +12 -197
  123. data/lib/PCP-server-Ruby-SDK/models/payment_response.rb +6 -234
  124. data/lib/PCP-server-Ruby-SDK/models/payment_status_output.rb +6 -234
  125. data/lib/PCP-server-Ruby-SDK/models/payout_output.rb +5 -205
  126. data/lib/PCP-server-Ruby-SDK/models/payout_response.rb +6 -215
  127. data/lib/PCP-server-Ruby-SDK/models/personal_information.rb +11 -227
  128. data/lib/PCP-server-Ruby-SDK/models/personal_name.rb +5 -201
  129. data/lib/PCP-server-Ruby-SDK/models/positive_amount_of_money.rb +4 -196
  130. data/lib/PCP-server-Ruby-SDK/models/processing_mandate_information.rb +9 -254
  131. data/lib/PCP-server-Ruby-SDK/models/redirect_data.rb +3 -183
  132. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_input.rb +14 -249
  133. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_input_for_intent.rb +12 -0
  134. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_output.rb +6 -211
  135. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_output_for_create_intent.rb +12 -0
  136. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_output_for_intent.rb +10 -0
  137. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_product840_specific_input.rb +6 -205
  138. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_product840_specific_input_data.rb +10 -0
  139. data/lib/PCP-server-Ruby-SDK/models/redirect_payment_product900_specific_input.rb +12 -177
  140. data/lib/PCP-server-Ruby-SDK/models/redirection_data.rb +11 -186
  141. data/lib/PCP-server-Ruby-SDK/models/references.rb +47 -205
  142. data/lib/PCP-server-Ruby-SDK/models/refresh_payment_request.rb +3 -186
  143. data/lib/PCP-server-Ruby-SDK/models/refund_error_response.rb +4 -193
  144. data/lib/PCP-server-Ruby-SDK/models/refund_output.rb +8 -211
  145. data/lib/PCP-server-Ruby-SDK/models/refund_payment_response.rb +7 -242
  146. data/lib/PCP-server-Ruby-SDK/models/refund_request.rb +6 -210
  147. data/lib/PCP-server-Ruby-SDK/models/return_information.rb +4 -194
  148. data/lib/PCP-server-Ruby-SDK/models/return_item.rb +6 -196
  149. data/lib/PCP-server-Ruby-SDK/models/return_request.rb +6 -234
  150. data/lib/PCP-server-Ruby-SDK/models/return_response.rb +4 -191
  151. data/lib/PCP-server-Ruby-SDK/models/sepa_direct_debit_payment_method_specific_input.rb +4 -193
  152. data/lib/PCP-server-Ruby-SDK/models/sepa_direct_debit_payment_method_specific_output.rb +4 -193
  153. data/lib/PCP-server-Ruby-SDK/models/sepa_direct_debit_payment_product771_specific_input.rb +4 -192
  154. data/lib/PCP-server-Ruby-SDK/models/sepa_transfer_payment_product_772_specific_input.rb +3 -186
  155. data/lib/PCP-server-Ruby-SDK/models/shipping.rb +3 -183
  156. data/lib/PCP-server-Ruby-SDK/models/shipping_address.rb +14 -0
  157. data/lib/PCP-server-Ruby-SDK/models/shopping_cart_data.rb +9 -0
  158. data/lib/PCP-server-Ruby-SDK/models/shopping_cart_input.rb +3 -185
  159. data/lib/PCP-server-Ruby-SDK/models/shopping_cart_patch.rb +3 -185
  160. data/lib/PCP-server-Ruby-SDK/models/shopping_cart_result.rb +3 -185
  161. data/lib/PCP-server-Ruby-SDK/models/status_output.rb +21 -264
  162. data/lib/PCP-server-Ruby-SDK/models/three_d_secure_results.rb +6 -226
  163. data/lib/PCP-server-Ruby-SDK/queries/get_checkouts_query.rb +5 -1
  164. data/lib/PCP-server-Ruby-SDK/version.rb +1 -1
  165. data/lib/PCP-server-Ruby-SDK.rb +25 -0
  166. data/package-lock.json +2 -2
  167. data/package.json +1 -1
  168. data/scripts/convert_models_to_model_base.rb +128 -0
  169. data/spec/endpoints/pay_by_link_api_client_spec.rb +38 -0
  170. data/spec/endpoints/payment_information_api_client_spec.rb +9 -2
  171. data/spec/endpoints/payment_intent_api_client_spec.rb +45 -0
  172. data/spec/models/api_definition_conformance_spec.rb +88 -0
  173. data/spec/models/model_base_spec.rb +87 -0
  174. data/spec/models/pay_by_link_models_spec.rb +50 -0
  175. data/spec/models/payment_intent_models_spec.rb +51 -0
  176. data/spec/models/required_field_validation_spec.rb +5 -5
  177. data/spec/queries/get_checkouts_query_spec.rb +15 -0
  178. metadata +45 -10
  179. data/lib/PCP-server-Ruby-SDK/models/action_type.rb +0 -34
  180. data/lib/PCP-server-Ruby-SDK/models/avs_result.rb +0 -52
  181. data/lib/PCP-server-Ruby-SDK/models/business_relation.rb +0 -30
@@ -1,314 +1,38 @@
1
- require 'date'
2
- require 'time'
1
+ require_relative 'model_base'
3
2
 
4
- # Object containing additional information that when supplied can have a beneficial effect on the discountrates.
5
3
  module PCPServerSDK
6
4
  module Models
7
- class OrderLineDetailsInput
5
+ class OrderLineDetailsInput < ModelBase
8
6
  # Product or UPC Code
9
- attr_accessor :product_code
10
-
7
+ attribute :product_code, :productCode, :String
11
8
  # The price of one unit of the product, the value should be zero or greater.
12
- attr_accessor :product_price
13
-
14
- attr_accessor :product_type
15
-
16
- # Quantity of the units being purchased, should be greater than zero Note: Must not be all spaces or all zeros
17
- attr_accessor :quantity
18
-
19
- # Tax on the line item, with the last two digits implied as decimal places
20
- attr_accessor :tax_amount
21
-
22
- # This field indicates if the `taxAmount` is to be interpreted as the tax amount per unit rather than for the entire line item. This field is included in the response only when `taxAmount` is set; otherwise, it will return as `null`.
23
- attr_accessor :tax_amount_per_unit
24
-
25
- # URL of the product in shop. Used for PAYONE Buy Now, Pay Later (BNPL).
26
- attr_accessor :product_url
27
-
28
- # URL of a product image. Used for PAYONE Buy Now, Pay Later (BNPL).
29
- attr_accessor :product_image_url
30
-
31
- # Category path of the item. Used for PAYONE Buy Now, Pay Later (BNPL).
32
- attr_accessor :product_category_path
33
-
34
- # Optional parameter to define the delivery shop or touchpoint where an item has been collected (e.g. for Click & Collect or Click & Reserve).
35
- attr_accessor :merchant_shop_delivery_reference
36
-
9
+ attribute :product_price, :productPrice, :Integer
10
+ attribute :product_type, :productType, :ProductType
11
+ # Quantity of the units being purchased, should be greater than zero
12
+ # Note: Must not be all spaces or all zeros
13
+ attribute :quantity, :quantity, :Integer
14
+ # Tax on the line item, with the last two digits implied as decimal places.
15
+ attribute :tax_amount, :taxAmount, :Integer
16
+ # This field indicates if the `taxAmount` is to be interpreted as the tax amount per unit rather than for the entire line item.
17
+ # This field is included in the response only when `taxAmount` is set; otherwise, it will return as `null`.
18
+ attribute :tax_amount_per_unit, :taxAmountPerUnit, :Boolean, default: false
19
+ # URL of the product in shop.
20
+ #
21
+ # Used for PAYONE Buy Now, Pay Later (BNPL).
22
+ attribute :product_url, :productUrl, :String
23
+ # URL of a product image.
24
+ #
25
+ # Used for PAYONE Buy Now, Pay Later (BNPL).
26
+ attribute :product_image_url, :productImageUrl, :String
27
+ # Category path of the item.
28
+ #
29
+ # Used for PAYONE Buy Now, Pay Later (BNPL).
30
+ attribute :product_category_path, :productCategoryPath, :String
31
+ # Optional parameter to define the delivery shop or touchpoint where an item has been collected (e.g. for
32
+ # Click & Collect or Click & Reserve).
33
+ attribute :merchant_shop_delivery_reference, :merchantShopDeliveryReference, :String
37
34
  # The name of the product, will be displayed in Portal if set.
38
- attr_accessor :product_name
39
-
40
- class EnumAttributeValidator
41
- attr_reader :datatype
42
- attr_reader :allowable_values
43
-
44
- def initialize(datatype, allowable_values)
45
- @allowable_values = allowable_values.map do |value|
46
- case datatype.to_s
47
- when /Integer/i
48
- value.to_i
49
- when /Float/i
50
- value.to_f
51
- else
52
- value
53
- end
54
- end
55
- end
56
-
57
- def valid?(value)
58
- !value || allowable_values.include?(value)
59
- end
60
- end
61
-
62
- # Attribute mapping from ruby-style variable name to JSON key.
63
- def self.attribute_map
64
- {
65
- :'product_code' => :'productCode',
66
- :'product_price' => :'productPrice',
67
- :'product_type' => :'productType',
68
- :'quantity' => :'quantity',
69
- :'tax_amount' => :'taxAmount',
70
- :'tax_amount_per_unit' => :'taxAmountPerUnit',
71
- :'product_url' => :'productUrl',
72
- :'product_image_url' => :'productImageUrl',
73
- :'product_category_path' => :'productCategoryPath',
74
- :'merchant_shop_delivery_reference' => :'merchantShopDeliveryReference',
75
- :'product_name' => :'productName'
76
- }
77
- end
78
-
79
- # Returns all the JSON keys this model knows about
80
- def self.acceptable_attributes
81
- attribute_map.values
82
- end
83
-
84
- # Attribute type mapping.
85
- def self.openapi_types
86
- {
87
- :'product_code' => :'String',
88
- :'product_price' => :'Integer',
89
- :'product_type' => :'ProductType',
90
- :'quantity' => :'Integer',
91
- :'tax_amount' => :'Integer',
92
- :'tax_amount_per_unit' => :'Boolean',
93
- :'product_url' => :'String',
94
- :'product_image_url' => :'String',
95
- :'product_category_path' => :'String',
96
- :'merchant_shop_delivery_reference' => :'String',
97
- :'product_name' => :'String'
98
- }
99
- end
100
-
101
- # List of attributes with nullable: true
102
- def self.openapi_nullable
103
- Set.new([])
104
- end
105
-
106
- # Initializes the object
107
- def initialize(attributes = {})
108
- if (!attributes.is_a?(Hash))
109
- fail ArgumentError, "The input argument (attributes) must be a hash in `OrderLineDetailsInput` initialize method"
110
- end
111
-
112
- # check to see if the attribute exists and convert string to symbol for hash key
113
- attributes = attributes.each_with_object({}) { |(k, v), h|
114
- if (!self.class.attribute_map.key?(k.to_sym))
115
- fail ArgumentError, "`#{k}` is not a valid attribute in `OrderLineDetailsInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
116
- end
117
- h[k.to_sym] = v
118
- }
119
-
120
- if attributes.key?(:'product_code')
121
- self.product_code = attributes[:'product_code']
122
- end
123
-
124
- if attributes.key?(:'product_price')
125
- self.product_price = attributes[:'product_price']
126
- else
127
- self.product_price = nil
128
- end
129
-
130
- if attributes.key?(:'product_type')
131
- self.product_type = attributes[:'product_type']
132
- end
133
-
134
- if attributes.key?(:'quantity')
135
- self.quantity = attributes[:'quantity']
136
- else
137
- self.quantity = nil
138
- end
139
-
140
- if attributes.key?(:'tax_amount')
141
- self.tax_amount = attributes[:'tax_amount']
142
- end
143
-
144
- if attributes.key?(:'tax_amount_per_unit')
145
- self.tax_amount_per_unit = attributes[:'tax_amount_per_unit']
146
- else
147
- self.tax_amount_per_unit = false
148
- end
149
-
150
- if attributes.key?(:'product_url')
151
- self.product_url = attributes[:'product_url']
152
- end
153
-
154
- if attributes.key?(:'product_image_url')
155
- self.product_image_url = attributes[:'product_image_url']
156
- end
157
-
158
- if attributes.key?(:'product_category_path')
159
- self.product_category_path = attributes[:'product_category_path']
160
- end
161
-
162
- if attributes.key?(:'merchant_shop_delivery_reference')
163
- self.merchant_shop_delivery_reference = attributes[:'merchant_shop_delivery_reference']
164
- end
165
-
166
- if attributes.key?(:'product_name')
167
- self.product_name = attributes[:'product_name']
168
- end
169
- end
170
-
171
- # Checks equality by comparing each attribute.
172
- # @param [Object] Object to be compared
173
- def ==(o)
174
- return true if self.equal?(o)
175
- self.class == o.class &&
176
- product_code == o.product_code &&
177
- product_price == o.product_price &&
178
- product_type == o.product_type &&
179
- quantity == o.quantity &&
180
- tax_amount == o.tax_amount &&
181
- tax_amount_per_unit == o.tax_amount_per_unit &&
182
- product_url == o.product_url &&
183
- product_image_url == o.product_image_url &&
184
- product_category_path == o.product_category_path &&
185
- merchant_shop_delivery_reference == o.merchant_shop_delivery_reference &&
186
- product_name == o.product_name
187
- end
188
-
189
- # @see the `==` method
190
- # @param [Object] Object to be compared
191
- def eql?(o)
192
- self == o
193
- end
194
-
195
- # Calculates hash code according to all attributes.
196
- # @return [Integer] Hash code
197
- def hash
198
- [product_code, product_price, product_type, quantity, tax_amount, tax_amount_per_unit, product_url, product_image_url, product_category_path, merchant_shop_delivery_reference, product_name].hash
199
- end
200
-
201
- # Builds the object from hash
202
- # @param [Hash] attributes Model attributes in the form of hash
203
- # @return [Object] Returns the model itself
204
- def self.build_from_hash(attributes)
205
- return nil unless attributes.is_a?(Hash)
206
- attributes = attributes.transform_keys(&:to_sym)
207
- transformed_hash = {}
208
- openapi_types.each_pair do |key, type|
209
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
210
- transformed_hash["#{key}"] = nil
211
- elsif type =~ /\AArray<(.*)>/i
212
- # check to ensure the input is an array given that the attribute
213
- # is documented as an array but the input is not
214
- if attributes[attribute_map[key]].is_a?(Array)
215
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
216
- end
217
- elsif !attributes[attribute_map[key]].nil?
218
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
219
- end
220
- end
221
- new(transformed_hash)
222
- end
223
-
224
- # Deserializes the data based on type
225
- # @param string type Data type
226
- # @param string value Value to be deserialized
227
- # @return [Object] Deserialized data
228
- def self._deserialize(type, value)
229
- case type.to_sym
230
- when :Time
231
- Time.parse(value)
232
- when :Date
233
- Date.parse(value)
234
- when :String
235
- value.to_s
236
- when :Integer
237
- value.to_i
238
- when :Float
239
- value.to_f
240
- when :Boolean
241
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
242
- true
243
- else
244
- false
245
- end
246
- when :Object
247
- # generic object (usually a Hash), return directly
248
- value
249
- when /\AArray<(?<inner_type>.+)>\z/
250
- inner_type = Regexp.last_match[:inner_type]
251
- value.map { |v| _deserialize(inner_type, v) }
252
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
253
- k_type = Regexp.last_match[:k_type]
254
- v_type = Regexp.last_match[:v_type]
255
- {}.tap do |hash|
256
- value.each do |k, v|
257
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
258
- end
259
- end
260
- else # model
261
- # models (e.g. Pet) or oneOf
262
- klass = PCPServerSDK::Models.const_get(type)
263
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
264
- end
265
- end
266
-
267
- # Returns the string representation of the object
268
- # @return [String] String presentation of the object
269
- def to_s
270
- to_hash.to_s
271
- end
272
-
273
- # to_body is an alias to to_hash (backward compatibility)
274
- # @return [Hash] Returns the object in the form of hash
275
- def to_body
276
- to_hash
277
- end
278
-
279
- # Returns the object in the form of hash
280
- # @return [Hash] Returns the object in the form of hash
281
- def to_hash
282
- hash = {}
283
- self.class.attribute_map.each_pair do |attr, param|
284
- value = self.send(attr)
285
- if value.nil?
286
- is_nullable = self.class.openapi_nullable.include?(attr)
287
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
288
- end
289
-
290
- hash[param] = _to_hash(value)
291
- end
292
- hash
293
- end
294
-
295
- # Outputs non-array value in the form of hash
296
- # For object, use to_hash. Otherwise, just return the value
297
- # @param [Object] value Any valid value
298
- # @return [Hash] Returns the value in the form of hash
299
- def _to_hash(value)
300
- if value.is_a?(Array)
301
- value.compact.map { |v| _to_hash(v) }
302
- elsif value.is_a?(Hash)
303
- {}.tap do |hash|
304
- value.each { |k, v| hash[k] = _to_hash(v) }
305
- end
306
- elsif value.respond_to? :to_hash
307
- value.to_hash
308
- else
309
- value
310
- end
311
- end
35
+ attribute :product_name, :productName, :String
312
36
  end
313
37
  end
314
38
  end
@@ -1,335 +1,14 @@
1
+ require_relative 'order_line_details_input'
1
2
 
2
- require 'date'
3
- require 'time'
4
-
5
- # Object containing additional information that when supplied can have a beneficial effect on the discountrates.
6
3
  module PCPServerSDK
7
4
  module Models
8
- class OrderLineDetailsPatch
5
+ class OrderLineDetailsPatch < OrderLineDetailsInput
9
6
  # Unique identifier of a cart item
10
- attr_accessor :id
11
-
12
- attr_accessor :status
13
-
14
- # Product or UPC Code
15
- attr_accessor :product_code
16
-
17
- # The price of one unit of the product, the value should be zero or greater.
18
- attr_accessor :product_price
19
-
20
- attr_accessor :product_type
21
-
22
- # Quantity of the units being purchased, should be greater than zero Note: Must not be all spaces or all zeros
23
- attr_accessor :quantity
24
-
25
- # Tax on the line item, with the last two digits implied as decimal places
26
- attr_accessor :tax_amount
27
-
28
- # Indicates if the taxAmount is to be interpreted as the tax amount per unit rather than for the entire line item.
29
- attr_accessor :tax_amount_per_unit
30
-
31
- # URL of the product in shop. Used for PAYONE Buy Now, Pay Later (BNPL).
32
- attr_accessor :product_url
33
-
34
- # URL of a product image. Used for PAYONE Buy Now, Pay Later (BNPL).
35
- attr_accessor :product_image_url
36
-
37
- # Category path of the item. Used for PAYONE Buy Now, Pay Later (BNPL).
38
- attr_accessor :product_category_path
39
-
40
- # Optional parameter to define the delivery shop or touchpoint where an item has been collected (e.g. for Click & Collect or Click & Reserve).
41
- attr_accessor :merchant_shop_delivery_reference
42
-
43
-
44
-
45
- class EnumAttributeValidator
46
- attr_reader :datatype
47
- attr_reader :allowable_values
48
-
49
- def initialize(datatype, allowable_values)
50
- @allowable_values = allowable_values.map do |value|
51
- case datatype.to_s
52
- when /Integer/i
53
- value.to_i
54
- when /Float/i
55
- value.to_f
56
- else
57
- value
58
- end
59
- end
60
- end
61
-
62
- def valid?(value)
63
- !value || allowable_values.include?(value)
64
- end
65
- end
66
-
67
- # Attribute mapping from ruby-style variable name to JSON key.
68
- def self.attribute_map
69
- {
70
- :'id' => :'id',
71
- :'status' => :'status',
72
- :'product_code' => :'productCode',
73
- :'product_price' => :'productPrice',
74
- :'product_type' => :'productType',
75
- :'quantity' => :'quantity',
76
- :'tax_amount' => :'taxAmount',
77
- :'tax_amount_per_unit' => :'taxAmountPerUnit',
78
- :'product_url' => :'productUrl',
79
- :'product_image_url' => :'productImageUrl',
80
- :'product_category_path' => :'productCategoryPath',
81
- :'merchant_shop_delivery_reference' => :'merchantShopDeliveryReference'
82
- }
83
- end
84
-
85
- # Returns all the JSON keys this model knows about
86
- def self.acceptable_attributes
87
- attribute_map.values
88
- end
89
-
90
- # Attribute type mapping.
91
- def self.openapi_types
92
- {
93
- :'id' => :'String',
94
- :'status' => :'Array<CartItemOrderStatus>',
95
- :'product_code' => :'String',
96
- :'product_price' => :'Integer',
97
- :'product_type' => :'ProductType',
98
- :'quantity' => :'Integer',
99
- :'tax_amount' => :'Integer',
100
- :'tax_amount_per_unit' => :'Boolean',
101
- :'product_url' => :'String',
102
- :'product_image_url' => :'String',
103
- :'product_category_path' => :'String',
104
- :'merchant_shop_delivery_reference' => :'String'
105
- }
106
- end
107
-
108
- # List of attributes with nullable: true
109
- def self.openapi_nullable
110
- Set.new([
111
- ])
112
- end
113
-
114
- # List of module PCPServerSDK
7
+ attribute :id, :id, :String
8
+ attribute :status, :status, "Array<CartItemOrderStatus>"
115
9
 
116
10
  def self.openapi_all_of
117
- [
118
- :'OrderLineDetailsInput'
119
- ]
120
- end
121
-
122
- # Initializes the object
123
- # @param [Hash] attributes Model attributes in the form of hash
124
- def initialize(attributes = {})
125
- if (!attributes.is_a?(Hash))
126
- fail ArgumentError, "The input argument (attributes) must be a hash in `OrderLineDetailsPatch` initialize method"
127
- end
128
-
129
- # check to see if the attribute exists and convert string to symbol for hash key
130
- attributes = attributes.each_with_object({}) { |(k, v), h|
131
- if (!self.class.attribute_map.key?(k.to_sym))
132
- fail ArgumentError, "`#{k}` is not a valid attribute in `OrderLineDetailsPatch`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
133
- end
134
- h[k.to_sym] = v
135
- }
136
-
137
- if attributes.key?(:'id')
138
- self.id = attributes[:'id']
139
- end
140
-
141
- if attributes.key?(:'status')
142
- if (value = attributes[:'status']).is_a?(Array)
143
- self.status = value
144
- end
145
- end
146
-
147
- if attributes.key?(:'product_code')
148
- self.product_code = attributes[:'product_code']
149
- end
150
-
151
- if attributes.key?(:'product_price')
152
- self.product_price = attributes[:'product_price']
153
- else
154
- self.product_price = nil
155
- end
156
-
157
- if attributes.key?(:'product_type')
158
- self.product_type = attributes[:'product_type']
159
- end
160
-
161
- if attributes.key?(:'quantity')
162
- self.quantity = attributes[:'quantity']
163
- else
164
- self.quantity = nil
165
- end
166
-
167
- if attributes.key?(:'tax_amount')
168
- self.tax_amount = attributes[:'tax_amount']
169
- end
170
-
171
- if attributes.key?(:'tax_amount_per_unit')
172
- self.tax_amount_per_unit = attributes[:'tax_amount_per_unit']
173
- end
174
-
175
- if attributes.key?(:'product_url')
176
- self.product_url = attributes[:'product_url']
177
- end
178
-
179
- if attributes.key?(:'product_image_url')
180
- self.product_image_url = attributes[:'product_image_url']
181
- end
182
-
183
- if attributes.key?(:'product_category_path')
184
- self.product_category_path = attributes[:'product_category_path']
185
- end
186
-
187
- if attributes.key?(:'merchant_shop_delivery_reference')
188
- self.merchant_shop_delivery_reference = attributes[:'merchant_shop_delivery_reference']
189
- end
190
- end
191
-
192
- # Checks equality by comparing each attribute.
193
- # @param [Object] Object to be compared
194
- def ==(o)
195
- return true if self.equal?(o)
196
- self.class == o.class &&
197
- id == o.id &&
198
- status == o.status &&
199
- product_code == o.product_code &&
200
- product_price == o.product_price &&
201
- product_type == o.product_type &&
202
- quantity == o.quantity &&
203
- tax_amount == o.tax_amount &&
204
- tax_amount_per_unit == o.tax_amount_per_unit &&
205
- product_url == o.product_url &&
206
- product_image_url == o.product_image_url &&
207
- product_category_path == o.product_category_path &&
208
- merchant_shop_delivery_reference == o.merchant_shop_delivery_reference
209
- end
210
-
211
- # @see the `==` method
212
- # @param [Object] Object to be compared
213
- def eql?(o)
214
- self == o
215
- end
216
-
217
- # Calculates hash code according to all attributes.
218
- # @return [Integer] Hash code
219
- def hash
220
- [id, status, product_code, product_price, product_type, quantity, tax_amount, tax_amount_per_unit, product_url, product_image_url, product_category_path, merchant_shop_delivery_reference].hash
221
- end
222
-
223
- # Builds the object from hash
224
- # @param [Hash] attributes Model attributes in the form of hash
225
- # @return [Object] Returns the model itself
226
- def self.build_from_hash(attributes)
227
- return nil unless attributes.is_a?(Hash)
228
- attributes = attributes.transform_keys(&:to_sym)
229
- transformed_hash = {}
230
- openapi_types.each_pair do |key, type|
231
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
232
- transformed_hash["#{key}"] = nil
233
- elsif type =~ /\AArray<(.*)>/i
234
- # check to ensure the input is an array given that the attribute
235
- # is documented as an array but the input is not
236
- if attributes[attribute_map[key]].is_a?(Array)
237
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
238
- end
239
- elsif !attributes[attribute_map[key]].nil?
240
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
241
- end
242
- end
243
- new(transformed_hash)
244
- end
245
-
246
- # Deserializes the data based on type
247
- # @param string type Data type
248
- # @param string value Value to be deserialized
249
- # @return [Object] Deserialized data
250
- def self._deserialize(type, value)
251
- case type.to_sym
252
- when :Time
253
- Time.parse(value)
254
- when :Date
255
- Date.parse(value)
256
- when :String
257
- value.to_s
258
- when :Integer
259
- value.to_i
260
- when :Float
261
- value.to_f
262
- when :Boolean
263
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
264
- true
265
- else
266
- false
267
- end
268
- when :Object
269
- # generic object (usually a Hash), return directly
270
- value
271
- when /\AArray<(?<inner_type>.+)>\z/
272
- inner_type = Regexp.last_match[:inner_type]
273
- value.map { |v| _deserialize(inner_type, v) }
274
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
275
- k_type = Regexp.last_match[:k_type]
276
- v_type = Regexp.last_match[:v_type]
277
- {}.tap do |hash|
278
- value.each do |k, v|
279
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
280
- end
281
- end
282
- else # model
283
- # models (e.g. Pet) or oneOf
284
- klass = PCPServerSDK::Models.const_get(type)
285
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
286
- end
287
- end
288
-
289
- # Returns the string representation of the object
290
- # @return [String] String presentation of the object
291
- def to_s
292
- to_hash.to_s
293
- end
294
-
295
- # to_body is an alias to to_hash (backward compatibility)
296
- # @return [Hash] Returns the object in the form of hash
297
- def to_body
298
- to_hash
299
- end
300
-
301
- # Returns the object in the form of hash
302
- # @return [Hash] Returns the object in the form of hash
303
- def to_hash
304
- hash = {}
305
- self.class.attribute_map.each_pair do |attr, param|
306
- value = self.send(attr)
307
- if value.nil?
308
- is_nullable = self.class.openapi_nullable.include?(attr)
309
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
310
- end
311
-
312
- hash[param] = _to_hash(value)
313
- end
314
- hash
315
- end
316
-
317
- # Outputs non-array value in the form of hash
318
- # For object, use to_hash. Otherwise, just return the value
319
- # @param [Object] value Any valid value
320
- # @return [Hash] Returns the value in the form of hash
321
- def _to_hash(value)
322
- if value.is_a?(Array)
323
- value.compact.map { |v| _to_hash(v) }
324
- elsif value.is_a?(Hash)
325
- {}.tap do |hash|
326
- value.each { |k, v| hash[k] = _to_hash(v) }
327
- end
328
- elsif value.respond_to? :to_hash
329
- value.to_hash
330
- else
331
- value
332
- end
11
+ [:OrderLineDetailsInput]
333
12
  end
334
13
  end
335
14
  end