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 = {}) ⇒ InlineResponse2018

Create an Offer Creates an offer record on the provider system.

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:



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

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<(InlineResponse2018, Fixnum, Hash)>

Create an Offer Creates an offer record on the provider system.

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<(InlineResponse2018, Fixnum, Hash)>)

    InlineResponse2018 data, response status code and response headers



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
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
# File 'lib/cybersource_rest_client/api/offers_api.rb', line 49

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
  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 => 'InlineResponse2018')
  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 = {}) ⇒ InlineResponse20015

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:



146
147
148
149
# File 'lib/cybersource_rest_client/api/offers_api.rb', line 146

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<(InlineResponse20015, 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<(InlineResponse20015, Fixnum, Hash)>)

    InlineResponse20015 data, response status code and response headers



161
162
163
164
165
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
# File 'lib/cybersource_rest_client/api/offers_api.rb', line 161

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
  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 => 'InlineResponse20015')
  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