Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
Release 1.10.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingenico ePayments committed Sep 15, 2017
1 parent 15c44c9 commit 6e0334b
Show file tree
Hide file tree
Showing 14 changed files with 473 additions and 2 deletions.
2 changes: 1 addition & 1 deletion connect-sdk-ruby.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |spec|
spec.name = 'connect-sdk-ruby'
spec.version = '1.9.0'
spec.version = '1.10.0'
spec.authors = ['Ingenico ePayments']
spec.email = ['github@epay.ingenico.com']
spec.summary = %q{SDK to communicate with the Ingenico ePayments platform using the Ingenico Connect Server API}
Expand Down
30 changes: 30 additions & 0 deletions examples/merchant/payments/find_payments_example.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# This class was auto-generated from the API references found at
# https://epayments-api.developer-ingenico.com/s2sapi/v1/
#
require 'ingenico/connect/sdk/factory'
require 'ingenico/connect/sdk/merchant/payments/find_payments_params'

Payments = Ingenico::Connect::SDK::Merchant::Payments

def example
get_client do |client|
query = Payments::FindPaymentsParams.new
query.merchant_reference = 'AcmeOrder0001'
query.merchant_order_id = 123456
query.offset = 0
query.limit = 10

response = client.merchant('merchantId').payments().find(query)
end
end

def get_client
api_key_id = ENV.fetch('connect.api.apiKeyId', 'someKey')
secret_api_key = ENV.fetch('connect.api.secretApiKey', 'someSecret')
configuration_file_name = File.join(__FILE__, '..', '..', 'example_configuration.yml')
yield client = Ingenico::Connect::SDK::Factory.create_client_from_file(configuration_file_name, api_key_id, secret_api_key)
ensure
# Free networking resources when done
client.close unless client.nil?
end
30 changes: 30 additions & 0 deletions examples/merchant/payouts/find_payouts_example.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# This class was auto-generated from the API references found at
# https://epayments-api.developer-ingenico.com/s2sapi/v1/
#
require 'ingenico/connect/sdk/factory'
require 'ingenico/connect/sdk/merchant/payouts/find_payouts_params'

Payouts = Ingenico::Connect::SDK::Merchant::Payouts

def example
get_client do |client|
query = Payouts::FindPayoutsParams.new
query.merchant_reference = 'AcmeOrder0001'
query.merchant_order_id = 123456
query.offset = 0
query.limit = 10

response = client.merchant('merchantId').payouts().find(query)
end
end

def get_client
api_key_id = ENV.fetch('connect.api.apiKeyId', 'someKey')
secret_api_key = ENV.fetch('connect.api.secretApiKey', 'someSecret')
configuration_file_name = File.join(__FILE__, '..', '..', 'example_configuration.yml')
yield client = Ingenico::Connect::SDK::Factory.create_client_from_file(configuration_file_name, api_key_id, secret_api_key)
ensure
# Free networking resources when done
client.close unless client.nil?
end
30 changes: 30 additions & 0 deletions examples/merchant/refunds/find_refunds_example.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# This class was auto-generated from the API references found at
# https://epayments-api.developer-ingenico.com/s2sapi/v1/
#
require 'ingenico/connect/sdk/factory'
require 'ingenico/connect/sdk/merchant/refunds/find_refunds_params'

Refunds = Ingenico::Connect::SDK::Merchant::Refunds

def example
get_client do |client|
query = Refunds::FindRefundsParams.new
query.merchant_reference = 'AcmeOrder0001'
query.merchant_order_id = 123456
query.offset = 0
query.limit = 10

response = client.merchant('merchantId').refunds().find(query)
end
end

def get_client
api_key_id = ENV.fetch('connect.api.apiKeyId', 'someKey')
secret_api_key = ENV.fetch('connect.api.secretApiKey', 'someSecret')
configuration_file_name = File.join(__FILE__, '..', '..', 'example_configuration.yml')
yield client = Ingenico::Connect::SDK::Factory.create_client_from_file(configuration_file_name, api_key_id, secret_api_key)
ensure
# Free networking resources when done
client.close unless client.nil?
end
59 changes: 59 additions & 0 deletions lib/ingenico/connect/sdk/domain/payment/find_payments_response.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#
# This class was auto-generated from the API references found at
# https://epayments-api.developer-ingenico.com/s2sapi/v1/
#
require 'ingenico/connect/sdk/data_object'
require 'ingenico/connect/sdk/domain/payment/payment'

module Ingenico::Connect::SDK
module Domain
module Payment

class FindPaymentsResponse < Ingenico::Connect::SDK::DataObject

# Integer
attr_accessor :limit

# Integer
attr_accessor :offset

# Array of {Ingenico::Connect::SDK::Domain::Payment::Payment}
attr_accessor :payments

# Integer
attr_accessor :total_count

def to_h
hash = super
add_to_hash(hash, 'limit', @limit)
add_to_hash(hash, 'offset', @offset)
add_to_hash(hash, 'payments', @payments)
add_to_hash(hash, 'totalCount', @total_count)
hash
end

def from_hash(hash)
super
if hash.has_key?('limit')
@limit = hash['limit']
end
if hash.has_key?('offset')
@offset = hash['offset']
end
if hash.has_key?('payments')
if !(hash['payments'].is_a? Array)
raise TypeError, "value '%s' is not an Array" % [hash['payments']]
end
@payments = []
hash['payments'].each do |e|
@payments << Ingenico::Connect::SDK::Domain::Payment::Payment.new_from_hash(e)
end
end
if hash.has_key?('totalCount')
@total_count = hash['totalCount']
end
end
end
end
end
end
59 changes: 59 additions & 0 deletions lib/ingenico/connect/sdk/domain/payout/find_payouts_response.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#
# This class was auto-generated from the API references found at
# https://epayments-api.developer-ingenico.com/s2sapi/v1/
#
require 'ingenico/connect/sdk/data_object'
require 'ingenico/connect/sdk/domain/payout/payout_result'

module Ingenico::Connect::SDK
module Domain
module Payout

class FindPayoutsResponse < Ingenico::Connect::SDK::DataObject

# Integer
attr_accessor :limit

# Integer
attr_accessor :offset

# Array of {Ingenico::Connect::SDK::Domain::Payout::PayoutResult}
attr_accessor :payouts

# Integer
attr_accessor :total_count

def to_h
hash = super
add_to_hash(hash, 'limit', @limit)
add_to_hash(hash, 'offset', @offset)
add_to_hash(hash, 'payouts', @payouts)
add_to_hash(hash, 'totalCount', @total_count)
hash
end

def from_hash(hash)
super
if hash.has_key?('limit')
@limit = hash['limit']
end
if hash.has_key?('offset')
@offset = hash['offset']
end
if hash.has_key?('payouts')
if !(hash['payouts'].is_a? Array)
raise TypeError, "value '%s' is not an Array" % [hash['payouts']]
end
@payouts = []
hash['payouts'].each do |e|
@payouts << Ingenico::Connect::SDK::Domain::Payout::PayoutResult.new_from_hash(e)
end
end
if hash.has_key?('totalCount')
@total_count = hash['totalCount']
end
end
end
end
end
end
59 changes: 59 additions & 0 deletions lib/ingenico/connect/sdk/domain/refund/find_refunds_response.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#
# This class was auto-generated from the API references found at
# https://epayments-api.developer-ingenico.com/s2sapi/v1/
#
require 'ingenico/connect/sdk/data_object'
require 'ingenico/connect/sdk/domain/refund/refund_result'

module Ingenico::Connect::SDK
module Domain
module Refund

class FindRefundsResponse < Ingenico::Connect::SDK::DataObject

# Integer
attr_accessor :limit

# Integer
attr_accessor :offset

# Array of {Ingenico::Connect::SDK::Domain::Refund::RefundResult}
attr_accessor :refunds

# Integer
attr_accessor :total_count

def to_h
hash = super
add_to_hash(hash, 'limit', @limit)
add_to_hash(hash, 'offset', @offset)
add_to_hash(hash, 'refunds', @refunds)
add_to_hash(hash, 'totalCount', @total_count)
hash
end

def from_hash(hash)
super
if hash.has_key?('limit')
@limit = hash['limit']
end
if hash.has_key?('offset')
@offset = hash['offset']
end
if hash.has_key?('refunds')
if !(hash['refunds'].is_a? Array)
raise TypeError, "value '%s' is not an Array" % [hash['refunds']]
end
@refunds = []
hash['refunds'].each do |e|
@refunds << Ingenico::Connect::SDK::Domain::Refund::RefundResult.new_from_hash(e)
end
end
if hash.has_key?('totalCount')
@total_count = hash['totalCount']
end
end
end
end
end
end
38 changes: 38 additions & 0 deletions lib/ingenico/connect/sdk/merchant/payments/find_payments_params.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#
# This class was auto-generated from the API references found at
# https://epayments-api.developer-ingenico.com/s2sapi/v1/
#
require 'ingenico/connect/sdk/param_request'

module Ingenico::Connect::SDK
module Merchant
module Payments

# Query parameters for {https://epayments-api.developer-ingenico.com/s2sapi/v1/en_US/ruby/payments/find.html Find payments}
class FindPaymentsParams < Ingenico::Connect::SDK::ParamRequest

# String
attr_accessor :merchant_reference

# Integer
attr_accessor :merchant_order_id

# Integer
attr_accessor :offset

# Integer
attr_accessor :limit

# Returns an Array of {Ingenico::Connect::SDK::RequestParam} objects representing the attributes of this class
def to_request_parameters
result = []
add_parameter(result, 'merchantReference', @merchant_reference)
add_parameter(result, 'merchantOrderId', @merchant_order_id)
add_parameter(result, 'offset', @offset)
add_parameter(result, 'limit', @limit)
result
end
end
end
end
end
30 changes: 30 additions & 0 deletions lib/ingenico/connect/sdk/merchant/payments/payments_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
require 'ingenico/connect/sdk/domain/payment/cancel_payment_response'
require 'ingenico/connect/sdk/domain/payment/complete_payment_response'
require 'ingenico/connect/sdk/domain/payment/create_payment_response'
require 'ingenico/connect/sdk/domain/payment/find_payments_response'
require 'ingenico/connect/sdk/domain/payment/payment_approval_response'
require 'ingenico/connect/sdk/domain/payment/payment_error_response'
require 'ingenico/connect/sdk/domain/payment/payment_response'
Expand All @@ -32,6 +33,35 @@ def initialize(parent, path_context)
super(parent, path_context)
end

# Resource /{{merchantId}}/payments
#
# {https://epayments-api.developer-ingenico.com/s2sapi/v1/en_US/ruby/payments/find.html Find payments}
# query:: {Ingenico::Connect::SDK::Merchant::Payments::FindPaymentsParams}
# context:: {Ingenico::Connect::SDK::CallContext}
# Returns:: {Ingenico::Connect::SDK::Domain::Payment::FindPaymentsResponse}
# Raises:: {Ingenico::Connect::SDK::ValidationException} if the request was not correct and couldn't be processed (HTTP status code 400)
# Raises:: {Ingenico::Connect::SDK::AuthorizationException} if the request was not allowed (HTTP status code 403)
# Raises:: {Ingenico::Connect::SDK::IdempotenceException} if an idempotent request caused a conflict (HTTP status code 409)
# Raises:: {Ingenico::Connect::SDK::ReferenceException} if an object was attempted to be referenced that doesn't exist or has been removed,
# or there was a conflict (HTTP status code 404, 409 or 410)
# Raises:: {Ingenico::Connect::SDK::GlobalCollectException} if something went wrong at the Ingenico ePayments platform,
# the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
# or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
# Raises:: {Ingenico::Connect::SDK::ApiException} if the Ingenico ePayments platform returned any other error
def find(query, context=nil)
uri = instantiate_uri('/{apiVersion}/{merchantId}/payments', nil)
return @communicator.get(
uri,
client_headers,
query,
Ingenico::Connect::SDK::Domain::Payment::FindPaymentsResponse,
context)
rescue ResponseException => e
error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
error_object = @communicator.marshaller.unmarshal(e.body, error_type)
raise create_exception(e.status_code, e.body, error_object, context)
end

# Resource /{{merchantId}}/payments
#
# {https://epayments-api.developer-ingenico.com/s2sapi/v1/en_US/ruby/payments/create.html Create payment}
Expand Down
Loading

0 comments on commit 6e0334b

Please sign in to comment.