Skip to content

Commit

Permalink
Release 1.0.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
WorldlineAcquiring committed Dec 11, 2024
1 parent 547abb7 commit b7ea724
Show file tree
Hide file tree
Showing 29 changed files with 697 additions and 35 deletions.
2 changes: 1 addition & 1 deletion acquiring-sdk-ruby.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |spec|
spec.name = 'acquiring-sdk-ruby'
spec.version = '0.1.0'
spec.version = '1.0.0'
spec.authors = ['Worldline Acquiring']
spec.email = ['github.acquiring@worldline.com']
spec.summary = %q{SDK to communicate with the Worldline Acquiring platform using the Worldline Acquiring API}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Communication
class MetadataProvider
private

SDK_VERSION = '0.1.0'.freeze
SDK_VERSION = '1.0.0'.freeze
SERVER_META_INFO_HEADER = 'X-WL-ServerMetaInfo'.freeze
PROHIBITED_HEADERS = [SERVER_META_INFO_HEADER, 'Date', 'Content-Type', 'Authorization'].sort!.freeze
CHARSET = 'utf-8'.freeze
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#
# This file was automatically generated.
#
Dir[File.join(__dir__, 'balanceinquiries', '*.rb')].each { |f| require f }
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#
# This file was automatically generated.
#
require 'worldline/acquiring/sdk/api_resource'
require 'worldline/acquiring/sdk/communication/response_exception'
require 'worldline/acquiring/sdk/v1/exception_factory'
require 'worldline/acquiring/sdk/v1/domain/api_balance_inquiry_response'
require 'worldline/acquiring/sdk/v1/domain/api_payment_error_response'

module Worldline
module Acquiring
module SDK
module V1
module Acquirer
module Merchant
module Balanceinquiries
# BalanceInquiries client. Thread-safe.
class BalanceInquiriesClient < Worldline::Acquiring::SDK::ApiResource

# @param parent [Worldline::Acquiring::SDK::ApiResource]
# @param path_context [Hash, nil]
def initialize(parent, path_context)
super(parent: parent, path_context: path_context)
end

# Resource /processing/v1/!{acquirerId}/!{merchantId}/balance-inquiries - {https://docs.acquiring.worldline-solutions.com/api-reference#tag/Balance-Inquiries/operation/processBalanceInquiry Balance inquiry}
#
# @param body [Worldline::Acquiring::SDK::V1::Domain::ApiBalanceInquiryRequest]
# @param context [Worldline::Acquiring::SDK::CallContext, nil]
# @return [Worldline::Acquiring::SDK::V1::Domain::ApiBalanceInquiryResponse]
# @raise [Worldline::Acquiring::SDK::V1::ValidationException] if the request was not correct and couldn't be processed (HTTP status code 400)
# @raise [Worldline::Acquiring::SDK::V1::AuthorizationException] if the request was not allowed (HTTP status code 403)
# @raise [Worldline::Acquiring::SDK::V1::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)
# @raise [Worldline::Acquiring::SDK::V1::PlatformException] if something went wrong at the Worldline Acquiring platform,
# the Worldline Acquiring 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)
# @raise [Worldline::Acquiring::SDK::V1::ApiException] if the Worldline Acquiring platform returned any other error
def process_balance_inquiry(body, context = nil)
uri = instantiate_uri('/processing/v1/{acquirerId}/{merchantId}/balance-inquiries', nil)
@communicator.post(
uri,
nil,
nil,
body,
Worldline::Acquiring::SDK::V1::Domain::ApiBalanceInquiryResponse,
context)
rescue Worldline::Acquiring::SDK::Communication::ResponseException => e
error_type = Worldline::Acquiring::SDK::V1::Domain::ApiPaymentErrorResponse
error_object = @communicator.marshaller.unmarshal(e.body, error_type)
raise Worldline::Acquiring::SDK::V1.create_exception(e.status_code, e.body, error_object, context)
end
end
end
end
end
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
require 'worldline/acquiring/sdk/api_resource'
require 'worldline/acquiring/sdk/v1/acquirer/merchant/accountverifications/account_verifications_client'
require 'worldline/acquiring/sdk/v1/acquirer/merchant/balanceinquiries/balance_inquiries_client'
require 'worldline/acquiring/sdk/v1/acquirer/merchant/dynamiccurrencyconversion/dynamic_currency_conversion_client'
require 'worldline/acquiring/sdk/v1/acquirer/merchant/payments/payments_client'
require 'worldline/acquiring/sdk/v1/acquirer/merchant/refunds/refunds_client'
Expand Down Expand Up @@ -44,6 +45,13 @@ def account_verifications
Worldline::Acquiring::SDK::V1::Acquirer::Merchant::Accountverifications::AccountVerificationsClient.new(self, nil)
end

# Resource /processing/v1/{acquirerId}/{merchantId}/balance-inquiries
#
# @return [Worldline::Acquiring::SDK::V1::Acquirer::Merchant::Balanceinquiries::BalanceInquiriesClient]
def balance_inquiries
Worldline::Acquiring::SDK::V1::Acquirer::Merchant::Balanceinquiries::BalanceInquiriesClient.new(self, nil)
end

# Resource /processing/v1/{acquirerId}/{merchantId}/operations/{operationId}/reverse
#
# @return [Worldline::Acquiring::SDK::V1::Acquirer::Merchant::Technicalreversals::TechnicalReversalsClient]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
require 'worldline/acquiring/sdk/v1/domain/card_payment_data_for_verification'
require 'worldline/acquiring/sdk/v1/domain/merchant_data'
require 'worldline/acquiring/sdk/v1/domain/payment_references'
require 'worldline/acquiring/sdk/v1/domain/terminal_data'

module Worldline
module Acquiring
Expand All @@ -17,6 +18,7 @@ module Domain
# @attr [Worldline::Acquiring::SDK::V1::Domain::MerchantData] merchant
# @attr [String] operation_id
# @attr [Worldline::Acquiring::SDK::V1::Domain::PaymentReferences] references
# @attr [Worldline::Acquiring::SDK::V1::Domain::TerminalData] terminal_data
# @attr [DateTime] transaction_timestamp
class ApiAccountVerificationRequest < Worldline::Acquiring::SDK::Domain::DataObject

Expand All @@ -28,6 +30,8 @@ class ApiAccountVerificationRequest < Worldline::Acquiring::SDK::Domain::DataObj

attr_accessor :references

attr_accessor :terminal_data

attr_accessor :transaction_timestamp

# @return (Hash)
Expand All @@ -37,6 +41,7 @@ def to_h
hash['merchant'] = @merchant.to_h unless @merchant.nil?
hash['operationId'] = @operation_id unless @operation_id.nil?
hash['references'] = @references.to_h unless @references.nil?
hash['terminalData'] = @terminal_data.to_h unless @terminal_data.nil?
hash['transactionTimestamp'] = @transaction_timestamp.iso8601(3) unless @transaction_timestamp.nil?
hash
end
Expand All @@ -58,6 +63,10 @@ def from_hash(hash)
raise TypeError, "value '%s' is not a Hash" % [hash['references']] unless hash['references'].is_a? Hash
@references = Worldline::Acquiring::SDK::V1::Domain::PaymentReferences.new_from_hash(hash['references'])
end
if hash.has_key? 'terminalData'
raise TypeError, "value '%s' is not a Hash" % [hash['terminalData']] unless hash['terminalData'].is_a? Hash
@terminal_data = Worldline::Acquiring::SDK::V1::Domain::TerminalData.new_from_hash(hash['terminalData'])
end
if hash.has_key? 'transactionTimestamp'
@transaction_timestamp = DateTime.parse(hash['transactionTimestamp'])
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#
# This file was automatically generated.
#
require 'date'

require 'worldline/acquiring/sdk/domain/data_object'
require 'worldline/acquiring/sdk/v1/domain/card_payment_data_for_balance_inquiry'
require 'worldline/acquiring/sdk/v1/domain/merchant_data'
require 'worldline/acquiring/sdk/v1/domain/payment_references'
require 'worldline/acquiring/sdk/v1/domain/terminal_data'

module Worldline
module Acquiring
module SDK
module V1
module Domain
# @attr [Worldline::Acquiring::SDK::V1::Domain::CardPaymentDataForBalanceInquiry] card_payment_data
# @attr [Worldline::Acquiring::SDK::V1::Domain::MerchantData] merchant
# @attr [String] operation_id
# @attr [Worldline::Acquiring::SDK::V1::Domain::PaymentReferences] references
# @attr [Worldline::Acquiring::SDK::V1::Domain::TerminalData] terminal_data
# @attr [DateTime] transaction_timestamp
class ApiBalanceInquiryRequest < Worldline::Acquiring::SDK::Domain::DataObject

attr_accessor :card_payment_data

attr_accessor :merchant

attr_accessor :operation_id

attr_accessor :references

attr_accessor :terminal_data

attr_accessor :transaction_timestamp

# @return (Hash)
def to_h
hash = super
hash['cardPaymentData'] = @card_payment_data.to_h unless @card_payment_data.nil?
hash['merchant'] = @merchant.to_h unless @merchant.nil?
hash['operationId'] = @operation_id unless @operation_id.nil?
hash['references'] = @references.to_h unless @references.nil?
hash['terminalData'] = @terminal_data.to_h unless @terminal_data.nil?
hash['transactionTimestamp'] = @transaction_timestamp.iso8601(3) unless @transaction_timestamp.nil?
hash
end

def from_hash(hash)
super
if hash.has_key? 'cardPaymentData'
raise TypeError, "value '%s' is not a Hash" % [hash['cardPaymentData']] unless hash['cardPaymentData'].is_a? Hash
@card_payment_data = Worldline::Acquiring::SDK::V1::Domain::CardPaymentDataForBalanceInquiry.new_from_hash(hash['cardPaymentData'])
end
if hash.has_key? 'merchant'
raise TypeError, "value '%s' is not a Hash" % [hash['merchant']] unless hash['merchant'].is_a? Hash
@merchant = Worldline::Acquiring::SDK::V1::Domain::MerchantData.new_from_hash(hash['merchant'])
end
if hash.has_key? 'operationId'
@operation_id = hash['operationId']
end
if hash.has_key? 'references'
raise TypeError, "value '%s' is not a Hash" % [hash['references']] unless hash['references'].is_a? Hash
@references = Worldline::Acquiring::SDK::V1::Domain::PaymentReferences.new_from_hash(hash['references'])
end
if hash.has_key? 'terminalData'
raise TypeError, "value '%s' is not a Hash" % [hash['terminalData']] unless hash['terminalData'].is_a? Hash
@terminal_data = Worldline::Acquiring::SDK::V1::Domain::TerminalData.new_from_hash(hash['terminalData'])
end
if hash.has_key? 'transactionTimestamp'
@transaction_timestamp = DateTime.parse(hash['transactionTimestamp'])
end
end
end
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#
# This file was automatically generated.
#
require 'worldline/acquiring/sdk/domain/data_object'
require 'worldline/acquiring/sdk/v1/domain/amount_data'
require 'worldline/acquiring/sdk/v1/domain/api_references_for_responses'

module Worldline
module Acquiring
module SDK
module V1
module Domain
# @attr [String] authorization_code
# @attr [Worldline::Acquiring::SDK::V1::Domain::AmountData] available_amount
# @attr [String] operation_id
# @attr [Worldline::Acquiring::SDK::V1::Domain::ApiReferencesForResponses] references
# @attr [String] responder
# @attr [String] response_code
# @attr [String] response_code_category
# @attr [String] response_code_description
class ApiBalanceInquiryResponse < Worldline::Acquiring::SDK::Domain::DataObject

attr_accessor :authorization_code

attr_accessor :available_amount

attr_accessor :operation_id

attr_accessor :references

attr_accessor :responder

attr_accessor :response_code

attr_accessor :response_code_category

attr_accessor :response_code_description

# @return (Hash)
def to_h
hash = super
hash['authorizationCode'] = @authorization_code unless @authorization_code.nil?
hash['availableAmount'] = @available_amount.to_h unless @available_amount.nil?
hash['operationId'] = @operation_id unless @operation_id.nil?
hash['references'] = @references.to_h unless @references.nil?
hash['responder'] = @responder unless @responder.nil?
hash['responseCode'] = @response_code unless @response_code.nil?
hash['responseCodeCategory'] = @response_code_category unless @response_code_category.nil?
hash['responseCodeDescription'] = @response_code_description unless @response_code_description.nil?
hash
end

def from_hash(hash)
super
if hash.has_key? 'authorizationCode'
@authorization_code = hash['authorizationCode']
end
if hash.has_key? 'availableAmount'
raise TypeError, "value '%s' is not a Hash" % [hash['availableAmount']] unless hash['availableAmount'].is_a? Hash
@available_amount = Worldline::Acquiring::SDK::V1::Domain::AmountData.new_from_hash(hash['availableAmount'])
end
if hash.has_key? 'operationId'
@operation_id = hash['operationId']
end
if hash.has_key? 'references'
raise TypeError, "value '%s' is not a Hash" % [hash['references']] unless hash['references'].is_a? Hash
@references = Worldline::Acquiring::SDK::V1::Domain::ApiReferencesForResponses.new_from_hash(hash['references'])
end
if hash.has_key? 'responder'
@responder = hash['responder']
end
if hash.has_key? 'responseCode'
@response_code = hash['responseCode']
end
if hash.has_key? 'responseCodeCategory'
@response_code_category = hash['responseCodeCategory']
end
if hash.has_key? 'responseCodeDescription'
@response_code_description = hash['responseCodeDescription']
end
end
end
end
end
end
end
end
18 changes: 18 additions & 0 deletions lib/worldline/acquiring/sdk/v1/domain/api_capture_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
require 'worldline/acquiring/sdk/domain/data_object'
require 'worldline/acquiring/sdk/v1/domain/amount_data'
require 'worldline/acquiring/sdk/v1/domain/dcc_data'
require 'worldline/acquiring/sdk/v1/domain/payment_references'
require 'worldline/acquiring/sdk/v1/domain/terminal_data'

module Worldline
module Acquiring
Expand All @@ -17,6 +19,8 @@ module Domain
# @attr [Worldline::Acquiring::SDK::V1::Domain::DccData] dynamic_currency_conversion
# @attr [true/false] is_final
# @attr [String] operation_id
# @attr [Worldline::Acquiring::SDK::V1::Domain::PaymentReferences] references
# @attr [Worldline::Acquiring::SDK::V1::Domain::TerminalData] terminal_data
# @attr [DateTime] transaction_timestamp
class ApiCaptureRequest < Worldline::Acquiring::SDK::Domain::DataObject

Expand All @@ -30,6 +34,10 @@ class ApiCaptureRequest < Worldline::Acquiring::SDK::Domain::DataObject

attr_accessor :operation_id

attr_accessor :references

attr_accessor :terminal_data

attr_accessor :transaction_timestamp

# @return (Hash)
Expand All @@ -40,6 +48,8 @@ def to_h
hash['dynamicCurrencyConversion'] = @dynamic_currency_conversion.to_h unless @dynamic_currency_conversion.nil?
hash['isFinal'] = @is_final unless @is_final.nil?
hash['operationId'] = @operation_id unless @operation_id.nil?
hash['references'] = @references.to_h unless @references.nil?
hash['terminalData'] = @terminal_data.to_h unless @terminal_data.nil?
hash['transactionTimestamp'] = @transaction_timestamp.iso8601(3) unless @transaction_timestamp.nil?
hash
end
Expand All @@ -63,6 +73,14 @@ def from_hash(hash)
if hash.has_key? 'operationId'
@operation_id = hash['operationId']
end
if hash.has_key? 'references'
raise TypeError, "value '%s' is not a Hash" % [hash['references']] unless hash['references'].is_a? Hash
@references = Worldline::Acquiring::SDK::V1::Domain::PaymentReferences.new_from_hash(hash['references'])
end
if hash.has_key? 'terminalData'
raise TypeError, "value '%s' is not a Hash" % [hash['terminalData']] unless hash['terminalData'].is_a? Hash
@terminal_data = Worldline::Acquiring::SDK::V1::Domain::TerminalData.new_from_hash(hash['terminalData'])
end
if hash.has_key? 'transactionTimestamp'
@transaction_timestamp = DateTime.parse(hash['transactionTimestamp'])
end
Expand Down
Loading

0 comments on commit b7ea724

Please sign in to comment.