cybersource_rest_client 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (363) hide show
  1. checksums.yaml +4 -4
  2. data/AuthenticationSDK/Cybersource.gemspec +24 -23
  3. data/AuthenticationSDK/authentication/http/GetSignatureParameter.rb +64 -64
  4. data/AuthenticationSDK/authentication/http/HttpSignatureHeader.rb +52 -52
  5. data/AuthenticationSDK/authentication/jwt/JwtToken.rb +62 -62
  6. data/AuthenticationSDK/authentication/payloadDigest/digest.rb +10 -10
  7. data/AuthenticationSDK/core/Authorization.rb +24 -24
  8. data/AuthenticationSDK/core/ITokenGeneration.rb +4 -4
  9. data/AuthenticationSDK/core/Logger.rb +26 -26
  10. data/AuthenticationSDK/core/MerchantConfig.rb +181 -181
  11. data/AuthenticationSDK/resource/TRRReports.json +12 -0
  12. data/AuthenticationSDK/resource/cybs.yml +31 -0
  13. data/AuthenticationSDK/resource/request.json +54 -0
  14. data/AuthenticationSDK/resource/request_capture.json +11 -0
  15. data/AuthenticationSDK/resource/testrest.p12 +0 -0
  16. data/AuthenticationSDK/spec/Authorization_spec.rb +274 -0
  17. data/AuthenticationSDK/spec/MerchantConfigData.rb +59 -0
  18. data/AuthenticationSDK/spec/MerchantConfig_spec.rb +116 -0
  19. data/AuthenticationSDK/spec/PostRequestData.json +54 -0
  20. data/AuthenticationSDK/spec/PutRequestData.json +12 -0
  21. data/AuthenticationSDK/spec/ResponseCodeMessage_spec.rb +60 -0
  22. data/AuthenticationSDK/spec/spec_helper.rb +12 -0
  23. data/AuthenticationSDK/util/ApiException.rb +18 -18
  24. data/AuthenticationSDK/util/Cache.rb +36 -36
  25. data/AuthenticationSDK/util/Constants.rb +137 -137
  26. data/AuthenticationSDK/util/PropertiesUtil.rb +20 -21
  27. data/AuthenticationSDK/util/Utility.rb +30 -30
  28. data/lib/cybersource_rest_client/api/capture_api.rb +84 -84
  29. data/lib/cybersource_rest_client/api/credit_api.rb +78 -78
  30. data/lib/cybersource_rest_client/api/flex_token_api.rb +74 -74
  31. data/lib/cybersource_rest_client/api/instrument_identifier_api.rb +254 -254
  32. data/lib/cybersource_rest_client/api/instrument_identifiers_api.rb +91 -91
  33. data/lib/cybersource_rest_client/api/key_generation_api.rb +74 -74
  34. data/lib/cybersource_rest_client/api/notification_of_changes_api.rb +86 -86
  35. data/lib/cybersource_rest_client/api/payment_instruments_api.rb +414 -414
  36. data/lib/cybersource_rest_client/api/payments_api.rb +78 -78
  37. data/lib/cybersource_rest_client/api/process_a_payout_api.rb +77 -77
  38. data/lib/cybersource_rest_client/api/purchase_and_refund_details_api.rb +124 -129
  39. data/lib/cybersource_rest_client/api/refund_api.rb +144 -144
  40. data/lib/cybersource_rest_client/api/report_definitions_api.rb +147 -156
  41. data/lib/cybersource_rest_client/api/report_downloads_api.rb +96 -100
  42. data/lib/cybersource_rest_client/api/report_subscriptions_api.rb +254 -262
  43. data/lib/cybersource_rest_client/api/reports_api.rb +250 -258
  44. data/lib/cybersource_rest_client/api/reversal_api.rb +84 -84
  45. data/lib/cybersource_rest_client/api/search_transactions_api.rb +132 -132
  46. data/lib/cybersource_rest_client/api/secure_file_share_api.rb +161 -169
  47. data/lib/cybersource_rest_client/api/transaction_batch_api.rb +77 -77
  48. data/lib/cybersource_rest_client/api/transaction_batches_api.rb +86 -86
  49. data/lib/cybersource_rest_client/api/transaction_details_api.rb +78 -78
  50. data/lib/cybersource_rest_client/api/user_management_api.rb +84 -84
  51. data/lib/cybersource_rest_client/api/void_api.rb +264 -264
  52. data/lib/cybersource_rest_client/api_client.rb +449 -447
  53. data/lib/cybersource_rest_client/api_error.rb +38 -38
  54. data/lib/cybersource_rest_client/configuration.rb +202 -202
  55. data/lib/cybersource_rest_client/models/auth_reversal_request.rb +219 -219
  56. data/lib/cybersource_rest_client/models/body.rb +295 -295
  57. data/lib/cybersource_rest_client/models/body_1.rb +183 -183
  58. data/lib/cybersource_rest_client/models/body_2.rb +331 -331
  59. data/lib/cybersource_rest_client/models/body_3.rb +331 -331
  60. data/lib/cybersource_rest_client/models/capture_payment_request.rb +267 -267
  61. data/lib/cybersource_rest_client/models/card_info.rb +214 -214
  62. data/lib/cybersource_rest_client/models/create_credit_request.rb +267 -267
  63. data/lib/cybersource_rest_client/models/create_payment_request.rb +285 -285
  64. data/lib/cybersource_rest_client/models/der_public_key.rb +205 -205
  65. data/lib/cybersource_rest_client/models/error.rb +192 -192
  66. data/lib/cybersource_rest_client/models/error_links.rb +205 -205
  67. data/lib/cybersource_rest_client/models/error_response.rb +192 -192
  68. data/lib/cybersource_rest_client/models/flex_v1_keys_post200_response.rb +202 -202
  69. data/lib/cybersource_rest_client/models/flex_v1_keys_post200_response_der.rb +205 -205
  70. data/lib/cybersource_rest_client/models/flex_v1_keys_post200_response_jwk.rb +225 -225
  71. data/lib/cybersource_rest_client/models/flex_v1_tokens_post200_response.rb +255 -255
  72. data/lib/cybersource_rest_client/models/flexv1tokens_card_info.rb +214 -214
  73. data/lib/cybersource_rest_client/models/generate_public_key_request.rb +249 -249
  74. data/lib/cybersource_rest_client/models/inline_response_400.rb +202 -202
  75. data/lib/cybersource_rest_client/models/inline_response_default.rb +192 -192
  76. data/lib/cybersource_rest_client/models/inline_response_default__links.rb +205 -205
  77. data/lib/cybersource_rest_client/models/inline_response_default__links_next.rb +204 -204
  78. data/lib/cybersource_rest_client/models/inline_response_default_response_status.rb +225 -225
  79. data/lib/cybersource_rest_client/models/inline_response_default_response_status_details.rb +194 -194
  80. data/lib/cybersource_rest_client/models/json_web_key.rb +225 -225
  81. data/lib/cybersource_rest_client/models/key_parameters.rb +184 -184
  82. data/lib/cybersource_rest_client/models/key_result.rb +202 -202
  83. data/lib/cybersource_rest_client/models/link.rb +204 -204
  84. data/lib/cybersource_rest_client/models/links.rb +205 -205
  85. data/lib/cybersource_rest_client/models/pts_v1_transaction_batches_get200_response.rb +204 -204
  86. data/lib/cybersource_rest_client/models/pts_v1_transaction_batches_get200_response__links.rb +183 -183
  87. data/lib/cybersource_rest_client/models/pts_v1_transaction_batches_get200_response__links_self.rb +192 -192
  88. data/lib/cybersource_rest_client/models/pts_v1_transaction_batches_get200_response_transaction_batches.rb +277 -277
  89. data/lib/cybersource_rest_client/models/pts_v1_transaction_batches_get400_response.rb +193 -193
  90. data/lib/cybersource_rest_client/models/pts_v1_transaction_batches_get400_response_error_information.rb +203 -203
  91. data/lib/cybersource_rest_client/models/pts_v1_transaction_batches_get400_response_error_information_details.rb +194 -194
  92. data/lib/cybersource_rest_client/models/pts_v1_transaction_batches_get500_response.rb +193 -193
  93. data/lib/cybersource_rest_client/models/pts_v1_transaction_batches_get500_response_error_information.rb +194 -194
  94. data/lib/cybersource_rest_client/models/pts_v2_credits_post201_response.rb +323 -323
  95. data/lib/cybersource_rest_client/models/pts_v2_credits_post201_response_credit_amount_details.rb +224 -224
  96. data/lib/cybersource_rest_client/models/pts_v2_payments_captures_post201_response.rb +314 -314
  97. data/lib/cybersource_rest_client/models/pts_v2_payments_captures_post201_response__links.rb +201 -201
  98. data/lib/cybersource_rest_client/models/pts_v2_payments_captures_post201_response_order_information.rb +192 -192
  99. data/lib/cybersource_rest_client/models/pts_v2_payments_captures_post201_response_order_information_amount_details.rb +224 -224
  100. data/lib/cybersource_rest_client/models/pts_v2_payments_captures_post201_response_processor_information.rb +199 -199
  101. data/lib/cybersource_rest_client/models/pts_v2_payments_captures_post400_response.rb +271 -271
  102. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response.rb +341 -341
  103. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response__links.rb +201 -201
  104. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response__links_self.rb +194 -194
  105. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_client_reference_information.rb +199 -199
  106. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_error_information.rb +239 -239
  107. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_error_information_details.rb +228 -228
  108. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_order_information.rb +192 -192
  109. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_order_information_amount_details.rb +249 -249
  110. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_order_information_invoice_details.rb +184 -184
  111. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_information.rb +201 -201
  112. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_information_account_features.rb +623 -623
  113. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_information_card.rb +199 -199
  114. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_information_tokenized_card.rb +349 -349
  115. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_point_of_sale_information.rb +208 -208
  116. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_point_of_sale_information_emv.rb +199 -199
  117. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processor_information.rb +642 -642
  118. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processor_information_avs.rb +224 -224
  119. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processor_information_card_verification.rb +224 -224
  120. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processor_information_consumer_authentication_response.rb +224 -224
  121. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processor_information_customer.rb +199 -199
  122. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processor_information_electronic_verification_results.rb +474 -474
  123. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processor_information_issuer.rb +224 -224
  124. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processor_information_merchant_advice.rb +224 -224
  125. data/lib/cybersource_rest_client/models/pts_v2_payments_post400_response.rb +271 -271
  126. data/lib/cybersource_rest_client/models/pts_v2_payments_post502_response.rb +260 -260
  127. data/lib/cybersource_rest_client/models/pts_v2_payments_refund_post201_response.rb +323 -323
  128. data/lib/cybersource_rest_client/models/pts_v2_payments_refund_post201_response__links.rb +192 -192
  129. data/lib/cybersource_rest_client/models/pts_v2_payments_refund_post201_response_order_information.rb +183 -183
  130. data/lib/cybersource_rest_client/models/pts_v2_payments_refund_post201_response_processor_information.rb +224 -224
  131. data/lib/cybersource_rest_client/models/pts_v2_payments_refund_post201_response_refund_amount_details.rb +224 -224
  132. data/lib/cybersource_rest_client/models/pts_v2_payments_refund_post400_response.rb +271 -271
  133. data/lib/cybersource_rest_client/models/pts_v2_payments_reversals_post201_response.rb +332 -332
  134. data/lib/cybersource_rest_client/models/pts_v2_payments_reversals_post201_response__links.rb +183 -183
  135. data/lib/cybersource_rest_client/models/pts_v2_payments_reversals_post201_response_authorization_information.rb +224 -224
  136. data/lib/cybersource_rest_client/models/pts_v2_payments_reversals_post201_response_processor_information.rb +324 -324
  137. data/lib/cybersource_rest_client/models/pts_v2_payments_reversals_post201_response_reversal_amount_details.rb +249 -249
  138. data/lib/cybersource_rest_client/models/pts_v2_payments_reversals_post400_response.rb +271 -271
  139. data/lib/cybersource_rest_client/models/pts_v2_payments_voids_post201_response.rb +280 -280
  140. data/lib/cybersource_rest_client/models/pts_v2_payments_voids_post201_response_void_amount_details.rb +219 -219
  141. data/lib/cybersource_rest_client/models/pts_v2_payments_voids_post400_response.rb +271 -271
  142. data/lib/cybersource_rest_client/models/pts_v2_payouts_post400_response.rb +259 -259
  143. data/lib/cybersource_rest_client/models/pts_v2_payouts_post_response.rb +237 -237
  144. data/lib/cybersource_rest_client/models/ptsv2credits_point_of_sale_information.rb +183 -183
  145. data/lib/cybersource_rest_client/models/ptsv2credits_point_of_sale_information_emv.rb +221 -221
  146. data/lib/cybersource_rest_client/models/ptsv2credits_processing_information.rb +383 -383
  147. data/lib/cybersource_rest_client/models/ptsv2payments_aggregator_information.rb +233 -233
  148. data/lib/cybersource_rest_client/models/ptsv2payments_aggregator_information_sub_merchant.rb +424 -424
  149. data/lib/cybersource_rest_client/models/ptsv2payments_buyer_information.rb +285 -285
  150. data/lib/cybersource_rest_client/models/ptsv2payments_buyer_information_personal_identification.rb +252 -252
  151. data/lib/cybersource_rest_client/models/ptsv2payments_client_reference_information.rb +219 -219
  152. data/lib/cybersource_rest_client/models/ptsv2payments_consumer_authentication_information.rb +374 -374
  153. data/lib/cybersource_rest_client/models/ptsv2payments_device_information.rb +249 -249
  154. data/lib/cybersource_rest_client/models/ptsv2payments_merchant_defined_information.rb +224 -224
  155. data/lib/cybersource_rest_client/models/ptsv2payments_merchant_information.rb +308 -308
  156. data/lib/cybersource_rest_client/models/ptsv2payments_merchant_information_merchant_descriptor.rb +365 -374
  157. data/lib/cybersource_rest_client/models/ptsv2payments_order_information.rb +230 -230
  158. data/lib/cybersource_rest_client/models/ptsv2payments_order_information_amount_details.rb +605 -605
  159. data/lib/cybersource_rest_client/models/ptsv2payments_order_information_amount_details_amex_additional_amounts.rb +224 -224
  160. data/lib/cybersource_rest_client/models/ptsv2payments_order_information_amount_details_surcharge.rb +209 -209
  161. data/lib/cybersource_rest_client/models/ptsv2payments_order_information_amount_details_tax_details.rb +328 -328
  162. data/lib/cybersource_rest_client/models/ptsv2payments_order_information_bill_to.rb +618 -618
  163. data/lib/cybersource_rest_client/models/ptsv2payments_order_information_invoice_details.rb +360 -360
  164. data/lib/cybersource_rest_client/models/ptsv2payments_order_information_invoice_details_transaction_advice_addendum.rb +199 -199
  165. data/lib/cybersource_rest_client/models/ptsv2payments_order_information_line_items.rb +649 -649
  166. data/lib/cybersource_rest_client/models/ptsv2payments_order_information_ship_to.rb +474 -474
  167. data/lib/cybersource_rest_client/models/ptsv2payments_order_information_shipping_details.rb +234 -234
  168. data/lib/cybersource_rest_client/models/ptsv2payments_payment_information.rb +210 -210
  169. data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_card.rb +474 -474
  170. data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_customer.rb +190 -199
  171. data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_fluid_data.rb +259 -259
  172. data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_tokenized_card.rb +424 -424
  173. data/lib/cybersource_rest_client/models/ptsv2payments_point_of_sale_information.rb +440 -440
  174. data/lib/cybersource_rest_client/models/ptsv2payments_point_of_sale_information_emv.rb +256 -256
  175. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information.rb +432 -432
  176. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information_authorization_options.rb +361 -361
  177. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information_authorization_options_initiator.rb +247 -247
  178. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information_authorization_options_merchant_initiated_transaction.rb +224 -224
  179. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information_capture_options.rb +267 -267
  180. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information_issuer.rb +199 -199
  181. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information_recurring_options.rb +198 -198
  182. data/lib/cybersource_rest_client/models/ptsv2payments_recipient_information.rb +249 -249
  183. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_aggregator_information.rb +233 -233
  184. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_aggregator_information_sub_merchant.rb +374 -374
  185. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_buyer_information.rb +224 -224
  186. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_merchant_information.rb +258 -258
  187. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_order_information.rb +230 -230
  188. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_order_information_amount_details.rb +546 -546
  189. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_order_information_bill_to.rb +449 -449
  190. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_order_information_invoice_details.rb +320 -320
  191. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_order_information_ship_to.rb +249 -249
  192. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_order_information_shipping_details.rb +199 -199
  193. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_payment_information.rb +183 -183
  194. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_point_of_sale_information.rb +208 -208
  195. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_point_of_sale_information_emv.rb +211 -211
  196. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_processing_information.rb +351 -351
  197. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_processing_information_authorization_options.rb +249 -249
  198. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_processing_information_capture_options.rb +242 -242
  199. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_merchant_information.rb +258 -258
  200. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_order_information.rb +230 -230
  201. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_order_information_line_items.rb +639 -639
  202. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_payment_information.rb +183 -183
  203. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_payment_information_card.rb +374 -374
  204. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_point_of_sale_information.rb +183 -183
  205. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_processing_information.rb +333 -333
  206. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_processing_information_recurring_options.rb +186 -186
  207. data/lib/cybersource_rest_client/models/ptsv2paymentsidreversals_client_reference_information.rb +209 -209
  208. data/lib/cybersource_rest_client/models/ptsv2paymentsidreversals_order_information.rb +185 -185
  209. data/lib/cybersource_rest_client/models/ptsv2paymentsidreversals_order_information_line_items.rb +233 -233
  210. data/lib/cybersource_rest_client/models/ptsv2paymentsidreversals_point_of_sale_information.rb +183 -183
  211. data/lib/cybersource_rest_client/models/ptsv2paymentsidreversals_processing_information.rb +308 -308
  212. data/lib/cybersource_rest_client/models/ptsv2paymentsidreversals_reversal_information.rb +208 -208
  213. data/lib/cybersource_rest_client/models/ptsv2paymentsidreversals_reversal_information_amount_details.rb +224 -224
  214. data/lib/cybersource_rest_client/models/ptsv2payouts_merchant_information.rb +258 -258
  215. data/lib/cybersource_rest_client/models/ptsv2payouts_merchant_information_merchant_descriptor.rb +324 -324
  216. data/lib/cybersource_rest_client/models/ptsv2payouts_order_information.rb +192 -192
  217. data/lib/cybersource_rest_client/models/ptsv2payouts_order_information_amount_details.rb +233 -233
  218. data/lib/cybersource_rest_client/models/ptsv2payouts_order_information_amount_details_surcharge.rb +199 -199
  219. data/lib/cybersource_rest_client/models/ptsv2payouts_order_information_bill_to.rb +443 -443
  220. data/lib/cybersource_rest_client/models/ptsv2payouts_payment_information.rb +183 -183
  221. data/lib/cybersource_rest_client/models/ptsv2payouts_payment_information_card.rb +299 -299
  222. data/lib/cybersource_rest_client/models/ptsv2payouts_processing_information.rb +283 -283
  223. data/lib/cybersource_rest_client/models/ptsv2payouts_processing_information_payouts_options.rb +274 -274
  224. data/lib/cybersource_rest_client/models/ptsv2payouts_recipient_information.rb +433 -433
  225. data/lib/cybersource_rest_client/models/ptsv2payouts_sender_information.rb +517 -517
  226. data/lib/cybersource_rest_client/models/ptsv2payouts_sender_information_account.rb +233 -233
  227. data/lib/cybersource_rest_client/models/refund_capture_request.rb +267 -267
  228. data/lib/cybersource_rest_client/models/refund_payment_request.rb +267 -267
  229. data/lib/cybersource_rest_client/models/reporting_v3_notificationof_changes_get200_response.rb +186 -186
  230. data/lib/cybersource_rest_client/models/reporting_v3_notificationof_changes_get200_response_notification_of_changes.rb +255 -255
  231. data/lib/cybersource_rest_client/models/reporting_v3_notificationof_changes_get400_response.rb +247 -247
  232. data/lib/cybersource_rest_client/models/reporting_v3_notificationof_changes_get400_response_fields.rb +205 -205
  233. data/lib/cybersource_rest_client/models/reporting_v3_report_definitions_get200_response.rb +185 -185
  234. data/lib/cybersource_rest_client/models/reporting_v3_report_definitions_get200_response_report_definitions.rb +243 -243
  235. data/lib/cybersource_rest_client/models/reporting_v3_report_definitions_name_get200_response.rb +254 -254
  236. data/lib/cybersource_rest_client/models/reporting_v3_report_definitions_name_get200_response_attributes.rb +237 -237
  237. data/lib/cybersource_rest_client/models/reporting_v3_report_subscriptions_get200_response.rb +185 -185
  238. data/lib/cybersource_rest_client/models/reporting_v3_report_subscriptions_get200_response_report_preferences.rb +229 -229
  239. data/lib/cybersource_rest_client/models/reporting_v3_report_subscriptions_get200_response_subscriptions.rb +354 -354
  240. data/lib/cybersource_rest_client/models/reporting_v3_reports_get200_response.rb +185 -185
  241. data/lib/cybersource_rest_client/models/reporting_v3_reports_get200_response_reports.rb +373 -373
  242. data/lib/cybersource_rest_client/models/reporting_v3_reports_id_get200_response.rb +376 -376
  243. data/lib/cybersource_rest_client/models/request_body.rb +446 -463
  244. data/lib/cybersource_rest_client/models/request_body_1.rb +398 -415
  245. data/lib/cybersource_rest_client/models/response_status.rb +225 -225
  246. data/lib/cybersource_rest_client/models/response_status_details.rb +194 -194
  247. data/lib/cybersource_rest_client/models/tms_v1_instrumentidentifiers_delete409_response.rb +183 -183
  248. data/lib/cybersource_rest_client/models/tms_v1_instrumentidentifiers_delete409_response__links.rb +183 -183
  249. data/lib/cybersource_rest_client/models/tms_v1_instrumentidentifiers_delete409_response__links_payment_instruments.rb +183 -183
  250. data/lib/cybersource_rest_client/models/tms_v1_instrumentidentifiers_paymentinstruments_get200_response.rb +277 -277
  251. data/lib/cybersource_rest_client/models/tms_v1_instrumentidentifiers_paymentinstruments_get200_response__links.rb +219 -219
  252. data/lib/cybersource_rest_client/models/tms_v1_instrumentidentifiers_paymentinstruments_get200_response__links_first.rb +184 -184
  253. data/lib/cybersource_rest_client/models/tms_v1_instrumentidentifiers_paymentinstruments_get200_response__links_last.rb +184 -184
  254. data/lib/cybersource_rest_client/models/tms_v1_instrumentidentifiers_paymentinstruments_get200_response__links_next.rb +184 -184
  255. data/lib/cybersource_rest_client/models/tms_v1_instrumentidentifiers_paymentinstruments_get200_response__links_prev.rb +184 -184
  256. data/lib/cybersource_rest_client/models/tms_v1_instrumentidentifiers_paymentinstruments_get200_response__links_self.rb +184 -184
  257. data/lib/cybersource_rest_client/models/tms_v1_instrumentidentifiers_post200_response.rb +295 -295
  258. data/lib/cybersource_rest_client/models/tms_v1_paymentinstruments_post201_response.rb +331 -331
  259. data/lib/cybersource_rest_client/models/tmsv1instrumentidentifiers__links.rb +201 -201
  260. data/lib/cybersource_rest_client/models/tmsv1instrumentidentifiers__links_self.rb +183 -183
  261. data/lib/cybersource_rest_client/models/tmsv1instrumentidentifiers_authorization_options_merchant_initiated_transaction.rb +184 -184
  262. data/lib/cybersource_rest_client/models/tmsv1instrumentidentifiers_bank_account.rb +194 -194
  263. data/lib/cybersource_rest_client/models/tmsv1instrumentidentifiers_card.rb +184 -184
  264. data/lib/cybersource_rest_client/models/tmsv1instrumentidentifiers_details.rb +194 -194
  265. data/lib/cybersource_rest_client/models/tmsv1instrumentidentifiers_metadata.rb +184 -184
  266. data/lib/cybersource_rest_client/models/tmsv1instrumentidentifiers_processing_information.rb +183 -183
  267. data/lib/cybersource_rest_client/models/tmsv1instrumentidentifiers_processing_information_authorization_options.rb +183 -183
  268. data/lib/cybersource_rest_client/models/tmsv1instrumentidentifiers_processing_information_authorization_options_initiator.rb +183 -183
  269. data/lib/cybersource_rest_client/models/tmsv1paymentinstruments_bank_account.rb +184 -184
  270. data/lib/cybersource_rest_client/models/tmsv1paymentinstruments_bill_to.rb +284 -284
  271. data/lib/cybersource_rest_client/models/tmsv1paymentinstruments_buyer_information.rb +215 -215
  272. data/lib/cybersource_rest_client/models/tmsv1paymentinstruments_buyer_information_issued_by.rb +184 -184
  273. data/lib/cybersource_rest_client/models/tmsv1paymentinstruments_buyer_information_personal_identification.rb +203 -203
  274. data/lib/cybersource_rest_client/models/tmsv1paymentinstruments_card.rb +278 -278
  275. data/lib/cybersource_rest_client/models/tmsv1paymentinstruments_instrument_identifier.rb +295 -295
  276. data/lib/cybersource_rest_client/models/tmsv1paymentinstruments_merchant_information.rb +183 -183
  277. data/lib/cybersource_rest_client/models/tmsv1paymentinstruments_merchant_information_merchant_descriptor.rb +184 -184
  278. data/lib/cybersource_rest_client/models/tmsv1paymentinstruments_processing_information.rb +193 -193
  279. data/lib/cybersource_rest_client/models/tmsv1paymentinstruments_processing_information_bank_transfer_options.rb +184 -184
  280. data/lib/cybersource_rest_client/models/tokenize_parameters.rb +193 -193
  281. data/lib/cybersource_rest_client/models/tokenize_request.rb +193 -193
  282. data/lib/cybersource_rest_client/models/tokenize_result.rb +255 -255
  283. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response.rb +444 -444
  284. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_application_information.rb +225 -225
  285. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_application_information_applications.rb +254 -254
  286. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_buyer_information.rb +224 -224
  287. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_client_reference_information.rb +239 -239
  288. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_consumer_authentication_information.rb +259 -259
  289. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_device_information.rb +234 -234
  290. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_error_information.rb +205 -205
  291. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_fraud_marking_information.rb +184 -184
  292. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_installment_information.rb +184 -184
  293. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_merchant_defined_information.rb +224 -224
  294. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_merchant_information.rb +183 -183
  295. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_merchant_information_merchant_descriptor.rb +199 -199
  296. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_order_information.rb +222 -222
  297. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_order_information_amount_details.rb +274 -274
  298. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_order_information_bill_to.rb +524 -524
  299. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_order_information_line_items.rb +343 -343
  300. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_order_information_ship_to.rb +424 -424
  301. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_order_information_shipping_details.rb +209 -209
  302. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information.rb +228 -228
  303. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_account_features.rb +249 -249
  304. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_bank.rb +242 -242
  305. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_bank_account.rb +244 -244
  306. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_bank_mandate.rb +204 -204
  307. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_card.rb +424 -424
  308. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_invoice.rb +204 -204
  309. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_payment_type.rb +244 -244
  310. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_point_of_sale_information.rb +233 -233
  311. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processing_information.rb +252 -252
  312. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processing_information_authorization_options.rb +199 -199
  313. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processing_information_bank_transfer_options.rb +184 -184
  314. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processor_information.rb +309 -309
  315. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processor_information_ach_verification.rb +224 -224
  316. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processor_information_card_verification.rb +199 -199
  317. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processor_information_electronic_verification_results.rb +424 -424
  318. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processor_information_processor.rb +199 -199
  319. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_risk_information.rb +233 -233
  320. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_risk_information_profile.rb +194 -194
  321. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_risk_information_score.rb +196 -196
  322. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_sender_information.rb +199 -199
  323. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response.rb +317 -317
  324. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded.rb +186 -186
  325. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded__links.rb +183 -183
  326. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_buyer_information.rb +199 -199
  327. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_client_reference_information.rb +219 -219
  328. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_consumer_authentication_information.rb +209 -209
  329. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_device_information.rb +199 -199
  330. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_merchant_information.rb +199 -199
  331. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_order_information.rb +201 -201
  332. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_order_information_bill_to.rb +299 -299
  333. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_order_information_ship_to.rb +299 -299
  334. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_payment_information.rb +201 -201
  335. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_payment_information_card.rb +249 -249
  336. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_payment_information_payment_method.rb +184 -184
  337. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_point_of_sale_information.rb +228 -228
  338. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_point_of_sale_information_partner.rb +199 -199
  339. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_processing_information.rb +209 -209
  340. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_processor_information.rb +183 -183
  341. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_risk_information.rb +183 -183
  342. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_risk_information_providers.rb +183 -183
  343. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_risk_information_providers_fingerprint.rb +249 -249
  344. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_transaction_summaries.rb +357 -357
  345. data/lib/cybersource_rest_client/models/tss_v2_transactions_post400_response.rb +249 -249
  346. data/lib/cybersource_rest_client/models/tss_v2_transactions_post_response.rb +244 -244
  347. data/lib/cybersource_rest_client/models/ums_v1_users_get200_response.rb +185 -185
  348. data/lib/cybersource_rest_client/models/ums_v1_users_get200_response_account_information.rb +282 -282
  349. data/lib/cybersource_rest_client/models/ums_v1_users_get200_response_contact_information.rb +210 -210
  350. data/lib/cybersource_rest_client/models/ums_v1_users_get200_response_organization_information.rb +183 -183
  351. data/lib/cybersource_rest_client/models/ums_v1_users_get200_response_users.rb +201 -201
  352. data/lib/cybersource_rest_client/models/v1_file_details_get200_response.rb +194 -194
  353. data/lib/cybersource_rest_client/models/v1_file_details_get200_response__links.rb +194 -194
  354. data/lib/cybersource_rest_client/models/v1_file_details_get200_response__links_files.rb +202 -202
  355. data/lib/cybersource_rest_client/models/v1_file_details_get200_response__links_self.rb +192 -192
  356. data/lib/cybersource_rest_client/models/v1_file_details_get200_response_file_details.rb +278 -278
  357. data/lib/cybersource_rest_client/models/void_capture_request.rb +183 -183
  358. data/lib/cybersource_rest_client/models/void_credit_request.rb +183 -183
  359. data/lib/cybersource_rest_client/models/void_payment_request.rb +183 -183
  360. data/lib/cybersource_rest_client/models/void_refund_request.rb +183 -183
  361. data/lib/cybersource_rest_client/version.rb +15 -15
  362. data/lib/cybersource_rest_client.rb +369 -369
  363. metadata +14 -2
@@ -1,199 +1,199 @@
1
- =begin
2
- #CyberSource Flex API
3
-
4
- #Simple PAN tokenization service
5
-
6
- OpenAPI spec version: 0.0.1
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.2.3
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module CyberSource
16
- class Ptsv2paymentsOrderInformationInvoiceDetailsTransactionAdviceAddendum
17
- # Four Transaction Advice Addendum (TAA) fields. These fields are used to display descriptive information about a transaction on the customer’s American Express card statement. When you send TAA fields, start with amexdata_taa1, then ...taa2, and so on. Skipping a TAA field causes subsequent TAA fields to be ignored. To use these fields, contact CyberSource Customer Support to have your account enabled for this feature.
18
- attr_accessor :data
19
-
20
- # Attribute mapping from ruby-style variable name to JSON key.
21
- def self.attribute_map
22
- {
23
- :'data' => :'data'
24
- }
25
- end
26
-
27
- # Attribute type mapping.
28
- def self.swagger_types
29
- {
30
- :'data' => :'String'
31
- }
32
- end
33
-
34
- # Initializes the object
35
- # @param [Hash] attributes Model attributes in the form of hash
36
- def initialize(attributes = {})
37
- return unless attributes.is_a?(Hash)
38
-
39
- # convert string to symbol for hash key
40
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
41
-
42
- if attributes.has_key?(:'data')
43
- self.data = attributes[:'data']
44
- end
45
- end
46
-
47
- # Show invalid properties with the reasons. Usually used together with valid?
48
- # @return Array for valid properties with the reasons
49
- def list_invalid_properties
50
- invalid_properties = Array.new
51
- if !@data.nil? && @data.to_s.length > 40
52
- invalid_properties.push('invalid value for "data", the character length must be smaller than or equal to 40.')
53
- end
54
-
55
- invalid_properties
56
- end
57
-
58
- # Check to see if the all the properties in the model are valid
59
- # @return true if the model is valid
60
- def valid?
61
- return false if !@data.nil? && @data.to_s.length > 40
62
- true
63
- end
64
-
65
- # Custom attribute writer method with validation
66
- # @param [Object] data Value to be assigned
67
- def data=(data)
68
- if !data.nil? && data.to_s.length > 40
69
- fail ArgumentError, 'invalid value for "data", the character length must be smaller than or equal to 40.'
70
- end
71
-
72
- @data = data
73
- end
74
-
75
- # Checks equality by comparing each attribute.
76
- # @param [Object] Object to be compared
77
- def ==(o)
78
- return true if self.equal?(o)
79
- self.class == o.class &&
80
- data == o.data
81
- end
82
-
83
- # @see the `==` method
84
- # @param [Object] Object to be compared
85
- def eql?(o)
86
- self == o
87
- end
88
-
89
- # Calculates hash code according to all attributes.
90
- # @return [Fixnum] Hash code
91
- def hash
92
- [data].hash
93
- end
94
-
95
- # Builds the object from hash
96
- # @param [Hash] attributes Model attributes in the form of hash
97
- # @return [Object] Returns the model itself
98
- def build_from_hash(attributes)
99
- return nil unless attributes.is_a?(Hash)
100
- self.class.swagger_types.each_pair do |key, type|
101
- if type =~ /\AArray<(.*)>/i
102
- # check to ensure the input is an array given that the the attribute
103
- # is documented as an array but the input is not
104
- if attributes[self.class.attribute_map[key]].is_a?(Array)
105
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
106
- end
107
- elsif !attributes[self.class.attribute_map[key]].nil?
108
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
109
- end # or else data not found in attributes(hash), not an issue as the data can be optional
110
- end
111
-
112
- self
113
- end
114
-
115
- # Deserializes the data based on type
116
- # @param string type Data type
117
- # @param string value Value to be deserialized
118
- # @return [Object] Deserialized data
119
- def _deserialize(type, value)
120
- case type.to_sym
121
- when :DateTime
122
- DateTime.parse(value)
123
- when :Date
124
- Date.parse(value)
125
- when :String
126
- value.to_s
127
- when :Integer
128
- value.to_i
129
- when :Float
130
- value.to_f
131
- when :BOOLEAN
132
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
133
- true
134
- else
135
- false
136
- end
137
- when :Object
138
- # generic object (usually a Hash), return directly
139
- value
140
- when /\AArray<(?<inner_type>.+)>\z/
141
- inner_type = Regexp.last_match[:inner_type]
142
- value.map { |v| _deserialize(inner_type, v) }
143
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
144
- k_type = Regexp.last_match[:k_type]
145
- v_type = Regexp.last_match[:v_type]
146
- {}.tap do |hash|
147
- value.each do |k, v|
148
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
149
- end
150
- end
151
- else # model
152
- temp_model = CyberSource.const_get(type).new
153
- temp_model.build_from_hash(value)
154
- end
155
- end
156
-
157
- # Returns the string representation of the object
158
- # @return [String] String presentation of the object
159
- def to_s
160
- to_hash.to_s
161
- end
162
-
163
- # to_body is an alias to to_hash (backward compatibility)
164
- # @return [Hash] Returns the object in the form of hash
165
- def to_body
166
- to_hash
167
- end
168
-
169
- # Returns the object in the form of hash
170
- # @return [Hash] Returns the object in the form of hash
171
- def to_hash
172
- hash = {}
173
- self.class.attribute_map.each_pair do |attr, param|
174
- value = self.send(attr)
175
- next if value.nil?
176
- hash[param] = _to_hash(value)
177
- end
178
- hash
179
- end
180
-
181
- # Outputs non-array value in the form of hash
182
- # For object, use to_hash. Otherwise, just return the value
183
- # @param [Object] value Any valid value
184
- # @return [Hash] Returns the value in the form of hash
185
- def _to_hash(value)
186
- if value.is_a?(Array)
187
- value.compact.map { |v| _to_hash(v) }
188
- elsif value.is_a?(Hash)
189
- {}.tap do |hash|
190
- value.each { |k, v| hash[k] = _to_hash(v) }
191
- end
192
- elsif value.respond_to? :to_hash
193
- value.to_hash
194
- else
195
- value
196
- end
197
- end
198
- end
199
- end
1
+ =begin
2
+ #CyberSource Flex API
3
+
4
+ #Simple PAN tokenization service
5
+
6
+ OpenAPI spec version: 0.0.1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CyberSource
16
+ class Ptsv2paymentsOrderInformationInvoiceDetailsTransactionAdviceAddendum
17
+ # Four Transaction Advice Addendum (TAA) fields. These fields are used to display descriptive information about a transaction on the customer’s American Express card statement. When you send TAA fields, start with amexdata_taa1, then ...taa2, and so on. Skipping a TAA field causes subsequent TAA fields to be ignored. To use these fields, contact CyberSource Customer Support to have your account enabled for this feature.
18
+ attr_accessor :data
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'data' => :'data'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.swagger_types
29
+ {
30
+ :'data' => :'String'
31
+ }
32
+ end
33
+
34
+ # Initializes the object
35
+ # @param [Hash] attributes Model attributes in the form of hash
36
+ def initialize(attributes = {})
37
+ return unless attributes.is_a?(Hash)
38
+
39
+ # convert string to symbol for hash key
40
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
41
+
42
+ if attributes.has_key?(:'data')
43
+ self.data = attributes[:'data']
44
+ end
45
+ end
46
+
47
+ # Show invalid properties with the reasons. Usually used together with valid?
48
+ # @return Array for valid properties with the reasons
49
+ def list_invalid_properties
50
+ invalid_properties = Array.new
51
+ if !@data.nil? && @data.to_s.length > 40
52
+ invalid_properties.push('invalid value for "data", the character length must be smaller than or equal to 40.')
53
+ end
54
+
55
+ invalid_properties
56
+ end
57
+
58
+ # Check to see if the all the properties in the model are valid
59
+ # @return true if the model is valid
60
+ def valid?
61
+ return false if !@data.nil? && @data.to_s.length > 40
62
+ true
63
+ end
64
+
65
+ # Custom attribute writer method with validation
66
+ # @param [Object] data Value to be assigned
67
+ def data=(data)
68
+ if !data.nil? && data.to_s.length > 40
69
+ fail ArgumentError, 'invalid value for "data", the character length must be smaller than or equal to 40.'
70
+ end
71
+
72
+ @data = data
73
+ end
74
+
75
+ # Checks equality by comparing each attribute.
76
+ # @param [Object] Object to be compared
77
+ def ==(o)
78
+ return true if self.equal?(o)
79
+ self.class == o.class &&
80
+ data == o.data
81
+ end
82
+
83
+ # @see the `==` method
84
+ # @param [Object] Object to be compared
85
+ def eql?(o)
86
+ self == o
87
+ end
88
+
89
+ # Calculates hash code according to all attributes.
90
+ # @return [Fixnum] Hash code
91
+ def hash
92
+ [data].hash
93
+ end
94
+
95
+ # Builds the object from hash
96
+ # @param [Hash] attributes Model attributes in the form of hash
97
+ # @return [Object] Returns the model itself
98
+ def build_from_hash(attributes)
99
+ return nil unless attributes.is_a?(Hash)
100
+ self.class.swagger_types.each_pair do |key, type|
101
+ if type =~ /\AArray<(.*)>/i
102
+ # check to ensure the input is an array given that the the attribute
103
+ # is documented as an array but the input is not
104
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
105
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
106
+ end
107
+ elsif !attributes[self.class.attribute_map[key]].nil?
108
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
109
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
110
+ end
111
+
112
+ self
113
+ end
114
+
115
+ # Deserializes the data based on type
116
+ # @param string type Data type
117
+ # @param string value Value to be deserialized
118
+ # @return [Object] Deserialized data
119
+ def _deserialize(type, value)
120
+ case type.to_sym
121
+ when :DateTime
122
+ DateTime.parse(value)
123
+ when :Date
124
+ Date.parse(value)
125
+ when :String
126
+ value.to_s
127
+ when :Integer
128
+ value.to_i
129
+ when :Float
130
+ value.to_f
131
+ when :BOOLEAN
132
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
133
+ true
134
+ else
135
+ false
136
+ end
137
+ when :Object
138
+ # generic object (usually a Hash), return directly
139
+ value
140
+ when /\AArray<(?<inner_type>.+)>\z/
141
+ inner_type = Regexp.last_match[:inner_type]
142
+ value.map { |v| _deserialize(inner_type, v) }
143
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
144
+ k_type = Regexp.last_match[:k_type]
145
+ v_type = Regexp.last_match[:v_type]
146
+ {}.tap do |hash|
147
+ value.each do |k, v|
148
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
149
+ end
150
+ end
151
+ else # model
152
+ temp_model = CyberSource.const_get(type).new
153
+ temp_model.build_from_hash(value)
154
+ end
155
+ end
156
+
157
+ # Returns the string representation of the object
158
+ # @return [String] String presentation of the object
159
+ def to_s
160
+ to_hash.to_s
161
+ end
162
+
163
+ # to_body is an alias to to_hash (backward compatibility)
164
+ # @return [Hash] Returns the object in the form of hash
165
+ def to_body
166
+ to_hash
167
+ end
168
+
169
+ # Returns the object in the form of hash
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_hash
172
+ hash = {}
173
+ self.class.attribute_map.each_pair do |attr, param|
174
+ value = self.send(attr)
175
+ next if value.nil?
176
+ hash[param] = _to_hash(value)
177
+ end
178
+ hash
179
+ end
180
+
181
+ # Outputs non-array value in the form of hash
182
+ # For object, use to_hash. Otherwise, just return the value
183
+ # @param [Object] value Any valid value
184
+ # @return [Hash] Returns the value in the form of hash
185
+ def _to_hash(value)
186
+ if value.is_a?(Array)
187
+ value.compact.map { |v| _to_hash(v) }
188
+ elsif value.is_a?(Hash)
189
+ {}.tap do |hash|
190
+ value.each { |k, v| hash[k] = _to_hash(v) }
191
+ end
192
+ elsif value.respond_to? :to_hash
193
+ value.to_hash
194
+ else
195
+ value
196
+ end
197
+ end
198
+ end
199
+ end
@@ -1,649 +1,649 @@
1
- =begin
2
- #CyberSource Flex API
3
-
4
- #Simple PAN tokenization service
5
-
6
- OpenAPI spec version: 0.0.1
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.2.3
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module CyberSource
16
- class Ptsv2paymentsOrderInformationLineItems
17
- # Type of product. This value is used to determine the category that the product is in: electronic, handling, physical, service, or shipping. The default value is **default**. For a payment, when you set this field to a value other than default or any of the values related to shipping and handling, below fields _quantity_, _productName_, and _productSKU_ are required.
18
- attr_accessor :product_code
19
-
20
- # For PAYMENT and CAPTURE API, this field is required when above _productCode_ is not **default** or one of the values related to shipping and handling.
21
- attr_accessor :product_name
22
-
23
- # Identification code for the product. For PAYMENT and CAPTURE API, this field is required when above _productCode_ is not **default** or one of the values related to shipping and/or handling.
24
- attr_accessor :product_sku
25
-
26
- # For a payment or capture, this field is required when _productCode_ is not **default** or one of the values related to shipping and handling.
27
- attr_accessor :quantity
28
-
29
- # Per-item price of the product. This value cannot be negative. You can include a decimal point (.), but you cannot include any other special characters. CyberSource truncates the amount to the correct number of decimal places. For processor-specific information, see the amount field in [Credit Card Services Using the SCMP API.](http://apps.cybersource.com/library/documentation/dev_guides/CC_Svcs_SCMP_API/html)
30
- attr_accessor :unit_price
31
-
32
- # Unit of measure, or unit of measure code, for the item.
33
- attr_accessor :unit_of_measure
34
-
35
- # Total amount for the item. Normally calculated as the unit price x quantity.
36
- attr_accessor :total_amount
37
-
38
- # Total tax to apply to the product. This value cannot be negative. The tax amount and the offer amount must be in the same currency. The tax amount field is additive. The following example uses a two-exponent currency such as USD: 1. You include each line item in your request. ..- 1st line item has amount=10.00, quantity=1, and taxAmount=0.80 ..- 2nd line item has amount=20.00, quantity=1, and taxAmount=1.60 2. The total amount authorized will be 32.40, not 30.00 with 2.40 of tax included. This field is frequently used for Level II and Level III transactions.
39
- attr_accessor :tax_amount
40
-
41
- # Tax rate applied to the item. See \"Numbered Elements,\" page 14. Visa: Valid range is 0.01 to 0.99 (1% to 99%, with only whole percentage values accepted; values with additional decimal places will be truncated). Mastercard: Valid range is 0.00001 to 0.99999 (0.001% to 99.999%).
42
- attr_accessor :tax_rate
43
-
44
- # Flag to indicate how you handle discount at the line item level. - 0: no line level discount provided - 1: tax was calculated on the post-discount line item total - 2: tax was calculated on the pre-discount line item total `Note` Visa will inset 0 (zero) if an invalid value is included in this field. This field relates to the value in the _lineItems[].discountAmount_ field.
45
- attr_accessor :tax_applied_after_discount
46
-
47
- # Flag to indicate whether tax is exempted or not included. - 0: tax not included - 1: tax included - 2: transaction is not subject to tax
48
- attr_accessor :tax_status_indicator
49
-
50
- # Type of tax being applied to the item. Possible values: Below values are used by **RBS WorldPay Atlanta**, **FDC Nashville Global**, **Litle** - 0000: unknown tax type - 0001: federal/national sales tax - 0002: state sales tax - 0003: city sales tax - 0004: local sales tax - 0005: municipal sales tax - 0006: other tax - 0010: value-added tax - 0011: goods and services tax - 0012: provincial sales tax - 0013: harmonized sales tax - 0014: Quebec sales tax (QST) - 0020: room tax - 0021: occupancy tax - 0022: energy tax - Blank: Tax not supported on line item.
51
- attr_accessor :tax_type_code
52
-
53
- # Flag that indicates whether the tax amount is included in the Line Item Total.
54
- attr_accessor :amount_includes_tax
55
-
56
- # Flag to indicate whether the purchase is categorized as goods or services. Possible values: - 00: goods - 01: services
57
- attr_accessor :type_of_supply
58
-
59
- # Commodity code or International description code used to classify the item. Contact your acquirer for a list of codes.
60
- attr_accessor :commodity_code
61
-
62
- # Discount applied to the item.
63
- attr_accessor :discount_amount
64
-
65
- # Flag that indicates whether the amount is discounted. If you do not provide a value but you set Discount Amount to a value greater than zero, then CyberSource sets this field to **true**.
66
- attr_accessor :discount_applied
67
-
68
- # Rate the item is discounted. Maximum of 2 decimal places. Example 5.25 (=5.25%)
69
- attr_accessor :discount_rate
70
-
71
- # Field to support an invoice number for a transaction. You must specify the number of line items that will include an invoice number. By default, the first line item will include an invoice number field. The invoice number field can be included for up to 10 line items.
72
- attr_accessor :invoice_number
73
-
74
- attr_accessor :tax_details
75
-
76
- # TODO
77
- attr_accessor :fulfillment_type
78
-
79
- # Attribute mapping from ruby-style variable name to JSON key.
80
- def self.attribute_map
81
- {
82
- :'product_code' => :'productCode',
83
- :'product_name' => :'productName',
84
- :'product_sku' => :'productSku',
85
- :'quantity' => :'quantity',
86
- :'unit_price' => :'unitPrice',
87
- :'unit_of_measure' => :'unitOfMeasure',
88
- :'total_amount' => :'totalAmount',
89
- :'tax_amount' => :'taxAmount',
90
- :'tax_rate' => :'taxRate',
91
- :'tax_applied_after_discount' => :'taxAppliedAfterDiscount',
92
- :'tax_status_indicator' => :'taxStatusIndicator',
93
- :'tax_type_code' => :'taxTypeCode',
94
- :'amount_includes_tax' => :'amountIncludesTax',
95
- :'type_of_supply' => :'typeOfSupply',
96
- :'commodity_code' => :'commodityCode',
97
- :'discount_amount' => :'discountAmount',
98
- :'discount_applied' => :'discountApplied',
99
- :'discount_rate' => :'discountRate',
100
- :'invoice_number' => :'invoiceNumber',
101
- :'tax_details' => :'taxDetails',
102
- :'fulfillment_type' => :'fulfillmentType'
103
- }
104
- end
105
-
106
- # Attribute type mapping.
107
- def self.swagger_types
108
- {
109
- :'product_code' => :'String',
110
- :'product_name' => :'String',
111
- :'product_sku' => :'String',
112
- :'quantity' => :'Float',
113
- :'unit_price' => :'String',
114
- :'unit_of_measure' => :'String',
115
- :'total_amount' => :'String',
116
- :'tax_amount' => :'String',
117
- :'tax_rate' => :'String',
118
- :'tax_applied_after_discount' => :'String',
119
- :'tax_status_indicator' => :'String',
120
- :'tax_type_code' => :'String',
121
- :'amount_includes_tax' => :'BOOLEAN',
122
- :'type_of_supply' => :'String',
123
- :'commodity_code' => :'String',
124
- :'discount_amount' => :'String',
125
- :'discount_applied' => :'BOOLEAN',
126
- :'discount_rate' => :'String',
127
- :'invoice_number' => :'String',
128
- :'tax_details' => :'Array<Ptsv2paymentsOrderInformationAmountDetailsTaxDetails>',
129
- :'fulfillment_type' => :'String'
130
- }
131
- end
132
-
133
- # Initializes the object
134
- # @param [Hash] attributes Model attributes in the form of hash
135
- def initialize(attributes = {})
136
- return unless attributes.is_a?(Hash)
137
-
138
- # convert string to symbol for hash key
139
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
140
-
141
- if attributes.has_key?(:'productCode')
142
- self.product_code = attributes[:'productCode']
143
- end
144
-
145
- if attributes.has_key?(:'productName')
146
- self.product_name = attributes[:'productName']
147
- end
148
-
149
- if attributes.has_key?(:'productSku')
150
- self.product_sku = attributes[:'productSku']
151
- end
152
-
153
- if attributes.has_key?(:'quantity')
154
- self.quantity = attributes[:'quantity']
155
- end
156
-
157
- if attributes.has_key?(:'unitPrice')
158
- self.unit_price = attributes[:'unitPrice']
159
- end
160
-
161
- if attributes.has_key?(:'unitOfMeasure')
162
- self.unit_of_measure = attributes[:'unitOfMeasure']
163
- end
164
-
165
- if attributes.has_key?(:'totalAmount')
166
- self.total_amount = attributes[:'totalAmount']
167
- end
168
-
169
- if attributes.has_key?(:'taxAmount')
170
- self.tax_amount = attributes[:'taxAmount']
171
- end
172
-
173
- if attributes.has_key?(:'taxRate')
174
- self.tax_rate = attributes[:'taxRate']
175
- end
176
-
177
- if attributes.has_key?(:'taxAppliedAfterDiscount')
178
- self.tax_applied_after_discount = attributes[:'taxAppliedAfterDiscount']
179
- end
180
-
181
- if attributes.has_key?(:'taxStatusIndicator')
182
- self.tax_status_indicator = attributes[:'taxStatusIndicator']
183
- end
184
-
185
- if attributes.has_key?(:'taxTypeCode')
186
- self.tax_type_code = attributes[:'taxTypeCode']
187
- end
188
-
189
- if attributes.has_key?(:'amountIncludesTax')
190
- self.amount_includes_tax = attributes[:'amountIncludesTax']
191
- end
192
-
193
- if attributes.has_key?(:'typeOfSupply')
194
- self.type_of_supply = attributes[:'typeOfSupply']
195
- end
196
-
197
- if attributes.has_key?(:'commodityCode')
198
- self.commodity_code = attributes[:'commodityCode']
199
- end
200
-
201
- if attributes.has_key?(:'discountAmount')
202
- self.discount_amount = attributes[:'discountAmount']
203
- end
204
-
205
- if attributes.has_key?(:'discountApplied')
206
- self.discount_applied = attributes[:'discountApplied']
207
- end
208
-
209
- if attributes.has_key?(:'discountRate')
210
- self.discount_rate = attributes[:'discountRate']
211
- end
212
-
213
- if attributes.has_key?(:'invoiceNumber')
214
- self.invoice_number = attributes[:'invoiceNumber']
215
- end
216
-
217
- if attributes.has_key?(:'taxDetails')
218
- if (value = attributes[:'taxDetails']).is_a?(Array)
219
- self.tax_details = value
220
- end
221
- end
222
-
223
- if attributes.has_key?(:'fulfillmentType')
224
- self.fulfillment_type = attributes[:'fulfillmentType']
225
- end
226
- end
227
-
228
- # Show invalid properties with the reasons. Usually used together with valid?
229
- # @return Array for valid properties with the reasons
230
- def list_invalid_properties
231
- invalid_properties = Array.new
232
- if !@product_code.nil? && @product_code.to_s.length > 255
233
- invalid_properties.push('invalid value for "product_code", the character length must be smaller than or equal to 255.')
234
- end
235
-
236
- if !@product_name.nil? && @product_name.to_s.length > 255
237
- invalid_properties.push('invalid value for "product_name", the character length must be smaller than or equal to 255.')
238
- end
239
-
240
- if !@product_sku.nil? && @product_sku.to_s.length > 255
241
- invalid_properties.push('invalid value for "product_sku", the character length must be smaller than or equal to 255.')
242
- end
243
-
244
- if !@quantity.nil? && @quantity > 9999999999
245
- invalid_properties.push('invalid value for "quantity", must be smaller than or equal to 9999999999.')
246
- end
247
-
248
- if !@quantity.nil? && @quantity < 1
249
- invalid_properties.push('invalid value for "quantity", must be greater than or equal to 1.')
250
- end
251
-
252
- if !@unit_price.nil? && @unit_price.to_s.length > 15
253
- invalid_properties.push('invalid value for "unit_price", the character length must be smaller than or equal to 15.')
254
- end
255
-
256
- if !@unit_of_measure.nil? && @unit_of_measure.to_s.length > 12
257
- invalid_properties.push('invalid value for "unit_of_measure", the character length must be smaller than or equal to 12.')
258
- end
259
-
260
- if !@total_amount.nil? && @total_amount.to_s.length > 13
261
- invalid_properties.push('invalid value for "total_amount", the character length must be smaller than or equal to 13.')
262
- end
263
-
264
- if !@tax_amount.nil? && @tax_amount.to_s.length > 15
265
- invalid_properties.push('invalid value for "tax_amount", the character length must be smaller than or equal to 15.')
266
- end
267
-
268
- if !@tax_rate.nil? && @tax_rate.to_s.length > 7
269
- invalid_properties.push('invalid value for "tax_rate", the character length must be smaller than or equal to 7.')
270
- end
271
-
272
- if !@tax_applied_after_discount.nil? && @tax_applied_after_discount.to_s.length > 1
273
- invalid_properties.push('invalid value for "tax_applied_after_discount", the character length must be smaller than or equal to 1.')
274
- end
275
-
276
- if !@tax_status_indicator.nil? && @tax_status_indicator.to_s.length > 1
277
- invalid_properties.push('invalid value for "tax_status_indicator", the character length must be smaller than or equal to 1.')
278
- end
279
-
280
- if !@tax_type_code.nil? && @tax_type_code.to_s.length > 4
281
- invalid_properties.push('invalid value for "tax_type_code", the character length must be smaller than or equal to 4.')
282
- end
283
-
284
- if !@type_of_supply.nil? && @type_of_supply.to_s.length > 2
285
- invalid_properties.push('invalid value for "type_of_supply", the character length must be smaller than or equal to 2.')
286
- end
287
-
288
- if !@commodity_code.nil? && @commodity_code.to_s.length > 15
289
- invalid_properties.push('invalid value for "commodity_code", the character length must be smaller than or equal to 15.')
290
- end
291
-
292
- if !@discount_amount.nil? && @discount_amount.to_s.length > 13
293
- invalid_properties.push('invalid value for "discount_amount", the character length must be smaller than or equal to 13.')
294
- end
295
-
296
- if !@discount_rate.nil? && @discount_rate.to_s.length > 6
297
- invalid_properties.push('invalid value for "discount_rate", the character length must be smaller than or equal to 6.')
298
- end
299
-
300
- if !@invoice_number.nil? && @invoice_number.to_s.length > 23
301
- invalid_properties.push('invalid value for "invoice_number", the character length must be smaller than or equal to 23.')
302
- end
303
-
304
- invalid_properties
305
- end
306
-
307
- # Check to see if the all the properties in the model are valid
308
- # @return true if the model is valid
309
- def valid?
310
- return false if !@product_code.nil? && @product_code.to_s.length > 255
311
- return false if !@product_name.nil? && @product_name.to_s.length > 255
312
- return false if !@product_sku.nil? && @product_sku.to_s.length > 255
313
- return false if !@quantity.nil? && @quantity > 9999999999
314
- return false if !@quantity.nil? && @quantity < 1
315
- return false if !@unit_price.nil? && @unit_price.to_s.length > 15
316
- return false if !@unit_of_measure.nil? && @unit_of_measure.to_s.length > 12
317
- return false if !@total_amount.nil? && @total_amount.to_s.length > 13
318
- return false if !@tax_amount.nil? && @tax_amount.to_s.length > 15
319
- return false if !@tax_rate.nil? && @tax_rate.to_s.length > 7
320
- return false if !@tax_applied_after_discount.nil? && @tax_applied_after_discount.to_s.length > 1
321
- return false if !@tax_status_indicator.nil? && @tax_status_indicator.to_s.length > 1
322
- return false if !@tax_type_code.nil? && @tax_type_code.to_s.length > 4
323
- return false if !@type_of_supply.nil? && @type_of_supply.to_s.length > 2
324
- return false if !@commodity_code.nil? && @commodity_code.to_s.length > 15
325
- return false if !@discount_amount.nil? && @discount_amount.to_s.length > 13
326
- return false if !@discount_rate.nil? && @discount_rate.to_s.length > 6
327
- return false if !@invoice_number.nil? && @invoice_number.to_s.length > 23
328
- true
329
- end
330
-
331
- # Custom attribute writer method with validation
332
- # @param [Object] product_code Value to be assigned
333
- def product_code=(product_code)
334
- if !product_code.nil? && product_code.to_s.length > 255
335
- fail ArgumentError, 'invalid value for "product_code", the character length must be smaller than or equal to 255.'
336
- end
337
-
338
- @product_code = product_code
339
- end
340
-
341
- # Custom attribute writer method with validation
342
- # @param [Object] product_name Value to be assigned
343
- def product_name=(product_name)
344
- if !product_name.nil? && product_name.to_s.length > 255
345
- fail ArgumentError, 'invalid value for "product_name", the character length must be smaller than or equal to 255.'
346
- end
347
-
348
- @product_name = product_name
349
- end
350
-
351
- # Custom attribute writer method with validation
352
- # @param [Object] product_sku Value to be assigned
353
- def product_sku=(product_sku)
354
- if !product_sku.nil? && product_sku.to_s.length > 255
355
- fail ArgumentError, 'invalid value for "product_sku", the character length must be smaller than or equal to 255.'
356
- end
357
-
358
- @product_sku = product_sku
359
- end
360
-
361
- # Custom attribute writer method with validation
362
- # @param [Object] quantity Value to be assigned
363
- def quantity=(quantity)
364
- if !quantity.nil? && quantity > 9999999999
365
- fail ArgumentError, 'invalid value for "quantity", must be smaller than or equal to 9999999999.'
366
- end
367
-
368
- if !quantity.nil? && quantity < 1
369
- fail ArgumentError, 'invalid value for "quantity", must be greater than or equal to 1.'
370
- end
371
-
372
- @quantity = quantity
373
- end
374
-
375
- # Custom attribute writer method with validation
376
- # @param [Object] unit_price Value to be assigned
377
- def unit_price=(unit_price)
378
- if !unit_price.nil? && unit_price.to_s.length > 15
379
- fail ArgumentError, 'invalid value for "unit_price", the character length must be smaller than or equal to 15.'
380
- end
381
-
382
- @unit_price = unit_price
383
- end
384
-
385
- # Custom attribute writer method with validation
386
- # @param [Object] unit_of_measure Value to be assigned
387
- def unit_of_measure=(unit_of_measure)
388
- if !unit_of_measure.nil? && unit_of_measure.to_s.length > 12
389
- fail ArgumentError, 'invalid value for "unit_of_measure", the character length must be smaller than or equal to 12.'
390
- end
391
-
392
- @unit_of_measure = unit_of_measure
393
- end
394
-
395
- # Custom attribute writer method with validation
396
- # @param [Object] total_amount Value to be assigned
397
- def total_amount=(total_amount)
398
- if !total_amount.nil? && total_amount.to_s.length > 13
399
- fail ArgumentError, 'invalid value for "total_amount", the character length must be smaller than or equal to 13.'
400
- end
401
-
402
- @total_amount = total_amount
403
- end
404
-
405
- # Custom attribute writer method with validation
406
- # @param [Object] tax_amount Value to be assigned
407
- def tax_amount=(tax_amount)
408
- if !tax_amount.nil? && tax_amount.to_s.length > 15
409
- fail ArgumentError, 'invalid value for "tax_amount", the character length must be smaller than or equal to 15.'
410
- end
411
-
412
- @tax_amount = tax_amount
413
- end
414
-
415
- # Custom attribute writer method with validation
416
- # @param [Object] tax_rate Value to be assigned
417
- def tax_rate=(tax_rate)
418
- if !tax_rate.nil? && tax_rate.to_s.length > 7
419
- fail ArgumentError, 'invalid value for "tax_rate", the character length must be smaller than or equal to 7.'
420
- end
421
-
422
- @tax_rate = tax_rate
423
- end
424
-
425
- # Custom attribute writer method with validation
426
- # @param [Object] tax_applied_after_discount Value to be assigned
427
- def tax_applied_after_discount=(tax_applied_after_discount)
428
- if !tax_applied_after_discount.nil? && tax_applied_after_discount.to_s.length > 1
429
- fail ArgumentError, 'invalid value for "tax_applied_after_discount", the character length must be smaller than or equal to 1.'
430
- end
431
-
432
- @tax_applied_after_discount = tax_applied_after_discount
433
- end
434
-
435
- # Custom attribute writer method with validation
436
- # @param [Object] tax_status_indicator Value to be assigned
437
- def tax_status_indicator=(tax_status_indicator)
438
- if !tax_status_indicator.nil? && tax_status_indicator.to_s.length > 1
439
- fail ArgumentError, 'invalid value for "tax_status_indicator", the character length must be smaller than or equal to 1.'
440
- end
441
-
442
- @tax_status_indicator = tax_status_indicator
443
- end
444
-
445
- # Custom attribute writer method with validation
446
- # @param [Object] tax_type_code Value to be assigned
447
- def tax_type_code=(tax_type_code)
448
- if !tax_type_code.nil? && tax_type_code.to_s.length > 4
449
- fail ArgumentError, 'invalid value for "tax_type_code", the character length must be smaller than or equal to 4.'
450
- end
451
-
452
- @tax_type_code = tax_type_code
453
- end
454
-
455
- # Custom attribute writer method with validation
456
- # @param [Object] type_of_supply Value to be assigned
457
- def type_of_supply=(type_of_supply)
458
- if !type_of_supply.nil? && type_of_supply.to_s.length > 2
459
- fail ArgumentError, 'invalid value for "type_of_supply", the character length must be smaller than or equal to 2.'
460
- end
461
-
462
- @type_of_supply = type_of_supply
463
- end
464
-
465
- # Custom attribute writer method with validation
466
- # @param [Object] commodity_code Value to be assigned
467
- def commodity_code=(commodity_code)
468
- if !commodity_code.nil? && commodity_code.to_s.length > 15
469
- fail ArgumentError, 'invalid value for "commodity_code", the character length must be smaller than or equal to 15.'
470
- end
471
-
472
- @commodity_code = commodity_code
473
- end
474
-
475
- # Custom attribute writer method with validation
476
- # @param [Object] discount_amount Value to be assigned
477
- def discount_amount=(discount_amount)
478
- if !discount_amount.nil? && discount_amount.to_s.length > 13
479
- fail ArgumentError, 'invalid value for "discount_amount", the character length must be smaller than or equal to 13.'
480
- end
481
-
482
- @discount_amount = discount_amount
483
- end
484
-
485
- # Custom attribute writer method with validation
486
- # @param [Object] discount_rate Value to be assigned
487
- def discount_rate=(discount_rate)
488
- if !discount_rate.nil? && discount_rate.to_s.length > 6
489
- fail ArgumentError, 'invalid value for "discount_rate", the character length must be smaller than or equal to 6.'
490
- end
491
-
492
- @discount_rate = discount_rate
493
- end
494
-
495
- # Custom attribute writer method with validation
496
- # @param [Object] invoice_number Value to be assigned
497
- def invoice_number=(invoice_number)
498
- if !invoice_number.nil? && invoice_number.to_s.length > 23
499
- fail ArgumentError, 'invalid value for "invoice_number", the character length must be smaller than or equal to 23.'
500
- end
501
-
502
- @invoice_number = invoice_number
503
- end
504
-
505
- # Checks equality by comparing each attribute.
506
- # @param [Object] Object to be compared
507
- def ==(o)
508
- return true if self.equal?(o)
509
- self.class == o.class &&
510
- product_code == o.product_code &&
511
- product_name == o.product_name &&
512
- product_sku == o.product_sku &&
513
- quantity == o.quantity &&
514
- unit_price == o.unit_price &&
515
- unit_of_measure == o.unit_of_measure &&
516
- total_amount == o.total_amount &&
517
- tax_amount == o.tax_amount &&
518
- tax_rate == o.tax_rate &&
519
- tax_applied_after_discount == o.tax_applied_after_discount &&
520
- tax_status_indicator == o.tax_status_indicator &&
521
- tax_type_code == o.tax_type_code &&
522
- amount_includes_tax == o.amount_includes_tax &&
523
- type_of_supply == o.type_of_supply &&
524
- commodity_code == o.commodity_code &&
525
- discount_amount == o.discount_amount &&
526
- discount_applied == o.discount_applied &&
527
- discount_rate == o.discount_rate &&
528
- invoice_number == o.invoice_number &&
529
- tax_details == o.tax_details &&
530
- fulfillment_type == o.fulfillment_type
531
- end
532
-
533
- # @see the `==` method
534
- # @param [Object] Object to be compared
535
- def eql?(o)
536
- self == o
537
- end
538
-
539
- # Calculates hash code according to all attributes.
540
- # @return [Fixnum] Hash code
541
- def hash
542
- [product_code, product_name, product_sku, quantity, unit_price, unit_of_measure, total_amount, tax_amount, tax_rate, tax_applied_after_discount, tax_status_indicator, tax_type_code, amount_includes_tax, type_of_supply, commodity_code, discount_amount, discount_applied, discount_rate, invoice_number, tax_details, fulfillment_type].hash
543
- end
544
-
545
- # Builds the object from hash
546
- # @param [Hash] attributes Model attributes in the form of hash
547
- # @return [Object] Returns the model itself
548
- def build_from_hash(attributes)
549
- return nil unless attributes.is_a?(Hash)
550
- self.class.swagger_types.each_pair do |key, type|
551
- if type =~ /\AArray<(.*)>/i
552
- # check to ensure the input is an array given that the the attribute
553
- # is documented as an array but the input is not
554
- if attributes[self.class.attribute_map[key]].is_a?(Array)
555
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
556
- end
557
- elsif !attributes[self.class.attribute_map[key]].nil?
558
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
559
- end # or else data not found in attributes(hash), not an issue as the data can be optional
560
- end
561
-
562
- self
563
- end
564
-
565
- # Deserializes the data based on type
566
- # @param string type Data type
567
- # @param string value Value to be deserialized
568
- # @return [Object] Deserialized data
569
- def _deserialize(type, value)
570
- case type.to_sym
571
- when :DateTime
572
- DateTime.parse(value)
573
- when :Date
574
- Date.parse(value)
575
- when :String
576
- value.to_s
577
- when :Integer
578
- value.to_i
579
- when :Float
580
- value.to_f
581
- when :BOOLEAN
582
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
583
- true
584
- else
585
- false
586
- end
587
- when :Object
588
- # generic object (usually a Hash), return directly
589
- value
590
- when /\AArray<(?<inner_type>.+)>\z/
591
- inner_type = Regexp.last_match[:inner_type]
592
- value.map { |v| _deserialize(inner_type, v) }
593
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
594
- k_type = Regexp.last_match[:k_type]
595
- v_type = Regexp.last_match[:v_type]
596
- {}.tap do |hash|
597
- value.each do |k, v|
598
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
599
- end
600
- end
601
- else # model
602
- temp_model = CyberSource.const_get(type).new
603
- temp_model.build_from_hash(value)
604
- end
605
- end
606
-
607
- # Returns the string representation of the object
608
- # @return [String] String presentation of the object
609
- def to_s
610
- to_hash.to_s
611
- end
612
-
613
- # to_body is an alias to to_hash (backward compatibility)
614
- # @return [Hash] Returns the object in the form of hash
615
- def to_body
616
- to_hash
617
- end
618
-
619
- # Returns the object in the form of hash
620
- # @return [Hash] Returns the object in the form of hash
621
- def to_hash
622
- hash = {}
623
- self.class.attribute_map.each_pair do |attr, param|
624
- value = self.send(attr)
625
- next if value.nil?
626
- hash[param] = _to_hash(value)
627
- end
628
- hash
629
- end
630
-
631
- # Outputs non-array value in the form of hash
632
- # For object, use to_hash. Otherwise, just return the value
633
- # @param [Object] value Any valid value
634
- # @return [Hash] Returns the value in the form of hash
635
- def _to_hash(value)
636
- if value.is_a?(Array)
637
- value.compact.map { |v| _to_hash(v) }
638
- elsif value.is_a?(Hash)
639
- {}.tap do |hash|
640
- value.each { |k, v| hash[k] = _to_hash(v) }
641
- end
642
- elsif value.respond_to? :to_hash
643
- value.to_hash
644
- else
645
- value
646
- end
647
- end
648
- end
649
- end
1
+ =begin
2
+ #CyberSource Flex API
3
+
4
+ #Simple PAN tokenization service
5
+
6
+ OpenAPI spec version: 0.0.1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CyberSource
16
+ class Ptsv2paymentsOrderInformationLineItems
17
+ # Type of product. This value is used to determine the category that the product is in: electronic, handling, physical, service, or shipping. The default value is **default**. For a payment, when you set this field to a value other than default or any of the values related to shipping and handling, below fields _quantity_, _productName_, and _productSKU_ are required.
18
+ attr_accessor :product_code
19
+
20
+ # For PAYMENT and CAPTURE API, this field is required when above _productCode_ is not **default** or one of the values related to shipping and handling.
21
+ attr_accessor :product_name
22
+
23
+ # Identification code for the product. For PAYMENT and CAPTURE API, this field is required when above _productCode_ is not **default** or one of the values related to shipping and/or handling.
24
+ attr_accessor :product_sku
25
+
26
+ # For a payment or capture, this field is required when _productCode_ is not **default** or one of the values related to shipping and handling.
27
+ attr_accessor :quantity
28
+
29
+ # Per-item price of the product. This value cannot be negative. You can include a decimal point (.), but you cannot include any other special characters. CyberSource truncates the amount to the correct number of decimal places. For processor-specific information, see the amount field in [Credit Card Services Using the SCMP API.](http://apps.cybersource.com/library/documentation/dev_guides/CC_Svcs_SCMP_API/html)
30
+ attr_accessor :unit_price
31
+
32
+ # Unit of measure, or unit of measure code, for the item.
33
+ attr_accessor :unit_of_measure
34
+
35
+ # Total amount for the item. Normally calculated as the unit price x quantity.
36
+ attr_accessor :total_amount
37
+
38
+ # Total tax to apply to the product. This value cannot be negative. The tax amount and the offer amount must be in the same currency. The tax amount field is additive. The following example uses a two-exponent currency such as USD: 1. You include each line item in your request. ..- 1st line item has amount=10.00, quantity=1, and taxAmount=0.80 ..- 2nd line item has amount=20.00, quantity=1, and taxAmount=1.60 2. The total amount authorized will be 32.40, not 30.00 with 2.40 of tax included. This field is frequently used for Level II and Level III transactions.
39
+ attr_accessor :tax_amount
40
+
41
+ # Tax rate applied to the item. See \"Numbered Elements,\" page 14. Visa: Valid range is 0.01 to 0.99 (1% to 99%, with only whole percentage values accepted; values with additional decimal places will be truncated). Mastercard: Valid range is 0.00001 to 0.99999 (0.001% to 99.999%).
42
+ attr_accessor :tax_rate
43
+
44
+ # Flag to indicate how you handle discount at the line item level. - 0: no line level discount provided - 1: tax was calculated on the post-discount line item total - 2: tax was calculated on the pre-discount line item total `Note` Visa will inset 0 (zero) if an invalid value is included in this field. This field relates to the value in the _lineItems[].discountAmount_ field.
45
+ attr_accessor :tax_applied_after_discount
46
+
47
+ # Flag to indicate whether tax is exempted or not included. - 0: tax not included - 1: tax included - 2: transaction is not subject to tax
48
+ attr_accessor :tax_status_indicator
49
+
50
+ # Type of tax being applied to the item. Possible values: Below values are used by **RBS WorldPay Atlanta**, **FDC Nashville Global**, **Litle** - 0000: unknown tax type - 0001: federal/national sales tax - 0002: state sales tax - 0003: city sales tax - 0004: local sales tax - 0005: municipal sales tax - 0006: other tax - 0010: value-added tax - 0011: goods and services tax - 0012: provincial sales tax - 0013: harmonized sales tax - 0014: Quebec sales tax (QST) - 0020: room tax - 0021: occupancy tax - 0022: energy tax - Blank: Tax not supported on line item.
51
+ attr_accessor :tax_type_code
52
+
53
+ # Flag that indicates whether the tax amount is included in the Line Item Total.
54
+ attr_accessor :amount_includes_tax
55
+
56
+ # Flag to indicate whether the purchase is categorized as goods or services. Possible values: - 00: goods - 01: services
57
+ attr_accessor :type_of_supply
58
+
59
+ # Commodity code or International description code used to classify the item. Contact your acquirer for a list of codes.
60
+ attr_accessor :commodity_code
61
+
62
+ # Discount applied to the item.
63
+ attr_accessor :discount_amount
64
+
65
+ # Flag that indicates whether the amount is discounted. If you do not provide a value but you set Discount Amount to a value greater than zero, then CyberSource sets this field to **true**.
66
+ attr_accessor :discount_applied
67
+
68
+ # Rate the item is discounted. Maximum of 2 decimal places. Example 5.25 (=5.25%)
69
+ attr_accessor :discount_rate
70
+
71
+ # Field to support an invoice number for a transaction. You must specify the number of line items that will include an invoice number. By default, the first line item will include an invoice number field. The invoice number field can be included for up to 10 line items.
72
+ attr_accessor :invoice_number
73
+
74
+ attr_accessor :tax_details
75
+
76
+ # TODO
77
+ attr_accessor :fulfillment_type
78
+
79
+ # Attribute mapping from ruby-style variable name to JSON key.
80
+ def self.attribute_map
81
+ {
82
+ :'product_code' => :'productCode',
83
+ :'product_name' => :'productName',
84
+ :'product_sku' => :'productSku',
85
+ :'quantity' => :'quantity',
86
+ :'unit_price' => :'unitPrice',
87
+ :'unit_of_measure' => :'unitOfMeasure',
88
+ :'total_amount' => :'totalAmount',
89
+ :'tax_amount' => :'taxAmount',
90
+ :'tax_rate' => :'taxRate',
91
+ :'tax_applied_after_discount' => :'taxAppliedAfterDiscount',
92
+ :'tax_status_indicator' => :'taxStatusIndicator',
93
+ :'tax_type_code' => :'taxTypeCode',
94
+ :'amount_includes_tax' => :'amountIncludesTax',
95
+ :'type_of_supply' => :'typeOfSupply',
96
+ :'commodity_code' => :'commodityCode',
97
+ :'discount_amount' => :'discountAmount',
98
+ :'discount_applied' => :'discountApplied',
99
+ :'discount_rate' => :'discountRate',
100
+ :'invoice_number' => :'invoiceNumber',
101
+ :'tax_details' => :'taxDetails',
102
+ :'fulfillment_type' => :'fulfillmentType'
103
+ }
104
+ end
105
+
106
+ # Attribute type mapping.
107
+ def self.swagger_types
108
+ {
109
+ :'product_code' => :'String',
110
+ :'product_name' => :'String',
111
+ :'product_sku' => :'String',
112
+ :'quantity' => :'Float',
113
+ :'unit_price' => :'String',
114
+ :'unit_of_measure' => :'String',
115
+ :'total_amount' => :'String',
116
+ :'tax_amount' => :'String',
117
+ :'tax_rate' => :'String',
118
+ :'tax_applied_after_discount' => :'String',
119
+ :'tax_status_indicator' => :'String',
120
+ :'tax_type_code' => :'String',
121
+ :'amount_includes_tax' => :'BOOLEAN',
122
+ :'type_of_supply' => :'String',
123
+ :'commodity_code' => :'String',
124
+ :'discount_amount' => :'String',
125
+ :'discount_applied' => :'BOOLEAN',
126
+ :'discount_rate' => :'String',
127
+ :'invoice_number' => :'String',
128
+ :'tax_details' => :'Array<Ptsv2paymentsOrderInformationAmountDetailsTaxDetails>',
129
+ :'fulfillment_type' => :'String'
130
+ }
131
+ end
132
+
133
+ # Initializes the object
134
+ # @param [Hash] attributes Model attributes in the form of hash
135
+ def initialize(attributes = {})
136
+ return unless attributes.is_a?(Hash)
137
+
138
+ # convert string to symbol for hash key
139
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
140
+
141
+ if attributes.has_key?(:'productCode')
142
+ self.product_code = attributes[:'productCode']
143
+ end
144
+
145
+ if attributes.has_key?(:'productName')
146
+ self.product_name = attributes[:'productName']
147
+ end
148
+
149
+ if attributes.has_key?(:'productSku')
150
+ self.product_sku = attributes[:'productSku']
151
+ end
152
+
153
+ if attributes.has_key?(:'quantity')
154
+ self.quantity = attributes[:'quantity']
155
+ end
156
+
157
+ if attributes.has_key?(:'unitPrice')
158
+ self.unit_price = attributes[:'unitPrice']
159
+ end
160
+
161
+ if attributes.has_key?(:'unitOfMeasure')
162
+ self.unit_of_measure = attributes[:'unitOfMeasure']
163
+ end
164
+
165
+ if attributes.has_key?(:'totalAmount')
166
+ self.total_amount = attributes[:'totalAmount']
167
+ end
168
+
169
+ if attributes.has_key?(:'taxAmount')
170
+ self.tax_amount = attributes[:'taxAmount']
171
+ end
172
+
173
+ if attributes.has_key?(:'taxRate')
174
+ self.tax_rate = attributes[:'taxRate']
175
+ end
176
+
177
+ if attributes.has_key?(:'taxAppliedAfterDiscount')
178
+ self.tax_applied_after_discount = attributes[:'taxAppliedAfterDiscount']
179
+ end
180
+
181
+ if attributes.has_key?(:'taxStatusIndicator')
182
+ self.tax_status_indicator = attributes[:'taxStatusIndicator']
183
+ end
184
+
185
+ if attributes.has_key?(:'taxTypeCode')
186
+ self.tax_type_code = attributes[:'taxTypeCode']
187
+ end
188
+
189
+ if attributes.has_key?(:'amountIncludesTax')
190
+ self.amount_includes_tax = attributes[:'amountIncludesTax']
191
+ end
192
+
193
+ if attributes.has_key?(:'typeOfSupply')
194
+ self.type_of_supply = attributes[:'typeOfSupply']
195
+ end
196
+
197
+ if attributes.has_key?(:'commodityCode')
198
+ self.commodity_code = attributes[:'commodityCode']
199
+ end
200
+
201
+ if attributes.has_key?(:'discountAmount')
202
+ self.discount_amount = attributes[:'discountAmount']
203
+ end
204
+
205
+ if attributes.has_key?(:'discountApplied')
206
+ self.discount_applied = attributes[:'discountApplied']
207
+ end
208
+
209
+ if attributes.has_key?(:'discountRate')
210
+ self.discount_rate = attributes[:'discountRate']
211
+ end
212
+
213
+ if attributes.has_key?(:'invoiceNumber')
214
+ self.invoice_number = attributes[:'invoiceNumber']
215
+ end
216
+
217
+ if attributes.has_key?(:'taxDetails')
218
+ if (value = attributes[:'taxDetails']).is_a?(Array)
219
+ self.tax_details = value
220
+ end
221
+ end
222
+
223
+ if attributes.has_key?(:'fulfillmentType')
224
+ self.fulfillment_type = attributes[:'fulfillmentType']
225
+ end
226
+ end
227
+
228
+ # Show invalid properties with the reasons. Usually used together with valid?
229
+ # @return Array for valid properties with the reasons
230
+ def list_invalid_properties
231
+ invalid_properties = Array.new
232
+ if !@product_code.nil? && @product_code.to_s.length > 255
233
+ invalid_properties.push('invalid value for "product_code", the character length must be smaller than or equal to 255.')
234
+ end
235
+
236
+ if !@product_name.nil? && @product_name.to_s.length > 255
237
+ invalid_properties.push('invalid value for "product_name", the character length must be smaller than or equal to 255.')
238
+ end
239
+
240
+ if !@product_sku.nil? && @product_sku.to_s.length > 255
241
+ invalid_properties.push('invalid value for "product_sku", the character length must be smaller than or equal to 255.')
242
+ end
243
+
244
+ if !@quantity.nil? && @quantity > 9999999999
245
+ invalid_properties.push('invalid value for "quantity", must be smaller than or equal to 9999999999.')
246
+ end
247
+
248
+ if !@quantity.nil? && @quantity < 1
249
+ invalid_properties.push('invalid value for "quantity", must be greater than or equal to 1.')
250
+ end
251
+
252
+ if !@unit_price.nil? && @unit_price.to_s.length > 15
253
+ invalid_properties.push('invalid value for "unit_price", the character length must be smaller than or equal to 15.')
254
+ end
255
+
256
+ if !@unit_of_measure.nil? && @unit_of_measure.to_s.length > 12
257
+ invalid_properties.push('invalid value for "unit_of_measure", the character length must be smaller than or equal to 12.')
258
+ end
259
+
260
+ if !@total_amount.nil? && @total_amount.to_s.length > 13
261
+ invalid_properties.push('invalid value for "total_amount", the character length must be smaller than or equal to 13.')
262
+ end
263
+
264
+ if !@tax_amount.nil? && @tax_amount.to_s.length > 15
265
+ invalid_properties.push('invalid value for "tax_amount", the character length must be smaller than or equal to 15.')
266
+ end
267
+
268
+ if !@tax_rate.nil? && @tax_rate.to_s.length > 7
269
+ invalid_properties.push('invalid value for "tax_rate", the character length must be smaller than or equal to 7.')
270
+ end
271
+
272
+ if !@tax_applied_after_discount.nil? && @tax_applied_after_discount.to_s.length > 1
273
+ invalid_properties.push('invalid value for "tax_applied_after_discount", the character length must be smaller than or equal to 1.')
274
+ end
275
+
276
+ if !@tax_status_indicator.nil? && @tax_status_indicator.to_s.length > 1
277
+ invalid_properties.push('invalid value for "tax_status_indicator", the character length must be smaller than or equal to 1.')
278
+ end
279
+
280
+ if !@tax_type_code.nil? && @tax_type_code.to_s.length > 4
281
+ invalid_properties.push('invalid value for "tax_type_code", the character length must be smaller than or equal to 4.')
282
+ end
283
+
284
+ if !@type_of_supply.nil? && @type_of_supply.to_s.length > 2
285
+ invalid_properties.push('invalid value for "type_of_supply", the character length must be smaller than or equal to 2.')
286
+ end
287
+
288
+ if !@commodity_code.nil? && @commodity_code.to_s.length > 15
289
+ invalid_properties.push('invalid value for "commodity_code", the character length must be smaller than or equal to 15.')
290
+ end
291
+
292
+ if !@discount_amount.nil? && @discount_amount.to_s.length > 13
293
+ invalid_properties.push('invalid value for "discount_amount", the character length must be smaller than or equal to 13.')
294
+ end
295
+
296
+ if !@discount_rate.nil? && @discount_rate.to_s.length > 6
297
+ invalid_properties.push('invalid value for "discount_rate", the character length must be smaller than or equal to 6.')
298
+ end
299
+
300
+ if !@invoice_number.nil? && @invoice_number.to_s.length > 23
301
+ invalid_properties.push('invalid value for "invoice_number", the character length must be smaller than or equal to 23.')
302
+ end
303
+
304
+ invalid_properties
305
+ end
306
+
307
+ # Check to see if the all the properties in the model are valid
308
+ # @return true if the model is valid
309
+ def valid?
310
+ return false if !@product_code.nil? && @product_code.to_s.length > 255
311
+ return false if !@product_name.nil? && @product_name.to_s.length > 255
312
+ return false if !@product_sku.nil? && @product_sku.to_s.length > 255
313
+ return false if !@quantity.nil? && @quantity > 9999999999
314
+ return false if !@quantity.nil? && @quantity < 1
315
+ return false if !@unit_price.nil? && @unit_price.to_s.length > 15
316
+ return false if !@unit_of_measure.nil? && @unit_of_measure.to_s.length > 12
317
+ return false if !@total_amount.nil? && @total_amount.to_s.length > 13
318
+ return false if !@tax_amount.nil? && @tax_amount.to_s.length > 15
319
+ return false if !@tax_rate.nil? && @tax_rate.to_s.length > 7
320
+ return false if !@tax_applied_after_discount.nil? && @tax_applied_after_discount.to_s.length > 1
321
+ return false if !@tax_status_indicator.nil? && @tax_status_indicator.to_s.length > 1
322
+ return false if !@tax_type_code.nil? && @tax_type_code.to_s.length > 4
323
+ return false if !@type_of_supply.nil? && @type_of_supply.to_s.length > 2
324
+ return false if !@commodity_code.nil? && @commodity_code.to_s.length > 15
325
+ return false if !@discount_amount.nil? && @discount_amount.to_s.length > 13
326
+ return false if !@discount_rate.nil? && @discount_rate.to_s.length > 6
327
+ return false if !@invoice_number.nil? && @invoice_number.to_s.length > 23
328
+ true
329
+ end
330
+
331
+ # Custom attribute writer method with validation
332
+ # @param [Object] product_code Value to be assigned
333
+ def product_code=(product_code)
334
+ if !product_code.nil? && product_code.to_s.length > 255
335
+ fail ArgumentError, 'invalid value for "product_code", the character length must be smaller than or equal to 255.'
336
+ end
337
+
338
+ @product_code = product_code
339
+ end
340
+
341
+ # Custom attribute writer method with validation
342
+ # @param [Object] product_name Value to be assigned
343
+ def product_name=(product_name)
344
+ if !product_name.nil? && product_name.to_s.length > 255
345
+ fail ArgumentError, 'invalid value for "product_name", the character length must be smaller than or equal to 255.'
346
+ end
347
+
348
+ @product_name = product_name
349
+ end
350
+
351
+ # Custom attribute writer method with validation
352
+ # @param [Object] product_sku Value to be assigned
353
+ def product_sku=(product_sku)
354
+ if !product_sku.nil? && product_sku.to_s.length > 255
355
+ fail ArgumentError, 'invalid value for "product_sku", the character length must be smaller than or equal to 255.'
356
+ end
357
+
358
+ @product_sku = product_sku
359
+ end
360
+
361
+ # Custom attribute writer method with validation
362
+ # @param [Object] quantity Value to be assigned
363
+ def quantity=(quantity)
364
+ if !quantity.nil? && quantity > 9999999999
365
+ fail ArgumentError, 'invalid value for "quantity", must be smaller than or equal to 9999999999.'
366
+ end
367
+
368
+ if !quantity.nil? && quantity < 1
369
+ fail ArgumentError, 'invalid value for "quantity", must be greater than or equal to 1.'
370
+ end
371
+
372
+ @quantity = quantity
373
+ end
374
+
375
+ # Custom attribute writer method with validation
376
+ # @param [Object] unit_price Value to be assigned
377
+ def unit_price=(unit_price)
378
+ if !unit_price.nil? && unit_price.to_s.length > 15
379
+ fail ArgumentError, 'invalid value for "unit_price", the character length must be smaller than or equal to 15.'
380
+ end
381
+
382
+ @unit_price = unit_price
383
+ end
384
+
385
+ # Custom attribute writer method with validation
386
+ # @param [Object] unit_of_measure Value to be assigned
387
+ def unit_of_measure=(unit_of_measure)
388
+ if !unit_of_measure.nil? && unit_of_measure.to_s.length > 12
389
+ fail ArgumentError, 'invalid value for "unit_of_measure", the character length must be smaller than or equal to 12.'
390
+ end
391
+
392
+ @unit_of_measure = unit_of_measure
393
+ end
394
+
395
+ # Custom attribute writer method with validation
396
+ # @param [Object] total_amount Value to be assigned
397
+ def total_amount=(total_amount)
398
+ if !total_amount.nil? && total_amount.to_s.length > 13
399
+ fail ArgumentError, 'invalid value for "total_amount", the character length must be smaller than or equal to 13.'
400
+ end
401
+
402
+ @total_amount = total_amount
403
+ end
404
+
405
+ # Custom attribute writer method with validation
406
+ # @param [Object] tax_amount Value to be assigned
407
+ def tax_amount=(tax_amount)
408
+ if !tax_amount.nil? && tax_amount.to_s.length > 15
409
+ fail ArgumentError, 'invalid value for "tax_amount", the character length must be smaller than or equal to 15.'
410
+ end
411
+
412
+ @tax_amount = tax_amount
413
+ end
414
+
415
+ # Custom attribute writer method with validation
416
+ # @param [Object] tax_rate Value to be assigned
417
+ def tax_rate=(tax_rate)
418
+ if !tax_rate.nil? && tax_rate.to_s.length > 7
419
+ fail ArgumentError, 'invalid value for "tax_rate", the character length must be smaller than or equal to 7.'
420
+ end
421
+
422
+ @tax_rate = tax_rate
423
+ end
424
+
425
+ # Custom attribute writer method with validation
426
+ # @param [Object] tax_applied_after_discount Value to be assigned
427
+ def tax_applied_after_discount=(tax_applied_after_discount)
428
+ if !tax_applied_after_discount.nil? && tax_applied_after_discount.to_s.length > 1
429
+ fail ArgumentError, 'invalid value for "tax_applied_after_discount", the character length must be smaller than or equal to 1.'
430
+ end
431
+
432
+ @tax_applied_after_discount = tax_applied_after_discount
433
+ end
434
+
435
+ # Custom attribute writer method with validation
436
+ # @param [Object] tax_status_indicator Value to be assigned
437
+ def tax_status_indicator=(tax_status_indicator)
438
+ if !tax_status_indicator.nil? && tax_status_indicator.to_s.length > 1
439
+ fail ArgumentError, 'invalid value for "tax_status_indicator", the character length must be smaller than or equal to 1.'
440
+ end
441
+
442
+ @tax_status_indicator = tax_status_indicator
443
+ end
444
+
445
+ # Custom attribute writer method with validation
446
+ # @param [Object] tax_type_code Value to be assigned
447
+ def tax_type_code=(tax_type_code)
448
+ if !tax_type_code.nil? && tax_type_code.to_s.length > 4
449
+ fail ArgumentError, 'invalid value for "tax_type_code", the character length must be smaller than or equal to 4.'
450
+ end
451
+
452
+ @tax_type_code = tax_type_code
453
+ end
454
+
455
+ # Custom attribute writer method with validation
456
+ # @param [Object] type_of_supply Value to be assigned
457
+ def type_of_supply=(type_of_supply)
458
+ if !type_of_supply.nil? && type_of_supply.to_s.length > 2
459
+ fail ArgumentError, 'invalid value for "type_of_supply", the character length must be smaller than or equal to 2.'
460
+ end
461
+
462
+ @type_of_supply = type_of_supply
463
+ end
464
+
465
+ # Custom attribute writer method with validation
466
+ # @param [Object] commodity_code Value to be assigned
467
+ def commodity_code=(commodity_code)
468
+ if !commodity_code.nil? && commodity_code.to_s.length > 15
469
+ fail ArgumentError, 'invalid value for "commodity_code", the character length must be smaller than or equal to 15.'
470
+ end
471
+
472
+ @commodity_code = commodity_code
473
+ end
474
+
475
+ # Custom attribute writer method with validation
476
+ # @param [Object] discount_amount Value to be assigned
477
+ def discount_amount=(discount_amount)
478
+ if !discount_amount.nil? && discount_amount.to_s.length > 13
479
+ fail ArgumentError, 'invalid value for "discount_amount", the character length must be smaller than or equal to 13.'
480
+ end
481
+
482
+ @discount_amount = discount_amount
483
+ end
484
+
485
+ # Custom attribute writer method with validation
486
+ # @param [Object] discount_rate Value to be assigned
487
+ def discount_rate=(discount_rate)
488
+ if !discount_rate.nil? && discount_rate.to_s.length > 6
489
+ fail ArgumentError, 'invalid value for "discount_rate", the character length must be smaller than or equal to 6.'
490
+ end
491
+
492
+ @discount_rate = discount_rate
493
+ end
494
+
495
+ # Custom attribute writer method with validation
496
+ # @param [Object] invoice_number Value to be assigned
497
+ def invoice_number=(invoice_number)
498
+ if !invoice_number.nil? && invoice_number.to_s.length > 23
499
+ fail ArgumentError, 'invalid value for "invoice_number", the character length must be smaller than or equal to 23.'
500
+ end
501
+
502
+ @invoice_number = invoice_number
503
+ end
504
+
505
+ # Checks equality by comparing each attribute.
506
+ # @param [Object] Object to be compared
507
+ def ==(o)
508
+ return true if self.equal?(o)
509
+ self.class == o.class &&
510
+ product_code == o.product_code &&
511
+ product_name == o.product_name &&
512
+ product_sku == o.product_sku &&
513
+ quantity == o.quantity &&
514
+ unit_price == o.unit_price &&
515
+ unit_of_measure == o.unit_of_measure &&
516
+ total_amount == o.total_amount &&
517
+ tax_amount == o.tax_amount &&
518
+ tax_rate == o.tax_rate &&
519
+ tax_applied_after_discount == o.tax_applied_after_discount &&
520
+ tax_status_indicator == o.tax_status_indicator &&
521
+ tax_type_code == o.tax_type_code &&
522
+ amount_includes_tax == o.amount_includes_tax &&
523
+ type_of_supply == o.type_of_supply &&
524
+ commodity_code == o.commodity_code &&
525
+ discount_amount == o.discount_amount &&
526
+ discount_applied == o.discount_applied &&
527
+ discount_rate == o.discount_rate &&
528
+ invoice_number == o.invoice_number &&
529
+ tax_details == o.tax_details &&
530
+ fulfillment_type == o.fulfillment_type
531
+ end
532
+
533
+ # @see the `==` method
534
+ # @param [Object] Object to be compared
535
+ def eql?(o)
536
+ self == o
537
+ end
538
+
539
+ # Calculates hash code according to all attributes.
540
+ # @return [Fixnum] Hash code
541
+ def hash
542
+ [product_code, product_name, product_sku, quantity, unit_price, unit_of_measure, total_amount, tax_amount, tax_rate, tax_applied_after_discount, tax_status_indicator, tax_type_code, amount_includes_tax, type_of_supply, commodity_code, discount_amount, discount_applied, discount_rate, invoice_number, tax_details, fulfillment_type].hash
543
+ end
544
+
545
+ # Builds the object from hash
546
+ # @param [Hash] attributes Model attributes in the form of hash
547
+ # @return [Object] Returns the model itself
548
+ def build_from_hash(attributes)
549
+ return nil unless attributes.is_a?(Hash)
550
+ self.class.swagger_types.each_pair do |key, type|
551
+ if type =~ /\AArray<(.*)>/i
552
+ # check to ensure the input is an array given that the the attribute
553
+ # is documented as an array but the input is not
554
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
555
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
556
+ end
557
+ elsif !attributes[self.class.attribute_map[key]].nil?
558
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
559
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
560
+ end
561
+
562
+ self
563
+ end
564
+
565
+ # Deserializes the data based on type
566
+ # @param string type Data type
567
+ # @param string value Value to be deserialized
568
+ # @return [Object] Deserialized data
569
+ def _deserialize(type, value)
570
+ case type.to_sym
571
+ when :DateTime
572
+ DateTime.parse(value)
573
+ when :Date
574
+ Date.parse(value)
575
+ when :String
576
+ value.to_s
577
+ when :Integer
578
+ value.to_i
579
+ when :Float
580
+ value.to_f
581
+ when :BOOLEAN
582
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
583
+ true
584
+ else
585
+ false
586
+ end
587
+ when :Object
588
+ # generic object (usually a Hash), return directly
589
+ value
590
+ when /\AArray<(?<inner_type>.+)>\z/
591
+ inner_type = Regexp.last_match[:inner_type]
592
+ value.map { |v| _deserialize(inner_type, v) }
593
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
594
+ k_type = Regexp.last_match[:k_type]
595
+ v_type = Regexp.last_match[:v_type]
596
+ {}.tap do |hash|
597
+ value.each do |k, v|
598
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
599
+ end
600
+ end
601
+ else # model
602
+ temp_model = CyberSource.const_get(type).new
603
+ temp_model.build_from_hash(value)
604
+ end
605
+ end
606
+
607
+ # Returns the string representation of the object
608
+ # @return [String] String presentation of the object
609
+ def to_s
610
+ to_hash.to_s
611
+ end
612
+
613
+ # to_body is an alias to to_hash (backward compatibility)
614
+ # @return [Hash] Returns the object in the form of hash
615
+ def to_body
616
+ to_hash
617
+ end
618
+
619
+ # Returns the object in the form of hash
620
+ # @return [Hash] Returns the object in the form of hash
621
+ def to_hash
622
+ hash = {}
623
+ self.class.attribute_map.each_pair do |attr, param|
624
+ value = self.send(attr)
625
+ next if value.nil?
626
+ hash[param] = _to_hash(value)
627
+ end
628
+ hash
629
+ end
630
+
631
+ # Outputs non-array value in the form of hash
632
+ # For object, use to_hash. Otherwise, just return the value
633
+ # @param [Object] value Any valid value
634
+ # @return [Hash] Returns the value in the form of hash
635
+ def _to_hash(value)
636
+ if value.is_a?(Array)
637
+ value.compact.map { |v| _to_hash(v) }
638
+ elsif value.is_a?(Hash)
639
+ {}.tap do |hash|
640
+ value.each { |k, v| hash[k] = _to_hash(v) }
641
+ end
642
+ elsif value.respond_to? :to_hash
643
+ value.to_hash
644
+ else
645
+ value
646
+ end
647
+ end
648
+ end
649
+ end