first_data_gateway 1.0.1
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 +7 -0
- data/Gemfile +7 -0
- data/README.md +123 -0
- data/Rakefile +8 -0
- data/docs/AccessTokenResponse.md +11 -0
- data/docs/Address.md +14 -0
- data/docs/Airline.md +21 -0
- data/docs/AirlineAncillaryServiceCategory.md +8 -0
- data/docs/AirlineTravelRoute.md +16 -0
- data/docs/Amount.md +10 -0
- data/docs/AmountComponents.md +14 -0
- data/docs/AuthenticationApi.md +68 -0
- data/docs/AuthenticationResponseVerification.md +10 -0
- data/docs/BasketItem.md +11 -0
- data/docs/Billing.md +13 -0
- data/docs/CarRental.md +15 -0
- data/docs/CarRentalExtraCharges.md +8 -0
- data/docs/CardVerificationsTransaction.md +9 -0
- data/docs/ClientLocale.md +9 -0
- data/docs/Contact.md +11 -0
- data/docs/Error.md +10 -0
- data/docs/ErrorDetails.md +9 -0
- data/docs/ErrorResponse.md +11 -0
- data/docs/Expiration.md +9 -0
- data/docs/Frequency.md +9 -0
- data/docs/IndustrySpecificExtensions.md +10 -0
- data/docs/InstallmentOptions.md +10 -0
- data/docs/Lodging.md +12 -0
- data/docs/LodgingExtraCharges.md +8 -0
- data/docs/Order.md +10 -0
- data/docs/OrderApi.md +148 -0
- data/docs/PayPal.md +8 -0
- data/docs/PaymentApi.md +345 -0
- data/docs/PaymentCard.md +15 -0
- data/docs/PaymentCardAuthenticationRequest.md +8 -0
- data/docs/PaymentCardAuthenticationResult.md +12 -0
- data/docs/PaymentMethod.md +11 -0
- data/docs/PaymentSchedulesRequest.md +21 -0
- data/docs/PaymentSchedulesResponse.md +11 -0
- data/docs/PaymentUrlRequest.md +11 -0
- data/docs/PaymentUrlResponse.md +13 -0
- data/docs/PrimaryTransaction.md +18 -0
- data/docs/PrimaryTransactionAdditionalDetails.md +14 -0
- data/docs/ProcessorData.md +10 -0
- data/docs/ResponseType.md +7 -0
- data/docs/SecondaryTransaction.md +9 -0
- data/docs/Sepa.md +12 -0
- data/docs/SepaMandate.md +11 -0
- data/docs/Shipping.md +10 -0
- data/docs/SplitShipment.md +9 -0
- data/docs/StoredCredential.md +11 -0
- data/docs/TransactionErrorResponse.md +28 -0
- data/docs/TransactionResponse.md +27 -0
- data/docs/TransactionResponseAuthenticationRedirect.md +10 -0
- data/docs/TransactionResponseAuthenticationRedirectParams.md +10 -0
- data/docs/TransactionType.md +7 -0
- data/first_data_gateway.gemspec +45 -0
- data/git_push.sh +55 -0
- data/lib/simple/client_context.rb +15 -0
- data/lib/simple/gateway.rb +155 -0
- data/lib/simple/merchant_credentials.rb +10 -0
- data/lib/simple/signature.rb +52 -0
- data/lib/simple_client.rb +4 -0
- data/lib/swagger_client.rb +91 -0
- data/lib/swagger_client/api/authentication_api.rb +111 -0
- data/lib/swagger_client/api/order_api.rb +229 -0
- data/lib/swagger_client/api/payment_api.rb +517 -0
- data/lib/swagger_client/api_client.rb +390 -0
- data/lib/swagger_client/api_error.rb +38 -0
- data/lib/swagger_client/configuration.rb +202 -0
- data/lib/swagger_client/models/access_token_response.rb +252 -0
- data/lib/swagger_client/models/address.rb +361 -0
- data/lib/swagger_client/models/airline.rb +487 -0
- data/lib/swagger_client/models/airline_ancillary_service_category.rb +221 -0
- data/lib/swagger_client/models/airline_travel_route.rb +406 -0
- data/lib/swagger_client/models/amount.rb +217 -0
- data/lib/swagger_client/models/amount_components.rb +242 -0
- data/lib/swagger_client/models/authentication_response_verification.rb +239 -0
- data/lib/swagger_client/models/basket_item.rb +218 -0
- data/lib/swagger_client/models/billing.rb +282 -0
- data/lib/swagger_client/models/car_rental.rb +317 -0
- data/lib/swagger_client/models/car_rental_extra_charges.rb +221 -0
- data/lib/swagger_client/models/card_verifications_transaction.rb +203 -0
- data/lib/swagger_client/models/client_locale.rb +209 -0
- data/lib/swagger_client/models/contact.rb +279 -0
- data/lib/swagger_client/models/error.rb +211 -0
- data/lib/swagger_client/models/error_details.rb +199 -0
- data/lib/swagger_client/models/error_response.rb +218 -0
- data/lib/swagger_client/models/expiration.rb +207 -0
- data/lib/swagger_client/models/frequency.rb +270 -0
- data/lib/swagger_client/models/industry_specific_extensions.rb +206 -0
- data/lib/swagger_client/models/installment_options.rb +259 -0
- data/lib/swagger_client/models/lodging.rb +245 -0
- data/lib/swagger_client/models/lodging_extra_charges.rb +221 -0
- data/lib/swagger_client/models/order.rb +206 -0
- data/lib/swagger_client/models/pay_pal.rb +213 -0
- data/lib/swagger_client/models/payment_card.rb +294 -0
- data/lib/swagger_client/models/payment_card_authentication_request.rb +222 -0
- data/lib/swagger_client/models/payment_card_authentication_result.rb +336 -0
- data/lib/swagger_client/models/payment_method.rb +254 -0
- data/lib/swagger_client/models/payment_schedules_request.rb +398 -0
- data/lib/swagger_client/models/payment_schedules_response.rb +267 -0
- data/lib/swagger_client/models/payment_url_request.rb +232 -0
- data/lib/swagger_client/models/payment_url_response.rb +286 -0
- data/lib/swagger_client/models/primary_transaction.rb +298 -0
- data/lib/swagger_client/models/primary_transaction_additional_details.rb +244 -0
- data/lib/swagger_client/models/processor_data.rb +216 -0
- data/lib/swagger_client/models/response_type.rb +37 -0
- data/lib/swagger_client/models/secondary_transaction.rb +197 -0
- data/lib/swagger_client/models/sepa.rb +321 -0
- data/lib/swagger_client/models/sepa_mandate.rb +321 -0
- data/lib/swagger_client/models/shipping.rb +222 -0
- data/lib/swagger_client/models/split_shipment.rb +201 -0
- data/lib/swagger_client/models/stored_credential.rb +290 -0
- data/lib/swagger_client/models/transaction_error_response.rb +445 -0
- data/lib/swagger_client/models/transaction_response.rb +436 -0
- data/lib/swagger_client/models/transaction_response_authentication_redirect.rb +239 -0
- data/lib/swagger_client/models/transaction_response_authentication_redirect_params.rb +206 -0
- data/lib/swagger_client/models/transaction_type.rb +36 -0
- data/lib/swagger_client/version.rb +15 -0
- data/spec/api/authentication_api_spec.rb +51 -0
- data/spec/api/order_api_spec.rb +73 -0
- data/spec/api/payment_api_spec.rb +126 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/access_token_response_spec.rb +64 -0
- data/spec/models/address_spec.rb +78 -0
- data/spec/models/airline_ancillary_service_category_spec.rb +46 -0
- data/spec/models/airline_spec.rb +124 -0
- data/spec/models/airline_travel_route_spec.rb +94 -0
- data/spec/models/amount_components_spec.rb +78 -0
- data/spec/models/amount_spec.rb +54 -0
- data/spec/models/authentication_response_verification_spec.rb +58 -0
- data/spec/models/basket_item_spec.rb +60 -0
- data/spec/models/billing_spec.rb +76 -0
- data/spec/models/car_rental_extra_charges_spec.rb +46 -0
- data/spec/models/car_rental_spec.rb +84 -0
- data/spec/models/card_verifications_transaction_spec.rb +48 -0
- data/spec/models/client_locale_spec.rb +48 -0
- data/spec/models/contact_spec.rb +60 -0
- data/spec/models/error_details_spec.rb +48 -0
- data/spec/models/error_response_spec.rb +60 -0
- data/spec/models/error_spec.rb +54 -0
- data/spec/models/expiration_spec.rb +48 -0
- data/spec/models/frequency_spec.rb +52 -0
- data/spec/models/industry_specific_extensions_spec.rb +54 -0
- data/spec/models/installment_options_spec.rb +54 -0
- data/spec/models/lodging_extra_charges_spec.rb +46 -0
- data/spec/models/lodging_spec.rb +66 -0
- data/spec/models/order_spec.rb +54 -0
- data/spec/models/pay_pal_spec.rb +42 -0
- data/spec/models/payment_card_authentication_request_spec.rb +46 -0
- data/spec/models/payment_card_authentication_result_spec.rb +78 -0
- data/spec/models/payment_card_spec.rb +88 -0
- data/spec/models/payment_method_spec.rb +64 -0
- data/spec/models/payment_schedules_request_spec.rb +124 -0
- data/spec/models/payment_schedules_response_spec.rb +64 -0
- data/spec/models/payment_url_request_spec.rb +60 -0
- data/spec/models/payment_url_response_spec.rb +76 -0
- data/spec/models/primary_transaction_additional_details_spec.rb +78 -0
- data/spec/models/primary_transaction_spec.rb +102 -0
- data/spec/models/processor_data_spec.rb +54 -0
- data/spec/models/response_type_spec.rb +36 -0
- data/spec/models/secondary_transaction_spec.rb +48 -0
- data/spec/models/sepa_mandate_spec.rb +64 -0
- data/spec/models/sepa_spec.rb +66 -0
- data/spec/models/shipping_spec.rb +54 -0
- data/spec/models/split_shipment_spec.rb +48 -0
- data/spec/models/stored_credential_spec.rb +68 -0
- data/spec/models/transaction_error_response_spec.rb +170 -0
- data/spec/models/transaction_response_authentication_redirect_params_spec.rb +54 -0
- data/spec/models/transaction_response_authentication_redirect_spec.rb +58 -0
- data/spec/models/transaction_response_spec.rb +164 -0
- data/spec/models/transaction_type_spec.rb +36 -0
- data/spec/spec_helper.rb +111 -0
- metadata +457 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module SimpleClient
|
|
2
|
+
class ClientContext
|
|
3
|
+
attr_reader :client, :config, :credentials
|
|
4
|
+
|
|
5
|
+
def self.create(credentials)
|
|
6
|
+
return self.new(credentials)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def initialize(credentials)
|
|
10
|
+
@config = SwaggerClient::Configuration.new
|
|
11
|
+
@client = SwaggerClient::ApiClient.new(@config)
|
|
12
|
+
@credentials = credentials
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
module SimpleClient
|
|
4
|
+
class Gateway
|
|
5
|
+
|
|
6
|
+
CONTENT_TYPE = "application/json"
|
|
7
|
+
|
|
8
|
+
def self.create(credentials)
|
|
9
|
+
return self.new(ClientContext.new(credentials))
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def initialize(context)
|
|
13
|
+
@context = context
|
|
14
|
+
@authentication_api = SwaggerClient::AuthenticationApi.new(@context.client)
|
|
15
|
+
@order_api = SwaggerClient::OrderApi.new(@context.client)
|
|
16
|
+
@payment_api = SwaggerClient::PaymentApi.new(@context.client)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def request_access_token
|
|
20
|
+
signature_service = get_signature_service
|
|
21
|
+
message_signature = signature_service.sign
|
|
22
|
+
return @authentication_api.v1_authentication_access_tokens_post(
|
|
23
|
+
CONTENT_TYPE,
|
|
24
|
+
signature_service.client_request_id,
|
|
25
|
+
get_api_key,
|
|
26
|
+
signature_service.timestamp,
|
|
27
|
+
message_signature
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def primary_payment_transaction(payload)
|
|
32
|
+
signature_service = get_signature_service
|
|
33
|
+
message_signature = signature_service.sign(payload)
|
|
34
|
+
return @payment_api.primary_payment_transaction(
|
|
35
|
+
CONTENT_TYPE,
|
|
36
|
+
signature_service.client_request_id,
|
|
37
|
+
get_api_key,
|
|
38
|
+
signature_service.timestamp,
|
|
39
|
+
message_signature,
|
|
40
|
+
payload
|
|
41
|
+
)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def return_transaction(transaction_id, payload, store_id=nil)
|
|
45
|
+
opts = {store_id: store_id}
|
|
46
|
+
signature_service = get_signature_service
|
|
47
|
+
message_signature = signature_service.sign(payload)
|
|
48
|
+
return @payment_api.return_transaction(
|
|
49
|
+
CONTENT_TYPE,
|
|
50
|
+
signature_service.client_request_id,
|
|
51
|
+
get_api_key,
|
|
52
|
+
signature_service.timestamp,
|
|
53
|
+
message_signature,
|
|
54
|
+
transaction_id,
|
|
55
|
+
payload,
|
|
56
|
+
opts
|
|
57
|
+
)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def transaction_inquiry(transaction_id, store_id=nil)
|
|
61
|
+
opts = {store_id: store_id}
|
|
62
|
+
signature_service = get_signature_service
|
|
63
|
+
message_signature = signature_service.sign
|
|
64
|
+
return @payment_api.transaction_inquiry(
|
|
65
|
+
CONTENT_TYPE,
|
|
66
|
+
signature_service.client_request_id,
|
|
67
|
+
get_api_key,
|
|
68
|
+
signature_service.timestamp,
|
|
69
|
+
message_signature,
|
|
70
|
+
transaction_id,
|
|
71
|
+
opts
|
|
72
|
+
)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def void_transaction(transaction_id, store_id=nil)
|
|
76
|
+
opts = {store_id: store_id}
|
|
77
|
+
signature_service = get_signature_service
|
|
78
|
+
message_signature = signature_service.sign
|
|
79
|
+
return @payment_api.void_transaction(
|
|
80
|
+
CONTENT_TYPE,
|
|
81
|
+
signature_service.client_request_id,
|
|
82
|
+
get_api_key,
|
|
83
|
+
signature_service.timestamp,
|
|
84
|
+
message_signature,
|
|
85
|
+
transaction_id,
|
|
86
|
+
opts
|
|
87
|
+
)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def perform_payment_post_authorization_by_order(order_id, payload, store_id=nil)
|
|
91
|
+
opts = {store_id: store_id}
|
|
92
|
+
signature_service = get_signature_service
|
|
93
|
+
message_signature = signature_service.sign(payload)
|
|
94
|
+
return @order_api.perform_payment_post_authorisation(
|
|
95
|
+
CONTENT_TYPE,
|
|
96
|
+
signature_service.client_request_id,
|
|
97
|
+
get_api_key,
|
|
98
|
+
signature_service.timestamp,
|
|
99
|
+
message_signature,
|
|
100
|
+
order_id,
|
|
101
|
+
payload,
|
|
102
|
+
opts
|
|
103
|
+
)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def perform_payment_authorization_by_transaction(transaction_id, payload, store_id=nil)
|
|
107
|
+
opts = {store_id: store_id}
|
|
108
|
+
signature_service = get_signature_service
|
|
109
|
+
message_signature = signature_service.sign(payload)
|
|
110
|
+
return @payment_api.perform_payment_post_authorisation(
|
|
111
|
+
CONTENT_TYPE,
|
|
112
|
+
signature_service.client_request_id,
|
|
113
|
+
get_api_key,
|
|
114
|
+
signature_service.timestamp,
|
|
115
|
+
message_signature,
|
|
116
|
+
transaction_id,
|
|
117
|
+
payload,
|
|
118
|
+
opts
|
|
119
|
+
)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def return_transaction_by_order(order_id, payload, store_id=nil)
|
|
123
|
+
opts = {store_id: store_id}
|
|
124
|
+
signature_service = get_signature_service
|
|
125
|
+
message_signature = signature_service.sign(payload)
|
|
126
|
+
return @order_api.return_transaction(
|
|
127
|
+
CONTENT_TYPE,
|
|
128
|
+
signature_service.client_request_id,
|
|
129
|
+
get_api_key,
|
|
130
|
+
signature_service.timestamp,
|
|
131
|
+
message_signature,
|
|
132
|
+
order_id,
|
|
133
|
+
payload,
|
|
134
|
+
opts
|
|
135
|
+
)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
private
|
|
139
|
+
|
|
140
|
+
def get_signature_service
|
|
141
|
+
return Signature.new(
|
|
142
|
+
api_key: get_api_key,
|
|
143
|
+
api_secret: get_api_secret
|
|
144
|
+
)
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def get_api_key
|
|
148
|
+
@context.credentials.api_key
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def get_api_secret
|
|
152
|
+
@context.credentials.api_secret
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
require "openssl"
|
|
3
|
+
require "base64"
|
|
4
|
+
require "securerandom"
|
|
5
|
+
require "date"
|
|
6
|
+
|
|
7
|
+
module SimpleClient
|
|
8
|
+
class Signature
|
|
9
|
+
|
|
10
|
+
ATTR = [
|
|
11
|
+
:api_key,
|
|
12
|
+
:api_secret,
|
|
13
|
+
:digest
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
attr_reader :client_request_id, :timestamp
|
|
17
|
+
|
|
18
|
+
def initialize(params)
|
|
19
|
+
ATTR.each { |attr| instance_variable_set("@#{attr}", params[attr]) if params[attr] }
|
|
20
|
+
@digest = "sha256" if !@digest
|
|
21
|
+
@client_request_id = SecureRandom.uuid
|
|
22
|
+
@timestamp = DateTime.now.strftime("%Q")
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def sign(payload=nil)
|
|
26
|
+
data = @api_key + @client_request_id + @timestamp
|
|
27
|
+
data += jsonify(payload) if payload
|
|
28
|
+
hmac = OpenSSL::HMAC.hexdigest(@digest, @api_secret, data)
|
|
29
|
+
Base64.urlsafe_encode64(hmac)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def jsonify(model)
|
|
33
|
+
return model if model.nil? || model.is_a?(String)
|
|
34
|
+
local_body = nil
|
|
35
|
+
if model.is_a?(Array)
|
|
36
|
+
local_body = model.map{|m| object_to_hash(m) }
|
|
37
|
+
else
|
|
38
|
+
local_body = object_to_hash(model)
|
|
39
|
+
end
|
|
40
|
+
local_body.to_json
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def object_to_hash(obj)
|
|
44
|
+
if obj.respond_to?(:to_hash)
|
|
45
|
+
obj.to_hash
|
|
46
|
+
else
|
|
47
|
+
obj
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Payment Gateway API Specification
|
|
3
|
+
|
|
4
|
+
#Payment Gateway API for payment processing.
|
|
5
|
+
|
|
6
|
+
OpenAPI spec version: 0.0.1
|
|
7
|
+
|
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
+
Swagger Codegen version: unset
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
# Common files
|
|
14
|
+
require 'swagger_client/api_client'
|
|
15
|
+
require 'swagger_client/api_error'
|
|
16
|
+
require 'swagger_client/version'
|
|
17
|
+
require 'swagger_client/configuration'
|
|
18
|
+
|
|
19
|
+
# Models
|
|
20
|
+
require 'swagger_client/models/access_token_response'
|
|
21
|
+
require 'swagger_client/models/address'
|
|
22
|
+
require 'swagger_client/models/airline'
|
|
23
|
+
require 'swagger_client/models/airline_ancillary_service_category'
|
|
24
|
+
require 'swagger_client/models/airline_travel_route'
|
|
25
|
+
require 'swagger_client/models/amount'
|
|
26
|
+
require 'swagger_client/models/amount_components'
|
|
27
|
+
require 'swagger_client/models/authentication_response_verification'
|
|
28
|
+
require 'swagger_client/models/basket_item'
|
|
29
|
+
require 'swagger_client/models/billing'
|
|
30
|
+
require 'swagger_client/models/car_rental'
|
|
31
|
+
require 'swagger_client/models/car_rental_extra_charges'
|
|
32
|
+
require 'swagger_client/models/card_verifications_transaction'
|
|
33
|
+
require 'swagger_client/models/client_locale'
|
|
34
|
+
require 'swagger_client/models/contact'
|
|
35
|
+
require 'swagger_client/models/error'
|
|
36
|
+
require 'swagger_client/models/error_details'
|
|
37
|
+
require 'swagger_client/models/error_response'
|
|
38
|
+
require 'swagger_client/models/expiration'
|
|
39
|
+
require 'swagger_client/models/frequency'
|
|
40
|
+
require 'swagger_client/models/industry_specific_extensions'
|
|
41
|
+
require 'swagger_client/models/installment_options'
|
|
42
|
+
require 'swagger_client/models/lodging'
|
|
43
|
+
require 'swagger_client/models/lodging_extra_charges'
|
|
44
|
+
require 'swagger_client/models/order'
|
|
45
|
+
require 'swagger_client/models/pay_pal'
|
|
46
|
+
require 'swagger_client/models/payment_card'
|
|
47
|
+
require 'swagger_client/models/payment_card_authentication_request'
|
|
48
|
+
require 'swagger_client/models/payment_card_authentication_result'
|
|
49
|
+
require 'swagger_client/models/payment_method'
|
|
50
|
+
require 'swagger_client/models/payment_schedules_request'
|
|
51
|
+
require 'swagger_client/models/payment_schedules_response'
|
|
52
|
+
require 'swagger_client/models/payment_url_request'
|
|
53
|
+
require 'swagger_client/models/payment_url_response'
|
|
54
|
+
require 'swagger_client/models/primary_transaction'
|
|
55
|
+
require 'swagger_client/models/primary_transaction_additional_details'
|
|
56
|
+
require 'swagger_client/models/processor_data'
|
|
57
|
+
require 'swagger_client/models/response_type'
|
|
58
|
+
require 'swagger_client/models/secondary_transaction'
|
|
59
|
+
require 'swagger_client/models/sepa'
|
|
60
|
+
require 'swagger_client/models/sepa_mandate'
|
|
61
|
+
require 'swagger_client/models/shipping'
|
|
62
|
+
require 'swagger_client/models/split_shipment'
|
|
63
|
+
require 'swagger_client/models/stored_credential'
|
|
64
|
+
require 'swagger_client/models/transaction_response'
|
|
65
|
+
require 'swagger_client/models/transaction_response_authentication_redirect'
|
|
66
|
+
require 'swagger_client/models/transaction_response_authentication_redirect_params'
|
|
67
|
+
require 'swagger_client/models/transaction_type'
|
|
68
|
+
require 'swagger_client/models/transaction_error_response'
|
|
69
|
+
|
|
70
|
+
# APIs
|
|
71
|
+
require 'swagger_client/api/authentication_api'
|
|
72
|
+
require 'swagger_client/api/order_api'
|
|
73
|
+
require 'swagger_client/api/payment_api'
|
|
74
|
+
|
|
75
|
+
module SwaggerClient
|
|
76
|
+
class << self
|
|
77
|
+
# Customize default settings for the SDK using block.
|
|
78
|
+
# SwaggerClient.configure do |config|
|
|
79
|
+
# config.username = "xxx"
|
|
80
|
+
# config.password = "xxx"
|
|
81
|
+
# end
|
|
82
|
+
# If no block given, return the default Configuration object.
|
|
83
|
+
def configure
|
|
84
|
+
if block_given?
|
|
85
|
+
yield(Configuration.default)
|
|
86
|
+
else
|
|
87
|
+
Configuration.default
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Payment Gateway API Specification
|
|
3
|
+
|
|
4
|
+
#Payment Gateway API for payment processing.
|
|
5
|
+
|
|
6
|
+
OpenAPI spec version: 0.0.1
|
|
7
|
+
|
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
+
Swagger Codegen version: unset
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require "uri"
|
|
14
|
+
|
|
15
|
+
module SwaggerClient
|
|
16
|
+
class AuthenticationApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Generate an access token for user authentication
|
|
24
|
+
# This is the access token generation call for authorizing subsequent financial transactions. A valid access token is required for web client requests.
|
|
25
|
+
# @param content_type content type
|
|
26
|
+
# @param client_request_id A client-generated ID for request tracking and signature creation, unique per request. This is also used for idempotency control. We recommend 128-bit UUID format.
|
|
27
|
+
# @param api_key
|
|
28
|
+
# @param timestamp Epoch timestamp in milliseconds in the request from a client system. Used for Message Signature generation and time limit (5 mins).
|
|
29
|
+
# @param message_signature Used to ensure the request has not been tampered with during transmission. The Message-Signature is the Base64 encoded HMAC hash (SHA256 algorithm with the API Secret as the key.) For more information, refer to the supporting documentation on the Developer Portal.
|
|
30
|
+
# @param [Hash] opts the optional parameters
|
|
31
|
+
# @return [AccessTokenResponse]
|
|
32
|
+
def v1_authentication_access_tokens_post(content_type, client_request_id, api_key, timestamp, message_signature, opts = {})
|
|
33
|
+
data, _status_code, _headers = v1_authentication_access_tokens_post_with_http_info(content_type, client_request_id, api_key, timestamp, message_signature, opts)
|
|
34
|
+
return data
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Generate an access token for user authentication
|
|
38
|
+
# This is the access token generation call for authorizing subsequent financial transactions. A valid access token is required for web client requests.
|
|
39
|
+
# @param content_type content type
|
|
40
|
+
# @param client_request_id A client-generated ID for request tracking and signature creation, unique per request. This is also used for idempotency control. We recommend 128-bit UUID format.
|
|
41
|
+
# @param api_key
|
|
42
|
+
# @param timestamp Epoch timestamp in milliseconds in the request from a client system. Used for Message Signature generation and time limit (5 mins).
|
|
43
|
+
# @param message_signature Used to ensure the request has not been tampered with during transmission. The Message-Signature is the Base64 encoded HMAC hash (SHA256 algorithm with the API Secret as the key.) For more information, refer to the supporting documentation on the Developer Portal.
|
|
44
|
+
# @param [Hash] opts the optional parameters
|
|
45
|
+
# @return [Array<(AccessTokenResponse, Fixnum, Hash)>] AccessTokenResponse data, response status code and response headers
|
|
46
|
+
def v1_authentication_access_tokens_post_with_http_info(content_type, client_request_id, api_key, timestamp, message_signature, opts = {})
|
|
47
|
+
if @api_client.config.debugging
|
|
48
|
+
@api_client.config.logger.debug "Calling API: AuthenticationApi.v1_authentication_access_tokens_post ..."
|
|
49
|
+
end
|
|
50
|
+
# verify the required parameter 'content_type' is set
|
|
51
|
+
if @api_client.config.client_side_validation && content_type.nil?
|
|
52
|
+
fail ArgumentError, "Missing the required parameter 'content_type' when calling AuthenticationApi.v1_authentication_access_tokens_post"
|
|
53
|
+
end
|
|
54
|
+
# verify enum value
|
|
55
|
+
if @api_client.config.client_side_validation && !['application/json'].include?(content_type)
|
|
56
|
+
fail ArgumentError, "invalid value for 'content_type', must be one of application/json"
|
|
57
|
+
end
|
|
58
|
+
# verify the required parameter 'client_request_id' is set
|
|
59
|
+
if @api_client.config.client_side_validation && client_request_id.nil?
|
|
60
|
+
fail ArgumentError, "Missing the required parameter 'client_request_id' when calling AuthenticationApi.v1_authentication_access_tokens_post"
|
|
61
|
+
end
|
|
62
|
+
# verify the required parameter 'api_key' is set
|
|
63
|
+
if @api_client.config.client_side_validation && api_key.nil?
|
|
64
|
+
fail ArgumentError, "Missing the required parameter 'api_key' when calling AuthenticationApi.v1_authentication_access_tokens_post"
|
|
65
|
+
end
|
|
66
|
+
# verify the required parameter 'timestamp' is set
|
|
67
|
+
if @api_client.config.client_side_validation && timestamp.nil?
|
|
68
|
+
fail ArgumentError, "Missing the required parameter 'timestamp' when calling AuthenticationApi.v1_authentication_access_tokens_post"
|
|
69
|
+
end
|
|
70
|
+
# verify the required parameter 'message_signature' is set
|
|
71
|
+
if @api_client.config.client_side_validation && message_signature.nil?
|
|
72
|
+
fail ArgumentError, "Missing the required parameter 'message_signature' when calling AuthenticationApi.v1_authentication_access_tokens_post"
|
|
73
|
+
end
|
|
74
|
+
# resource path
|
|
75
|
+
local_var_path = "/v1/authentication/access-tokens"
|
|
76
|
+
|
|
77
|
+
# query parameters
|
|
78
|
+
query_params = {}
|
|
79
|
+
|
|
80
|
+
# header parameters
|
|
81
|
+
header_params = {}
|
|
82
|
+
# HTTP header 'Accept' (if needed)
|
|
83
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
84
|
+
# HTTP header 'Content-Type'
|
|
85
|
+
# header_params[:'Content-Type'] = content_type
|
|
86
|
+
header_params[:'Client-Request-Id'] = client_request_id
|
|
87
|
+
header_params[:'Api-Key'] = api_key
|
|
88
|
+
header_params[:'Timestamp'] = timestamp
|
|
89
|
+
header_params[:'Message-Signature'] = message_signature
|
|
90
|
+
|
|
91
|
+
# form parameters
|
|
92
|
+
form_params = {}
|
|
93
|
+
|
|
94
|
+
# http body (model)
|
|
95
|
+
post_body = nil
|
|
96
|
+
auth_names = []
|
|
97
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
|
98
|
+
:header_params => header_params,
|
|
99
|
+
:query_params => query_params,
|
|
100
|
+
:form_params => form_params,
|
|
101
|
+
:body => post_body,
|
|
102
|
+
:auth_names => auth_names,
|
|
103
|
+
:return_type => 'AccessTokenResponse',
|
|
104
|
+
:error_type => 'ErrorResponse')
|
|
105
|
+
if @api_client.config.debugging
|
|
106
|
+
@api_client.config.logger.debug "API called: AuthenticationApi#v1_authentication_access_tokens_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
107
|
+
end
|
|
108
|
+
return data, status_code, headers
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|