connect-sdk-ruby 2.25.0 → 2.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/connect-sdk-ruby.gemspec +1 -1
- data/examples/merchant/captures/create_refund_capture_example.rb +54 -0
- data/examples/merchant/hostedcheckouts/delete_hosted_checkout_example.rb +22 -0
- data/examples/merchant/services/get_settlement_details_example.rb +22 -0
- data/lib/ingenico/connect/sdk/domain/definitions/card.rb +7 -0
- data/lib/ingenico/connect/sdk/domain/definitions/card_fraud_results.rb +9 -0
- data/lib/ingenico/connect/sdk/domain/definitions/microsoft_fraud_results.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/payment/cash_payment_method_specific_input.rb +27 -0
- data/lib/ingenico/connect/sdk/domain/payment/cash_payment_product1506_specific_input.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/payment/cash_payment_product1508_specific_input.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/payment/cash_payment_product1511_specific_input.rb +32 -0
- data/lib/ingenico/connect/sdk/domain/payment/order_line_details.rb +7 -0
- data/lib/ingenico/connect/sdk/domain/services/settlement_details.rb +55 -0
- data/lib/ingenico/connect/sdk/merchant/captures/captures_client.rb +35 -0
- data/lib/ingenico/connect/sdk/merchant/hostedcheckouts/hostedcheckouts_client.rb +29 -0
- data/lib/ingenico/connect/sdk/merchant/services/services_client.rb +31 -0
- data/lib/ingenico/connect/sdk/meta_data_provider.rb +1 -1
- data/spec/integration/idempotence_spec.rb +20 -5
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf5846113a34444077709cdd1442d0e0ce79d53aafd628759e1b263b4e6377b2
|
4
|
+
data.tar.gz: 4340e5ca7922f121f5c36317945b55f4ea85c642d1c5eb8e63cce9b3356ddb92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f44ab2a432db832f597d63548ae2f28eb329af96fc32a571b0e1fe2b82f71ac0f5ea5b80fbfb25bd63b4baa906b4eef1b9cbae4f0545c72b14b6041bdb9429f
|
7
|
+
data.tar.gz: 5875974191b3326f5bdc3131429f31dea8379cf95738795a71074cb3512299b1916050655f62a18df57be98787906fada45b29a83d488034e8d2b16204d24fdb
|
data/connect-sdk-ruby.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'connect-sdk-ruby'
|
3
|
-
spec.version = '2.
|
3
|
+
spec.version = '2.29.0'
|
4
4
|
spec.authors = ['Ingenico ePayments']
|
5
5
|
spec.email = ['github@epay.ingenico.com']
|
6
6
|
spec.summary = %q{SDK to communicate with the Ingenico ePayments platform using the Ingenico Connect Server API}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#
|
2
|
+
# This class was auto-generated from the API references found at
|
3
|
+
# https://epayments-api.developer-ingenico.com/s2sapi/v1/
|
4
|
+
#
|
5
|
+
require 'ingenico/connect/sdk/api_exception'
|
6
|
+
require 'ingenico/connect/sdk/declined_refund_exception'
|
7
|
+
require 'ingenico/connect/sdk/factory'
|
8
|
+
require 'ingenico/connect/sdk/domain/definitions/amount_of_money'
|
9
|
+
require 'ingenico/connect/sdk/domain/refund/refund_references'
|
10
|
+
require 'ingenico/connect/sdk/domain/refund/refund_request'
|
11
|
+
|
12
|
+
Definitions = Ingenico::Connect::SDK::Domain::Definitions
|
13
|
+
Refund = Ingenico::Connect::SDK::Domain::Refund
|
14
|
+
|
15
|
+
def example
|
16
|
+
get_client do |client|
|
17
|
+
amount_of_money = Definitions::AmountOfMoney.new
|
18
|
+
amount_of_money.amount = 500
|
19
|
+
amount_of_money.currency_code = 'EUR'
|
20
|
+
|
21
|
+
refund_references = Refund::RefundReferences.new
|
22
|
+
refund_references.merchant_reference = 'AcmeOrder0001'
|
23
|
+
|
24
|
+
body = Refund::RefundRequest.new
|
25
|
+
body.amount_of_money = amount_of_money
|
26
|
+
body.refund_references = refund_references
|
27
|
+
|
28
|
+
begin
|
29
|
+
response = client.merchant('merchantId').captures.refund('captureId', body)
|
30
|
+
rescue Ingenico::Connect::SDK::DeclinedRefundException => e
|
31
|
+
handle_declined_refund(e.refund_result)
|
32
|
+
rescue Ingenico::Connect::SDK::ApiException => e
|
33
|
+
handle_api_errors(e.errors)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def get_client
|
39
|
+
api_key_id = ENV.fetch('connect.api.apiKeyId', 'someKey')
|
40
|
+
secret_api_key = ENV.fetch('connect.api.secretApiKey', 'someSecret')
|
41
|
+
configuration_file_name = File.join(__FILE__, '..', '..', 'example_configuration.yml')
|
42
|
+
yield client = Ingenico::Connect::SDK::Factory.create_client_from_file(configuration_file_name, api_key_id, secret_api_key)
|
43
|
+
ensure
|
44
|
+
# Free networking resources when done
|
45
|
+
client.close unless client.nil?
|
46
|
+
end
|
47
|
+
|
48
|
+
def handle_declined_refund(refund_result)
|
49
|
+
# handle the result here
|
50
|
+
end
|
51
|
+
|
52
|
+
def handle_api_errors(errors)
|
53
|
+
# handle the errors here
|
54
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#
|
2
|
+
# This class was auto-generated from the API references found at
|
3
|
+
# https://epayments-api.developer-ingenico.com/s2sapi/v1/
|
4
|
+
#
|
5
|
+
require 'ingenico/connect/sdk/factory'
|
6
|
+
|
7
|
+
|
8
|
+
def example
|
9
|
+
get_client do |client|
|
10
|
+
client.merchant('merchantId').hostedcheckouts.delete('hostedCheckoutId')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_client
|
15
|
+
api_key_id = ENV.fetch('connect.api.apiKeyId', 'someKey')
|
16
|
+
secret_api_key = ENV.fetch('connect.api.secretApiKey', 'someSecret')
|
17
|
+
configuration_file_name = File.join(__FILE__, '..', '..', 'example_configuration.yml')
|
18
|
+
yield client = Ingenico::Connect::SDK::Factory.create_client_from_file(configuration_file_name, api_key_id, secret_api_key)
|
19
|
+
ensure
|
20
|
+
# Free networking resources when done
|
21
|
+
client.close unless client.nil?
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#
|
2
|
+
# This class was auto-generated from the API references found at
|
3
|
+
# https://epayments-api.developer-ingenico.com/s2sapi/v1/
|
4
|
+
#
|
5
|
+
require 'ingenico/connect/sdk/factory'
|
6
|
+
|
7
|
+
|
8
|
+
def example
|
9
|
+
get_client do |client|
|
10
|
+
response = client.merchant('merchantId').services.settlementdetails('paymentId')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_client
|
15
|
+
api_key_id = ENV.fetch('connect.api.apiKeyId', 'someKey')
|
16
|
+
secret_api_key = ENV.fetch('connect.api.secretApiKey', 'someSecret')
|
17
|
+
configuration_file_name = File.join(__FILE__, '..', '..', 'example_configuration.yml')
|
18
|
+
yield client = Ingenico::Connect::SDK::Factory.create_client_from_file(configuration_file_name, api_key_id, secret_api_key)
|
19
|
+
ensure
|
20
|
+
# Free networking resources when done
|
21
|
+
client.close unless client.nil?
|
22
|
+
end
|
@@ -9,14 +9,18 @@ module Ingenico::Connect::SDK
|
|
9
9
|
module Definitions
|
10
10
|
|
11
11
|
# @attr [String] cvv
|
12
|
+
# @attr [String] partial_pin
|
12
13
|
class Card < Ingenico::Connect::SDK::Domain::Definitions::CardWithoutCvv
|
13
14
|
|
14
15
|
attr_accessor :cvv
|
15
16
|
|
17
|
+
attr_accessor :partial_pin
|
18
|
+
|
16
19
|
# @return (Hash)
|
17
20
|
def to_h
|
18
21
|
hash = super
|
19
22
|
hash['cvv'] = @cvv unless @cvv.nil?
|
23
|
+
hash['partialPin'] = @partial_pin unless @partial_pin.nil?
|
20
24
|
hash
|
21
25
|
end
|
22
26
|
|
@@ -25,6 +29,9 @@ module Ingenico::Connect::SDK
|
|
25
29
|
if hash.has_key? 'cvv'
|
26
30
|
@cvv = hash['cvv']
|
27
31
|
end
|
32
|
+
if hash.has_key? 'partialPin'
|
33
|
+
@partial_pin = hash['partialPin']
|
34
|
+
end
|
28
35
|
end
|
29
36
|
end
|
30
37
|
end
|
@@ -5,6 +5,7 @@
|
|
5
5
|
require 'ingenico/connect/sdk/domain/definitions/fraud_results'
|
6
6
|
require 'ingenico/connect/sdk/domain/definitions/fraud_results_retail_decisions'
|
7
7
|
require 'ingenico/connect/sdk/domain/definitions/fraugster_results'
|
8
|
+
require 'ingenico/connect/sdk/domain/definitions/microsoft_fraud_results'
|
8
9
|
|
9
10
|
module Ingenico::Connect::SDK
|
10
11
|
module Domain
|
@@ -13,6 +14,7 @@ module Ingenico::Connect::SDK
|
|
13
14
|
# @attr [String] avs_result
|
14
15
|
# @attr [String] cvv_result
|
15
16
|
# @attr [Ingenico::Connect::SDK::Domain::Definitions::FraugsterResults] fraugster
|
17
|
+
# @attr [Ingenico::Connect::SDK::Domain::Definitions::MicrosoftFraudResults] microsoft_fraud_protection
|
16
18
|
# @attr [Ingenico::Connect::SDK::Domain::Definitions::FraudResultsRetailDecisions] retail_decisions
|
17
19
|
class CardFraudResults < Ingenico::Connect::SDK::Domain::Definitions::FraudResults
|
18
20
|
|
@@ -22,6 +24,8 @@ module Ingenico::Connect::SDK
|
|
22
24
|
|
23
25
|
attr_accessor :fraugster
|
24
26
|
|
27
|
+
attr_accessor :microsoft_fraud_protection
|
28
|
+
|
25
29
|
attr_accessor :retail_decisions
|
26
30
|
|
27
31
|
# @return (Hash)
|
@@ -30,6 +34,7 @@ module Ingenico::Connect::SDK
|
|
30
34
|
hash['avsResult'] = @avs_result unless @avs_result.nil?
|
31
35
|
hash['cvvResult'] = @cvv_result unless @cvv_result.nil?
|
32
36
|
hash['fraugster'] = @fraugster.to_h unless @fraugster.nil?
|
37
|
+
hash['microsoftFraudProtection'] = @microsoft_fraud_protection.to_h unless @microsoft_fraud_protection.nil?
|
33
38
|
hash['retailDecisions'] = @retail_decisions.to_h unless @retail_decisions.nil?
|
34
39
|
hash
|
35
40
|
end
|
@@ -46,6 +51,10 @@ module Ingenico::Connect::SDK
|
|
46
51
|
raise TypeError, "value '%s' is not a Hash" % [hash['fraugster']] unless hash['fraugster'].is_a? Hash
|
47
52
|
@fraugster = Ingenico::Connect::SDK::Domain::Definitions::FraugsterResults.new_from_hash(hash['fraugster'])
|
48
53
|
end
|
54
|
+
if hash.has_key? 'microsoftFraudProtection'
|
55
|
+
raise TypeError, "value '%s' is not a Hash" % [hash['microsoftFraudProtection']] unless hash['microsoftFraudProtection'].is_a? Hash
|
56
|
+
@microsoft_fraud_protection = Ingenico::Connect::SDK::Domain::Definitions::MicrosoftFraudResults.new_from_hash(hash['microsoftFraudProtection'])
|
57
|
+
end
|
49
58
|
if hash.has_key? 'retailDecisions'
|
50
59
|
raise TypeError, "value '%s' is not a Hash" % [hash['retailDecisions']] unless hash['retailDecisions'].is_a? Hash
|
51
60
|
@retail_decisions = Ingenico::Connect::SDK::Domain::Definitions::FraudResultsRetailDecisions.new_from_hash(hash['retailDecisions'])
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#
|
2
|
+
# This class was auto-generated from the API references found at
|
3
|
+
# https://epayments-api.developer-ingenico.com/s2sapi/v1/
|
4
|
+
#
|
5
|
+
require 'ingenico/connect/sdk/data_object'
|
6
|
+
|
7
|
+
module Ingenico::Connect::SDK
|
8
|
+
module Domain
|
9
|
+
module Definitions
|
10
|
+
|
11
|
+
# @attr [Integer] fraud_score
|
12
|
+
class MicrosoftFraudResults < Ingenico::Connect::SDK::DataObject
|
13
|
+
|
14
|
+
attr_accessor :fraud_score
|
15
|
+
|
16
|
+
# @return (Hash)
|
17
|
+
def to_h
|
18
|
+
hash = super
|
19
|
+
hash['fraudScore'] = @fraud_score unless @fraud_score.nil?
|
20
|
+
hash
|
21
|
+
end
|
22
|
+
|
23
|
+
def from_hash(hash)
|
24
|
+
super
|
25
|
+
if hash.has_key? 'fraudScore'
|
26
|
+
@fraud_score = hash['fraudScore']
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -5,6 +5,9 @@
|
|
5
5
|
require 'ingenico/connect/sdk/domain/payment/abstract_cash_payment_method_specific_input'
|
6
6
|
require 'ingenico/connect/sdk/domain/payment/cash_payment_product1503_specific_input'
|
7
7
|
require 'ingenico/connect/sdk/domain/payment/cash_payment_product1504_specific_input'
|
8
|
+
require 'ingenico/connect/sdk/domain/payment/cash_payment_product1506_specific_input'
|
9
|
+
require 'ingenico/connect/sdk/domain/payment/cash_payment_product1508_specific_input'
|
10
|
+
require 'ingenico/connect/sdk/domain/payment/cash_payment_product1511_specific_input'
|
8
11
|
require 'ingenico/connect/sdk/domain/payment/cash_payment_product1521_specific_input'
|
9
12
|
require 'ingenico/connect/sdk/domain/payment/cash_payment_product1522_specific_input'
|
10
13
|
require 'ingenico/connect/sdk/domain/payment/cash_payment_product1523_specific_input'
|
@@ -17,6 +20,9 @@ module Ingenico::Connect::SDK
|
|
17
20
|
|
18
21
|
# @attr [Ingenico::Connect::SDK::Domain::Payment::CashPaymentProduct1503SpecificInput] payment_product1503_specific_input
|
19
22
|
# @attr [Ingenico::Connect::SDK::Domain::Payment::CashPaymentProduct1504SpecificInput] payment_product1504_specific_input
|
23
|
+
# @attr [Ingenico::Connect::SDK::Domain::Payment::CashPaymentProduct1506SpecificInput] payment_product1506_specific_input
|
24
|
+
# @attr [Ingenico::Connect::SDK::Domain::Payment::CashPaymentProduct1508SpecificInput] payment_product1508_specific_input
|
25
|
+
# @attr [Ingenico::Connect::SDK::Domain::Payment::CashPaymentProduct1511SpecificInput] payment_product1511_specific_input
|
20
26
|
# @attr [Ingenico::Connect::SDK::Domain::Payment::CashPaymentProduct1521SpecificInput] payment_product1521_specific_input
|
21
27
|
# @attr [Ingenico::Connect::SDK::Domain::Payment::CashPaymentProduct1522SpecificInput] payment_product1522_specific_input
|
22
28
|
# @attr [Ingenico::Connect::SDK::Domain::Payment::CashPaymentProduct1523SpecificInput] payment_product1523_specific_input
|
@@ -30,6 +36,12 @@ module Ingenico::Connect::SDK
|
|
30
36
|
|
31
37
|
attr_accessor :payment_product1504_specific_input
|
32
38
|
|
39
|
+
attr_accessor :payment_product1506_specific_input
|
40
|
+
|
41
|
+
attr_accessor :payment_product1508_specific_input
|
42
|
+
|
43
|
+
attr_accessor :payment_product1511_specific_input
|
44
|
+
|
33
45
|
attr_accessor :payment_product1521_specific_input
|
34
46
|
|
35
47
|
attr_accessor :payment_product1522_specific_input
|
@@ -45,6 +57,9 @@ module Ingenico::Connect::SDK
|
|
45
57
|
hash = super
|
46
58
|
hash['paymentProduct1503SpecificInput'] = @payment_product1503_specific_input.to_h unless @payment_product1503_specific_input.nil?
|
47
59
|
hash['paymentProduct1504SpecificInput'] = @payment_product1504_specific_input.to_h unless @payment_product1504_specific_input.nil?
|
60
|
+
hash['paymentProduct1506SpecificInput'] = @payment_product1506_specific_input.to_h unless @payment_product1506_specific_input.nil?
|
61
|
+
hash['paymentProduct1508SpecificInput'] = @payment_product1508_specific_input.to_h unless @payment_product1508_specific_input.nil?
|
62
|
+
hash['paymentProduct1511SpecificInput'] = @payment_product1511_specific_input.to_h unless @payment_product1511_specific_input.nil?
|
48
63
|
hash['paymentProduct1521SpecificInput'] = @payment_product1521_specific_input.to_h unless @payment_product1521_specific_input.nil?
|
49
64
|
hash['paymentProduct1522SpecificInput'] = @payment_product1522_specific_input.to_h unless @payment_product1522_specific_input.nil?
|
50
65
|
hash['paymentProduct1523SpecificInput'] = @payment_product1523_specific_input.to_h unless @payment_product1523_specific_input.nil?
|
@@ -63,6 +78,18 @@ module Ingenico::Connect::SDK
|
|
63
78
|
raise TypeError, "value '%s' is not a Hash" % [hash['paymentProduct1504SpecificInput']] unless hash['paymentProduct1504SpecificInput'].is_a? Hash
|
64
79
|
@payment_product1504_specific_input = Ingenico::Connect::SDK::Domain::Payment::CashPaymentProduct1504SpecificInput.new_from_hash(hash['paymentProduct1504SpecificInput'])
|
65
80
|
end
|
81
|
+
if hash.has_key? 'paymentProduct1506SpecificInput'
|
82
|
+
raise TypeError, "value '%s' is not a Hash" % [hash['paymentProduct1506SpecificInput']] unless hash['paymentProduct1506SpecificInput'].is_a? Hash
|
83
|
+
@payment_product1506_specific_input = Ingenico::Connect::SDK::Domain::Payment::CashPaymentProduct1506SpecificInput.new_from_hash(hash['paymentProduct1506SpecificInput'])
|
84
|
+
end
|
85
|
+
if hash.has_key? 'paymentProduct1508SpecificInput'
|
86
|
+
raise TypeError, "value '%s' is not a Hash" % [hash['paymentProduct1508SpecificInput']] unless hash['paymentProduct1508SpecificInput'].is_a? Hash
|
87
|
+
@payment_product1508_specific_input = Ingenico::Connect::SDK::Domain::Payment::CashPaymentProduct1508SpecificInput.new_from_hash(hash['paymentProduct1508SpecificInput'])
|
88
|
+
end
|
89
|
+
if hash.has_key? 'paymentProduct1511SpecificInput'
|
90
|
+
raise TypeError, "value '%s' is not a Hash" % [hash['paymentProduct1511SpecificInput']] unless hash['paymentProduct1511SpecificInput'].is_a? Hash
|
91
|
+
@payment_product1511_specific_input = Ingenico::Connect::SDK::Domain::Payment::CashPaymentProduct1511SpecificInput.new_from_hash(hash['paymentProduct1511SpecificInput'])
|
92
|
+
end
|
66
93
|
if hash.has_key? 'paymentProduct1521SpecificInput'
|
67
94
|
raise TypeError, "value '%s' is not a Hash" % [hash['paymentProduct1521SpecificInput']] unless hash['paymentProduct1521SpecificInput'].is_a? Hash
|
68
95
|
@payment_product1521_specific_input = Ingenico::Connect::SDK::Domain::Payment::CashPaymentProduct1521SpecificInput.new_from_hash(hash['paymentProduct1521SpecificInput'])
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#
|
2
|
+
# This class was auto-generated from the API references found at
|
3
|
+
# https://epayments-api.developer-ingenico.com/s2sapi/v1/
|
4
|
+
#
|
5
|
+
require 'ingenico/connect/sdk/data_object'
|
6
|
+
|
7
|
+
module Ingenico::Connect::SDK
|
8
|
+
module Domain
|
9
|
+
module Payment
|
10
|
+
|
11
|
+
# @attr [String] return_url
|
12
|
+
class CashPaymentProduct1506SpecificInput < Ingenico::Connect::SDK::DataObject
|
13
|
+
|
14
|
+
attr_accessor :return_url
|
15
|
+
|
16
|
+
# @return (Hash)
|
17
|
+
def to_h
|
18
|
+
hash = super
|
19
|
+
hash['returnUrl'] = @return_url unless @return_url.nil?
|
20
|
+
hash
|
21
|
+
end
|
22
|
+
|
23
|
+
def from_hash(hash)
|
24
|
+
super
|
25
|
+
if hash.has_key? 'returnUrl'
|
26
|
+
@return_url = hash['returnUrl']
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#
|
2
|
+
# This class was auto-generated from the API references found at
|
3
|
+
# https://epayments-api.developer-ingenico.com/s2sapi/v1/
|
4
|
+
#
|
5
|
+
require 'ingenico/connect/sdk/data_object'
|
6
|
+
|
7
|
+
module Ingenico::Connect::SDK
|
8
|
+
module Domain
|
9
|
+
module Payment
|
10
|
+
|
11
|
+
# @attr [String] return_url
|
12
|
+
class CashPaymentProduct1508SpecificInput < Ingenico::Connect::SDK::DataObject
|
13
|
+
|
14
|
+
attr_accessor :return_url
|
15
|
+
|
16
|
+
# @return (Hash)
|
17
|
+
def to_h
|
18
|
+
hash = super
|
19
|
+
hash['returnUrl'] = @return_url unless @return_url.nil?
|
20
|
+
hash
|
21
|
+
end
|
22
|
+
|
23
|
+
def from_hash(hash)
|
24
|
+
super
|
25
|
+
if hash.has_key? 'returnUrl'
|
26
|
+
@return_url = hash['returnUrl']
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#
|
2
|
+
# This class was auto-generated from the API references found at
|
3
|
+
# https://epayments-api.developer-ingenico.com/s2sapi/v1/
|
4
|
+
#
|
5
|
+
require 'ingenico/connect/sdk/data_object'
|
6
|
+
|
7
|
+
module Ingenico::Connect::SDK
|
8
|
+
module Domain
|
9
|
+
module Payment
|
10
|
+
|
11
|
+
# @attr [String] return_url
|
12
|
+
class CashPaymentProduct1511SpecificInput < Ingenico::Connect::SDK::DataObject
|
13
|
+
|
14
|
+
attr_accessor :return_url
|
15
|
+
|
16
|
+
# @return (Hash)
|
17
|
+
def to_h
|
18
|
+
hash = super
|
19
|
+
hash['returnUrl'] = @return_url unless @return_url.nil?
|
20
|
+
hash
|
21
|
+
end
|
22
|
+
|
23
|
+
def from_hash(hash)
|
24
|
+
super
|
25
|
+
if hash.has_key? 'returnUrl'
|
26
|
+
@return_url = hash['returnUrl']
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -15,6 +15,7 @@ module Ingenico::Connect::SDK
|
|
15
15
|
# @attr [String] product_code
|
16
16
|
# @attr [String] product_name
|
17
17
|
# @attr [Integer] product_price
|
18
|
+
# @attr [String] product_sku
|
18
19
|
# @attr [String] product_type
|
19
20
|
# @attr [Integer] quantity
|
20
21
|
# @attr [Integer] tax_amount
|
@@ -35,6 +36,8 @@ module Ingenico::Connect::SDK
|
|
35
36
|
|
36
37
|
attr_accessor :product_price
|
37
38
|
|
39
|
+
attr_accessor :product_sku
|
40
|
+
|
38
41
|
attr_accessor :product_type
|
39
42
|
|
40
43
|
attr_accessor :quantity
|
@@ -53,6 +56,7 @@ module Ingenico::Connect::SDK
|
|
53
56
|
hash['productCode'] = @product_code unless @product_code.nil?
|
54
57
|
hash['productName'] = @product_name unless @product_name.nil?
|
55
58
|
hash['productPrice'] = @product_price unless @product_price.nil?
|
59
|
+
hash['productSku'] = @product_sku unless @product_sku.nil?
|
56
60
|
hash['productType'] = @product_type unless @product_type.nil?
|
57
61
|
hash['quantity'] = @quantity unless @quantity.nil?
|
58
62
|
hash['taxAmount'] = @tax_amount unless @tax_amount.nil?
|
@@ -83,6 +87,9 @@ module Ingenico::Connect::SDK
|
|
83
87
|
if hash.has_key? 'productPrice'
|
84
88
|
@product_price = hash['productPrice']
|
85
89
|
end
|
90
|
+
if hash.has_key? 'productSku'
|
91
|
+
@product_sku = hash['productSku']
|
92
|
+
end
|
86
93
|
if hash.has_key? 'productType'
|
87
94
|
@product_type = hash['productType']
|
88
95
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#
|
2
|
+
# This class was auto-generated from the API references found at
|
3
|
+
# https://epayments-api.developer-ingenico.com/s2sapi/v1/
|
4
|
+
#
|
5
|
+
require 'ingenico/connect/sdk/data_object'
|
6
|
+
require 'ingenico/connect/sdk/domain/definitions/amount_of_money'
|
7
|
+
|
8
|
+
module Ingenico::Connect::SDK
|
9
|
+
module Domain
|
10
|
+
module Services
|
11
|
+
|
12
|
+
# @attr [String] acquirer_reference_number
|
13
|
+
# @attr [Ingenico::Connect::SDK::Domain::Definitions::AmountOfMoney] amount_of_money
|
14
|
+
# @attr [String] payment_id
|
15
|
+
# @attr [String] retrieval_reference_number
|
16
|
+
class SettlementDetails < Ingenico::Connect::SDK::DataObject
|
17
|
+
|
18
|
+
attr_accessor :acquirer_reference_number
|
19
|
+
|
20
|
+
attr_accessor :amount_of_money
|
21
|
+
|
22
|
+
attr_accessor :payment_id
|
23
|
+
|
24
|
+
attr_accessor :retrieval_reference_number
|
25
|
+
|
26
|
+
# @return (Hash)
|
27
|
+
def to_h
|
28
|
+
hash = super
|
29
|
+
hash['acquirerReferenceNumber'] = @acquirer_reference_number unless @acquirer_reference_number.nil?
|
30
|
+
hash['amountOfMoney'] = @amount_of_money.to_h unless @amount_of_money.nil?
|
31
|
+
hash['paymentId'] = @payment_id unless @payment_id.nil?
|
32
|
+
hash['retrievalReferenceNumber'] = @retrieval_reference_number unless @retrieval_reference_number.nil?
|
33
|
+
hash
|
34
|
+
end
|
35
|
+
|
36
|
+
def from_hash(hash)
|
37
|
+
super
|
38
|
+
if hash.has_key? 'acquirerReferenceNumber'
|
39
|
+
@acquirer_reference_number = hash['acquirerReferenceNumber']
|
40
|
+
end
|
41
|
+
if hash.has_key? 'amountOfMoney'
|
42
|
+
raise TypeError, "value '%s' is not a Hash" % [hash['amountOfMoney']] unless hash['amountOfMoney'].is_a? Hash
|
43
|
+
@amount_of_money = Ingenico::Connect::SDK::Domain::Definitions::AmountOfMoney.new_from_hash(hash['amountOfMoney'])
|
44
|
+
end
|
45
|
+
if hash.has_key? 'paymentId'
|
46
|
+
@payment_id = hash['paymentId']
|
47
|
+
end
|
48
|
+
if hash.has_key? 'retrievalReferenceNumber'
|
49
|
+
@retrieval_reference_number = hash['retrievalReferenceNumber']
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -6,6 +6,8 @@ require 'ingenico/connect/sdk/api_resource'
|
|
6
6
|
require 'ingenico/connect/sdk/response_exception'
|
7
7
|
require 'ingenico/connect/sdk/domain/capture/capture_response'
|
8
8
|
require 'ingenico/connect/sdk/domain/errors/error_response'
|
9
|
+
require 'ingenico/connect/sdk/domain/refund/refund_error_response'
|
10
|
+
require 'ingenico/connect/sdk/domain/refund/refund_response'
|
9
11
|
|
10
12
|
module Ingenico::Connect::SDK
|
11
13
|
module Merchant
|
@@ -49,6 +51,39 @@ module Ingenico::Connect::SDK
|
|
49
51
|
error_object = @communicator.marshaller.unmarshal(e.body, error_type)
|
50
52
|
raise create_exception(e.status_code, e.body, error_object, context)
|
51
53
|
end
|
54
|
+
|
55
|
+
# Resource /!{merchantId}/captures/!{captureId}/refund - {https://epayments-api.developer-ingenico.com/s2sapi/v1/en_US/ruby/captures/refund.html Create Refund}
|
56
|
+
# @param capture_id [String]
|
57
|
+
# @param body [Ingenico::Connect::SDK::Domain::Refund::RefundRequest]
|
58
|
+
# @param context [Ingenico::Connect::SDK::CallContext]
|
59
|
+
# @return [Ingenico::Connect::SDK::Domain::Refund::RefundResponse]
|
60
|
+
# @raise [Ingenico::Connect::SDK::DeclinedRefundException] if the Ingenico ePayments platform declined / rejected the refund. The refund result will be available from the exception.
|
61
|
+
# @raise [Ingenico::Connect::SDK::ValidationException] if the request was not correct and couldn't be processed (HTTP status code 400)
|
62
|
+
# @raise [Ingenico::Connect::SDK::AuthorizationException] if the request was not allowed (HTTP status code 403)
|
63
|
+
# @raise [Ingenico::Connect::SDK::IdempotenceException] if an idempotent request caused a conflict (HTTP status code 409)
|
64
|
+
# @raise [Ingenico::Connect::SDK::ReferenceException] if an object was attempted to be referenced that doesn't exist or has been removed,
|
65
|
+
# or there was a conflict (HTTP status code 404, 409 or 410)
|
66
|
+
# @raise [Ingenico::Connect::SDK::GlobalCollectException] if something went wrong at the Ingenico ePayments platform,
|
67
|
+
# the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
|
68
|
+
# or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
|
69
|
+
# @raise [Ingenico::Connect::SDK::ApiException]if the Ingenico ePayments platform returned any other error
|
70
|
+
def refund(capture_id, body, context=nil)
|
71
|
+
path_context = {
|
72
|
+
'captureId'.freeze => capture_id,
|
73
|
+
}
|
74
|
+
uri = instantiate_uri('/v1/{merchantId}/captures/{captureId}/refund', path_context)
|
75
|
+
return @communicator.post(
|
76
|
+
uri,
|
77
|
+
client_headers,
|
78
|
+
nil,
|
79
|
+
body,
|
80
|
+
Ingenico::Connect::SDK::Domain::Refund::RefundResponse,
|
81
|
+
context)
|
82
|
+
rescue ResponseException => e
|
83
|
+
error_type = Ingenico::Connect::SDK::Domain::Refund::RefundErrorResponse
|
84
|
+
error_object = @communicator.marshaller.unmarshal(e.body, error_type)
|
85
|
+
raise create_exception(e.status_code, e.body, error_object, context)
|
86
|
+
end
|
52
87
|
end
|
53
88
|
end
|
54
89
|
end
|
@@ -78,6 +78,35 @@ module Ingenico::Connect::SDK
|
|
78
78
|
error_object = @communicator.marshaller.unmarshal(e.body, error_type)
|
79
79
|
raise create_exception(e.status_code, e.body, error_object, context)
|
80
80
|
end
|
81
|
+
|
82
|
+
# Resource /!{merchantId}/hostedcheckouts/!{hostedCheckoutId} - {https://epayments-api.developer-ingenico.com/s2sapi/v1/en_US/ruby/hostedcheckouts/delete.html Delete hosted checkout}
|
83
|
+
# @param hosted_checkout_id [String]
|
84
|
+
# @param context [Ingenico::Connect::SDK::CallContext]
|
85
|
+
# @raise [Ingenico::Connect::SDK::ValidationException] if the request was not correct and couldn't be processed (HTTP status code 400)
|
86
|
+
# @raise [Ingenico::Connect::SDK::AuthorizationException] if the request was not allowed (HTTP status code 403)
|
87
|
+
# @raise [Ingenico::Connect::SDK::IdempotenceException] if an idempotent request caused a conflict (HTTP status code 409)
|
88
|
+
# @raise [Ingenico::Connect::SDK::ReferenceException] if an object was attempted to be referenced that doesn't exist or has been removed,
|
89
|
+
# or there was a conflict (HTTP status code 404, 409 or 410)
|
90
|
+
# @raise [Ingenico::Connect::SDK::GlobalCollectException] if something went wrong at the Ingenico ePayments platform,
|
91
|
+
# the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
|
92
|
+
# or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
|
93
|
+
# @raise [Ingenico::Connect::SDK::ApiException]if the Ingenico ePayments platform returned any other error
|
94
|
+
def delete(hosted_checkout_id, context=nil)
|
95
|
+
path_context = {
|
96
|
+
'hostedCheckoutId'.freeze => hosted_checkout_id,
|
97
|
+
}
|
98
|
+
uri = instantiate_uri('/v1/{merchantId}/hostedcheckouts/{hostedCheckoutId}', path_context)
|
99
|
+
return @communicator.delete(
|
100
|
+
uri,
|
101
|
+
client_headers,
|
102
|
+
nil,
|
103
|
+
nil,
|
104
|
+
context)
|
105
|
+
rescue ResponseException => e
|
106
|
+
error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
|
107
|
+
error_object = @communicator.marshaller.unmarshal(e.body, error_type)
|
108
|
+
raise create_exception(e.status_code, e.body, error_object, context)
|
109
|
+
end
|
81
110
|
end
|
82
111
|
end
|
83
112
|
end
|
@@ -9,6 +9,7 @@ require 'ingenico/connect/sdk/domain/services/bank_details_response'
|
|
9
9
|
require 'ingenico/connect/sdk/domain/services/convert_amount'
|
10
10
|
require 'ingenico/connect/sdk/domain/services/get_iin_details_response'
|
11
11
|
require 'ingenico/connect/sdk/domain/services/get_privacy_policy_response'
|
12
|
+
require 'ingenico/connect/sdk/domain/services/settlement_details'
|
12
13
|
require 'ingenico/connect/sdk/domain/services/test_connection'
|
13
14
|
|
14
15
|
module Ingenico::Connect::SDK
|
@@ -159,6 +160,36 @@ module Ingenico::Connect::SDK
|
|
159
160
|
error_object = @communicator.marshaller.unmarshal(e.body, error_type)
|
160
161
|
raise create_exception(e.status_code, e.body, error_object, context)
|
161
162
|
end
|
163
|
+
|
164
|
+
# Resource /!{merchantId}/services/settlementdetails/!{paymentId} - {https://epayments-api.developer-ingenico.com/s2sapi/v1/en_US/ruby/services/settlementdetails.html Get Settlement details}
|
165
|
+
# @param payment_id [String]
|
166
|
+
# @param context [Ingenico::Connect::SDK::CallContext]
|
167
|
+
# @return [Ingenico::Connect::SDK::Domain::Services::SettlementDetails]
|
168
|
+
# @raise [Ingenico::Connect::SDK::ValidationException] if the request was not correct and couldn't be processed (HTTP status code 400)
|
169
|
+
# @raise [Ingenico::Connect::SDK::AuthorizationException] if the request was not allowed (HTTP status code 403)
|
170
|
+
# @raise [Ingenico::Connect::SDK::IdempotenceException] if an idempotent request caused a conflict (HTTP status code 409)
|
171
|
+
# @raise [Ingenico::Connect::SDK::ReferenceException] if an object was attempted to be referenced that doesn't exist or has been removed,
|
172
|
+
# or there was a conflict (HTTP status code 404, 409 or 410)
|
173
|
+
# @raise [Ingenico::Connect::SDK::GlobalCollectException] if something went wrong at the Ingenico ePayments platform,
|
174
|
+
# the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
|
175
|
+
# or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
|
176
|
+
# @raise [Ingenico::Connect::SDK::ApiException]if the Ingenico ePayments platform returned any other error
|
177
|
+
def settlementdetails(payment_id, context=nil)
|
178
|
+
path_context = {
|
179
|
+
'paymentId'.freeze => payment_id,
|
180
|
+
}
|
181
|
+
uri = instantiate_uri('/v1/{merchantId}/services/settlementdetails/{paymentId}', path_context)
|
182
|
+
return @communicator.get(
|
183
|
+
uri,
|
184
|
+
client_headers,
|
185
|
+
nil,
|
186
|
+
Ingenico::Connect::SDK::Domain::Services::SettlementDetails,
|
187
|
+
context)
|
188
|
+
rescue ResponseException => e
|
189
|
+
error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
|
190
|
+
error_object = @communicator.marshaller.unmarshal(e.body, error_type)
|
191
|
+
raise create_exception(e.status_code, e.body, error_object, context)
|
192
|
+
end
|
162
193
|
end
|
163
194
|
end
|
164
195
|
end
|
@@ -7,7 +7,7 @@ module Ingenico::Connect::SDK
|
|
7
7
|
#
|
8
8
|
# @attr_reader [Array<Ingenico::Connect::SDK::RequestHeader>] meta_data_headers List of headers that should be used in all requests.
|
9
9
|
class MetaDataProvider
|
10
|
-
@@SDK_VERSION = '2.
|
10
|
+
@@SDK_VERSION = '2.29.0'
|
11
11
|
@@SERVER_META_INFO_HEADER = 'X-GCS-ServerMetaInfo'
|
12
12
|
@@PROHIBITED_HEADERS = [@@SERVER_META_INFO_HEADER, 'X-GCS-Idempotence-Key',
|
13
13
|
'Date', 'Content-Type', 'Authorization'].sort!.freeze
|
@@ -10,6 +10,7 @@ require 'ingenico/connect/sdk/domain/payment/order'
|
|
10
10
|
require 'ingenico/connect/sdk/domain/payment/redirect_payment_product809_specific_input'
|
11
11
|
require 'ingenico/connect/sdk/domain/payment/redirect_payment_method_specific_input'
|
12
12
|
require 'ingenico/connect/sdk/call_context'
|
13
|
+
require 'ingenico/connect/sdk/declined_payment_exception'
|
13
14
|
|
14
15
|
describe 'Idempotence with the server' do
|
15
16
|
|
@@ -41,17 +42,31 @@ describe 'Idempotence with the server' do
|
|
41
42
|
context = Ingenico::Connect::SDK::CallContext.new(idempotence_key)
|
42
43
|
|
43
44
|
Integration.init_client(false) do |client|
|
44
|
-
|
45
|
-
|
45
|
+
def do_create_payment(client, body, context)
|
46
|
+
# For this test it doesn't matter if the response is successful or declined,
|
47
|
+
# as long as idempotence is handled correctly
|
48
|
+
begin
|
49
|
+
client.merchant(Integration::MERCHANT_ID).payments.create(body, context)
|
50
|
+
rescue Ingenico::Connect::SDK::DeclinedPaymentException => ex
|
51
|
+
ex.payment_result
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
result = do_create_payment(client, body, context)
|
56
|
+
payment_id = result.payment.id
|
57
|
+
status = result.payment.status
|
46
58
|
|
47
59
|
expect(payment_id).to_not be_nil
|
60
|
+
expect(status).to_not be_nil
|
48
61
|
expect(context.idempotence_key).to eq(idempotence_key)
|
49
62
|
expect(context.idempotence_request_timestamp).to be_nil
|
50
63
|
|
51
|
-
|
52
|
-
payment_id2 =
|
64
|
+
result_2 = do_create_payment(client, body, context)
|
65
|
+
payment_id2 = result_2.payment.id
|
66
|
+
status2 = result_2.payment.status
|
53
67
|
|
54
|
-
expect(
|
68
|
+
expect(payment_id2).to eq(payment_id)
|
69
|
+
expect(status2).to eq(status)
|
55
70
|
expect(context.idempotence_key).to eq(idempotence_key)
|
56
71
|
expect(context.idempotence_request_timestamp).to_not be_nil
|
57
72
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: connect-sdk-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.29.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ingenico ePayments
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- README.md
|
128
128
|
- Rakefile
|
129
129
|
- connect-sdk-ruby.gemspec
|
130
|
+
- examples/merchant/captures/create_refund_capture_example.rb
|
130
131
|
- examples/merchant/captures/get_capture_example.rb
|
131
132
|
- examples/merchant/disputes/cancel_dispute_example.rb
|
132
133
|
- examples/merchant/disputes/get_dispute_example.rb
|
@@ -135,6 +136,7 @@ files:
|
|
135
136
|
- examples/merchant/example_configuration.yml
|
136
137
|
- examples/merchant/files/get_file_example.rb
|
137
138
|
- examples/merchant/hostedcheckouts/create_hosted_checkout_example.rb
|
139
|
+
- examples/merchant/hostedcheckouts/delete_hosted_checkout_example.rb
|
138
140
|
- examples/merchant/hostedcheckouts/get_hosted_checkout_example.rb
|
139
141
|
- examples/merchant/hostedmandatemanagements/create_hosted_mandate_management_example.rb
|
140
142
|
- examples/merchant/hostedmandatemanagements/get_hosted_mandate_management_example.rb
|
@@ -187,6 +189,7 @@ files:
|
|
187
189
|
- examples/merchant/services/convert_amount_example.rb
|
188
190
|
- examples/merchant/services/convert_bank_account_example.rb
|
189
191
|
- examples/merchant/services/get_privacy_policy_example.rb
|
192
|
+
- examples/merchant/services/get_settlement_details_example.rb
|
190
193
|
- examples/merchant/services/iin_details_example.rb
|
191
194
|
- examples/merchant/services/test_connection_example.rb
|
192
195
|
- examples/merchant/sessions/create_session_example.rb
|
@@ -249,6 +252,7 @@ files:
|
|
249
252
|
- lib/ingenico/connect/sdk/domain/definitions/lodging_charge.rb
|
250
253
|
- lib/ingenico/connect/sdk/domain/definitions/lodging_data.rb
|
251
254
|
- lib/ingenico/connect/sdk/domain/definitions/lodging_room.rb
|
255
|
+
- lib/ingenico/connect/sdk/domain/definitions/microsoft_fraud_results.rb
|
252
256
|
- lib/ingenico/connect/sdk/domain/definitions/order_status_output.rb
|
253
257
|
- lib/ingenico/connect/sdk/domain/definitions/payment_product_filter.rb
|
254
258
|
- lib/ingenico/connect/sdk/domain/definitions/personal_name_base.rb
|
@@ -336,6 +340,9 @@ files:
|
|
336
340
|
- lib/ingenico/connect/sdk/domain/payment/cash_payment_method_specific_output.rb
|
337
341
|
- lib/ingenico/connect/sdk/domain/payment/cash_payment_product1503_specific_input.rb
|
338
342
|
- lib/ingenico/connect/sdk/domain/payment/cash_payment_product1504_specific_input.rb
|
343
|
+
- lib/ingenico/connect/sdk/domain/payment/cash_payment_product1506_specific_input.rb
|
344
|
+
- lib/ingenico/connect/sdk/domain/payment/cash_payment_product1508_specific_input.rb
|
345
|
+
- lib/ingenico/connect/sdk/domain/payment/cash_payment_product1511_specific_input.rb
|
339
346
|
- lib/ingenico/connect/sdk/domain/payment/cash_payment_product1521_specific_input.rb
|
340
347
|
- lib/ingenico/connect/sdk/domain/payment/cash_payment_product1522_specific_input.rb
|
341
348
|
- lib/ingenico/connect/sdk/domain/payment/cash_payment_product1523_specific_input.rb
|
@@ -545,6 +552,7 @@ files:
|
|
545
552
|
- lib/ingenico/connect/sdk/domain/services/get_privacy_policy_response.rb
|
546
553
|
- lib/ingenico/connect/sdk/domain/services/iin_detail.rb
|
547
554
|
- lib/ingenico/connect/sdk/domain/services/payment_context.rb
|
555
|
+
- lib/ingenico/connect/sdk/domain/services/settlement_details.rb
|
548
556
|
- lib/ingenico/connect/sdk/domain/services/swift.rb
|
549
557
|
- lib/ingenico/connect/sdk/domain/services/test_connection.rb
|
550
558
|
- lib/ingenico/connect/sdk/domain/sessions/payment_product_filters_client_session.rb
|