Class: CyberSourceMergedSpec::InvoiceSettingsController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/controllers/invoice_settings_controller.rb

Overview

InvoiceSettingsController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

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

Constructor Details

This class inherits a constructor from CyberSourceMergedSpec::BaseController

Instance Method Details

#get_invoice_settings(product_type: nil) ⇒ ApiResponse

Allows you to retrieve the invoice settings for the payment page. which product type settings you want to update.

Parameters:

  • product_type (ProductType) (defaults to: nil)

    Optional parameter: Allows you to choose

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/cyber_source_merged_spec/controllers/invoice_settings_controller.rb', line 50

def get_invoice_settings(product_type: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/invoicing/v2/invoiceSettings',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json;charset=utf-8', key: 'Content-Type'))
               .query_param(new_parameter(product_type, key: 'productType'))
               .header_param(new_parameter('application/json', key: 'accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(InvoicingV2InvoiceSettingsGet200Response.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Could not get the invoice settings for this merchant.',
                             InvoicingV2InvoiceSettingsGet400ResponseException)
                .local_error('default',
                             'Unexpected error.',
                             InvoicingV2InvoiceSettingsGet502ResponseException))
    .execute
end

#update_invoice_settings(invoice_settings_request, product_type: nil) ⇒ ApiResponse

Allows you to customize the payment page, the checkout experience, email communication and payer authentication. You can customize the invoice to match your brand with your business name, logo and brand colors, and a VAT Tax number. You can choose to capture the payers shipping details, phone number and email during the checkout process. You can add a custom message to all invoice emails and enable or disable payer authentication for invoice payments. parameter: TODO: type description here which product type settings you want to update.

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/cyber_source_merged_spec/controllers/invoice_settings_controller.rb', line 21

def update_invoice_settings(invoice_settings_request,
                            product_type: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/invoicing/v2/invoiceSettings',
                                 Server::DEFAULT)
               .body_param(new_parameter(invoice_settings_request)
                            .is_required(true))
               .header_param(new_parameter('application/json;charset=utf-8', key: 'Content-Type'))
               .query_param(new_parameter(product_type, key: 'productType'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(InvoicingV2InvoiceSettingsPut200Response.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Could not update the invoice settings for this merchant.',
                             InvoicingV2InvoiceSettingsPut400ResponseException)
                .local_error('default',
                             'Unexpected error.',
                             InvoicingV2InvoiceSettingsPut502ResponseException))
    .execute
end