Class: NewStoreApi::FinancialDocumentController

Inherits:
BaseController show all
Defined in:
lib/new_store_api/controllers/financial_document_controller.rb

Overview

FinancialDocumentController

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

Constructor Details

This class inherits a constructor from NewStoreApi::BaseController

Instance Method Details

#create_exchange_receipt(x_newstore_tenant, request_id: nil, body: nil) ⇒ PermalinkResponse

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Retrieve or generate a exchange receipt for a given order. description here parameter: TODO: type description here

Parameters:

Returns:



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/new_store_api/controllers/financial_document_controller.rb', line 67

def create_exchange_receipt(x_newstore_tenant,
                            request_id: nil,
                            body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/checkout/financial-documents/exchange-receipts',
                                 Server::API)
               .header_param(new_parameter(x_newstore_tenant, key: 'X-Newstore-Tenant'))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .header_param(new_parameter(request_id, key: 'request-id'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PermalinkResponse.method(:from_hash)))
    .execute
end

#create_new_documents_created_events(x_newstore_tenant, tenant, order_id, request_id: nil) ⇒ String

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Republish documents created events for a specific order_id: * financial_documents.sales_receipt_created * financial_documents.return_receipt_created * financial_documents.exchange_receipt_created * financial_documents.invoice_created * financial_documents.refund_note_created description here

Parameters:

  • x_newstore_tenant (String)

    Required parameter: TODO: type

  • tenant (String)

    Required parameter: TODO: type description here

  • order_id (String)

    Required parameter: TODO: type description here

  • request_id (String) (defaults to: nil)

    Optional parameter: ID of the request

Returns:

  • (String)

    Response from the API call.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/new_store_api/controllers/financial_document_controller.rb', line 30

def create_new_documents_created_events(x_newstore_tenant,
                                        tenant,
                                        order_id,
                                        request_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/checkout/financial-documents/document-created-events/{order_id}',
                                 Server::API)
               .header_param(new_parameter(x_newstore_tenant, key: 'X-Newstore-Tenant'))
               .header_param(new_parameter(tenant, key: 'tenant'))
               .template_param(new_parameter(order_id, key: 'order_id')
                                .should_encode(true))
               .header_param(new_parameter(request_id, key: 'request-id'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:deserialize_primitive_types))
                .deserialize_into(proc do |response| response&.to_s end)
                .is_primitive_response(true))
    .execute
end

#create_return_receipt(x_newstore_tenant, request_id: nil, body: nil) ⇒ ReturnReceiptResponse

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Retrieve or regenerate return_receipt for a given order. This endpoint will not generate a return receipt if it hasn't been generated before. description here description here

Parameters:

  • x_newstore_tenant (String)

    Required parameter: TODO: type

  • request_id (String) (defaults to: nil)

    Optional parameter: ID of the request

  • body (GetReturnReceiptRequest) (defaults to: nil)

    Optional parameter: TODO: type

Returns:



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/new_store_api/controllers/financial_document_controller.rb', line 105

def create_return_receipt(x_newstore_tenant,
                          request_id: nil,
                          body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/checkout/financial-documents/return-receipts',
                                 Server::API)
               .header_param(new_parameter(x_newstore_tenant, key: 'X-Newstore-Tenant'))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .header_param(new_parameter(request_id, key: 'request-id'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ReturnReceiptResponse.method(:from_hash)))
    .execute
end

#create_sales_receipt(x_newstore_tenant, request_id: nil, body: nil) ⇒ PermalinkResponse

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Retrieve or generate a sales receipt for a given order. description here parameter: TODO: type description here

Parameters:

  • x_newstore_tenant (String)

    Required parameter: TODO: type

  • request_id (String) (defaults to: nil)

    Optional parameter: ID of the request

  • body (CheckoutFinancialDocumentsSalesReceiptsRequest) (defaults to: nil)

    Optional

Returns:



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/new_store_api/controllers/financial_document_controller.rb', line 141

def create_sales_receipt(x_newstore_tenant,
                         request_id: nil,
                         body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/checkout/financial-documents/sales-receipts',
                                 Server::API)
               .header_param(new_parameter(x_newstore_tenant, key: 'X-Newstore-Tenant'))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .header_param(new_parameter(request_id, key: 'request-id'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PermalinkResponse.method(:from_hash)))
    .execute
end