cybersource_rest_client 0.0.29 → 0.0.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/AuthenticationSDK/authentication/oauth/OAuthToken.rb +15 -0
- data/lib/AuthenticationSDK/core/Authorization.rb +4 -1
- data/lib/AuthenticationSDK/core/MerchantConfig.rb +93 -19
- data/lib/AuthenticationSDK/util/Constants.rb +78 -76
- data/lib/cybersource_rest_client.rb +19 -9
- data/lib/cybersource_rest_client/api/customer_payment_instrument_api.rb +3 -3
- data/lib/cybersource_rest_client/api/instrument_identifier_api.rb +3 -3
- data/lib/cybersource_rest_client/api/o_auth_api.rb +104 -0
- data/lib/cybersource_rest_client/api/payments_api.rb +2 -2
- data/lib/cybersource_rest_client/api/refund_api.rb +4 -4
- data/lib/cybersource_rest_client/api/void_api.rb +4 -4
- data/lib/cybersource_rest_client/api_client.rb +31 -8
- data/lib/cybersource_rest_client/configuration.rb +2 -2
- data/lib/cybersource_rest_client/models/access_token_response.rb +244 -0
- data/lib/cybersource_rest_client/models/add_negative_list_request.rb +1 -1
- data/lib/cybersource_rest_client/models/bad_request_error.rb +192 -0
- data/lib/cybersource_rest_client/models/create_access_token_request.rb +254 -0
- data/lib/cybersource_rest_client/models/fraud_marking_action_request.rb +1 -1
- data/lib/cybersource_rest_client/models/invoicing_v2_invoices_all_get200_response_customer_information.rb +20 -4
- data/lib/cybersource_rest_client/models/invoicingv2invoices_customer_information.rb +20 -4
- data/lib/cybersource_rest_client/models/{payment_instrument_list_for_customer.rb → payment_instrument_list.rb} +3 -3
- data/lib/cybersource_rest_client/models/{payment_instrument_list_for_customer__embedded.rb → payment_instrument_list__embedded.rb} +1 -1
- data/lib/cybersource_rest_client/models/{payment_instrument_list_for_customer__links.rb → payment_instrument_list__links.rb} +6 -6
- data/lib/cybersource_rest_client/models/{payment_instrument_list_for_customer__links_first.rb → payment_instrument_list__links_first.rb} +1 -1
- data/lib/cybersource_rest_client/models/{payment_instrument_list_for_customer__links_last.rb → payment_instrument_list__links_last.rb} +1 -1
- data/lib/cybersource_rest_client/models/{payment_instrument_list_for_customer__links_next.rb → payment_instrument_list__links_next.rb} +1 -1
- data/lib/cybersource_rest_client/models/{payment_instrument_list_for_customer__links_prev.rb → payment_instrument_list__links_prev.rb} +1 -1
- data/lib/cybersource_rest_client/models/{payment_instrument_list_for_customer__links_self.rb → payment_instrument_list__links_self.rb} +1 -1
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response.rb +10 -1
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_consumer_authentication_information.rb +11 -1
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_order_information.rb +13 -4
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_order_information_reward_points_details.rb +270 -0
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_account_information.rb +183 -0
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_account_information_card.rb +242 -0
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_information.rb +1 -1
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_information_tokenized_card.rb +1 -1
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processing_information.rb +1 -1
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processor_information.rb +17 -1
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processor_information_routing.rb +3 -3
- data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response_merchant_information_merchant_descriptor.rb +6 -0
- data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response_recipient_information_card.rb +1 -1
- data/lib/cybersource_rest_client/models/ptsv2credits_processing_information.rb +1 -1
- data/lib/cybersource_rest_client/models/ptsv2payments_client_reference_information.rb +1 -1
- data/lib/cybersource_rest_client/models/ptsv2payments_consumer_authentication_information.rb +60 -2
- data/lib/cybersource_rest_client/models/ptsv2payments_health_care_information_amount_details.rb +1 -1
- data/lib/cybersource_rest_client/models/ptsv2payments_merchant_information_merchant_descriptor.rb +6 -0
- data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_card.rb +4 -4
- data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_fluid_data.rb +3 -3
- data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_tokenized_card.rb +1 -1
- data/lib/cybersource_rest_client/models/ptsv2payments_point_of_sale_information.rb +36 -38
- data/lib/cybersource_rest_client/models/ptsv2payments_processing_information.rb +15 -5
- data/lib/cybersource_rest_client/models/ptsv2payments_processing_information_authorization_options.rb +7 -7
- data/lib/cybersource_rest_client/models/ptsv2payments_recurring_payment_information.rb +24 -4
- data/lib/cybersource_rest_client/models/ptsv2payments_risk_information.rb +15 -4
- data/lib/cybersource_rest_client/models/ptsv2payments_risk_information_auxiliary_data.rb +207 -0
- data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_payment_information_card.rb +1 -1
- data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_processing_information.rb +15 -5
- data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_payment_information_card.rb +4 -4
- data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_processing_information.rb +1 -1
- data/lib/cybersource_rest_client/models/ptsv2paymentsidreversals_client_reference_information.rb +17 -1
- data/lib/cybersource_rest_client/models/ptsv2paymentsidreversals_processing_information.rb +1 -1
- data/lib/cybersource_rest_client/models/ptsv2payouts_merchant_information_merchant_descriptor.rb +6 -0
- data/lib/cybersource_rest_client/models/ptsv2payouts_payment_information_card.rb +4 -4
- data/lib/cybersource_rest_client/models/resource_not_found_error.rb +192 -0
- data/lib/cybersource_rest_client/models/riskv1authenticationresults_consumer_authentication_information.rb +1 -1
- data/lib/cybersource_rest_client/models/riskv1authenticationresults_payment_information_card.rb +3 -3
- data/lib/cybersource_rest_client/models/riskv1authenticationresults_payment_information_tokenized_card.rb +1 -1
- data/lib/cybersource_rest_client/models/riskv1authentications_payment_information_card.rb +3 -3
- data/lib/cybersource_rest_client/models/riskv1authentications_payment_information_tokenized_card.rb +1 -1
- data/lib/cybersource_rest_client/models/riskv1authenticationsetups_payment_information_card.rb +3 -3
- data/lib/cybersource_rest_client/models/riskv1authenticationsetups_payment_information_fluid_data.rb +3 -3
- data/lib/cybersource_rest_client/models/riskv1authenticationsetups_payment_information_tokenized_card.rb +1 -1
- data/lib/cybersource_rest_client/models/riskv1authenticationsetups_processing_information.rb +1 -1
- data/lib/cybersource_rest_client/models/riskv1decisions_client_reference_information.rb +17 -1
- data/lib/cybersource_rest_client/models/riskv1decisions_consumer_authentication_information.rb +1 -1
- data/lib/cybersource_rest_client/models/riskv1decisions_device_information.rb +1 -11
- data/lib/cybersource_rest_client/models/riskv1decisions_payment_information_card.rb +3 -3
- data/lib/cybersource_rest_client/models/riskv1decisions_payment_information_tokenized_card.rb +1 -1
- data/lib/cybersource_rest_client/models/riskv1decisions_risk_information.rb +15 -4
- data/lib/cybersource_rest_client/models/riskv1liststypeentries_client_reference_information.rb +224 -0
- data/lib/cybersource_rest_client/models/riskv1liststypeentries_payment_information_card.rb +1 -1
- data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_card.rb +5 -5
- data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processing_information_authorization_options.rb +13 -4
- data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_payment_information_card.rb +3 -3
- data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_processing_information.rb +1 -1
- data/lib/cybersource_rest_client/models/unauthorized_client_error.rb +192 -0
- data/lib/cybersource_rest_client/models/validate_export_compliance_request.rb +1 -1
- data/lib/cybersource_rest_client/models/verify_customer_address_request.rb +1 -1
- metadata +120 -101
- data/lib/AuthenticationSDK/resource/TRRReports.json +0 -12
- data/lib/AuthenticationSDK/resource/cybs.yml +0 -31
- data/lib/AuthenticationSDK/resource/request.json +0 -54
- data/lib/AuthenticationSDK/resource/request_capture.json +0 -11
- data/lib/AuthenticationSDK/resource/testrest.p12 +0 -0
- data/lib/AuthenticationSDK/spec/Authorization_spec.rb +0 -274
- data/lib/AuthenticationSDK/spec/MerchantConfigData.rb +0 -59
- data/lib/AuthenticationSDK/spec/MerchantConfig_spec.rb +0 -116
- data/lib/AuthenticationSDK/spec/PostRequestData.json +0 -54
- data/lib/AuthenticationSDK/spec/PutRequestData.json +0 -12
- data/lib/AuthenticationSDK/spec/ResponseCodeMessage_spec.rb +0 -60
- data/lib/AuthenticationSDK/spec/spec_helper.rb +0 -12
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_information_card.rb +0 -184
@@ -217,7 +217,7 @@ module CyberSource
|
|
217
217
|
# @option opts [String] :profile_id The id of a profile containing user specific TMS configuration.
|
218
218
|
# @option opts [Integer] :offset Starting record in zero-based dataset that should be returned as the first object in the array. Default is 0. (default to 0)
|
219
219
|
# @option opts [Integer] :limit The maximum number that can be returned in the array starting from the offset record in zero-based dataset. Default is 20, maximum is 100. (default to 20)
|
220
|
-
# @return [
|
220
|
+
# @return [PaymentInstrumentList]
|
221
221
|
def get_customer_payment_instruments_list(customer_token_id, opts = {})
|
222
222
|
data, status_code, headers = get_customer_payment_instruments_list_with_http_info(customer_token_id, opts)
|
223
223
|
return data, status_code, headers
|
@@ -229,7 +229,7 @@ module CyberSource
|
|
229
229
|
# @option opts [String] :profile_id The id of a profile containing user specific TMS configuration.
|
230
230
|
# @option opts [Integer] :offset Starting record in zero-based dataset that should be returned as the first object in the array. Default is 0.
|
231
231
|
# @option opts [Integer] :limit The maximum number that can be returned in the array starting from the offset record in zero-based dataset. Default is 20, maximum is 100.
|
232
|
-
# @return [Array<(
|
232
|
+
# @return [Array<(PaymentInstrumentList, Fixnum, Hash)>] PaymentInstrumentList data, response status code and response headers
|
233
233
|
def get_customer_payment_instruments_list_with_http_info(customer_token_id, opts = {})
|
234
234
|
|
235
235
|
if @api_client.config.debugging
|
@@ -300,7 +300,7 @@ module CyberSource
|
|
300
300
|
:form_params => form_params,
|
301
301
|
:body => post_body,
|
302
302
|
:auth_names => auth_names,
|
303
|
-
:return_type => '
|
303
|
+
:return_type => 'PaymentInstrumentList')
|
304
304
|
if @api_client.config.debugging
|
305
305
|
begin
|
306
306
|
raise
|
@@ -189,7 +189,7 @@ module CyberSource
|
|
189
189
|
# @option opts [String] :profile_id The id of a profile containing user specific TMS configuration.
|
190
190
|
# @option opts [Integer] :offset Starting record in zero-based dataset that should be returned as the first object in the array. Default is 0. (default to 0)
|
191
191
|
# @option opts [Integer] :limit The maximum number that can be returned in the array starting from the offset record in zero-based dataset. Default is 20, maximum is 100. (default to 20)
|
192
|
-
# @return [
|
192
|
+
# @return [PaymentInstrumentList]
|
193
193
|
def get_instrument_identifier_payment_instruments_list(instrument_identifier_token_id, opts = {})
|
194
194
|
data, status_code, headers = get_instrument_identifier_payment_instruments_list_with_http_info(instrument_identifier_token_id, opts)
|
195
195
|
return data, status_code, headers
|
@@ -201,7 +201,7 @@ module CyberSource
|
|
201
201
|
# @option opts [String] :profile_id The id of a profile containing user specific TMS configuration.
|
202
202
|
# @option opts [Integer] :offset Starting record in zero-based dataset that should be returned as the first object in the array. Default is 0.
|
203
203
|
# @option opts [Integer] :limit The maximum number that can be returned in the array starting from the offset record in zero-based dataset. Default is 20, maximum is 100.
|
204
|
-
# @return [Array<(
|
204
|
+
# @return [Array<(PaymentInstrumentList, Fixnum, Hash)>] PaymentInstrumentList data, response status code and response headers
|
205
205
|
def get_instrument_identifier_payment_instruments_list_with_http_info(instrument_identifier_token_id, opts = {})
|
206
206
|
|
207
207
|
if @api_client.config.debugging
|
@@ -272,7 +272,7 @@ module CyberSource
|
|
272
272
|
:form_params => form_params,
|
273
273
|
:body => post_body,
|
274
274
|
:auth_names => auth_names,
|
275
|
-
:return_type => '
|
275
|
+
:return_type => 'PaymentInstrumentList')
|
276
276
|
if @api_client.config.debugging
|
277
277
|
begin
|
278
278
|
raise
|
@@ -0,0 +1,104 @@
|
|
1
|
+
=begin
|
2
|
+
#OAuth2 API
|
3
|
+
|
4
|
+
#OAuth2 Token Service (OAuth2)
|
5
|
+
|
6
|
+
OpenAPI spec version: v3
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.2.3
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'uri'
|
14
|
+
|
15
|
+
module CyberSource
|
16
|
+
class OAuthApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default, config)
|
20
|
+
@api_client = api_client
|
21
|
+
@api_client.set_configuration(config)
|
22
|
+
end
|
23
|
+
# Create access token and refresh token
|
24
|
+
# This request is used by technology partners to obtain an access token and a refresh token, which are contained in the response. The partner can then use the access token for authentication when submitting API requests to CyberSource on behalf of the merchant. The request must include the authorization code that was included in the URL redirect response from CyberSource (see [full documentation](https://developer.cybersource.com/api/developer-guides/OAuth/cybs_extend_intro.html)). Access tokens expire after 15 minutes. The refresh token is used to create a new access token, it expires after one year.
|
25
|
+
# @param create_access_token_request Request payload
|
26
|
+
# @param [Hash] opts the optional parameters
|
27
|
+
# @option opts [String] :v_c_client_correlation_id We recommended that you submit this header with a unique value in every client request to this endpoint. It is sent back in the response header and logged both in the request log and response log.
|
28
|
+
# @return [AccessTokenResponse]
|
29
|
+
def create_access_token(create_access_token_request, opts = {})
|
30
|
+
data, status_code, headers = create_access_token_with_http_info(create_access_token_request, opts)
|
31
|
+
return data, status_code, headers
|
32
|
+
end
|
33
|
+
|
34
|
+
# Create access token and refresh token
|
35
|
+
# This request is used by technology partners to obtain an access token and a refresh token, which are contained in the response. The partner can then use the access token for authentication when submitting API requests to CyberSource on behalf of the merchant. The request must include the authorization code that was included in the URL redirect response from CyberSource (see [full documentation](https://developer.cybersource.com/api/developer-guides/OAuth/cybs_extend_intro.html)). Access tokens expire after 15 minutes. The refresh token is used to create a new access token, it expires after one year.
|
36
|
+
# @param create_access_token_request Request payload
|
37
|
+
# @param [Hash] opts the optional parameters
|
38
|
+
# @option opts [String] :v_c_client_correlation_id We recommended that you submit this header with a unique value in every client request to this endpoint. It is sent back in the response header and logged both in the request log and response log.
|
39
|
+
# @return [Array<(AccessTokenResponse, Fixnum, Hash)>] AccessTokenResponse data, response status code and response headers
|
40
|
+
def create_access_token_with_http_info(create_access_token_request, opts = {})
|
41
|
+
|
42
|
+
if @api_client.config.debugging
|
43
|
+
begin
|
44
|
+
raise
|
45
|
+
@api_client.config.logger.debug 'Calling API: OAuthApi.create_access_token ...'
|
46
|
+
rescue
|
47
|
+
puts 'Cannot write to log'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
# verify the required parameter 'create_access_token_request' is set
|
51
|
+
if @api_client.config.client_side_validation && create_access_token_request.nil?
|
52
|
+
fail ArgumentError, "Missing the required parameter 'create_access_token_request' when calling OAuthApi.create_access_token"
|
53
|
+
end
|
54
|
+
if @api_client.config.client_side_validation && !opts[:'v_c_client_correlation_id'].nil? && opts[:'v_c_client_correlation_id'].to_s.length > 36
|
55
|
+
fail ArgumentError, 'invalid value for "opts[:"v_c_client_correlation_id"]" when calling OAuthApi.create_access_token, the character length must be smaller than or equal to 36.'
|
56
|
+
end
|
57
|
+
|
58
|
+
if @api_client.config.client_side_validation && !opts[:'v_c_client_correlation_id'].nil? && opts[:'v_c_client_correlation_id'].to_s.length < 36
|
59
|
+
fail ArgumentError, 'invalid value for "opts[:"v_c_client_correlation_id"]" when calling OAuthApi.create_access_token, the character length must be great than or equal to 36.'
|
60
|
+
end
|
61
|
+
|
62
|
+
#if @api_client.config.client_side_validation && !opts[:'v_c_client_correlation_id'].nil? && opts[:'v_c_client_correlation_id'] !~ Regexp.new(/^[A-Za-z0-9\\.\\-_:]+$/)
|
63
|
+
#fail ArgumentError, "invalid value for 'opts[:\"v_c_client_correlation_id\"]' when calling OAuthApi.create_access_token, must conform to the pattern /^[A-Za-z0-9\\.\\-_:]+$/."
|
64
|
+
#end
|
65
|
+
|
66
|
+
# resource path
|
67
|
+
local_var_path = 'oauth2/v3/token'
|
68
|
+
|
69
|
+
# query parameters
|
70
|
+
query_params = {}
|
71
|
+
|
72
|
+
# header parameters
|
73
|
+
header_params = {}
|
74
|
+
# HTTP header 'Accept' (if needed)
|
75
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=utf-8'])
|
76
|
+
# HTTP header 'Content-Type'
|
77
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
|
78
|
+
header_params[:'v-c-client-correlation-id'] = opts[:'v_c_client_correlation_id'] if !opts[:'v_c_client_correlation_id'].nil?
|
79
|
+
|
80
|
+
# form parameters
|
81
|
+
form_params = {}
|
82
|
+
|
83
|
+
# http body (model)
|
84
|
+
post_body = @api_client.object_to_http_body(create_access_token_request)
|
85
|
+
auth_names = []
|
86
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
87
|
+
:header_params => header_params,
|
88
|
+
:query_params => query_params,
|
89
|
+
:form_params => form_params,
|
90
|
+
:body => post_body,
|
91
|
+
:auth_names => auth_names,
|
92
|
+
:return_type => 'AccessTokenResponse')
|
93
|
+
if @api_client.config.debugging
|
94
|
+
begin
|
95
|
+
raise
|
96
|
+
@api_client.config.logger.debug "API called: OAuthApi#create_access_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
97
|
+
rescue
|
98
|
+
puts 'Cannot write to log'
|
99
|
+
end
|
100
|
+
end
|
101
|
+
return data, status_code, headers
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -21,7 +21,7 @@ module CyberSource
|
|
21
21
|
@api_client.set_configuration(config)
|
22
22
|
end
|
23
23
|
# Process a Payment
|
24
|
-
# A payment authorizes the amount for the transaction. There are a number of supported payment feature, such as E-commerce and Card Present - Credit Card/Debit Card, Echeck, e-Wallets, Level II/III Data, etc.. A payment response includes the status of the request. It also includes processor-specific information when the request is successful and errors if unsuccessful. See the [Payments Developer Guides Page](https://developer.cybersource.com/api/developer-guides/dita-payments/GettingStarted.html). Authorization can be requested with Capture, Decision Manager, Payer Authentication(3ds), and Token Creation. Find more on [Authorization with Add-On Features page.]
|
24
|
+
# A payment authorizes the amount for the transaction. There are a number of supported payment feature, such as E-commerce and Card Present - Credit Card/Debit Card, Echeck, e-Wallets, Level II/III Data, etc.. A payment response includes the status of the request. It also includes processor-specific information when the request is successful and errors if unsuccessful. See the [Payments Developer Guides Page](https://developer.cybersource.com/api/developer-guides/dita-payments/GettingStarted.html). Authorization can be requested with Capture, Decision Manager, Payer Authentication(3ds), and Token Creation. Find more on [Authorization with Add-On Features page.](https://developer.cybersource.com/api/authorization-add-ons.html)
|
25
25
|
# @param create_payment_request
|
26
26
|
# @param [Hash] opts the optional parameters
|
27
27
|
# @return [PtsV2PaymentsPost201Response]
|
@@ -31,7 +31,7 @@ module CyberSource
|
|
31
31
|
end
|
32
32
|
|
33
33
|
# Process a Payment
|
34
|
-
# A payment authorizes the amount for the transaction. There are a number of supported payment feature, such as E-commerce and Card Present - Credit Card/Debit Card, Echeck, e-Wallets, Level II/III Data, etc.. A payment response includes the status of the request. It also includes processor-specific information when the request is successful and errors if unsuccessful. See the [Payments Developer Guides Page](https://developer.cybersource.com/api/developer-guides/dita-payments/GettingStarted.html). Authorization can be requested with Capture, Decision Manager, Payer Authentication(3ds), and Token Creation. Find more on [Authorization with Add-On Features page.]
|
34
|
+
# A payment authorizes the amount for the transaction. There are a number of supported payment feature, such as E-commerce and Card Present - Credit Card/Debit Card, Echeck, e-Wallets, Level II/III Data, etc.. A payment response includes the status of the request. It also includes processor-specific information when the request is successful and errors if unsuccessful. See the [Payments Developer Guides Page](https://developer.cybersource.com/api/developer-guides/dita-payments/GettingStarted.html). Authorization can be requested with Capture, Decision Manager, Payer Authentication(3ds), and Token Creation. Find more on [Authorization with Add-On Features page.](https://developer.cybersource.com/api/authorization-add-ons.html)
|
35
35
|
# @param create_payment_request
|
36
36
|
# @param [Hash] opts the optional parameters
|
37
37
|
# @return [Array<(PtsV2PaymentsPost201Response, Fixnum, Hash)>] PtsV2PaymentsPost201Response data, response status code and response headers
|
@@ -21,7 +21,7 @@ module CyberSource
|
|
21
21
|
@api_client.set_configuration(config)
|
22
22
|
end
|
23
23
|
# Refund a Capture
|
24
|
-
# Refund a capture API is only used, if you have requested Capture independenlty using [/pts/v2/payments/{id}/captures](https://developer.cybersource.com/api-reference-assets/index.html#payments_capture) API call Include the capture ID in the POST request to refund the captured amount.
|
24
|
+
# Refund a capture API is only used, if you have requested Capture independenlty using [/pts/v2/payments/{id}/captures](https://developer.cybersource.com/api-reference-assets/index.html#payments_capture) API call. Include the capture ID in the POST request to refund the captured amount.
|
25
25
|
# @param refund_capture_request
|
26
26
|
# @param id The capture ID. This ID is returned from a previous capture request.
|
27
27
|
# @param [Hash] opts the optional parameters
|
@@ -32,7 +32,7 @@ module CyberSource
|
|
32
32
|
end
|
33
33
|
|
34
34
|
# Refund a Capture
|
35
|
-
# Refund a capture API is only used, if you have requested Capture independenlty using [/pts/v2/payments/{id}/captures](https://developer.cybersource.com/api-reference-assets/index.html#payments_capture) API call Include the capture ID in the POST request to refund the captured amount.
|
35
|
+
# Refund a capture API is only used, if you have requested Capture independenlty using [/pts/v2/payments/{id}/captures](https://developer.cybersource.com/api-reference-assets/index.html#payments_capture) API call. Include the capture ID in the POST request to refund the captured amount.
|
36
36
|
# @param refund_capture_request
|
37
37
|
# @param id The capture ID. This ID is returned from a previous capture request.
|
38
38
|
# @param [Hash] opts the optional parameters
|
@@ -92,7 +92,7 @@ module CyberSource
|
|
92
92
|
return data, status_code, headers
|
93
93
|
end
|
94
94
|
# Refund a Payment
|
95
|
-
# Refund a Payment API is only used, if you have requested Authorization and Capture together in [/pts/v2/payments](https://developer.cybersource.com/api-reference-assets/index.html#payments_payments) API call.
|
95
|
+
# Refund a Payment API is only used, if you have requested Authorization and Capture together in [/pts/v2/payments](https://developer.cybersource.com/api-reference-assets/index.html#payments_payments) API call. Include the payment ID in the POST request to refund the payment amount.
|
96
96
|
# @param refund_payment_request
|
97
97
|
# @param id The payment ID. This ID is returned from a previous payment request.
|
98
98
|
# @param [Hash] opts the optional parameters
|
@@ -103,7 +103,7 @@ module CyberSource
|
|
103
103
|
end
|
104
104
|
|
105
105
|
# Refund a Payment
|
106
|
-
# Refund a Payment API is only used, if you have requested Authorization and Capture together in [/pts/v2/payments](https://developer.cybersource.com/api-reference-assets/index.html#payments_payments) API call.
|
106
|
+
# Refund a Payment API is only used, if you have requested Authorization and Capture together in [/pts/v2/payments](https://developer.cybersource.com/api-reference-assets/index.html#payments_payments) API call. Include the payment ID in the POST request to refund the payment amount.
|
107
107
|
# @param refund_payment_request
|
108
108
|
# @param id The payment ID. This ID is returned from a previous payment request.
|
109
109
|
# @param [Hash] opts the optional parameters
|
@@ -86,7 +86,7 @@ module CyberSource
|
|
86
86
|
return data, status_code, headers
|
87
87
|
end
|
88
88
|
# Void a Capture
|
89
|
-
# Refund a capture API is only used, if you have requested Capture independenlty using [/pts/v2/payments/{id}/captures](https://developer.cybersource.com/api-reference-assets/index.html#payments_capture) API call.
|
89
|
+
# Refund a capture API is only used, if you have requested Capture independenlty using [/pts/v2/payments/{id}/captures](https://developer.cybersource.com/api-reference-assets/index.html#payments_capture) API call. Include the capture ID in the POST request to cancel the capture.
|
90
90
|
# @param void_capture_request
|
91
91
|
# @param id The capture ID returned from a previous capture request.
|
92
92
|
# @param [Hash] opts the optional parameters
|
@@ -97,7 +97,7 @@ module CyberSource
|
|
97
97
|
end
|
98
98
|
|
99
99
|
# Void a Capture
|
100
|
-
# Refund a capture API is only used, if you have requested Capture independenlty using [/pts/v2/payments/{id}/captures](https://developer.cybersource.com/api-reference-assets/index.html#payments_capture) API call.
|
100
|
+
# Refund a capture API is only used, if you have requested Capture independenlty using [/pts/v2/payments/{id}/captures](https://developer.cybersource.com/api-reference-assets/index.html#payments_capture) API call. Include the capture ID in the POST request to cancel the capture.
|
101
101
|
# @param void_capture_request
|
102
102
|
# @param id The capture ID returned from a previous capture request.
|
103
103
|
# @param [Hash] opts the optional parameters
|
@@ -228,7 +228,7 @@ module CyberSource
|
|
228
228
|
return data, status_code, headers
|
229
229
|
end
|
230
230
|
# Void a Payment
|
231
|
-
# Void a Payment API is only used, if you have requested Authorization and Capture together in [/pts/v2/payments](https://developer.cybersource.com/api-reference-assets/index.html#payments_payments) API call.
|
231
|
+
# Void a Payment API is only used, if you have requested Authorization and Capture together in [/pts/v2/payments](https://developer.cybersource.com/api-reference-assets/index.html#payments_payments) API call. Include the payment ID in the POST request to cancel the payment.
|
232
232
|
# @param void_payment_request
|
233
233
|
# @param id The payment ID returned from a previous payment request.
|
234
234
|
# @param [Hash] opts the optional parameters
|
@@ -239,7 +239,7 @@ module CyberSource
|
|
239
239
|
end
|
240
240
|
|
241
241
|
# Void a Payment
|
242
|
-
# Void a Payment API is only used, if you have requested Authorization and Capture together in [/pts/v2/payments](https://developer.cybersource.com/api-reference-assets/index.html#payments_payments) API call.
|
242
|
+
# Void a Payment API is only used, if you have requested Authorization and Capture together in [/pts/v2/payments](https://developer.cybersource.com/api-reference-assets/index.html#payments_payments) API call. Include the payment ID in the POST request to cancel the payment.
|
243
243
|
# @param void_payment_request
|
244
244
|
# @param id The payment ID returned from a previous payment request.
|
245
245
|
# @param [Hash] opts the optional parameters
|
@@ -15,7 +15,7 @@ require 'json'
|
|
15
15
|
require 'logger'
|
16
16
|
require 'tempfile'
|
17
17
|
require 'typhoeus'
|
18
|
-
require 'uri'
|
18
|
+
require 'addressable/uri'
|
19
19
|
|
20
20
|
module CyberSource
|
21
21
|
class ApiClient
|
@@ -39,7 +39,6 @@ module CyberSource
|
|
39
39
|
@config = config
|
40
40
|
@user_agent = "Swagger-Codegen/#{VERSION}/ruby"
|
41
41
|
@default_headers = {
|
42
|
-
'Content-Type' => 'application/json',
|
43
42
|
'User-Agent' => @user_agent
|
44
43
|
}
|
45
44
|
|
@@ -113,17 +112,27 @@ module CyberSource
|
|
113
112
|
body_params = opts[:body] || {}
|
114
113
|
query_params = opts[:query_params] || {}
|
115
114
|
if !query_params.empty?
|
116
|
-
query_params = URI.
|
115
|
+
query_params = Addressable::URI.form_encode(query_params)
|
116
|
+
end
|
117
|
+
|
118
|
+
headers = opts[:header_params]
|
119
|
+
if $merchantconfig_obj.authenticationType.upcase != Constants::AUTH_TYPE_MUTUAL_AUTH
|
120
|
+
headers = CallAuthenticationHeader(http_method, path, body_params, headers, query_params)
|
117
121
|
end
|
118
|
-
headers = CallAuthenticationHeader(http_method, path, body_params, opts[:header_params], query_params)
|
119
122
|
http_method = http_method.to_sym.downcase
|
120
|
-
header_params =
|
123
|
+
header_params = headers.merge(@default_headers)
|
121
124
|
form_params = opts[:form_params] || {}
|
122
125
|
|
123
126
|
|
124
127
|
# set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
|
125
128
|
_verify_ssl_host = @config.verify_ssl_host ? 2 : 0
|
126
129
|
|
130
|
+
# client cert
|
131
|
+
if $merchantconfig_obj.enableClientCert
|
132
|
+
@config.cert_file = File.join($merchantconfig_obj.clientCertDirectory, $merchantconfig_obj.sslClientCert)
|
133
|
+
@config.key_file = File.join($merchantconfig_obj.clientCertDirectory, $merchantconfig_obj.privateKey)
|
134
|
+
end
|
135
|
+
|
127
136
|
req_opts = {
|
128
137
|
:method => http_method,
|
129
138
|
:headers => header_params,
|
@@ -133,6 +142,7 @@ module CyberSource
|
|
133
142
|
:ssl_verifypeer => @config.verify_ssl,
|
134
143
|
:ssl_verifyhost => _verify_ssl_host,
|
135
144
|
:sslcert => @config.cert_file,
|
145
|
+
:sslkeypasswd => $merchantconfig_obj.sslKeyPassword || "",
|
136
146
|
:sslkey => @config.key_file,
|
137
147
|
:verbose => @config.debugging
|
138
148
|
}
|
@@ -208,9 +218,13 @@ module CyberSource
|
|
208
218
|
token = "Bearer " + token
|
209
219
|
header_params['Authorization'] = token
|
210
220
|
end
|
211
|
-
|
212
|
-
|
221
|
+
if $merchantconfig_obj.authenticationType.upcase == Constants::AUTH_TYPE_OAUTH
|
222
|
+
token = "Bearer " + token
|
223
|
+
header_params['Authorization'] = token
|
213
224
|
end
|
225
|
+
# header_params.each do |key, value|
|
226
|
+
# log_obj.logger.info("#{key} : #{value}")
|
227
|
+
# end
|
214
228
|
return header_params
|
215
229
|
end
|
216
230
|
def get_query_param(path, query_params)
|
@@ -359,7 +373,7 @@ module CyberSource
|
|
359
373
|
def build_request_url(path)
|
360
374
|
# Add leading and trailing slashes to path
|
361
375
|
path = "/#{path}".gsub(/\/+/, '/')
|
362
|
-
URI.encode(@config.base_url + path)
|
376
|
+
Addressable::URI.encode(@config.base_url + path)
|
363
377
|
end
|
364
378
|
|
365
379
|
# Builds the HTTP request body
|
@@ -382,6 +396,15 @@ module CyberSource
|
|
382
396
|
data[key] = value.to_s
|
383
397
|
end
|
384
398
|
end
|
399
|
+
JSON.parse(body).each do |key, value|
|
400
|
+
case value
|
401
|
+
when ::File, ::Array, nil
|
402
|
+
# let typhoeus handle File, Array and nil parameters
|
403
|
+
data[key] = value
|
404
|
+
else
|
405
|
+
data[key] = value.to_s
|
406
|
+
end
|
407
|
+
end
|
385
408
|
elsif body
|
386
409
|
data = body.is_a?(String) ? body : body.to_json
|
387
410
|
else
|
@@ -10,7 +10,7 @@ Swagger Codegen version: 2.2.3
|
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
|
-
require 'uri'
|
13
|
+
require 'addressable/uri'
|
14
14
|
|
15
15
|
module CyberSource
|
16
16
|
class Configuration
|
@@ -175,7 +175,7 @@ module CyberSource
|
|
175
175
|
|
176
176
|
def base_url
|
177
177
|
url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
|
178
|
-
URI.encode(url)
|
178
|
+
Addressable::URI.encode(url)
|
179
179
|
end
|
180
180
|
|
181
181
|
# Gets API key (with prefix if set).
|
@@ -0,0 +1,244 @@
|
|
1
|
+
=begin
|
2
|
+
#OAuth2 API
|
3
|
+
|
4
|
+
#OAuth2 Token Service (OAuth2)
|
5
|
+
|
6
|
+
OpenAPI spec version: v3
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.2.3
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module CyberSource
|
16
|
+
class AccessTokenResponse
|
17
|
+
# Created JWT token.
|
18
|
+
attr_accessor :access_token
|
19
|
+
|
20
|
+
# Bearer.
|
21
|
+
attr_accessor :token_type
|
22
|
+
|
23
|
+
# Newly created JWT token for initial request or if refresh token expired, else the same refresh token as in the request.
|
24
|
+
attr_accessor :refresh_token
|
25
|
+
|
26
|
+
# Number of seconds left till the access token gets expired.
|
27
|
+
attr_accessor :expires_in
|
28
|
+
|
29
|
+
# List of permissions for APIs.
|
30
|
+
attr_accessor :scope
|
31
|
+
|
32
|
+
# Number of seconds left till the refresh token gets expired.
|
33
|
+
attr_accessor :refresh_token_expires_in
|
34
|
+
|
35
|
+
# Successful response can be returned only if client status is active.
|
36
|
+
attr_accessor :client_status
|
37
|
+
|
38
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
39
|
+
def self.attribute_map
|
40
|
+
{
|
41
|
+
:'access_token' => :'access_token',
|
42
|
+
:'token_type' => :'token_type',
|
43
|
+
:'refresh_token' => :'refresh_token',
|
44
|
+
:'expires_in' => :'expires_in',
|
45
|
+
:'scope' => :'scope',
|
46
|
+
:'refresh_token_expires_in' => :'refresh_token_expires_in',
|
47
|
+
:'client_status' => :'client_status'
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# Attribute type mapping.
|
52
|
+
def self.swagger_types
|
53
|
+
{
|
54
|
+
:'access_token' => :'String',
|
55
|
+
:'token_type' => :'String',
|
56
|
+
:'refresh_token' => :'String',
|
57
|
+
:'expires_in' => :'Integer',
|
58
|
+
:'scope' => :'String',
|
59
|
+
:'refresh_token_expires_in' => :'Integer',
|
60
|
+
:'client_status' => :'String'
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
# Initializes the object
|
65
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
66
|
+
def initialize(attributes = {})
|
67
|
+
return unless attributes.is_a?(Hash)
|
68
|
+
|
69
|
+
# convert string to symbol for hash key
|
70
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
71
|
+
|
72
|
+
if attributes.has_key?(:'access_token')
|
73
|
+
self.access_token = attributes[:'access_token']
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes.has_key?(:'token_type')
|
77
|
+
self.token_type = attributes[:'token_type']
|
78
|
+
end
|
79
|
+
|
80
|
+
if attributes.has_key?(:'refresh_token')
|
81
|
+
self.refresh_token = attributes[:'refresh_token']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.has_key?(:'expires_in')
|
85
|
+
self.expires_in = attributes[:'expires_in']
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes.has_key?(:'scope')
|
89
|
+
self.scope = attributes[:'scope']
|
90
|
+
end
|
91
|
+
|
92
|
+
if attributes.has_key?(:'refresh_token_expires_in')
|
93
|
+
self.refresh_token_expires_in = attributes[:'refresh_token_expires_in']
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.has_key?(:'client_status')
|
97
|
+
self.client_status = attributes[:'client_status']
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
102
|
+
# @return Array for valid properties with the reasons
|
103
|
+
def list_invalid_properties
|
104
|
+
invalid_properties = Array.new
|
105
|
+
invalid_properties
|
106
|
+
end
|
107
|
+
|
108
|
+
# Check to see if the all the properties in the model are valid
|
109
|
+
# @return true if the model is valid
|
110
|
+
def valid?
|
111
|
+
true
|
112
|
+
end
|
113
|
+
|
114
|
+
# Checks equality by comparing each attribute.
|
115
|
+
# @param [Object] Object to be compared
|
116
|
+
def ==(o)
|
117
|
+
return true if self.equal?(o)
|
118
|
+
self.class == o.class &&
|
119
|
+
access_token == o.access_token &&
|
120
|
+
token_type == o.token_type &&
|
121
|
+
refresh_token == o.refresh_token &&
|
122
|
+
expires_in == o.expires_in &&
|
123
|
+
scope == o.scope &&
|
124
|
+
refresh_token_expires_in == o.refresh_token_expires_in &&
|
125
|
+
client_status == o.client_status
|
126
|
+
end
|
127
|
+
|
128
|
+
# @see the `==` method
|
129
|
+
# @param [Object] Object to be compared
|
130
|
+
def eql?(o)
|
131
|
+
self == o
|
132
|
+
end
|
133
|
+
|
134
|
+
# Calculates hash code according to all attributes.
|
135
|
+
# @return [Fixnum] Hash code
|
136
|
+
def hash
|
137
|
+
[access_token, token_type, refresh_token, expires_in, scope, refresh_token_expires_in, client_status].hash
|
138
|
+
end
|
139
|
+
|
140
|
+
# Builds the object from hash
|
141
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
142
|
+
# @return [Object] Returns the model itself
|
143
|
+
def build_from_hash(attributes)
|
144
|
+
return nil unless attributes.is_a?(Hash)
|
145
|
+
self.class.swagger_types.each_pair do |key, type|
|
146
|
+
if type =~ /\AArray<(.*)>/i
|
147
|
+
# check to ensure the input is an array given that the the attribute
|
148
|
+
# is documented as an array but the input is not
|
149
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
150
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
151
|
+
end
|
152
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
153
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
154
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
155
|
+
end
|
156
|
+
|
157
|
+
self
|
158
|
+
end
|
159
|
+
|
160
|
+
# Deserializes the data based on type
|
161
|
+
# @param string type Data type
|
162
|
+
# @param string value Value to be deserialized
|
163
|
+
# @return [Object] Deserialized data
|
164
|
+
def _deserialize(type, value)
|
165
|
+
case type.to_sym
|
166
|
+
when :DateTime
|
167
|
+
DateTime.parse(value)
|
168
|
+
when :Date
|
169
|
+
Date.parse(value)
|
170
|
+
when :String
|
171
|
+
value.to_s
|
172
|
+
when :Integer
|
173
|
+
value.to_i
|
174
|
+
when :Float
|
175
|
+
value.to_f
|
176
|
+
when :BOOLEAN
|
177
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
178
|
+
true
|
179
|
+
else
|
180
|
+
false
|
181
|
+
end
|
182
|
+
when :Object
|
183
|
+
# generic object (usually a Hash), return directly
|
184
|
+
value
|
185
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
186
|
+
inner_type = Regexp.last_match[:inner_type]
|
187
|
+
value.map { |v| _deserialize(inner_type, v) }
|
188
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
189
|
+
k_type = Regexp.last_match[:k_type]
|
190
|
+
v_type = Regexp.last_match[:v_type]
|
191
|
+
{}.tap do |hash|
|
192
|
+
value.each do |k, v|
|
193
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
else # model
|
197
|
+
temp_model = CyberSource.const_get(type).new
|
198
|
+
temp_model.build_from_hash(value)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
# Returns the string representation of the object
|
203
|
+
# @return [String] String presentation of the object
|
204
|
+
def to_s
|
205
|
+
to_hash.to_s
|
206
|
+
end
|
207
|
+
|
208
|
+
# to_body is an alias to to_hash (backward compatibility)
|
209
|
+
# @return [Hash] Returns the object in the form of hash
|
210
|
+
def to_body
|
211
|
+
to_hash
|
212
|
+
end
|
213
|
+
|
214
|
+
# Returns the object in the form of hash
|
215
|
+
# @return [Hash] Returns the object in the form of hash
|
216
|
+
def to_hash
|
217
|
+
hash = {}
|
218
|
+
self.class.attribute_map.each_pair do |attr, param|
|
219
|
+
value = self.send(attr)
|
220
|
+
next if value.nil?
|
221
|
+
hash[param] = _to_hash(value)
|
222
|
+
end
|
223
|
+
hash
|
224
|
+
end
|
225
|
+
|
226
|
+
# Outputs non-array value in the form of hash
|
227
|
+
# For object, use to_hash. Otherwise, just return the value
|
228
|
+
# @param [Object] value Any valid value
|
229
|
+
# @return [Hash] Returns the value in the form of hash
|
230
|
+
def _to_hash(value)
|
231
|
+
if value.is_a?(Array)
|
232
|
+
value.compact.map { |v| _to_hash(v) }
|
233
|
+
elsif value.is_a?(Hash)
|
234
|
+
{}.tap do |hash|
|
235
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
236
|
+
end
|
237
|
+
elsif value.respond_to? :to_hash
|
238
|
+
value.to_hash
|
239
|
+
else
|
240
|
+
value
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|