pcp-server-ruby-sdk 1.13.0 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +1 -1
- data/api-definition.yaml +438 -20
- data/lib/PCP-server-Ruby-SDK/endpoints/pay_by_link_api_client.rb +33 -0
- data/lib/PCP-server-Ruby-SDK/endpoints/payment_intent_api_client.rb +14 -1
- data/lib/PCP-server-Ruby-SDK/models/authentication_token.rb +6 -183
- data/lib/PCP-server-Ruby-SDK/models/create_pay_by_link_request.rb +12 -0
- data/lib/PCP-server-Ruby-SDK/models/create_pay_by_link_response.rb +13 -0
- data/lib/PCP-server-Ruby-SDK/models/create_payment_intent.rb +1 -1
- data/lib/PCP-server-Ruby-SDK/models/patch_payment_intent_request.rb +10 -0
- data/lib/PCP-server-Ruby-SDK/models/patch_payment_intent_response.rb +11 -0
- data/lib/PCP-server-Ruby-SDK/models/pay_link_status_value.rb +20 -0
- data/lib/PCP-server-Ruby-SDK/models/payment_information_response.rb +4 -0
- data/lib/PCP-server-Ruby-SDK/models/payment_link_order.rb +10 -0
- data/lib/PCP-server-Ruby-SDK/models/payment_link_specific_input.rb +19 -0
- data/lib/PCP-server-Ruby-SDK/models/payment_product840_customer_account_for_intent.rb +12 -0
- data/lib/PCP-server-Ruby-SDK/models/payment_product840_specific_output.rb +5 -6
- data/lib/PCP-server-Ruby-SDK/models/payment_product840_specific_output_for_intent.rb +5 -6
- data/lib/PCP-server-Ruby-SDK/models/payment_references_for_payment_intent.rb +11 -0
- data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_output_for_create_intent.rb +1 -1
- data/lib/PCP-server-Ruby-SDK/queries/get_checkouts_query.rb +5 -1
- data/lib/PCP-server-Ruby-SDK/version.rb +1 -1
- data/lib/PCP-server-Ruby-SDK.rb +10 -1
- data/package-lock.json +2 -2
- data/package.json +1 -1
- data/spec/endpoints/pay_by_link_api_client_spec.rb +38 -0
- data/spec/endpoints/payment_information_api_client_spec.rb +9 -2
- data/spec/endpoints/payment_intent_api_client_spec.rb +35 -2
- data/spec/models/api_definition_conformance_spec.rb +28 -0
- data/spec/models/pay_by_link_models_spec.rb +50 -0
- data/spec/models/payment_intent_models_spec.rb +68 -0
- data/spec/queries/get_checkouts_query_spec.rb +15 -0
- metadata +24 -11
- data/lib/PCP-server-Ruby-SDK/models/payment_product840_specific_output_data.rb +0 -11
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
require 'uri'
|
|
3
|
+
require_relative 'base_api_client'
|
|
4
|
+
require_relative '../models/create_pay_by_link_response'
|
|
5
|
+
|
|
6
|
+
module PCPServerSDK
|
|
7
|
+
module Endpoints
|
|
8
|
+
class PayByLinkApiClient < BaseApiClient
|
|
9
|
+
# Create a pay-by-link for a checkout.
|
|
10
|
+
# @param merchant_id [String] The merchant identifier
|
|
11
|
+
# @param commerce_case_id [String] The commerce case identifier
|
|
12
|
+
# @param checkout_id [String] The checkout identifier
|
|
13
|
+
# @param payload [PCPServerSDK::Models::CreatePayByLinkRequest] The pay-by-link request
|
|
14
|
+
# @return [PCPServerSDK::Models::CreatePayByLinkResponse] The created pay-by-link
|
|
15
|
+
def create_pay_by_link_request(merchant_id, commerce_case_id, checkout_id, payload)
|
|
16
|
+
raise TypeError, MERCHANT_ID_REQUIRED_ERROR if merchant_id.nil? || merchant_id.empty?
|
|
17
|
+
raise TypeError, COMMERCE_CASE_ID_REQUIRED_ERROR if commerce_case_id.nil? || commerce_case_id.empty?
|
|
18
|
+
raise TypeError, CHECKOUT_ID_REQUIRED_ERROR if checkout_id.nil? || checkout_id.empty?
|
|
19
|
+
raise TypeError, PAYLOAD_REQUIRED_ERROR if payload.nil?
|
|
20
|
+
|
|
21
|
+
url = URI.join(get_config.host, "/v1/#{merchant_id}/commerce-cases/#{commerce_case_id}/checkouts/#{checkout_id}/pay-by-link")
|
|
22
|
+
request_init = {
|
|
23
|
+
method: 'POST',
|
|
24
|
+
headers: { 'Content-Type' => 'application/json' },
|
|
25
|
+
body: JSON.generate(payload)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
response = make_api_call(url.to_s, request_init)
|
|
29
|
+
deserialize_json(response, PCPServerSDK::Models::CreatePayByLinkResponse)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -4,6 +4,7 @@ require_relative 'base_api_client'
|
|
|
4
4
|
require_relative '../models/create_payment_intent_response'
|
|
5
5
|
require_relative '../models/payment_intent_output'
|
|
6
6
|
require_relative '../models/payment_intent_response'
|
|
7
|
+
require_relative '../models/patch_payment_intent_response'
|
|
7
8
|
require_relative '../models/payment_product840_specific_output_for_intent'
|
|
8
9
|
require_relative '../models/redirect_payment_method_specific_output_for_create_intent'
|
|
9
10
|
require_relative '../models/redirect_payment_method_specific_output_for_intent'
|
|
@@ -20,7 +21,8 @@ module PCPServerSDK
|
|
|
20
21
|
raise TypeError, PAYLOAD_REQUIRED_ERROR if payload.nil?
|
|
21
22
|
|
|
22
23
|
response = make_api_call(URI.join(get_config.host, "/v1/#{merchant_id}/payment-intents").to_s,
|
|
23
|
-
|
|
24
|
+
method: 'POST', headers: { 'Content-Type' => 'application/json' },
|
|
25
|
+
body: JSON.generate(payload.respond_to?(:to_hash) ? payload.to_hash : payload))
|
|
24
26
|
deserialize_json(response, PCPServerSDK::Models::CreatePaymentIntentResponse)
|
|
25
27
|
end
|
|
26
28
|
|
|
@@ -32,6 +34,17 @@ module PCPServerSDK
|
|
|
32
34
|
method: 'GET', headers: {})
|
|
33
35
|
deserialize_json(response, PCPServerSDK::Models::PaymentIntentResponse)
|
|
34
36
|
end
|
|
37
|
+
|
|
38
|
+
def patch_payment_intent(merchant_id, payment_intent_id, payload)
|
|
39
|
+
raise TypeError, MERCHANT_ID_REQUIRED_ERROR if merchant_id.nil? || merchant_id.empty?
|
|
40
|
+
raise TypeError, PAYMENT_INTENT_ID_REQUIRED_ERROR if payment_intent_id.nil? || payment_intent_id.empty?
|
|
41
|
+
raise TypeError, PAYLOAD_REQUIRED_ERROR if payload.nil?
|
|
42
|
+
|
|
43
|
+
response = make_api_call(URI.join(get_config.host, "/v1/#{merchant_id}/payment-intents/#{payment_intent_id}").to_s,
|
|
44
|
+
method: 'PATCH', headers: { 'Content-Type' => 'application/json' },
|
|
45
|
+
body: JSON.generate(payload.respond_to?(:to_hash) ? payload.to_hash : payload))
|
|
46
|
+
deserialize_json(response, PCPServerSDK::Models::PatchPaymentIntentResponse)
|
|
47
|
+
end
|
|
35
48
|
end
|
|
36
49
|
end
|
|
37
50
|
end
|
|
@@ -1,189 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require 'json'
|
|
4
|
-
require 'date'
|
|
5
|
-
require 'securerandom'
|
|
1
|
+
require_relative 'model_base'
|
|
6
2
|
|
|
7
3
|
module PCPServerSDK
|
|
8
4
|
module Models
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
|
5
|
+
class AuthenticationToken < ModelBase
|
|
6
|
+
attribute :token, :token, :String
|
|
7
|
+
attribute :id, :id, :String
|
|
8
|
+
attribute :creation_date, :creationDate, :Time
|
|
9
|
+
attribute :expiration_date, :expirationDate, :Time
|
|
187
10
|
end
|
|
188
11
|
end
|
|
189
12
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require_relative 'model_base'
|
|
2
|
+
|
|
3
|
+
module PCPServerSDK
|
|
4
|
+
module Models
|
|
5
|
+
class CreatePayByLinkRequest < ModelBase
|
|
6
|
+
attribute :payment_link_specific_input, :paymentLinkSpecificInput, :PaymentLinkSpecificInput
|
|
7
|
+
attribute :order_type, :orderType, :OrderType
|
|
8
|
+
attribute :items, :items, 'Array<OrderItem>'
|
|
9
|
+
attribute :order_references, :orderReferences, :References
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require_relative 'model_base'
|
|
2
|
+
|
|
3
|
+
module PCPServerSDK
|
|
4
|
+
module Models
|
|
5
|
+
class CreatePayByLinkResponse < ModelBase
|
|
6
|
+
attribute :expiration_date, :expirationDate, :Time
|
|
7
|
+
attribute :payment_link_order, :paymentLinkOrder, :PaymentLinkOrder
|
|
8
|
+
attribute :status, :status, :PayLinkStatusValue
|
|
9
|
+
attribute :redirection_url, :redirectionUrl, :String
|
|
10
|
+
attribute :payment_link_id, :paymentLinkId, :String
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -4,7 +4,7 @@ module PCPServerSDK
|
|
|
4
4
|
module Models
|
|
5
5
|
class CreatePaymentIntent < ModelBase
|
|
6
6
|
attribute :amount_of_money, :amountOfMoney, :AmountOfMoney
|
|
7
|
-
attribute :references, :references, :
|
|
7
|
+
attribute :references, :references, :PaymentReferencesForPaymentIntent
|
|
8
8
|
attribute :shopping_cart, :shoppingCart, :ShoppingCartData
|
|
9
9
|
end
|
|
10
10
|
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module PCPServerSDK
|
|
2
|
+
module Models
|
|
3
|
+
class PayLinkStatusValue
|
|
4
|
+
ACTIVE = 'ACTIVE'.freeze
|
|
5
|
+
PAID = 'PAID'.freeze
|
|
6
|
+
EXPIRED = 'EXPIRED'.freeze
|
|
7
|
+
REDIRECTED = 'REDIRECTED'.freeze
|
|
8
|
+
|
|
9
|
+
def self.all_vars
|
|
10
|
+
@all_vars ||= [ACTIVE, PAID, EXPIRED, REDIRECTED].freeze
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.build_from_hash(value)
|
|
14
|
+
return value if all_vars.include?(value)
|
|
15
|
+
|
|
16
|
+
raise "Invalid ENUM value #{value} for class #PayLinkStatusValue"
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -22,6 +22,10 @@ module PCPServerSDK
|
|
|
22
22
|
# or terminal will be used. It is always the reference for external transactions.
|
|
23
23
|
# (e.g. card present payments, cash payments or payments processed by other payment providers).
|
|
24
24
|
attribute :merchant_reference, :merchantReference, :String
|
|
25
|
+
# Trace number assigned by the payment terminal.
|
|
26
|
+
attribute :trace_number, :traceNumber, :String
|
|
27
|
+
# Receipt number assigned by the payment terminal.
|
|
28
|
+
attribute :receipt_number, :receiptNumber, :String
|
|
25
29
|
# The date and time when the payment was created.
|
|
26
30
|
#
|
|
27
31
|
# Format will be in one of the following formats:
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require_relative 'model_base'
|
|
2
|
+
|
|
3
|
+
module PCPServerSDK
|
|
4
|
+
module Models
|
|
5
|
+
class PaymentLinkSpecificInput < ModelBase
|
|
6
|
+
attribute :expiration_date, :expirationDate, :Time
|
|
7
|
+
attribute :authorization_mode, :authorizationMode, :AuthorizationMode
|
|
8
|
+
attribute :payment_methods, :paymentMethods, 'Array<String>'
|
|
9
|
+
attribute :bnpl_id, :bnplId, :String
|
|
10
|
+
attribute :return_url, :returnUrl, :String
|
|
11
|
+
attribute :logo_url, :logoUrl, :String
|
|
12
|
+
attribute :auto_redirection, :autoRedirection, :Boolean
|
|
13
|
+
attribute :terms_url, :termsUrl, :String
|
|
14
|
+
attribute :retry_number, :retryNumber, :Integer
|
|
15
|
+
attribute :merchant_name, :merchantName, :String
|
|
16
|
+
attribute :merchant_origin, :merchantOrigin, :String
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require_relative 'model_base'
|
|
2
|
+
|
|
3
|
+
module PCPServerSDK
|
|
4
|
+
module Models
|
|
5
|
+
class PaymentProduct840CustomerAccountForIntent < ModelBase
|
|
6
|
+
attribute :company_name, :companyName, :String
|
|
7
|
+
attribute :first_name, :firstName, :String
|
|
8
|
+
attribute :surname, :surname, :String
|
|
9
|
+
attribute :email_address, :emailAddress, :String
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
require_relative '
|
|
1
|
+
require_relative 'model_base'
|
|
2
2
|
|
|
3
3
|
module PCPServerSDK
|
|
4
4
|
module Models
|
|
5
|
-
class PaymentProduct840SpecificOutput <
|
|
5
|
+
class PaymentProduct840SpecificOutput < ModelBase
|
|
6
|
+
attribute :billing_address, :billingAddress, :Address
|
|
7
|
+
attribute :customer_account, :customerAccount, :PaymentProduct840CustomerAccount
|
|
8
|
+
attribute :pay_pal_transaction_id, :payPalTransactionId, :String
|
|
6
9
|
attribute :shipping_address, :shippingAddress, :Address
|
|
7
|
-
|
|
8
|
-
def self.openapi_all_of
|
|
9
|
-
[:PaymentProduct840SpecificOutputData]
|
|
10
|
-
end
|
|
11
10
|
end
|
|
12
11
|
end
|
|
13
12
|
end
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
require_relative '
|
|
1
|
+
require_relative 'model_base'
|
|
2
2
|
|
|
3
3
|
module PCPServerSDK
|
|
4
4
|
module Models
|
|
5
|
-
class PaymentProduct840SpecificOutputForIntent <
|
|
5
|
+
class PaymentProduct840SpecificOutputForIntent < ModelBase
|
|
6
|
+
attribute :billing_address, :billingAddress, :Address
|
|
7
|
+
attribute :customer_account, :customerAccount, :PaymentProduct840CustomerAccountForIntent
|
|
8
|
+
attribute :pay_pal_transaction_id, :payPalTransactionId, :String
|
|
6
9
|
attribute :shipping_address, :shippingAddress, :ShippingAddress
|
|
7
|
-
|
|
8
|
-
def self.openapi_all_of
|
|
9
|
-
[:PaymentProduct840SpecificOutputData]
|
|
10
|
-
end
|
|
11
10
|
end
|
|
12
11
|
end
|
|
13
12
|
end
|
data/lib/PCP-server-Ruby-SDK/models/redirect_payment_method_specific_output_for_create_intent.rb
CHANGED
|
@@ -6,7 +6,7 @@ module PCPServerSDK
|
|
|
6
6
|
attribute :requires_approval, :requiresApproval, :Boolean
|
|
7
7
|
attribute :payment_product_id, :paymentProductId, :Integer
|
|
8
8
|
attribute :payment_product840_specific_output, :paymentProduct840SpecificOutput, :RedirectPaymentProduct840SpecificInputData
|
|
9
|
-
attribute :
|
|
9
|
+
attribute :redirect_data, :redirectData, :RedirectData
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
end
|
|
@@ -15,7 +15,8 @@ module PCPServerSDK
|
|
|
15
15
|
:include_payment_product_id, :include_checkout_status,
|
|
16
16
|
:include_extended_checkout_status, :include_payment_channel,
|
|
17
17
|
:payment_reference, :payment_id, :first_name, :surname,
|
|
18
|
-
:email, :phone_number, :date_of_birth, :company_information, :terminal_id, :reporting_token
|
|
18
|
+
:email, :phone_number, :date_of_birth, :company_information, :terminal_id, :reporting_token,
|
|
19
|
+
:card_authorization_id, :receipt_number, :trace_number
|
|
19
20
|
|
|
20
21
|
def initialize
|
|
21
22
|
@include_payment_product_id = []
|
|
@@ -60,6 +61,9 @@ module PCPServerSDK
|
|
|
60
61
|
query['companyInformation'] = @company_information if @company_information
|
|
61
62
|
query['terminalId'] = @terminal_id if @terminal_id
|
|
62
63
|
query['reportingToken'] = @reporting_token if @reporting_token
|
|
64
|
+
query['cardAuthorizationId'] = @card_authorization_id if @card_authorization_id
|
|
65
|
+
query['receiptNumber'] = @receipt_number if @receipt_number
|
|
66
|
+
query['traceNumber'] = @trace_number if @trace_number
|
|
63
67
|
|
|
64
68
|
query
|
|
65
69
|
end
|
data/lib/PCP-server-Ruby-SDK.rb
CHANGED
|
@@ -7,6 +7,7 @@ require_relative 'PCP-server-Ruby-SDK/endpoints/order_management_checkout_action
|
|
|
7
7
|
require_relative 'PCP-server-Ruby-SDK/endpoints/payment_execution_api_client'
|
|
8
8
|
require_relative 'PCP-server-Ruby-SDK/endpoints/payment_information_api_client'
|
|
9
9
|
require_relative 'PCP-server-Ruby-SDK/endpoints/payment_intent_api_client'
|
|
10
|
+
require_relative 'PCP-server-Ruby-SDK/endpoints/pay_by_link_api_client'
|
|
10
11
|
|
|
11
12
|
# Errors
|
|
12
13
|
require_relative 'PCP-server-Ruby-SDK/errors/api_error_response_exception'
|
|
@@ -118,11 +119,14 @@ require_relative 'PCP-server-Ruby-SDK/models/payment_instructions'
|
|
|
118
119
|
require_relative 'PCP-server-Ruby-SDK/models/create_payment_intent'
|
|
119
120
|
require_relative 'PCP-server-Ruby-SDK/models/create_payment_intent_request'
|
|
120
121
|
require_relative 'PCP-server-Ruby-SDK/models/create_payment_intent_response'
|
|
122
|
+
require_relative 'PCP-server-Ruby-SDK/models/create_pay_by_link_request'
|
|
123
|
+
require_relative 'PCP-server-Ruby-SDK/models/create_pay_by_link_response'
|
|
121
124
|
require_relative 'PCP-server-Ruby-SDK/models/payment_intent_response_data'
|
|
122
125
|
require_relative 'PCP-server-Ruby-SDK/models/payment_intent_output'
|
|
123
126
|
require_relative 'PCP-server-Ruby-SDK/models/payment_intent_response'
|
|
127
|
+
require_relative 'PCP-server-Ruby-SDK/models/patch_payment_intent_request'
|
|
128
|
+
require_relative 'PCP-server-Ruby-SDK/models/patch_payment_intent_response'
|
|
124
129
|
require_relative 'PCP-server-Ruby-SDK/models/payment_method_specific_input_for_intent'
|
|
125
|
-
require_relative 'PCP-server-Ruby-SDK/models/payment_product840_specific_output_data'
|
|
126
130
|
require_relative 'PCP-server-Ruby-SDK/models/payment_product840_specific_output_for_intent'
|
|
127
131
|
require_relative 'PCP-server-Ruby-SDK/models/redirect_payment_method_specific_input_for_intent'
|
|
128
132
|
require_relative 'PCP-server-Ruby-SDK/models/redirect_payment_method_specific_output_for_create_intent'
|
|
@@ -137,10 +141,15 @@ require_relative 'PCP-server-Ruby-SDK/models/payment_product3392_specific_input'
|
|
|
137
141
|
require_relative 'PCP-server-Ruby-SDK/models/payment_product5002_specific_input'
|
|
138
142
|
require_relative 'PCP-server-Ruby-SDK/models/payment_product771_specific_output'
|
|
139
143
|
require_relative 'PCP-server-Ruby-SDK/models/payment_product840_customer_account'
|
|
144
|
+
require_relative 'PCP-server-Ruby-SDK/models/payment_product840_customer_account_for_intent'
|
|
140
145
|
require_relative 'PCP-server-Ruby-SDK/models/payment_product840_specific_output'
|
|
141
146
|
require_relative 'PCP-server-Ruby-SDK/models/payment_references'
|
|
147
|
+
require_relative 'PCP-server-Ruby-SDK/models/payment_references_for_payment_intent'
|
|
142
148
|
require_relative 'PCP-server-Ruby-SDK/models/payment_references_for_refund'
|
|
143
149
|
require_relative 'PCP-server-Ruby-SDK/models/payment_response'
|
|
150
|
+
require_relative 'PCP-server-Ruby-SDK/models/payment_link_order'
|
|
151
|
+
require_relative 'PCP-server-Ruby-SDK/models/payment_link_specific_input'
|
|
152
|
+
require_relative 'PCP-server-Ruby-SDK/models/pay_link_status_value'
|
|
144
153
|
require_relative 'PCP-server-Ruby-SDK/models/payment_status_output'
|
|
145
154
|
require_relative 'PCP-server-Ruby-SDK/models/payment_type'
|
|
146
155
|
require_relative 'PCP-server-Ruby-SDK/models/payout_output'
|
data/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pcp-serversdk-ruby",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pcp-serversdk-ruby",
|
|
9
|
-
"version": "1.
|
|
9
|
+
"version": "1.15.0",
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@commitlint/cli": "19.4.0",
|
|
12
12
|
"@commitlint/config-conventional": "19.2.2",
|
data/package.json
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'net/http'
|
|
3
|
+
require 'json'
|
|
4
|
+
require_relative '../../lib/PCP-server-Ruby-SDK.rb'
|
|
5
|
+
|
|
6
|
+
RSpec.describe PCPServerSDK::Endpoints::PayByLinkApiClient do
|
|
7
|
+
let(:config) { mock_communicator_config }
|
|
8
|
+
let(:client) { described_class.new(config) }
|
|
9
|
+
let(:payload) { double('PCPServerSDK::Models::CreatePayByLinkRequest') }
|
|
10
|
+
let(:response) do
|
|
11
|
+
double(
|
|
12
|
+
'Response',
|
|
13
|
+
body: '{"status":"ACTIVE","paymentLinkId":"707ef15b-7a0a-48f2-b7d8-c95103418a9c"}',
|
|
14
|
+
code: 201
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
before do
|
|
19
|
+
allow(client).to receive(:get_response).and_return(response)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe '#create_pay_by_link_request' do
|
|
23
|
+
it 'posts to the pay-by-link endpoint and deserializes its response' do
|
|
24
|
+
result = client.create_pay_by_link_request('1', '2', '3', payload)
|
|
25
|
+
|
|
26
|
+
expect(result).to be_a(PCPServerSDK::Models::CreatePayByLinkResponse)
|
|
27
|
+
expect(result.status).to eq('ACTIVE')
|
|
28
|
+
expect(result.payment_link_id).to eq('707ef15b-7a0a-48f2-b7d8-c95103418a9c')
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'requires all path parameters and the payload' do
|
|
32
|
+
expect { client.create_pay_by_link_request(nil, '2', '3', payload) }.to raise_error(TypeError, 'Merchant ID is required')
|
|
33
|
+
expect { client.create_pay_by_link_request('1', nil, '3', payload) }.to raise_error(TypeError, 'Commerce Case ID is required')
|
|
34
|
+
expect { client.create_pay_by_link_request('1', '2', nil, payload) }.to raise_error(TypeError, 'Checkout ID is required')
|
|
35
|
+
expect { client.create_pay_by_link_request('1', '2', '3', nil) }.to raise_error(TypeError, 'Payload is required')
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -17,8 +17,13 @@ RSpec.describe PCPServerSDK::Endpoints::PaymentInformationApiClient do
|
|
|
17
17
|
let(:payload) { double('PCPServerSDK::Models::PaymentInformationRequest') }
|
|
18
18
|
|
|
19
19
|
context 'when request is successful' do
|
|
20
|
-
let(:response) { double('Response', body: '{}', code: '200') }
|
|
21
|
-
let(:expected_response)
|
|
20
|
+
let(:response) { double('Response', body: '{"traceNumber":"trace-123","receiptNumber":"receipt-123"}', code: '200') }
|
|
21
|
+
let(:expected_response) do
|
|
22
|
+
PCPServerSDK::Models::PaymentInformationResponse.new(
|
|
23
|
+
trace_number: 'trace-123',
|
|
24
|
+
receipt_number: 'receipt-123'
|
|
25
|
+
)
|
|
26
|
+
end
|
|
22
27
|
|
|
23
28
|
before do
|
|
24
29
|
allow(client).to receive(:get_response).and_return(response)
|
|
@@ -27,6 +32,8 @@ RSpec.describe PCPServerSDK::Endpoints::PaymentInformationApiClient do
|
|
|
27
32
|
it 'returns a successful response' do
|
|
28
33
|
result = client.create_payment_information('1', '2', '3', payload)
|
|
29
34
|
expect(result).to eq(expected_response)
|
|
35
|
+
expect(result.trace_number).to eq('trace-123')
|
|
36
|
+
expect(result.receipt_number).to eq('receipt-123')
|
|
30
37
|
end
|
|
31
38
|
end
|
|
32
39
|
|