connect-sdk-ruby 2.27.0 → 2.28.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/lib/ingenico/connect/sdk/domain/payment/order_line_details.rb +7 -0
- data/lib/ingenico/connect/sdk/merchant/captures/captures_client.rb +35 -0
- data/lib/ingenico/connect/sdk/meta_data_provider.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5992bcc131f53b3ccada88fbd47649cae3d3e2b7a2f4e962d03b720284ec867b
|
4
|
+
data.tar.gz: 8176d72bdb8b2476334f1b4dee14ee5a3630aaf74d03832444bc4816dbaeb2eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 339b9d17f342797147b0cb27b957a0365f1c65d695ef4d709863654a989cbabac407c74865ea129b2316c7972b468435ef4d53fd63d39dfb1f8b25a25aa09c66
|
7
|
+
data.tar.gz: ed49a59d4903bdcffb408119dcb3e2448a0e13981c98a1dfa7ad42c3c3b0d15b8e1ee456305ed8577e51b3d404e4f625f790b747879316a3bc5ce4e7f7bec714
|
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.28.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
|
@@ -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
|
@@ -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
|
@@ -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.28.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
|
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.28.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-06 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
|