Class: CyberSource::OffersApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cybersource_rest_client/api/offers_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default, config) ⇒ OffersApi

Returns a new instance of OffersApi.



18
19
20
21
# File 'lib/cybersource_rest_client/api/offers_api.rb', line 18

def initialize(api_client = ApiClient.default, config)
  @api_client = api_client
  @api_client.set_configuration(config)
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



16
17
18
# File 'lib/cybersource_rest_client/api/offers_api.rb', line 16

def api_client
  @api_client
end

Instance Method Details

#create_offer(content_type, x_requestid, v_c_merchant_id, v_c_correlation_id, v_c_organization_id, offer_request, opts = {}) ⇒ InlineResponse2019

Create an Offer Empower global transactions with transparency and choice. Our Dynamic Currency Conversion API lets merchants offer customers the option to pay in their home currency at checkout, delivering real-time exchange rates. <div style="display: flex; gap: 2rem;"> <div style="flex: 1;"> **Key Benefits:** - **Enhanced Customer Experience:** Provide clarity and convenience for international shoppers. - **Real-Time Rates:** Accurate currency conversion with all the data required for acquirers and their merchants to maintain compliance with card network rules. - **Seamless Integration:** Flexible API endpoints for rate lookup, authorization, and capture. - **Regulatory Compliance:** Provides the data required for acquirers and merchants to meet and maintain card scheme requirements for disclosure and consent.
Ideal for merchants and payment partners seeking to boost trust and conversion in cross-border commerce.
**Key Features:** - **Rate Lookup:** Retrieves the most up-to-date exchange rate for eligible cards before authorization. - **Currency Choice:** Enables the merchant to offer customers the option to select between the merchant’s local currency and their card’s billing currency. - Compliance: Ensures merchants have the data required to adhere to card network regulations; exchange rates, markups, etc. <div style="margin-top: 1.5rem;"> **Supported Scenarios:** - Dynamic Currency Conversion when cardholder’s billing currency differs from merchant’s pricing currency. - Merchant and acquirer must support the cardholder’s billing currency. </div> <div style="margin-top: 1.5rem;"> **Supported Processors:** - VPC - FDI Global </div> <div style="margin-top: 1.5rem;"> **Compliance & Disclosure:** Merchants must: - Adhere to card network rules for Dynamic Currency Conversion (DCC) transactions. - Display the converted amount, exchange rate, and markup percentage and other required disclosures. - Obtain explicit cardholder consent before applying DCC. - Work with your acquirer to obtain full set of compliance requirements. </div> </div> <div style="flex: 1;"> **Core API Endpoints:** **Currency Conversion API** Returns eligibility and exchange rate details, including: - exchangeRate - marginRate - reconciliationId and Id (for subsequent payment requests) <div style="margin-top: 1.5rem;"> **Payment Authorization with DCC*** POST /pts/v2/payments Required fields include: - orderInformation.amountDetails.currency - orderInformation.amountDetails.originalCurrency - orderInformation.amountDetails.originalAmount - orderInformation.amountDetails.exchangeRate - currencyConversion.indicator (e.g., 1 = Converted, 2 = Nonconvertible, 3 = Declined) </div> <div style="margin-top: 1.5rem;"> **Capture with DCC*** POST /pts/v2/payments/id/captures Maps from original authorization and includes original and converted amounts. </div> <div style="margin-top: 1.5rem;"> **Refund with DCC*** POST /pts/v2/captures/id/refunds Maps from original authorization and includes original and converted amounts. *Note: DCC is only supported on select processors. Contact your acquirer or account manager for more information.* </div> </div> </div>
For more information, see the [Currency Conversion Developer Guide](developer.cybersource.com/docs/cybs/en-us/currency-conversion/developer/all/rest/currency-conversion/cc-intro.html).

DISCLAIMER : Cybersource may allow Customer to access, use, and/or test a Cybersource product or service that may still be in development or has not been market-tested (“Beta Product”) solely for the purpose of evaluating the functionality or marketability of the Beta Product (a “Beta Evaluation”). Notwithstanding any language to the contrary, the following terms shall apply with respect to Customer’s participation in any Beta Evaluation (and the Beta Product(s)) accessed thereunder): The Parties will enter into a separate form agreement detailing the scope of the Beta Evaluation, requirements, pricing, the length of the beta evaluation period (“Beta Product Form”). Beta Products are not, and may not become, Transaction Services and have not yet been publicly released and are offered for the sole purpose of internal testing and non-commercial evaluation. Customer’s use of the Beta Product shall be solely for the purpose of conducting the Beta Evaluation. Customer accepts all risks arising out of the access and use of the Beta Products. Cybersource may, in its sole discretion, at any time, terminate or discontinue the Beta Evaluation. Customer acknowledges and agrees that any Beta Product may still be in development and that Beta Product is provided “AS IS” and may not perform at the level of a commercially available service, may not operate as expected and may be modified prior to release. CYBERSOURCE SHALL NOT BE RESPONSIBLE OR LIABLE UNDER ANY CONTRACT, TORT (INCLUDING NEGLIGENCE), OR OTHERWISE RELATING TO A BETA PRODUCT OR THE BETA EVALUATION (A) FOR LOSS OR INACCURACY OF DATA OR COST OF PROCUREMENT OF SUBSTITUTE GOODS, SERVICES OR TECHNOLOGY, (B) ANY CLAIM, LOSSES, DAMAGES, OR CAUSE OF ACTION ARISING IN CONNECTION WITH THE BETA PRODUCT; OR © FOR ANY INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES INCLUDING, BUT NOT LIMITED TO, LOSS OF REVENUES AND LOSS OF PROFITS.

Parameters:

  • content_type
  • x_requestid
  • v_c_merchant_id
  • v_c_correlation_id
  • v_c_organization_id
  • offer_request
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



35
36
37
38
# File 'lib/cybersource_rest_client/api/offers_api.rb', line 35

def create_offer(content_type, x_requestid, v_c_merchant_id, v_c_correlation_id, v_c_organization_id, offer_request, opts = {})
  data, status_code, headers = create_offer_with_http_info(content_type, x_requestid, v_c_merchant_id, v_c_correlation_id, v_c_organization_id, offer_request, opts)
  return data, status_code, headers
end

#create_offer_with_http_info(content_type, x_requestid, v_c_merchant_id, v_c_correlation_id, v_c_organization_id, offer_request, opts = {}) ⇒ Array<(InlineResponse2019, Fixnum, Hash)>

Create an Offer Empower global transactions with transparency and choice. Our Dynamic Currency Conversion API lets merchants offer customers the option to pay in their home currency at checkout, delivering real-time exchange rates. &lt;div style&#x3D;&quot;display: flex; gap: 2rem;&quot;&gt; &lt;div style&#x3D;&quot;flex: 1;&quot;&gt; **Key Benefits:** - **Enhanced Customer Experience:** Provide clarity and convenience for international shoppers. - **Real-Time Rates:** Accurate currency conversion with all the data required for acquirers and their merchants to maintain compliance with card network rules. - **Seamless Integration:** Flexible API endpoints for rate lookup, authorization, and capture. - **Regulatory Compliance:** Provides the data required for acquirers and merchants to meet and maintain card scheme requirements for disclosure and consent. &lt;br&gt; Ideal for merchants and payment partners seeking to boost trust and conversion in cross-border commerce. &lt;br&gt; **Key Features:** - **Rate Lookup:** Retrieves the most up-to-date exchange rate for eligible cards before authorization. - **Currency Choice:** Enables the merchant to offer customers the option to select between the merchant&#39;s local currency and their card&#39;s billing currency. - Compliance: Ensures merchants have the data required to adhere to card network regulations; exchange rates, markups, etc. &lt;div style&#x3D;&quot;margin-top: 1.5rem;&quot;&gt; **Supported Scenarios:** - Dynamic Currency Conversion when cardholder&#39;s billing currency differs from merchant&#39;s pricing currency. - Merchant and acquirer must support the cardholder&#39;s billing currency. &lt;/div&gt; &lt;div style&#x3D;&quot;margin-top: 1.5rem;&quot;&gt; **Supported Processors:** - VPC - FDI Global &lt;/div&gt; &lt;div style&#x3D;&quot;margin-top: 1.5rem;&quot;&gt; **Compliance &amp; Disclosure:** Merchants must: - Adhere to card network rules for Dynamic Currency Conversion (DCC) transactions. - Display the converted amount, exchange rate, and markup percentage and other required disclosures. - Obtain explicit cardholder consent before applying DCC. - Work with your acquirer to obtain full set of compliance requirements. &lt;/div&gt; &lt;/div&gt; &lt;div style&#x3D;&quot;flex: 1;&quot;&gt; **Core API Endpoints:** **Currency Conversion API** Returns eligibility and exchange rate details, including: - exchangeRate - marginRate - reconciliationId and Id (for subsequent payment requests) &lt;div style&#x3D;&quot;margin-top: 1.5rem;&quot;&gt; **Payment Authorization with DCC*** POST /pts/v2/payments Required fields include: - orderInformation.amountDetails.currency - orderInformation.amountDetails.originalCurrency - orderInformation.amountDetails.originalAmount - orderInformation.amountDetails.exchangeRate - currencyConversion.indicator (e.g., 1 &#x3D; Converted, 2 &#x3D; Nonconvertible, 3 &#x3D; Declined) &lt;/div&gt; &lt;div style&#x3D;&quot;margin-top: 1.5rem;&quot;&gt; **Capture with DCC*** POST /pts/v2/payments/id/captures Maps from original authorization and includes original and converted amounts. &lt;/div&gt; &lt;div style&#x3D;&quot;margin-top: 1.5rem;&quot;&gt; **Refund with DCC*** POST /pts/v2/captures/id/refunds Maps from original authorization and includes original and converted amounts. *Note: DCC is only supported on select processors. Contact your acquirer or account manager for more information.* &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;br&gt; For more information, see the [Currency Conversion Developer Guide](developer.cybersource.com/docs/cybs/en-us/currency-conversion/developer/all/rest/currency-conversion/cc-intro.html).

Parameters:

  • content_type
  • x_requestid
  • v_c_merchant_id
  • v_c_correlation_id
  • v_c_organization_id
  • offer_request
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(InlineResponse2019, Fixnum, Hash)>)

    InlineResponse2019 data, response status code and response headers



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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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
# File 'lib/cybersource_rest_client/api/offers_api.rb', line 50

def create_offer_with_http_info(content_type, x_requestid, v_c_merchant_id, v_c_correlation_id, v_c_organization_id, offer_request, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: OffersApi.create_offer ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'content_type' is set
  if @api_client.config.client_side_validation && content_type.nil?
    fail ArgumentError, "Missing the required parameter 'content_type' when calling OffersApi.create_offer"
  end
  # verify the required parameter 'x_requestid' is set
  if @api_client.config.client_side_validation && x_requestid.nil?
    fail ArgumentError, "Missing the required parameter 'x_requestid' when calling OffersApi.create_offer"
  end
  # verify the required parameter 'v_c_merchant_id' is set
  if @api_client.config.client_side_validation && v_c_merchant_id.nil?
    fail ArgumentError, "Missing the required parameter 'v_c_merchant_id' when calling OffersApi.create_offer"
  end
  # verify the required parameter 'v_c_correlation_id' is set
  if @api_client.config.client_side_validation && v_c_correlation_id.nil?
    fail ArgumentError, "Missing the required parameter 'v_c_correlation_id' when calling OffersApi.create_offer"
  end
  # verify the required parameter 'v_c_organization_id' is set
  if @api_client.config.client_side_validation && v_c_organization_id.nil?
    fail ArgumentError, "Missing the required parameter 'v_c_organization_id' when calling OffersApi.create_offer"
  end
  # verify the required parameter 'offer_request' is set
  if @api_client.config.client_side_validation && offer_request.nil?
    fail ArgumentError, "Missing the required parameter 'offer_request' when calling OffersApi.create_offer"
  end
  # resource path
  local_var_path = 'vas/v1/currencyconversion'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/hal+json;charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json;charset=utf-8'])
  header_params[:'Content-Type'] = content_type
  header_params[:'x-requestid'] = x_requestid
  header_params[:'v-c-merchant-id'] = v_c_merchant_id
  header_params[:'v-c-correlation-id'] = v_c_correlation_id
  header_params[:'v-c-organization-id'] = v_c_organization_id

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(offer_request)
  sdk_tracker = SdkTracker.new
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'OfferRequest', @api_client.config.host, @api_client.merchantconfig.defaultDeveloperId)
  inbound_mle_status = "false"
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, inbound_mle_status, ["create_offer","create_offer_with_http_info"])
    begin
      post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
    rescue
      raise
    end
  end

  is_response_mle_for_api = MLEUtility.check_is_response_mle_for_api(@api_client.merchantconfig, ["create_offer","create_offer_with_http_info"])

  auth_names = []
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'InlineResponse2019',
    :isResponseMLEForApi => is_response_mle_for_api)
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: OffersApi#create_offer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#get_offer(content_type, x_requestid, v_c_merchant_id, v_c_correlation_id, v_c_organization_id, id, opts = {}) ⇒ InlineResponse20016

Retrieve an Offer Retrieves an offer record from the system.

Parameters:

  • content_type
  • x_requestid
  • v_c_merchant_id
  • v_c_correlation_id
  • v_c_organization_id
  • id

    Request ID generated by Cybersource. This was sent in the header on the request. Echo value from v-c-request-id

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



151
152
153
154
# File 'lib/cybersource_rest_client/api/offers_api.rb', line 151

def get_offer(content_type, x_requestid, v_c_merchant_id, v_c_correlation_id, v_c_organization_id, id, opts = {})
  data, status_code, headers = get_offer_with_http_info(content_type, x_requestid, v_c_merchant_id, v_c_correlation_id, v_c_organization_id, id, opts)
  return data, status_code, headers
end

#get_offer_with_http_info(content_type, x_requestid, v_c_merchant_id, v_c_correlation_id, v_c_organization_id, id, opts = {}) ⇒ Array<(InlineResponse20016, Fixnum, Hash)>

Retrieve an Offer Retrieves an offer record from the system.

Parameters:

  • content_type
  • x_requestid
  • v_c_merchant_id
  • v_c_correlation_id
  • v_c_organization_id
  • id

    Request ID generated by Cybersource. This was sent in the header on the request. Echo value from v-c-request-id

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(InlineResponse20016, Fixnum, Hash)>)

    InlineResponse20016 data, response status code and response headers



166
167
168
169
170
171
172
173
174
175
176
177
178
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/cybersource_rest_client/api/offers_api.rb', line 166

def get_offer_with_http_info(content_type, x_requestid, v_c_merchant_id, v_c_correlation_id, v_c_organization_id, id, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: OffersApi.get_offer ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'content_type' is set
  if @api_client.config.client_side_validation && content_type.nil?
    fail ArgumentError, "Missing the required parameter 'content_type' when calling OffersApi.get_offer"
  end
  # verify the required parameter 'x_requestid' is set
  if @api_client.config.client_side_validation && x_requestid.nil?
    fail ArgumentError, "Missing the required parameter 'x_requestid' when calling OffersApi.get_offer"
  end
  # verify the required parameter 'v_c_merchant_id' is set
  if @api_client.config.client_side_validation && v_c_merchant_id.nil?
    fail ArgumentError, "Missing the required parameter 'v_c_merchant_id' when calling OffersApi.get_offer"
  end
  # verify the required parameter 'v_c_correlation_id' is set
  if @api_client.config.client_side_validation && v_c_correlation_id.nil?
    fail ArgumentError, "Missing the required parameter 'v_c_correlation_id' when calling OffersApi.get_offer"
  end
  # verify the required parameter 'v_c_organization_id' is set
  if @api_client.config.client_side_validation && v_c_organization_id.nil?
    fail ArgumentError, "Missing the required parameter 'v_c_organization_id' when calling OffersApi.get_offer"
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling OffersApi.get_offer"
  end
  # resource path
  local_var_path = 'vas/v1/currencyconversion/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/hal+json;charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json;charset=utf-8'])
  header_params[:'Content-Type'] = content_type
  header_params[:'x-requestid'] = x_requestid
  header_params[:'v-c-merchant-id'] = v_c_merchant_id
  header_params[:'v-c-correlation-id'] = v_c_correlation_id
  header_params[:'v-c-organization-id'] = v_c_organization_id

  # form parameters
  form_params = {}

  # http body (model)
  if 'GET' == 'POST'
    post_body = '{}'
  else
    post_body = nil
  end
  inbound_mle_status = "false"
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, inbound_mle_status, ["get_offer","get_offer_with_http_info"])
    begin
      post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
    rescue
      raise
    end
  end

  is_response_mle_for_api = MLEUtility.check_is_response_mle_for_api(@api_client.merchantconfig, ["get_offer","get_offer_with_http_info"])

  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'InlineResponse20016',
    :isResponseMLEForApi => is_response_mle_for_api)
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: OffersApi#get_offer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end