Class: VisaAcceptanceMergedSpec::PaymentInstrumentApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/apis/payment_instrument_api.rb

Overview

PaymentInstrumentApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from VisaAcceptanceMergedSpec::BaseApi

Instance Method Details

#delete_payment_instrument(payment_instrument_id, profile_id: nil) ⇒ ApiResponse

| | | | | --- | --- | --- | |Standalone Payment Instruments
A Payment Instrument represents tokenized payment information such as expiration date, billing address & card type.
A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-i dentifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.
Standalone Payment Instruments do not belong to a Customer.|  &n bsp;   |Deleting a Payment Instrument
Your system can use this API to delete an existing Payment Instrument.
Any Instrument Identifiers representing the card number will also be deleted if they are not associated with any other Payment Instruments. payment instrument. containing user specific TMS configuration.

Parameters:

  • payment_instrument_id (String)

    Required parameter: The Id of a

  • profile_id (String) (defaults to: nil)

    Optional parameter: The Id of a profile

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/visa_acceptance_merged_spec/apis/payment_instrument_api.rb', line 253

def delete_payment_instrument(payment_instrument_id,
                              profile_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/tms/v1/paymentinstruments/{paymentInstrumentId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(payment_instrument_id, key: 'paymentInstrumentId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(profile_id, key: 'profile-id'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(And.new('BearerAuth', 'Accept')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('403',
                             'Forbidden: e.g. The profile might not have permission to'\
                              ' perform the operation.',
                             DeletePaymentInstrumentException1Exception)
                .local_error('404',
                             'Token Not Found. The Id may not exist or was entered'\
                              ' incorrectly.',
                             DeletePaymentInstrumentException21Exception)
                .local_error('410',
                             'Token Not Available. The token has been deleted.',
                             DeletePaymentInstrumentException31Exception)
                .local_error('424',
                             'Failed Dependency: e.g. The profile represented by the'\
                              ' profile-id may not exist or the profile-id was entered'\
                              ' incorrectly.',
                             DeletePaymentInstrumentException21Exception)
                .local_error('500',
                             'Unexpected error.',
                             DeletePaymentInstrumentException51Exception))
    .execute
end

#get_payment_instrument(payment_instrument_id, profile_id: nil, retrieve_bin_details: nil) ⇒ ApiResponse

| | | | | --- | --- | --- | |Standalone Payment Instruments
A Payment Instrument represents tokenized payment information such as expiration date, billing address & card type.
A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-i dentifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.
Standalone Payment Instruments do not belong to a Customer.|  &n bsp;   |Retrieving a Payment Instrument
Your system can use this API to retrieve an existing Payment Instrument.
To perform a payment with a particular Payment Instrument simply specify the [Payment Instrument Id in the payments request](#payments_payments_process-a-payment_samplerequests-dropdown_auth orization-using-tokens_authorization-with-customer-payment-instrument-and- shipping-address-token-id_liveconsole-tab-request-body). payment instrument. containing user specific TMS configuration. Retrieve the Bin Details of PAN or network token

Parameters:

  • payment_instrument_id (String)

    Required parameter: The Id of a

  • profile_id (String) (defaults to: nil)

    Optional parameter: The Id of a profile

  • retrieve_bin_details (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/visa_acceptance_merged_spec/apis/payment_instrument_api.rb', line 112

def get_payment_instrument(payment_instrument_id,
                           profile_id: nil,
                           retrieve_bin_details: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/tms/v1/paymentinstruments/{paymentInstrumentId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(payment_instrument_id, key: 'paymentInstrumentId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(profile_id, key: 'profile-id'))
               .query_param(new_parameter(retrieve_bin_details, key: 'retrieveBinDetails'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(And.new('BearerAuth', 'Accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(GetPaymentInstrumentResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request: e.g. A required header value could be missing.',
                             GetPaymentInstrumentException1Exception)
                .local_error('403',
                             'Forbidden: e.g. The profile might not have permission to'\
                              ' perform the operation.',
                             GetPaymentInstrumentException21Exception)
                .local_error('404',
                             'Token Not Found. The Id may not exist or was entered'\
                              ' incorrectly.',
                             GetPaymentInstrumentException31Exception)
                .local_error('410',
                             'Token Not Available. The token has been deleted.',
                             GetPaymentInstrumentException41Exception)
                .local_error('424',
                             'Failed Dependency: e.g. The profile represented by the'\
                              ' profile-id may not exist or the profile-id was entered'\
                              ' incorrectly.',
                             GetPaymentInstrumentException31Exception)
                .local_error('500',
                             'Unexpected error.',
                             GetPaymentInstrumentException61Exception))
    .execute
end

#patch_payment_instrument(payment_instrument_id, body, profile_id: nil, retrieve_bin_details: nil, if_match: nil) ⇒ ApiResponse

| | | | | --- | --- | --- | |Standalone Payment Instruments
A Payment Instrument represents tokenized payment information such as expiration date, billing address & card type.
A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-i dentifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.
Standalone Payment Instruments do not belong to a Customer.|  &n bsp;   |Updating a Payment Instrument
Your system can use this API to update an existing Payment Instrument. payment instrument. description here containing user specific TMS configuration. Retrieve the Bin Details of PAN or network token GET request to make the request conditional.

Parameters:

  • payment_instrument_id (String)

    Required parameter: The Id of a

  • body (PatchPaymentInstrumentRequest)

    Required parameter: TODO: type

  • profile_id (String) (defaults to: nil)

    Optional parameter: The Id of a profile

  • retrieve_bin_details (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter:

  • if_match (String) (defaults to: nil)

    Optional parameter: Contains an ETag value from a

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/visa_acceptance_merged_spec/apis/payment_instrument_api.rb', line 179

def patch_payment_instrument(payment_instrument_id,
                             body,
                             profile_id: nil,
                             retrieve_bin_details: nil,
                             if_match: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PATCH,
                                 '/tms/v1/paymentinstruments/{paymentInstrumentId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(payment_instrument_id, key: 'paymentInstrumentId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json;charset=utf-8', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter(profile_id, key: 'profile-id'))
               .query_param(new_parameter(retrieve_bin_details, key: 'retrieveBinDetails'))
               .header_param(new_parameter(if_match, key: 'if-match'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('BearerAuth', 'Accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PatchPaymentInstrumentResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request: e.g. A required header value could be missing.',
                             PatchPaymentInstrumentException1Exception)
                .local_error('403',
                             'Forbidden: e.g. The profile might not have permission to'\
                              ' perform the operation.',
                             PatchPaymentInstrumentException21Exception)
                .local_error('404',
                             'Token Not Found. The Id may not exist or was entered'\
                              ' incorrectly.',
                             PatchPaymentInstrumentException31Exception)
                .local_error('410',
                             'Token Not Available. The token has been deleted.',
                             PatchPaymentInstrumentException41Exception)
                .local_error('412',
                             'Precondition Failed: The If-Match request header value does'\
                              ' not match the current resources ETag',
                             PatchPaymentInstrumentException51Exception)
                .local_error('424',
                             'Failed Dependency: e.g. The profile represented by the'\
                              ' profile-id may not exist or the profile-id was entered'\
                              ' incorrectly.',
                             PatchPaymentInstrumentException31Exception)
                .local_error('500',
                             'Unexpected error.',
                             PatchPaymentInstrumentException71Exception))
    .execute
end

#post_payment_instrument(body, profile_id: nil, retrieve_bin_details: nil) ⇒ ApiResponse

| | | | | --- | --- | --- | |Standalone Payment Instruments
A Payment Instrument represents tokenized payment information such as expiration date, billing address & card type.
A Payment Instrument token does not store the card number. A Payment Instrument is associated with an [Instrument Identifier](#token-management_instrument-identifier_create-an-instrument-i dentifier) that represents either a payment card number, or in the case of an ACH bank account, the routing and account number.
Standalone Payment Instruments do not belong to a Customer.

Creat ing a Payment Instrument

It is recommended you [create a Payment Instrument via a Payment Authorization](#payments_payments_process-a-payment_samplerequests-dropdow n_authorization-with-token-create_authorization-with-customer-token-creati on_liveconsole-tab-request-body), this can be for a zero amount.
In Europe: You should perform Payer Authentication alongside the Authorization.|      |Payment Network Tokens
Network tokens perform better than regular card numbers and they are not necessarily invalidated when a cardholder loses their card, or it expires.
A Payment Network Token will be automatically created and used in future payments if you are enabled for the service.
A Payment Network Token can also be [provisioned for an existing Instrument Identifier](#token-management_instrument-identifier_enroll-an-instrument-i dentifier-for-payment-network-token).
For more information about Payment Network Tokens see the Developer Guide.

Payments with Payment Instruments
To perform a payment with a particular Payment Instrument specify the [Payment Instrument in the payment request](#payments_payments_process-a-payment_samplerequests-dropdown_auth orization-using-tokens_authorization-with-customer-payment-instrument-and- shipping-address-token-id_liveconsole-tab-request-body). description here containing user specific TMS configuration. Retrieve the Bin Details of PAN or network token

Parameters:

  • body (PostPaymentInstrumentRequest)

    Required parameter: TODO: type

  • profile_id (String) (defaults to: nil)

    Optional parameter: The Id of a profile

  • retrieve_bin_details (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/visa_acceptance_merged_spec/apis/payment_instrument_api.rb', line 47

def post_payment_instrument(body,
                            profile_id: nil,
                            retrieve_bin_details: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/tms/v1/paymentinstruments',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json;charset=utf-8', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter(profile_id, key: 'profile-id'))
               .query_param(new_parameter(retrieve_bin_details, key: 'retrieveBinDetails'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('BearerAuth', 'Accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PostPaymentInstrumentResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request: e.g. A required header value could be missing.',
                             PostPaymentInstrumentException1Exception)
                .local_error('403',
                             'Forbidden: e.g. The profile might not have permission to'\
                              ' perform the operation.',
                             PostPaymentInstrumentException21Exception)
                .local_error('409',
                             'Conflict. The token is linked to a Payment Instrument.',
                             PostPaymentInstrumentException31Exception)
                .local_error('424',
                             'Failed Dependency: e.g. The profile represented by the'\
                              ' profile-id may not exist or the profile-id was entered'\
                              ' incorrectly.',
                             PostPaymentInstrumentException41Exception)
                .local_error('500',
                             'Unexpected error.',
                             PostPaymentInstrumentException51Exception))
    .execute
end