pcp-server-ruby-sdk 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1bb5f0ea1361b7a6408c765fc4481f67f30f034af9d50562e8437bfd18eaef1e
4
- data.tar.gz: ddaf6677949a0abbec513ca2fe37c23e62d26da9a61795437082b1156c1942f1
3
+ metadata.gz: bb0118721663f462f5bc434e7b2df5d76e517f2865d03d666cd32dbce5133fca
4
+ data.tar.gz: 37c389d8f6d02e865f4713f93b7d0745c232846acc797e697a1295de7921db43
5
5
  SHA512:
6
- metadata.gz: 52a9d0e57e4abf01eb47ea776e537f9f38b7b9b0a46f827a3d4ca6384d220da8e6b5716d8df47810ad64bceb669b450522687d868984967e7875b1e533831aaf
7
- data.tar.gz: 86b177ac1dd4f25bb75c56fd4d0adaa1636278737d12a84be669ad634b16b135288715fbede305c28c6eb2a0655862e3f8622adbf5758e5f737b9685d6f258c2
6
+ metadata.gz: 4f2912be3416517cb213a8d50196879fe2fa60248d011d83d19bced6d1f4b6d20abbf279b59dd68f837dd1d8df0f243431b50c571a2012a2ae940ca264512b07
7
+ data.tar.gz: 48c4c4540f71b982ca05b17c7e4d357835eee938b7164e059890a2dc85a906018a720201c5f3840fb0dc86494f25026beba0e7c5fcbb1108d1574f5f1c99c3ff
data/CHANGELOG.md CHANGED
@@ -1,3 +1,27 @@
1
+ # [1.3.0](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/compare/v1.2.0...v1.3.0) (2025-07-10)
2
+
3
+ ### Features
4
+
5
+ * feat: add auth client ([c8fd009b11a8ec3416a33ecab949ec2c51406e7e](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/c8fd009b11a8ec3416a33ecab949ec2c51406e7e))
6
+
7
+ # [1.2.0](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/compare/v1.1.0...v1.2.0) (2025-05-26)
8
+
9
+ ### Documentation
10
+
11
+ * docs: clarify comment for category attribute in APIError class ([ccafb6db2bc474bb07a30a1fda7ff6e730a8137d](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/ccafb6db2bc474bb07a30a1fda7ff6e730a8137d))
12
+ * docs: improve comment clarity for tax_amount_per_unit attribute in OrderLineDetailsInput model ([37fcf28f22a1a9ccf93689c21c07f06d2e3249a8](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/37fcf28f22a1a9ccf93689c21c07f06d2e3249a8))
13
+ * docs: update docs ([a4b33ef94dc183847f5be0288c84312c0dd8cfba](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/a4b33ef94dc183847f5be0288c84312c0dd8cfba))
14
+ * docs: update README with new badge links and API version ([c69507cd4b9da665fb686576c0900570462fc1bf](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/c69507cd4b9da665fb686576c0900570462fc1bf))
15
+
16
+ ### Features
17
+
18
+ * feat: add BusinessRelation class and update customer model to use it ([68ab9fc5c41aad7f3f967b75b1ecdd0ac02cba63](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/68ab9fc5c41aad7f3f967b75b1ecdd0ac02cba63))
19
+ * feat: add CustomerAccount class and integrate it into Customer class ([ee1600ec78d66498cc758b4c931f510dd3ffb4c7](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/ee1600ec78d66498cc758b4c931f510dd3ffb4c7))
20
+ * feat: add fraud_net_id attribute to RedirectPaymentProduct840SpecificInput model ([27ec17cce2fb42eb37116790ce2dd106502487c0](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/27ec17cce2fb42eb37116790ce2dd106502487c0))
21
+ * feat: add RecurringPaymentSequenceIndicator class and update CardRecurrenceDetails to use it ([e2507f4328a297dc700fa1635029a1599fa58101](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/e2507f4328a297dc700fa1635029a1599fa58101))
22
+ * feat: implement ActionType class and update MerchantAction to use it ([8e259dc45f4e20ea0a10a351a3abdc86926b91f1](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/8e259dc45f4e20ea0a10a351a3abdc86926b91f1))
23
+ * feat: implement AvsResult enum class and update CardFraudResults to use it ([c0a40cc08aa878afaae93851be1619907e7c5e86](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/c0a40cc08aa878afaae93851be1619907e7c5e86))
24
+
1
25
  # [1.1.0](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/compare/v1.0.0...v1.1.0) (2025-03-14)
2
26
 
3
27
  ### Documentation
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
25
25
  s.add_development_dependency 'simplecov', '~> 0.22.0'
26
26
 
27
27
  s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
28
- s.test_files = `find test/*`.split("\n")
28
+ s.test_files = `find spec/*`.split("\n")
29
29
  s.executables = []
30
30
  s.require_paths = ["lib"]
31
31
  end
data/README.md CHANGED
@@ -2,10 +2,16 @@
2
2
 
3
3
  [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=PAYONE-GmbH_PCP-ServerSDK-ruby&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=PAYONE-GmbH_PCP-ServerSDK-ruby)
4
4
  [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=PAYONE-GmbH_PCP-ServerSDK-ruby&metric=coverage)](https://sonarcloud.io/summary/new_code?id=PAYONE-GmbH_PCP-ServerSDK-ruby)
5
- ![PyPI - Version](https://img.shields.io/pypi/v/pcp_serversdk_ruby)
6
- ![PyPI - Downloads](https://img.shields.io/pypi/dw/pcp_serversdk_ruby)
5
+ ![PyPI - Version](https://img.shields.io/gem/v/pcp-server-ruby-sdk)
6
+ ![PyPI - Downloads](https://img.shields.io/gem/dv/pcp-server-ruby-sdk/1.1.0)
7
+
8
+
9
+ Welcome to the Ruby SDK for the PAYONE Commerce Platform (api-version 1.35.0)! This repository contains a powerful, easy-to-use software development kit (SDK) designed to simplify the integration of online payment processing into your applications.
10
+
11
+ ## Requirements
12
+
13
+ This SDK requires Ruby 3.2 or later.
7
14
 
8
- Welcome to the Ruby SDK for the PAYONE Commerce Platform! This repository contains a powerful, easy-to-use software development kit (SDK) designed to simplify the integration of online payment processing into your applications.
9
15
 
10
16
  ## Table of Contents
11
17
 
@@ -13,6 +19,7 @@ Welcome to the Ruby SDK for the PAYONE Commerce Platform! This repository contai
13
19
  - [Installation](#installation)
14
20
  - [Usage](#usage)
15
21
  - [General](#general)
22
+ - [Authentication Token Retrieval](#authentication-token-retrieval)
16
23
  - [Error Handling](#error-handling)
17
24
  - [Client Side](#client-side)
18
25
  - [Apple Pay](#apple-pay)
@@ -77,6 +84,26 @@ createCommerceCaseResponse = client.create_commerce_case_request('merchant_id',
77
84
 
78
85
  The models directly map to the API as described in [PAYONE Commerce Platform API Reference](https://docs.payone.com/pcp/commerce-platform-api). For an in depth example you can take a look at the [demo app](#demo-app).
79
86
 
87
+
88
+ ### Authentication Token Retrieval
89
+
90
+ To interact with certain client-side SDKs (such as the credit card tokenizer), you need to generate a short-lived authentication JWT token for your merchant. This token can be retrieved using the SDK as follows:
91
+
92
+ ```rb
93
+ require 'pcp-server-ruby-sdk'
94
+
95
+ authentication_client = PCPServerSDK::Endpoints::AuthenticationApiClient.new(communicator_configuration)
96
+ token = authentication_client.get_authentication_tokens(merchant_id)
97
+ puts "JWT Token: #{token.token}"
98
+ puts "Token ID: #{token.id}"
99
+ puts "Created: #{token.creation_date}"
100
+ puts "Expires: #{token.expiration_date}"
101
+ ```
102
+
103
+ This token can then be used for secure operations such as initializing the credit card tokenizer or other client-side SDKs that require merchant authentication. The token is valid for a limited time (10 minutes) and should be handled securely.
104
+
105
+ **Note:** The `get_authentication_tokens` method requires a valid `merchant_id`. Optionally, you can provide an `X-Request-ID` header for tracing requests.
106
+
80
107
  ### Error Handling
81
108
 
82
109
  When making a request any client may throw a `PCPServerSDK::Errors::ApiException`. There two subtypes of this exception:
data/api-definition.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  openapi: "3.0.3"
2
2
 
3
3
  info:
4
- version: 1.28.0
4
+ version: 1.35.0
5
5
  title: "Commerce Platform API"
6
6
  description: |
7
7
  RESTful API for the creation of Commerce Cases with Checkouts and the execution of Payments.
@@ -1948,7 +1948,6 @@ components:
1948
1948
  object.
1949
1949
  required:
1950
1950
  - transactionId
1951
- - applicationData
1952
1951
  APIError:
1953
1952
  description: Contains detailed information on one single error.
1954
1953
  type: object
@@ -1962,7 +1961,7 @@ components:
1962
1961
  type: string
1963
1962
  description: |-
1964
1963
  Category the error belongs to. The category should give an indication of the type of error you are dealing
1965
- with. Possible values:
1964
+ with. Do not expect a finite set of possible categories, as they are subject to change. Common values are:
1966
1965
  * DIRECT_PLATFORM_ERROR - indicating that a functional error has occurred in the platform.
1967
1966
  * PAYMENT_PLATFORM_ERROR - indicating that a functional error has occurred in the payment platform.
1968
1967
  * IO_ERROR - indicating that a technical error has occurred within the payment platform or between the
@@ -2259,6 +2258,31 @@ components:
2259
2258
  * 0 - No service available
2260
2259
  example: A
2261
2260
  type: string
2261
+ enum:
2262
+ - A
2263
+ - B
2264
+ - C
2265
+ - D
2266
+ - E
2267
+ - F
2268
+ - G
2269
+ - H
2270
+ - I
2271
+ - K
2272
+ - L
2273
+ - M
2274
+ - N
2275
+ - O
2276
+ - P
2277
+ - Q
2278
+ - R
2279
+ - S
2280
+ - U
2281
+ - W
2282
+ - X
2283
+ - Y
2284
+ - Z
2285
+ - "0"
2262
2286
  CardPaymentDetails:
2263
2287
  type: object
2264
2288
  description: Information for card payments realized at a POS.
@@ -2418,6 +2442,9 @@ components:
2418
2442
  Note: For any first of a recurring the system will automatically create a token as you will need to use a
2419
2443
  token for any subsequent recurring transactions. In case a token already exists this is indicated in the
2420
2444
  response with a value of False for the isNewToken property in the response.
2445
+ enum:
2446
+ - first
2447
+ - recurring
2421
2448
  CartItemInput:
2422
2449
  type: object
2423
2450
  description: This object contains information of all items in the cart.
@@ -2825,6 +2852,9 @@ components:
2825
2852
  * 3390 - PAYONE Secured Invoice
2826
2853
  * 3391 - PAYONE Secured Installment
2827
2854
  * 3392 - PAYONE Secured Direct Debit
2855
+ enum:
2856
+ - B2C
2857
+ - B2B
2828
2858
  locale:
2829
2859
  maxLength: 2
2830
2860
  type: string
@@ -2835,6 +2865,25 @@ components:
2835
2865
  example: de
2836
2866
  personalInformation:
2837
2867
  $ref: '#/components/schemas/PersonalInformation'
2868
+ account:
2869
+ $ref: '#/components/schemas/CustomerAccount'
2870
+ CustomerAccount:
2871
+ type: object
2872
+ description: Object containing data related to the account the customer has with you.
2873
+ properties:
2874
+ createDate:
2875
+ type: string
2876
+ format: date-time
2877
+ description: |
2878
+ Creation date and time of the customer account in ISO 8601 format (UTC).
2879
+ Accepted formats are:
2880
+ * YYYY-MM-DD'T'HH:mm:ss'Z'
2881
+ * YYYY-MM-DD'T'HH:mm:ss+XX:XX
2882
+ * YYYY-MM-DD'T'HH:mm:ss-XX:XX
2883
+ * YYYY-MM-DD'T'HH:mm'Z'
2884
+ * YYYY-MM-DD'T'HH:mm+XX:XX
2885
+ * YYYY-MM-DD'T'HH:mm-XX:XX
2886
+ example: 2023-10-05T14:30:15.123Z
2838
2887
 
2839
2888
  CustomerDevice:
2840
2889
  type: object
@@ -3144,6 +3193,13 @@ components:
3144
3193
  to be provided to the EMVco certified Mobile SDK as a challengeParameters object.
3145
3194
  * CALL_THIRD_PARTY - The merchant needs to call a third party using the data found in thirdPartyData
3146
3195
  example: REDIRECT
3196
+ enum:
3197
+ - REDIRECT
3198
+ - SHOW_FORM
3199
+ - SHOW_INSTRUCTIONS
3200
+ - SHOW_TRANSACTION_RESULTS
3201
+ - MOBILE_THREEDS_CHALLENGE
3202
+ - CALL_THIRD_PARTY
3147
3203
  redirectData:
3148
3204
  $ref: '#/components/schemas/RedirectData'
3149
3205
  MobilePaymentMethodSpecificInput:
@@ -3287,7 +3343,9 @@ components:
3287
3343
  example: 0
3288
3344
  taxAmountPerUnit:
3289
3345
  type: boolean
3290
- description: If this is set to true, `taxAmount` will be interpreted as the tax amount per unit as opposed to the tax amount per line item.
3346
+ description: |-
3347
+ This field indicates if the `taxAmount` is to be interpreted as the tax amount per unit rather than for the entire line item.
3348
+ This field is included in the response only when `taxAmount` is set; otherwise, it will return as `null`.
3291
3349
  format: int64
3292
3350
  example: true
3293
3351
  default: false
@@ -4313,6 +4371,14 @@ components:
4313
4371
  Default value is false.
4314
4372
  Please note that this field is ignored when order.additionalInput.typeInformation.purchaseType is set to
4315
4373
  "digital"
4374
+ fraudNetId:
4375
+ type: string
4376
+ format: UUID
4377
+ description: |-
4378
+ A unique ID determined by the merchant, to link a Paypal transaction to a FraudNet PayPal risk session. Only applicable to
4379
+ customer-initiated transactions, when the FraudNet SDK is used, and to be passed in the API request the same tracking ID value
4380
+ (FraudNet Session Identifier).
4381
+ example: 686e5823-1ffd-42f7-9ba3-42b41b57d8dd
4316
4382
  RefreshPaymentRequest:
4317
4383
  type: object
4318
4384
  description: Request to refresh the payment status of a specific payment.
@@ -1,12 +1,20 @@
1
1
  require_relative '../lib/PCP-server-Ruby-SDK.rb'
2
2
  class CommerceCaseApiExample
3
- attr_accessor :client, :merchant_id, :commerce_case_id
3
+ attr_accessor :client, :merchant_id, :commerce_case_id, :auth_client
4
4
 
5
5
  def initialize(config)
6
6
  @client = PCPServerSDK::Endpoints::CommerceCaseApiClient.new(config)
7
+ @auth_client = PCPServerSDK::Endpoints::AuthenticationApiClient.new(config)
7
8
  @merchant_id = ENV['MERCHANT_ID']
8
9
  @commerce_case_id = ENV['COMMERCE_CASE_ID']
9
10
  end
11
+ def run_auth_token_example
12
+ token = @auth_client.get_authentication_tokens(@merchant_id)
13
+ puts "JWT Token: #{token.token}"
14
+ puts "Token ID: #{token.id}"
15
+ puts "Created: #{token.creation_date}"
16
+ puts "Expires: #{token.expiration_date}"
17
+ end
10
18
 
11
19
  def run_post_one
12
20
  payload = {}
@@ -26,8 +26,9 @@ def run
26
26
  # commerce_case_api_client_example.run_post_one
27
27
  # commerce_case_api_client_example.run_get_all
28
28
 
29
- commerce_case_api_client_example.run_get_one
29
+ # commerce_case_api_client_example.run_get_one
30
30
  # commerce_case_api_client_example.run_update_one
31
+ commerce_case_api_client_example.run_auth_token_example
31
32
  end
32
33
 
33
34
  run
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../errors/api_error_response_exception'
4
+ require_relative '../errors/api_response_retrieval_exception'
5
+ require_relative '../models/authentication_token'
6
+ require_relative 'base_api_client'
7
+
8
+ module PCPServerSDK
9
+ module Endpoints
10
+ # Client for authentication token operations
11
+ class AuthenticationApiClient < BaseApiClient
12
+ def get_authentication_tokens(merchant_id, request_id = nil)
13
+ raise TypeError, MERCHANT_ID_REQUIRED_ERROR if merchant_id.nil? || merchant_id.empty?
14
+
15
+ url = URI.join(get_config.host, "/v1/#{merchant_id}/authentication-tokens")
16
+
17
+ request_init = {
18
+ method: 'POST',
19
+ headers: { 'Content-Type' => 'application/json' },
20
+ body: ''
21
+ }
22
+ request_init[:headers]['X-Request-ID'] = request_id unless request_id.nil?
23
+
24
+ response = make_api_call(url.to_s, request_init)
25
+ deserialize_json(response, PCPServerSDK::Models::AuthenticationToken)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,34 @@
1
+ require 'date'
2
+ require 'time'
3
+
4
+ module PCPServerSDK
5
+ module Models
6
+ class ActionType
7
+ REDIRECT = "REDIRECT".freeze # The customer needs to be redirected using the details found in redirectData
8
+ SHOW_FORM = "SHOW_FORM".freeze # The customer needs to be shown a form with the fields found in formFields
9
+ SHOW_INSTRUCTIONS = "SHOW_INSTRUCTIONS".freeze # The customer needs to be shown payment instruction using the details found in showData
10
+ SHOW_TRANSACTION_RESULTS = "SHOW_TRANSACTION_RESULTS".freeze # The customer needs to be shown the transaction results using the details found in showData
11
+ MOBILE_THREEDS_CHALLENGE = "MOBILE_THREEDS_CHALLENGE".freeze # The customer needs to complete a challenge as part of the 3D Secure authentication inside your mobile app
12
+ CALL_THIRD_PARTY = "CALL_THIRD_PARTY".freeze # The merchant needs to call a third party using the data found in thirdPartyData
13
+
14
+ def self.all_vars
15
+ @all_vars ||= [REDIRECT, SHOW_FORM, SHOW_INSTRUCTIONS, SHOW_TRANSACTION_RESULTS, MOBILE_THREEDS_CHALLENGE, CALL_THIRD_PARTY].freeze
16
+ end
17
+
18
+ # Builds the enum from string
19
+ # @param [String] The enum value in the form of the string
20
+ # @return [String] The enum value
21
+ def self.build_from_hash(value)
22
+ new.build_from_hash(value)
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def build_from_hash(value)
29
+ return value if ActionType.all_vars.include?(value)
30
+ raise "Invalid ENUM value #{value} for class #ActionType"
31
+ end
32
+ end
33
+ end
34
+ end
@@ -8,7 +8,7 @@ module PCPServerSDK
8
8
  # Error code
9
9
  attr_accessor :error_code
10
10
 
11
- # Category the error belongs to. The category should give an indication of the type of error you are dealing with. Possible values: * DIRECT_PLATFORM_ERROR - indicating that a functional error has occurred in the platform. * PAYMENT_PLATFORM_ERROR - indicating that a functional error has occurred in the payment platform. * IO_ERROR - indicating that a technical error has occurred within the payment platform or between the payment platform and third party systems. * COMMERCE_PLATFORM_ERROR - indicating an error originating from the Commerce Platform. * COMMERCE_PORTAL_BACKEND_ERROR - indicating an error originating from the Commerce Portal Backend.
11
+ # Category the error belongs to. The category should give an indication of the type of error you are dealing with. Do not expect a finite set of possible categories, as they are subject to change. Common values are: * DIRECT_PLATFORM_ERROR - indicating that a functional error has occurred in the platform. * PAYMENT_PLATFORM_ERROR - indicating that a functional error has occurred in the payment platform. * IO_ERROR - indicating that a technical error has occurred within the payment platform or between the payment platform and third party systems. * COMMERCE_PLATFORM_ERROR - indicating an error originating from the Commerce Platform. * COMMERCE_PORTAL_BACKEND_ERROR - indicating an error originating from the Commerce Portal Backend.
12
12
  attr_accessor :category
13
13
 
14
14
  # HTTP status code for this error that can be used to determine the type of error
@@ -0,0 +1,189 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+ require 'date'
5
+ require 'securerandom'
6
+
7
+ module PCPServerSDK
8
+ module Models
9
+ # Model for the authentication JWT token response
10
+ class AuthenticationToken
11
+ attr_accessor :token
12
+ attr_accessor :id
13
+ attr_accessor :creation_date
14
+ attr_accessor :expiration_date
15
+
16
+ def self.attribute_map
17
+ {
18
+ :'token' => :'token',
19
+ :'id' => :'id',
20
+ :'creation_date' => :'creationDate',
21
+ :'expiration_date' => :'expirationDate'
22
+ }
23
+ end
24
+
25
+ def self.acceptable_attributes
26
+ attribute_map.values
27
+ end
28
+
29
+ def self.openapi_types
30
+ {
31
+ :'token' => :'String',
32
+ :'id' => :'String',
33
+ :'creation_date' => :'Time',
34
+ :'expiration_date' => :'Time'
35
+ }
36
+ end
37
+
38
+ def self.openapi_nullable
39
+ Set.new([])
40
+ end
41
+
42
+ def initialize(attributes = {})
43
+ if (!attributes.is_a?(Hash))
44
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AuthenticationToken` initialize method"
45
+ end
46
+
47
+ attributes = attributes.each_with_object({}) { |(k, v), h|
48
+ if (!self.class.attribute_map.key?(k.to_sym))
49
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AuthenticationToken`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
+ end
51
+ h[k.to_sym] = v
52
+ }
53
+
54
+ if attributes.key?(:'token')
55
+ self.token = attributes[:'token']
56
+ end
57
+
58
+ if attributes.key?(:'id')
59
+ self.id = attributes[:'id']
60
+ end
61
+
62
+ if attributes.key?(:'creation_date')
63
+ self.creation_date = attributes[:'creation_date'].is_a?(String) ? Time.parse(attributes[:'creation_date']) : attributes[:'creation_date']
64
+ end
65
+
66
+ if attributes.key?(:'expiration_date')
67
+ self.expiration_date = attributes[:'expiration_date'].is_a?(String) ? Time.parse(attributes[:'expiration_date']) : attributes[:'expiration_date']
68
+ end
69
+ end
70
+
71
+ def self.from_json(json_str)
72
+ data = JSON.parse(json_str)
73
+ new(data)
74
+ end
75
+
76
+ def self.build_from_hash(attributes)
77
+ return nil unless attributes.is_a?(Hash)
78
+ attributes = attributes.transform_keys(&:to_sym)
79
+ transformed_hash = {}
80
+ openapi_types.each_pair do |key, type|
81
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
82
+ transformed_hash[key] = nil
83
+ elsif type =~ /\AArray<(.*)>/i
84
+ if attributes[attribute_map[key]].is_a?(Array)
85
+ transformed_hash[key] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
86
+ end
87
+ elsif !attributes[attribute_map[key]].nil?
88
+ transformed_hash[key] = _deserialize(type, attributes[attribute_map[key]])
89
+ end
90
+ end
91
+ new(transformed_hash)
92
+ end
93
+
94
+ def self._deserialize(type, value)
95
+ case type.to_sym
96
+ when :Time
97
+ Time.parse(value)
98
+ when :Date
99
+ Date.parse(value)
100
+ when :String
101
+ value.to_s
102
+ when :Integer
103
+ value.to_i
104
+ when :Float
105
+ value.to_f
106
+ when :Boolean
107
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
108
+ true
109
+ else
110
+ false
111
+ end
112
+ when :Object
113
+ value
114
+ when /\AArray<(?<inner_type>.+)>/i
115
+ inner_type = Regexp.last_match[:inner_type]
116
+ value.map { |v| _deserialize(inner_type, v) }
117
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>/i
118
+ k_type = Regexp.last_match[:k_type]
119
+ v_type = Regexp.last_match[:v_type]
120
+ {}.tap do |hash|
121
+ value.each do |k, v|
122
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
123
+ end
124
+ end
125
+ else
126
+ # models (e.g. Pet) or oneOf
127
+ if PCPServerSDK::Models.const_defined?(type)
128
+ klass = PCPServerSDK::Models.const_get(type)
129
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
130
+ else
131
+ value
132
+ end
133
+ end
134
+ end
135
+
136
+ def ==(o)
137
+ return true if self.equal?(o)
138
+ self.class == o.class &&
139
+ token == o.token &&
140
+ id == o.id &&
141
+ creation_date == o.creation_date &&
142
+ expiration_date == o.expiration_date
143
+ end
144
+
145
+ def eql?(o)
146
+ self == o
147
+ end
148
+
149
+ def hash
150
+ [token, id, creation_date, expiration_date].hash
151
+ end
152
+
153
+ def to_s
154
+ to_hash.to_s
155
+ end
156
+
157
+ def to_body
158
+ to_hash
159
+ end
160
+
161
+ def to_hash
162
+ hash = {}
163
+ self.class.attribute_map.each_pair do |attr, param|
164
+ value = self.send(attr)
165
+ if value.nil?
166
+ is_nullable = self.class.openapi_nullable.include?(attr)
167
+ next if !is_nullable || (is_nullable && !instance_variable_defined?("@#{attr}"))
168
+ end
169
+ hash[param] = _to_hash(value)
170
+ end
171
+ hash
172
+ end
173
+
174
+ def _to_hash(value)
175
+ if value.is_a?(Array)
176
+ value.compact.map { |v| _to_hash(v) }
177
+ elsif value.is_a?(Hash)
178
+ {}.tap do |hash|
179
+ value.each { |k, v| hash[k] = _to_hash(v) }
180
+ end
181
+ elsif value.respond_to? :to_hash
182
+ value.to_hash
183
+ else
184
+ value
185
+ end
186
+ end
187
+ end
188
+ end
189
+ end
@@ -0,0 +1,52 @@
1
+ require 'date'
2
+ require 'time'
3
+
4
+ module PCPServerSDK
5
+ module Models
6
+ class AvsResult
7
+ A = "A".freeze # Address (Street) matches, Zip does not
8
+ B = "B".freeze # Street address match for international transactions—Postal code not verified due to incompatible formats
9
+ C = "C".freeze # Street address and postal code not verified for international transaction due to incompatible formats
10
+ D = "D".freeze # Street address and postal code match for international transaction, cardholder name is incorrect
11
+ E = "E".freeze # AVS error
12
+ F = "F".freeze # Address does match and five digit ZIP code does match (UK only)
13
+ G = "G".freeze # Address information is unavailable; international transaction; non-AVS participant
14
+ H = "H".freeze # Billing address and postal code match, cardholder name is incorrect (Amex)
15
+ I = "I".freeze # Address information not verified for international transaction
16
+ K = "K".freeze # Cardholder name matches (Amex)
17
+ L = "L".freeze # Cardholder name and postal code match (Amex)
18
+ M = "M".freeze # Cardholder name, street address, and postal code match for international transaction
19
+ N = "N".freeze # No Match on Address (Street) or Zip
20
+ O = "O".freeze # Cardholder name and address match (Amex)
21
+ P = "P".freeze # Postal codes match for international transaction—Street address not verified due to incompatible formats
22
+ Q = "Q".freeze # Billing address matches, cardholder is incorrect (Amex)
23
+ R = "R".freeze # Retry, System unavailable or Timed out
24
+ S = "S".freeze # Service not supported by issuer
25
+ U = "U".freeze # Address information is unavailable
26
+ W = "W".freeze # 9 digit Zip matches, Address (Street) does not
27
+ X = "X".freeze # Exact AVS Match
28
+ Y = "Y".freeze # Address (Street) and 5 digit Zip match
29
+ Z = "Z".freeze # 5 digit Zip matches, Address (Street) does not
30
+ ZERO = "0".freeze # No service available
31
+
32
+ def self.all_vars
33
+ @all_vars ||= [A, B, C, D, E, F, G, H, I, K, L, M, N, O, P, Q, R, S, U, W, X, Y, Z, ZERO].freeze
34
+ end
35
+
36
+ # Builds the enum from string
37
+ # @param [String] The enum value in the form of the string
38
+ # @return [String] The enum value
39
+ def self.build_from_hash(value)
40
+ new.build_from_hash(value)
41
+ end
42
+
43
+ # Builds the enum from string
44
+ # @param [String] The enum value in the form of the string
45
+ # @return [String] The enum value
46
+ def build_from_hash(value)
47
+ return value if AvsResult.all_vars.include?(value)
48
+ raise "Invalid ENUM value #{value} for class #AvsResult"
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,30 @@
1
+ require 'date'
2
+ require 'time'
3
+
4
+ module PCPServerSDK
5
+ module Models
6
+ class BusinessRelation
7
+ B2C = "B2C".freeze # Indicates business to consumer
8
+ B2B = "B2B".freeze # Indicates business to business
9
+
10
+ def self.all_vars
11
+ @all_vars ||= [B2C, B2B].freeze
12
+ end
13
+
14
+ # Builds the enum from string
15
+ # @param [String] The enum value in the form of the string
16
+ # @return [String] The enum value
17
+ def self.build_from_hash(value)
18
+ new.build_from_hash(value)
19
+ end
20
+
21
+ # Builds the enum from string
22
+ # @param [String] The enum value in the form of the string
23
+ # @return [String] The enum value
24
+ def build_from_hash(value)
25
+ return value if BusinessRelation.all_vars.include?(value)
26
+ raise "Invalid ENUM value #{value} for class #BusinessRelation"
27
+ end
28
+ end
29
+ end
30
+ end
@@ -5,7 +5,8 @@ module PCPServerSDK
5
5
  module Models
6
6
  # Fraud results contained in the CardFraudResults object.
7
7
  class CardFraudResults
8
- # Result of the Address Verification Service checks. Possible values are: * A - Address (Street) matches, Zip does not * B - Street address match for international transactions—Postal code not verified due to incompatible formats * C - Street address and postal code not verified for international transaction due to incompatible formats * D - Street address and postal code match for international transaction, cardholder name is incorrect * E - AVS error * F - Address does match and five digit ZIP code does match (UK only) * G - Address information is unavailable; international transaction; non-AVS participant * H - Billing address and postal code match, cardholder name is incorrect (Amex) * I - Address information not verified for international transaction * K - Cardholder name matches (Amex) * L - Cardholder name and postal code match (Amex) * M - Cardholder name, street address, and postal code match for international transaction * N - No Match on Address (Street) or Zip * O - Cardholder name and address match (Amex) * P - Postal codes match for international transaction—Street address not verified due to incompatible formats * Q - Billing address matches, cardholder is incorrect (Amex) * R - Retry, System unavailable or Timed out * S - Service not supported by issuer * U - Address information is unavailable * W - 9 digit Zip matches, Address (Street) does not * X - Exact AVS Match * Y - Address (Street) and 5 digit Zip match * Z - 5 digit Zip matches, Address (Street) does not * 0 - No service available
8
+ # Result of the Address Verification Service checks.
9
+ # @return [AvsResult]
9
10
  attr_accessor :avs_result
10
11
 
11
12
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -23,7 +24,7 @@ module PCPServerSDK
23
24
  # Attribute type mapping.
24
25
  def self.openapi_types
25
26
  {
26
- :'avs_result' => :'String'
27
+ :'avs_result' => :'AvsResult'
27
28
  }
28
29
  end
29
30