data-and-reporting-sdk 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +104 -0
- data/lib/shell_data_reporting_ap_is/api_helper.rb +10 -0
- data/lib/shell_data_reporting_ap_is/client.rb +84 -0
- data/lib/shell_data_reporting_ap_is/configuration.rb +110 -0
- data/lib/shell_data_reporting_ap_is/controllers/base_controller.rb +66 -0
- data/lib/shell_data_reporting_ap_is/controllers/customer_controller.rb +478 -0
- data/lib/shell_data_reporting_ap_is/controllers/invoice_controller.rb +470 -0
- data/lib/shell_data_reporting_ap_is/controllers/o_auth_authorization_controller.rb +42 -0
- data/lib/shell_data_reporting_ap_is/controllers/transaction_controller.rb +878 -0
- data/lib/shell_data_reporting_ap_is/exceptions/api_exception.rb +10 -0
- data/lib/shell_data_reporting_ap_is/exceptions/default_error_exception.rb +32 -0
- data/lib/shell_data_reporting_ap_is/exceptions/error_object_exception.rb +54 -0
- data/lib/shell_data_reporting_ap_is/exceptions/error_user_access_error1_exception.rb +32 -0
- data/lib/shell_data_reporting_ap_is/exceptions/o_auth_provider_exception.rb +48 -0
- data/lib/shell_data_reporting_ap_is/http/auth/basic_auth.rb +50 -0
- data/lib/shell_data_reporting_ap_is/http/auth/bearer_token.rb +89 -0
- data/lib/shell_data_reporting_ap_is/http/http_call_back.rb +10 -0
- data/lib/shell_data_reporting_ap_is/http/http_method_enum.rb +10 -0
- data/lib/shell_data_reporting_ap_is/http/http_request.rb +10 -0
- data/lib/shell_data_reporting_ap_is/http/http_response.rb +10 -0
- data/lib/shell_data_reporting_ap_is/models/account_access.rb +128 -0
- data/lib/shell_data_reporting_ap_is/models/account_request.rb +252 -0
- data/lib/shell_data_reporting_ap_is/models/account_response.rb +111 -0
- data/lib/shell_data_reporting_ap_is/models/account_response_accounts_items.rb +750 -0
- data/lib/shell_data_reporting_ap_is/models/accounts.rb +65 -0
- data/lib/shell_data_reporting_ap_is/models/address.rb +174 -0
- data/lib/shell_data_reporting_ap_is/models/associated_account.rb +98 -0
- data/lib/shell_data_reporting_ap_is/models/audit_request.rb +256 -0
- data/lib/shell_data_reporting_ap_is/models/audit_response.rb +111 -0
- data/lib/shell_data_reporting_ap_is/models/audit_response_audits_items.rb +450 -0
- data/lib/shell_data_reporting_ap_is/models/bank_account.rb +192 -0
- data/lib/shell_data_reporting_ap_is/models/base_model.rb +62 -0
- data/lib/shell_data_reporting_ap_is/models/bonus_configuration.rb +419 -0
- data/lib/shell_data_reporting_ap_is/models/bonus_history.rb +444 -0
- data/lib/shell_data_reporting_ap_is/models/card_day_time_restrictions.rb +159 -0
- data/lib/shell_data_reporting_ap_is/models/card_exceptions.rb +268 -0
- data/lib/shell_data_reporting_ap_is/models/card_group_request.rb +178 -0
- data/lib/shell_data_reporting_ap_is/models/card_group_response.rb +109 -0
- data/lib/shell_data_reporting_ap_is/models/card_group_response_card_groups_items.rb +301 -0
- data/lib/shell_data_reporting_ap_is/models/card_type_request.rb +145 -0
- data/lib/shell_data_reporting_ap_is/models/card_type_response.rb +79 -0
- data/lib/shell_data_reporting_ap_is/models/card_type_response_customer_card_types_items.rb +470 -0
- data/lib/shell_data_reporting_ap_is/models/card_type_response_error.rb +60 -0
- data/lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb +281 -0
- data/lib/shell_data_reporting_ap_is/models/card_usage_summary_request.rb +159 -0
- data/lib/shell_data_reporting_ap_is/models/card_usage_summary_response.rb +79 -0
- data/lib/shell_data_reporting_ap_is/models/col_co_access.rb +88 -0
- data/lib/shell_data_reporting_ap_is/models/current_volume.rb +99 -0
- data/lib/shell_data_reporting_ap_is/models/customer_contract.rb +63 -0
- data/lib/shell_data_reporting_ap_is/models/customer_detail_request.rb +123 -0
- data/lib/shell_data_reporting_ap_is/models/customer_detail_response.rb +437 -0
- data/lib/shell_data_reporting_ap_is/models/customer_price_list_request.rb +200 -0
- data/lib/shell_data_reporting_ap_is/models/customer_price_list_response.rb +82 -0
- data/lib/shell_data_reporting_ap_is/models/default_error_fault.rb +60 -0
- data/lib/shell_data_reporting_ap_is/models/default_error_fault_detail.rb +50 -0
- data/lib/shell_data_reporting_ap_is/models/delivery_addresses.rb +258 -0
- data/lib/shell_data_reporting_ap_is/models/eid_access.rb +75 -0
- data/lib/shell_data_reporting_ap_is/models/eid_document.rb +166 -0
- data/lib/shell_data_reporting_ap_is/models/eid_document_response.rb +140 -0
- data/lib/shell_data_reporting_ap_is/models/eid_download_req.rb +86 -0
- data/lib/shell_data_reporting_ap_is/models/eid_download_request.rb +50 -0
- data/lib/shell_data_reporting_ap_is/models/eid_search_req.rb +160 -0
- data/lib/shell_data_reporting_ap_is/models/eid_search_request.rb +70 -0
- data/lib/shell_data_reporting_ap_is/models/error_details.rb +81 -0
- data/lib/shell_data_reporting_ap_is/models/error_status.rb +60 -0
- data/lib/shell_data_reporting_ap_is/models/error_user_access.rb +50 -0
- data/lib/shell_data_reporting_ap_is/models/error_user_access_error.rb +60 -0
- data/lib/shell_data_reporting_ap_is/models/exception_product.rb +65 -0
- data/lib/shell_data_reporting_ap_is/models/exception_site_location.rb +63 -0
- data/lib/shell_data_reporting_ap_is/models/fee_item.rb +977 -0
- data/lib/shell_data_reporting_ap_is/models/fee_item_summary_all_of0.rb +194 -0
- data/lib/shell_data_reporting_ap_is/models/fee_rule_location.rb +153 -0
- data/lib/shell_data_reporting_ap_is/models/fee_rule_product.rb +98 -0
- data/lib/shell_data_reporting_ap_is/models/fee_rule_tier.rb +74 -0
- data/lib/shell_data_reporting_ap_is/models/fee_summary_response.rb +85 -0
- data/lib/shell_data_reporting_ap_is/models/fees_fee_rule_tiers.rb +124 -0
- data/lib/shell_data_reporting_ap_is/models/finance_currency.rb +98 -0
- data/lib/shell_data_reporting_ap_is/models/fuel_consumption_card.rb +73 -0
- data/lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb +267 -0
- data/lib/shell_data_reporting_ap_is/models/fuel_consumption_request.rb +197 -0
- data/lib/shell_data_reporting_ap_is/models/fuel_consumption_response.rb +79 -0
- data/lib/shell_data_reporting_ap_is/models/invoice_dates_data.rb +62 -0
- data/lib/shell_data_reporting_ap_is/models/invoice_dates_request.rb +50 -0
- data/lib/shell_data_reporting_ap_is/models/invoice_dates_request_filters.rb +146 -0
- data/lib/shell_data_reporting_ap_is/models/invoice_dates_response_data.rb +80 -0
- data/lib/shell_data_reporting_ap_is/models/invoice_distribution_method.rb +99 -0
- data/lib/shell_data_reporting_ap_is/models/invoice_download_req.rb +99 -0
- data/lib/shell_data_reporting_ap_is/models/invoice_download_request.rb +50 -0
- data/lib/shell_data_reporting_ap_is/models/invoice_search_additional_document.rb +80 -0
- data/lib/shell_data_reporting_ap_is/models/invoice_search_details.rb +913 -0
- data/lib/shell_data_reporting_ap_is/models/invoice_search_request.rb +91 -0
- data/lib/shell_data_reporting_ap_is/models/invoice_search_request_filters.rb +344 -0
- data/lib/shell_data_reporting_ap_is/models/invoice_search_response.rb +127 -0
- data/lib/shell_data_reporting_ap_is/models/invoice_summary_details.rb +129 -0
- data/lib/shell_data_reporting_ap_is/models/invoice_summary_request.rb +50 -0
- data/lib/shell_data_reporting_ap_is/models/invoice_summary_request_filters.rb +345 -0
- data/lib/shell_data_reporting_ap_is/models/invoice_summary_response.rb +79 -0
- data/lib/shell_data_reporting_ap_is/models/invoices_summaries.rb +221 -0
- data/lib/shell_data_reporting_ap_is/models/last_statement_of_account.rb +421 -0
- data/lib/shell_data_reporting_ap_is/models/logged_in_user_request.rb +107 -0
- data/lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb +394 -0
- data/lib/shell_data_reporting_ap_is/models/monthly_invoice_trend.rb +112 -0
- data/lib/shell_data_reporting_ap_is/models/multi_priced_transaction_request.rb +360 -0
- data/lib/shell_data_reporting_ap_is/models/multi_priced_transaction_request_accounts_items.rb +84 -0
- data/lib/shell_data_reporting_ap_is/models/multi_priced_transaction_response.rb +110 -0
- data/lib/shell_data_reporting_ap_is/models/multi_priced_transaction_response_transactions_items.rb +1724 -0
- data/lib/shell_data_reporting_ap_is/models/o_auth_provider_error_enum.rb +45 -0
- data/lib/shell_data_reporting_ap_is/models/o_auth_token.rb +100 -0
- data/lib/shell_data_reporting_ap_is/models/past_statement_of_accounts.rb +502 -0
- data/lib/shell_data_reporting_ap_is/models/payer_access.rb +147 -0
- data/lib/shell_data_reporting_ap_is/models/payer_details.rb +1412 -0
- data/lib/shell_data_reporting_ap_is/models/payer_request.rb +126 -0
- data/lib/shell_data_reporting_ap_is/models/payer_response.rb +115 -0
- data/lib/shell_data_reporting_ap_is/models/payers.rb +109 -0
- data/lib/shell_data_reporting_ap_is/models/payments_since_last_soa.rb +322 -0
- data/lib/shell_data_reporting_ap_is/models/pin_advice_types.rb +80 -0
- data/lib/shell_data_reporting_ap_is/models/price_list.rb +485 -0
- data/lib/shell_data_reporting_ap_is/models/price_trans_summary_request.rb +477 -0
- data/lib/shell_data_reporting_ap_is/models/price_transaction_request.rb +572 -0
- data/lib/shell_data_reporting_ap_is/models/priced_request_data.rb +485 -0
- data/lib/shell_data_reporting_ap_is/models/priced_response_data.rb +2132 -0
- data/lib/shell_data_reporting_ap_is/models/priced_trans_summary_response.rb +79 -0
- data/lib/shell_data_reporting_ap_is/models/priced_trans_summary_response_transactions_summary_items.rb +242 -0
- data/lib/shell_data_reporting_ap_is/models/priced_transaction_items_location_items.rb +67 -0
- data/lib/shell_data_reporting_ap_is/models/priced_transaction_req_v2_invoice_status_enum.rb +27 -0
- data/lib/shell_data_reporting_ap_is/models/priced_transaction_req_v2_period_enum.rb +27 -0
- data/lib/shell_data_reporting_ap_is/models/priced_transaction_req_v2_sort_order_enum.rb +37 -0
- data/lib/shell_data_reporting_ap_is/models/priced_transaction_request_v2.rb +72 -0
- data/lib/shell_data_reporting_ap_is/models/priced_transaction_resp_v2_refund_flag_enum.rb +23 -0
- data/lib/shell_data_reporting_ap_is/models/priced_transaction_response.rb +59 -0
- data/lib/shell_data_reporting_ap_is/models/priced_transaction_response_transactions_items.rb +1719 -0
- data/lib/shell_data_reporting_ap_is/models/priced_transaction_response_v2.rb +110 -0
- data/lib/shell_data_reporting_ap_is/models/pricing_current_volume.rb +115 -0
- data/lib/shell_data_reporting_ap_is/models/pricing_history.rb +105 -0
- data/lib/shell_data_reporting_ap_is/models/purchase_categories.rb +114 -0
- data/lib/shell_data_reporting_ap_is/models/recent_transaction_req.rb +217 -0
- data/lib/shell_data_reporting_ap_is/models/recent_transaction_request.rb +66 -0
- data/lib/shell_data_reporting_ap_is/models/recent_transactions.rb +918 -0
- data/lib/shell_data_reporting_ap_is/models/recent_transactions_response.rb +110 -0
- data/lib/shell_data_reporting_ap_is/models/role.rb +102 -0
- data/lib/shell_data_reporting_ap_is/models/search_doc_req.rb +269 -0
- data/lib/shell_data_reporting_ap_is/models/search_documents_invoice.rb +204 -0
- data/lib/shell_data_reporting_ap_is/models/search_documents_request.rb +70 -0
- data/lib/shell_data_reporting_ap_is/models/search_documents_response.rb +122 -0
- data/lib/shell_data_reporting_ap_is/models/search_soa_req.rb +197 -0
- data/lib/shell_data_reporting_ap_is/models/search_statement_of_account.rb +220 -0
- data/lib/shell_data_reporting_ap_is/models/search_statement_of_account_request.rb +70 -0
- data/lib/shell_data_reporting_ap_is/models/search_statement_of_account_response.rb +120 -0
- data/lib/shell_data_reporting_ap_is/models/site_location.rb +67 -0
- data/lib/shell_data_reporting_ap_is/models/statement_of_account_request.rb +50 -0
- data/lib/shell_data_reporting_ap_is/models/statement_of_account_request_filters.rb +197 -0
- data/lib/shell_data_reporting_ap_is/models/statement_of_account_resp.rb +138 -0
- data/lib/shell_data_reporting_ap_is/models/statement_of_account_response.rb +80 -0
- data/lib/shell_data_reporting_ap_is/models/tier.rb +167 -0
- data/lib/shell_data_reporting_ap_is/models/transaction_exceptions.rb +1267 -0
- data/lib/shell_data_reporting_ap_is/models/transaction_exceptions_request.rb +267 -0
- data/lib/shell_data_reporting_ap_is/models/transaction_exceptions_response.rb +100 -0
- data/lib/shell_data_reporting_ap_is/models/transaction_fees_request.rb +348 -0
- data/lib/shell_data_reporting_ap_is/models/transaction_fees_response.rb +111 -0
- data/lib/shell_data_reporting_ap_is/models/update_odometer.rb +62 -0
- data/lib/shell_data_reporting_ap_is/models/update_odometer_reference.rb +67 -0
- data/lib/shell_data_reporting_ap_is/models/update_odometer_request.rb +146 -0
- data/lib/shell_data_reporting_ap_is/models/update_odometer_response.rb +93 -0
- data/lib/shell_data_reporting_ap_is/models/usage_summary.rb +202 -0
- data/lib/shell_data_reporting_ap_is/models/volume_based_bonus_request.rb +118 -0
- data/lib/shell_data_reporting_ap_is/models/volume_based_bonus_response.rb +120 -0
- data/lib/shell_data_reporting_ap_is/models/volume_based_pricing_request.rb +103 -0
- data/lib/shell_data_reporting_ap_is/models/volume_based_pricing_response.rb +120 -0
- data/lib/shell_data_reporting_ap_is/utilities/date_time_helper.rb +11 -0
- data/lib/shell_data_reporting_ap_is/utilities/file_wrapper.rb +16 -0
- data/lib/shell_data_reporting_ap_is.rb +229 -0
- data/test/controllers/controller_test_base.rb +34 -0
- data/test/controllers/test_invoice_controller.rb +398 -0
- data/test/controllers/test_transaction_controller.rb +235 -0
- data/test/http_response_catcher.rb +19 -0
- metadata +302 -0
@@ -0,0 +1,398 @@
|
|
1
|
+
# shell_data_reporting_ap_is
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
require_relative 'controller_test_base'
|
7
|
+
|
8
|
+
class InvoiceControllerTests < ControllerTestBase
|
9
|
+
# Called only once for the class before any test has executed
|
10
|
+
def setup
|
11
|
+
setup_class
|
12
|
+
@controller = @client.invoice
|
13
|
+
@response_catcher = @controller.http_call_back
|
14
|
+
end
|
15
|
+
|
16
|
+
# This API allows to search invoice data in the Shell Card Platform. It provides flexible search criteria in the request body and supports paging.
|
17
|
+
#
|
18
|
+
#This API will also query the relevant invoice documents list and return a reference number that can be used to download invoice documents (PDF and Proofing elements in a zip file).
|
19
|
+
#
|
20
|
+
##### Supported operations
|
21
|
+
# * Search invoices by account
|
22
|
+
# * Search invoices by invoice type or invoice status
|
23
|
+
# * Search invoices by invoice id or number
|
24
|
+
# * Search invoices by invoiced country
|
25
|
+
# * Search invoices including einvoices
|
26
|
+
# * Search invoices by summary document
|
27
|
+
# * Search invoices by statement of account
|
28
|
+
# * Search invoices by fixed and custom date periods
|
29
|
+
def test_invoice_search
|
30
|
+
# Parameters for the API call
|
31
|
+
request_id = '2b0cbe11-f109-4c43-9201-49af0370df1c'
|
32
|
+
body = InvoiceSearchRequest.from_hash(APIHelper.json_deserialize(
|
33
|
+
'{"Filters":{"ColCoId":14,"PayerId":78,"PayerNumber":"DE26688478","Accou'\
|
34
|
+
'ntId":92,"AccountNumber":"DE26702892","InvoiceId":4013059,"InvoiceNumbe'\
|
35
|
+
'r":"0123456789","FromDate":"20170830","ToDate":"20171031","InvoiceDate"'\
|
36
|
+
':"20171031","Type":"Original","SummaryDocumentId":1616729,"SummaryDocum'\
|
37
|
+
'entNumber":"1283899/289261063/2019","StatementOfAccountId":"DE26702892"'\
|
38
|
+
',"SoAReferenceNumber":"1283899","Period":1,"InvoiceStatus":"Due","Invoi'\
|
39
|
+
'cedOnBehalfOf":"DE","IncludeEInvoiceDetails":false,"SortBy":[1]},"PageS'\
|
40
|
+
'ize":50,"Page":1}', false))
|
41
|
+
|
42
|
+
# Perform the API call through the SDK function
|
43
|
+
result = @controller.invoice_search(request_id, body: body)
|
44
|
+
|
45
|
+
# Test response code
|
46
|
+
assert_equal(200, @response_catcher.response.status_code)
|
47
|
+
|
48
|
+
# Test headers
|
49
|
+
expected_headers = {}
|
50
|
+
expected_headers['content-type'] = 'application/json'
|
51
|
+
|
52
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
53
|
+
|
54
|
+
# Test whether the captured response is as we expected
|
55
|
+
refute_nil(result)
|
56
|
+
expected_body = JSON.parse(
|
57
|
+
'{"RequestId":"18c955d1-b3ec-4dc0-95da-76e67afb891a","Status":"SUCCESS",'\
|
58
|
+
'"Data":[{"AccountFullName":"powder ambition ERF ","AccountId":179827,"'\
|
59
|
+
'AccountNumber":"DE26702892","AccountShortName":"soft grocery Argyle ",'\
|
60
|
+
'"ColCoId":14,"ColCoOpCoId":"014","CurrentBillingFrequency":"Last day of'\
|
61
|
+
' month","CurrentBillingFrequencyId":40,"CurrentDistributionMethod":"e-m'\
|
62
|
+
'ail","CurrentDistributionMethodId":1,"CustomerCurrencyCode":"EUR","Cust'\
|
63
|
+
'omerCurrencySymbol":"€","DelCoClientNumber":"014","DelCoId":14,"DelCoOp'\
|
64
|
+
'CoId":"014","DocumentType":"Invoice","DocumentTypeId":1,"DueDate":"2019'\
|
65
|
+
'0707","GrossAmountCustomerCurrency":22.85,"GrossAmountTransactionCurren'\
|
66
|
+
'cy":22.85,"InvoiceDate":"20190630","InvoicedBy":"euroShell Deutschland '\
|
67
|
+
'GmbH & Co. KG","InvoicedOnBehalfOf":"Germany","InvoiceId":4013059,"Invo'\
|
68
|
+
'iceNumber":"6402009004","IsInternational":false,"IsNational":true,"NetA'\
|
69
|
+
'mountCustomerCurrency":19.2,"NetAmountTransactionCurrency":19.2,"PayerI'\
|
70
|
+
'd":164825,"PayerNumber":"DE26688478","PaymentTerms":"7 days after invoi'\
|
71
|
+
'ce","PaymentTermsId":9,"ReplacementInvoiceId":null,"ReversalInvoiceId":'\
|
72
|
+
'null,"Status":"Paid","SummaryDocumentBillingType":"Standard Invoice","S'\
|
73
|
+
'ummaryDocumentBillingTypeId":0,"SummaryDocumentDate":"20190630","Summar'\
|
74
|
+
'yDocumentDDAmount":22.85,"SummaryDocumentDueDate":"20190707","SummaryDo'\
|
75
|
+
'cumentId":1616729,"SummaryDocumentIsFullyPaid":true,"SummaryDocumentNum'\
|
76
|
+
'ber":"1283899/289261063/2019","SummaryDocumentPaidAmount":22.85,"Summar'\
|
77
|
+
'yDocumentSoAReferenceNumber":"2000745709","SummaryDocumentStatementOfAc'\
|
78
|
+
'countId":2000745709,"TransactionCurrencyCode":"EUR","TransactionCurrenc'\
|
79
|
+
'ySymbol":"€","Type":"Original","TypeId":1,"VATAmountCustomerCurrency":3'\
|
80
|
+
'.65,"VATAmountTransactionCurrency":3.65,"VATCountry":"Germany","VATCoun'\
|
81
|
+
'tryId":9,"VATCountryISOCode":"DE","VATCountryOpCoId":"014"}],"Page":1,"'\
|
82
|
+
'PageSize":50,"TotalRecords":1,"TotalPages":1}'
|
83
|
+
)
|
84
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
85
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
86
|
+
end
|
87
|
+
|
88
|
+
# This API returns the high level summary of invoices that match the given search criteria. The same search criteria as the endpoint `/v1/invoice/search` is supported with the exception of paging related parameters.
|
89
|
+
#
|
90
|
+
#
|
91
|
+
##### Supported operations
|
92
|
+
# * Search invoices by account
|
93
|
+
# * Search invoices by invoice type or invoice status
|
94
|
+
# * Search invoices by invoice id or number
|
95
|
+
# * Search invoices by invoiced country
|
96
|
+
# * Search invoices including einvoices
|
97
|
+
# * Search invoices by summary document
|
98
|
+
# * Search invoices by statement of account
|
99
|
+
# * Search invoices by fixed and custom date periods
|
100
|
+
def test_invoice_summary
|
101
|
+
# Parameters for the API call
|
102
|
+
request_id = '2b0cbe11-f109-4c43-9201-49af0370df1c'
|
103
|
+
body = InvoiceSummaryRequest.from_hash(APIHelper.json_deserialize(
|
104
|
+
'{"Filters":{"ColCoId":14,"PayerId":78,"PayerNumber":"DE26688478","Accou'\
|
105
|
+
'ntId":92,"AccountNumber":"DE26702892","InvoiceId":4013059,"InvoiceNumbe'\
|
106
|
+
'r":"0123456789","FromDate":"20170830","ToDate":"20171031","InvoiceDate"'\
|
107
|
+
':"20171031","Type":"Original","SummaryDocumentId":1616729,"SummaryDocum'\
|
108
|
+
'entNumber":"1283899/289261063/2019","StatementOfAccountId":"DE26702892"'\
|
109
|
+
',"SoAReferenceNumber":"1283899","Period":1,"InvoiceStatus":"Due","Invoi'\
|
110
|
+
'cedOnBehalfOf":"DE","IncludeEInvoiceDetails":false}}', false))
|
111
|
+
|
112
|
+
# Perform the API call through the SDK function
|
113
|
+
result = @controller.invoice_summary(request_id, body: body)
|
114
|
+
|
115
|
+
# Test response code
|
116
|
+
assert_equal(200, @response_catcher.response.status_code)
|
117
|
+
|
118
|
+
# Test headers
|
119
|
+
expected_headers = {}
|
120
|
+
expected_headers['content-type'] = 'application/json'
|
121
|
+
|
122
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
123
|
+
|
124
|
+
# Test whether the captured response is as we expected
|
125
|
+
refute_nil(result)
|
126
|
+
expected_body = JSON.parse(
|
127
|
+
'{"RequestId":"a0a1596f-b242-4672-b513-66c5e5554195","Status":"SUCCESS",'\
|
128
|
+
'"Data":[{"TotalInvoices":1,"TotalGrossAmountCustomerCurrency":22.85,"To'\
|
129
|
+
'talNetAmountCustomerCurrency":19.2,"TotalVATAmountCustomerCurrency":3.6'\
|
130
|
+
'5,"CustomerCurrencyCode":"EUR","CustomerCurrencySymbol":"€"}]}'
|
131
|
+
)
|
132
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
133
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
134
|
+
end
|
135
|
+
|
136
|
+
# This API allows querying the details of the latest statement of account (SOA) generated for a given Payer.
|
137
|
+
#
|
138
|
+
#The endpoint supports querying SOA documents by various input parameters specified in the request body.
|
139
|
+
#
|
140
|
+
##### Supported operations
|
141
|
+
# * Search invoice SOA by payer and account
|
142
|
+
# * Search invoice SOA including monthly trend (last 13 months invocie trend summary)
|
143
|
+
# * Search invoice SOA including past SOAs
|
144
|
+
# * Search invoice SOA including due/overdue documents
|
145
|
+
# * Search invoice SOA including invoice summary
|
146
|
+
def test_statement_of_account
|
147
|
+
# Parameters for the API call
|
148
|
+
request_id = '2b0cbe11-f109-4c43-9201-49af0370df1c'
|
149
|
+
body = StatementOfAccountRequest.from_hash(APIHelper.json_deserialize(
|
150
|
+
'{"Filters":{"ColCoCode":32,"PayerId":308,"PayerNumber":"CZ56891709","Ac'\
|
151
|
+
'countNumber":"CZ56891900","Accountid":6928,"IncludeMonthlyInvoiceTrend"'\
|
152
|
+
':true,"IncludePastStatementOfAccounts":true,"DueOrOverDueSOADocumentsOn'\
|
153
|
+
'ly":false,"NumberOfSOADocuments":10,"IncludeAccountInvoicesSummary":tru'\
|
154
|
+
'e}}', false))
|
155
|
+
|
156
|
+
# Perform the API call through the SDK function
|
157
|
+
result = @controller.statement_of_account(request_id, body: body)
|
158
|
+
|
159
|
+
# Test response code
|
160
|
+
assert_equal(200, @response_catcher.response.status_code)
|
161
|
+
|
162
|
+
# Test headers
|
163
|
+
expected_headers = {}
|
164
|
+
expected_headers['content-type'] = 'application/json'
|
165
|
+
|
166
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
167
|
+
|
168
|
+
# Test whether the captured response is as we expected
|
169
|
+
refute_nil(result)
|
170
|
+
expected_body = JSON.parse(
|
171
|
+
'{"RequestId":"5acba53b-3ce7-4f4b-ab59-1db09399aa6a","Status":"SUCCESS",'\
|
172
|
+
'"Data":[{"LastStatementOfAccount":{"AmountDue":123699.71,"AmountNotOver'\
|
173
|
+
'due":136604.83,"AmountOverdue":926469.11,"CreditLimit":7000000,"CreditL'\
|
174
|
+
'imitCurrencyCode":"CZK","CreditLimitCurrencySymbol":"Kč","CreditLimitIn'\
|
175
|
+
'CustomerCurrency":286826.469986,"CurrencyCode":"EUR","CurrencySymbol":"'\
|
176
|
+
'€","LastPaymentCurrencyCode":"EUR","LastPaymentCurrencySymbol":"€","Las'\
|
177
|
+
'tPaymentDate":"20220209","LastPaymentValue":17918.98,"OutstandingBalanc'\
|
178
|
+
'e":1186773.65,"PayerId":308,"PayerNumber":"CZ56891709","PaymentDueDate"'\
|
179
|
+
':"20230608","PaymentMethod":"Incoming - Bank Transfer","PaymentMethodId'\
|
180
|
+
'":4,"PaymentTerms":"30 days after Invoice","PaymentTermsId":4,"SoARefer'\
|
181
|
+
'enceNumber":"2003923319","StatementDate":"20230509","StatementOfAccount'\
|
182
|
+
'Id":2003923319,"TotalBillingDocuments":6,"TotalSummaryBillingDocuments"'\
|
183
|
+
':1,"UnallocatedPayment":0},"MonthlyInvoiceTrend":null,"PastStatementOfA'\
|
184
|
+
'ccounts":[{"AmountDue":136604.83,"AmountNotOverdue":130344.09,"AmountOv'\
|
185
|
+
'erdue":796109.41,"AmountOverdueFromUnallocated":0,"AmountPaid":0,"Balan'\
|
186
|
+
'ceOnThisStatement":5866.1,"BillingCurrencyCode":"EUR","BillingCurrencyS'\
|
187
|
+
'ymbol":"€","CreditLimit":7000000,"CreditLimitCurrencyCode":"CZK","Credi'\
|
188
|
+
'tLimitCurrencySymbol":"Kč","CreditLimitInCustomerCurrency":286826.46998'\
|
189
|
+
'57,"CurrencyCode":"EUR","CurrencySymbol":"€","FullyPaid":false,"LastPay'\
|
190
|
+
'mentCurrencyCode":"EUR","LastPaymentCurrencySymbol":"€","LastPaymentDat'\
|
191
|
+
'e":"20220209","LastPaymentValue":17918.98,"OutstandingBalance":1063058.'\
|
192
|
+
'33,"PayerId":308,"PayerNumber":"CZ56891709","PaymentDueDate":"20230511"'\
|
193
|
+
',"SoAReferenceNumber":"2003920583","StatementDate":"20230411","Statemen'\
|
194
|
+
'tOfAccountId":2003920583,"TotalBillingDocuments":3,"TotalNetAmountBilli'\
|
195
|
+
'ngCurrency":4847.94,"TotalSummaryBillingDocuments":1,"TotalVATAmountBil'\
|
196
|
+
'lingCurrency":1018.16,"UnallocatedPayment":0,"LocalCurrencyCode":"EUR",'\
|
197
|
+
'"LocalCurrencySymbol":"€","LocalCurrencyExchangeRate":24.405}],"Payment'\
|
198
|
+
'sSinceLastSOA":null,"InvoicesSummaries":null}]}'
|
199
|
+
)
|
200
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
201
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
202
|
+
end
|
203
|
+
|
204
|
+
# - This API will return the list of Invoice Dates and Numbers for the given date range. If the dates are not provided then it will fetch the data for past 13 months.
|
205
|
+
def test_dates
|
206
|
+
# Parameters for the API call
|
207
|
+
request_id = '2b0cbe11-f109-4c43-9201-49af0370df1c'
|
208
|
+
body = InvoiceDatesRequest.from_hash(APIHelper.json_deserialize(
|
209
|
+
'{"Filters":{"ColCoCode":0,"PayerId":0,"PayerNumber":"string","IncludeMo'\
|
210
|
+
'nthlyInvoiceTrend":true,"IncludePastStatementOfAccounts":true,"DueOrOve'\
|
211
|
+
'rDueSOADocumentsOnly":true,"NumberOfSOADocuments":0,"IncludeAccountInvo'\
|
212
|
+
'icesSummary":true,"ColCoId":0,"Accounts":[{"AccountId":3453,"AccountNum'\
|
213
|
+
'ber":"GB000000124"}]}}', false))
|
214
|
+
|
215
|
+
# Perform the API call through the SDK function
|
216
|
+
result = @controller.dates(request_id, body: body)
|
217
|
+
|
218
|
+
# Test response code
|
219
|
+
assert_equal(200, @response_catcher.response.status_code)
|
220
|
+
|
221
|
+
# Test headers
|
222
|
+
expected_headers = {}
|
223
|
+
expected_headers['content-type'] = 'application/json'
|
224
|
+
|
225
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
226
|
+
|
227
|
+
# Test whether the captured response is as we expected
|
228
|
+
refute_nil(result)
|
229
|
+
expected_body = JSON.parse(
|
230
|
+
'{"RequestId":"a0a1596f-b242-4672-b513-66c5e5554195","Status":"SUCCESS",'\
|
231
|
+
'"Data":[{"InvoiceNumbers":["6402009004"],"InvoiceDates":["20170101"]}]}'\
|
232
|
+
''
|
233
|
+
)
|
234
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
235
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
236
|
+
end
|
237
|
+
|
238
|
+
# - This API will allow querying of SOA from different systems
|
239
|
+
def test_search_statement_of_account
|
240
|
+
# Parameters for the API call
|
241
|
+
request_id = '2b0cbe11-f109-4c43-9201-49af0370df1c'
|
242
|
+
body = SearchStatementOfAccountRequest.from_hash(APIHelper.json_deserialize(
|
243
|
+
'{"Filters":{"ColCoCode":18,"PayerNumber":"NL99781417","InvoiceNumber":"'\
|
244
|
+
'0123456789","FromDate":"2022/05/04","ToDate":"2022/05/10","Period":1,"I'\
|
245
|
+
'nvoiceDate":"20170830","InvoiceStatus":["Due"],"SortBy":[1]},"Page":1,"'\
|
246
|
+
'PageSize":10}', false))
|
247
|
+
|
248
|
+
# Perform the API call through the SDK function
|
249
|
+
result = @controller.search_statement_of_account(request_id, body: body)
|
250
|
+
|
251
|
+
# Test response code
|
252
|
+
assert_equal(200, @response_catcher.response.status_code)
|
253
|
+
|
254
|
+
# Test headers
|
255
|
+
expected_headers = {}
|
256
|
+
expected_headers['content-type'] = 'application/json'
|
257
|
+
|
258
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
259
|
+
|
260
|
+
# Test whether the captured response is as we expected
|
261
|
+
refute_nil(result)
|
262
|
+
expected_body = JSON.parse(
|
263
|
+
'{"RequestId":"a0a1596f-b242-4672-b513-66c5e5554195","Status":"SUCCESS",'\
|
264
|
+
'"Data":[{"StatementOfAccountId":2001581712,"SoAReferenceNumber":"200158'\
|
265
|
+
'1712","DocumentReferenceNumber":null,"StatementDate":"20220505","PayerI'\
|
266
|
+
'd":17150,"PayerNumber":"NL99781417","AmountDue":0,"AmountOverdue":19704'\
|
267
|
+
'6.47,"CurrencyCode":"EUR","CurrencySymbol":"€","DueDate":"20220604","In'\
|
268
|
+
'voicedOnBehalfOf":"Netherlands","Status":"OverDue","GrossAmountCustomer'\
|
269
|
+
'Currency":0}],"Page":1,"TotalRecords":62,"TotalPages":7,"PageSize":10}'
|
270
|
+
)
|
271
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
272
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
273
|
+
end
|
274
|
+
|
275
|
+
# - This API allows querying the details of all invoices successfully uploaded to the Worldline invoice repository and file reference numbers for downloading.
|
276
|
+
def test_search_documents
|
277
|
+
# Parameters for the API call
|
278
|
+
request_id = '2b0cbe11-f109-4c43-9201-49af0370df1c'
|
279
|
+
body = SearchDocumentsRequest.from_hash(APIHelper.json_deserialize(
|
280
|
+
'{"Filters":{"PayerNumber":"DE00000096","AccountNumber":"DE00000096","Co'\
|
281
|
+
'lCoCode":14,"AccountNumberList":["DE00000123","DE00000225"],"InvoiceNum'\
|
282
|
+
'ber":"1234567","InvoiceNumberList":["6400013693","9421000010"],"Invoice'\
|
283
|
+
'Status":"NEW","IssuingDateFrom":"2023/05/01","IssuingDateTo":"2023/06/3'\
|
284
|
+
'0","DueDateFrom":"2023/05/04","DueDateTo":"2023/06/30","GrossAmount":"1'\
|
285
|
+
'000","GrossAmountOperator":"LT","DocumentType":"SOA","VATIssuerCountry"'\
|
286
|
+
':"DE","SortyBy":["InvoiceNumber ASC","InvoiceDate DESC"]},"Page":"1","P'\
|
287
|
+
'ageSize":"50"}', false))
|
288
|
+
|
289
|
+
# Perform the API call through the SDK function
|
290
|
+
result = @controller.search_documents(request_id, body: body)
|
291
|
+
|
292
|
+
# Test response code
|
293
|
+
assert_equal(200, @response_catcher.response.status_code)
|
294
|
+
|
295
|
+
# Test headers
|
296
|
+
expected_headers = {}
|
297
|
+
expected_headers['content-type'] = 'application/json'
|
298
|
+
|
299
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
300
|
+
|
301
|
+
# Test whether the captured response is as we expected
|
302
|
+
refute_nil(result)
|
303
|
+
expected_body = JSON.parse(
|
304
|
+
'{"RequestId":"a8b81c1d-f44a-4365-8113-8958061c0b7e","Status":"SUCCESS",'\
|
305
|
+
'"Data":[{"DocumentReference":311161,"InvoiceNumber":"6400013693","Payer'\
|
306
|
+
'Name":"DE00000096","AccountNumber":"DE00000096","AccountName":"DE000000'\
|
307
|
+
'96","DocumentType":"NAT","GrossAmount":-3141.93,"NetAmount":0,"TaxAmoun'\
|
308
|
+
't":0,"CurrencyCode":"EUR","InvoiceStatus":"NEW","InvoiceDate":"2023/01/'\
|
309
|
+
'31","DueDate":"2023/02/07","VATCountryISOCode":"DE"}],"TotalRecords":2,'\
|
310
|
+
'"TotalRecordsOnPage":2,"IsFirstPage":true,"IsLastPage":true}'
|
311
|
+
)
|
312
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
313
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
314
|
+
end
|
315
|
+
|
316
|
+
# - This API provides the functionality needed for the screen “EID FILES” in the web interface. It allows retrieving a list of EIDs based on search criteria.
|
317
|
+
def test_eid_search
|
318
|
+
# Parameters for the API call
|
319
|
+
request_id = '2b0cbe11-f109-4c43-9201-49af0370df1c'
|
320
|
+
body = EIDSearchRequest.from_hash(APIHelper.json_deserialize(
|
321
|
+
'{"Filters":{"ColCoCode":32,"AccountGroupCountry":32,"AccountGroupId":["'\
|
322
|
+
'122"],"AccountGroupName":null,"FromDate":"2017/08/30","ToDate":"2017/10'\
|
323
|
+
'/31","InvoiceType":"NAT","InvoiceStatus":"NEW","SortBy":["DocumentDate '\
|
324
|
+
'ASC"]},"Page":1,"PageSize":10}', false))
|
325
|
+
|
326
|
+
# Perform the API call through the SDK function
|
327
|
+
result = @controller.eid_search(request_id, body: body)
|
328
|
+
|
329
|
+
# Test response code
|
330
|
+
assert_equal(200, @response_catcher.response.status_code)
|
331
|
+
|
332
|
+
# Test headers
|
333
|
+
expected_headers = {}
|
334
|
+
expected_headers['content-type'] = 'application/json'
|
335
|
+
|
336
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
337
|
+
|
338
|
+
# Test whether the captured response is as we expected
|
339
|
+
refute_nil(result)
|
340
|
+
expected_body = JSON.parse(
|
341
|
+
'{"RequestId":"a0a1596f-b242-4672-b513-66c5e5554195","Status":"SUCCESS",'\
|
342
|
+
'"Data":[{"DocumentId":15029,"AccountGroupId":"122","AccountGroupName":"'\
|
343
|
+
'EID-122","DocumentType":"INT","DocumentFormat":"FLAT","DocumentDate":"2'\
|
344
|
+
'022/12/28","NumberOfInvoices":1,"FileSize":1624,"DocumentStatus":"DOWNL'\
|
345
|
+
'OADED","DocumentName":"032_122_INT_28122022.TXT"}],"PageSize":1,"Page":'\
|
346
|
+
'1,"TotalPages":12,"TotalRecords":120,"IsFirstPage":true,"IsLastPage":fa'\
|
347
|
+
'lse}'
|
348
|
+
)
|
349
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
350
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
351
|
+
end
|
352
|
+
|
353
|
+
# - This API downloads Invoice Documents i.e., ZIP file with Invoice PDF file and Proofing Elements in XML format from invoice repository.
|
354
|
+
def test_download
|
355
|
+
# Parameters for the API call
|
356
|
+
request_id = '2b0cbe11-f109-4c43-9201-49af0370df1c'
|
357
|
+
body = InvoiceDownloadRequest.from_hash(APIHelper.json_deserialize(
|
358
|
+
'{"Filters":{"ColCoCode":18,"PayerNumber":"NL99781417","AccountNumber":['\
|
359
|
+
'"NL99781420"],"DocumentReference":[1234567890],"InvoiceOrSOANumber":"22'\
|
360
|
+
'34556"}}', false))
|
361
|
+
|
362
|
+
# Perform the API call through the SDK function
|
363
|
+
result = @controller.download(request_id, body: body)
|
364
|
+
|
365
|
+
# Test response code
|
366
|
+
assert_equal(200, @response_catcher.response.status_code)
|
367
|
+
|
368
|
+
# Test headers
|
369
|
+
expected_headers = {}
|
370
|
+
expected_headers['content-type'] = 'application/octet-stream'
|
371
|
+
|
372
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
373
|
+
end
|
374
|
+
|
375
|
+
# - This service allows downloading one or more EID documents and the corresponding signature material (where applicable) in one single request
|
376
|
+
#- The number of EID that can be downloaded at once is limited to 100 documents.
|
377
|
+
#
|
378
|
+
def test_eid_download
|
379
|
+
# Parameters for the API call
|
380
|
+
request_id = '2b0cbe11-f109-4c43-9201-49af0370df1c'
|
381
|
+
body = EIDDownloadRequest.from_hash(APIHelper.json_deserialize(
|
382
|
+
'{"Filters":{"ColCoCode":18,"EIDList":["1710187","1734566"],"AccountGrou'\
|
383
|
+
'pCountry":18,"AccountGroupIdList":["26685402"]}}', false))
|
384
|
+
|
385
|
+
# Perform the API call through the SDK function
|
386
|
+
result = @controller.eid_download(request_id, body: body)
|
387
|
+
|
388
|
+
# Test response code
|
389
|
+
assert_equal(200, @response_catcher.response.status_code)
|
390
|
+
|
391
|
+
# Test headers
|
392
|
+
expected_headers = {}
|
393
|
+
expected_headers['content-type'] = 'application/octet-stream'
|
394
|
+
|
395
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
396
|
+
end
|
397
|
+
|
398
|
+
end
|
@@ -0,0 +1,235 @@
|
|
1
|
+
# shell_data_reporting_ap_is
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
require_relative 'controller_test_base'
|
7
|
+
|
8
|
+
class TransactionControllerTests < ControllerTestBase
|
9
|
+
# Called only once for the class before any test has executed
|
10
|
+
def setup
|
11
|
+
setup_class
|
12
|
+
@controller = @client.transaction
|
13
|
+
@response_catcher = @controller.http_call_back
|
14
|
+
end
|
15
|
+
|
16
|
+
# This endpoint allows querying last 48 hours of transaction data of Shell Card (i.e. Priced, Billed, Unbilled etc. sales items). It provides a flexible search criteria and supports pagination. E.g., if the request is made at 08:30 AM on 18 Aug 2022 then transactions until 16 Aug 2022 08:30 AM (including) can be retrieved.
|
17
|
+
#
|
18
|
+
##### Supported operations
|
19
|
+
# * Search by Date and Time range (within the last 48 hours only)
|
20
|
+
# * Search by Payer and/or Account number
|
21
|
+
# * Search by Card
|
22
|
+
# * Search by Purchased Country
|
23
|
+
# * Search by Transaction posting date
|
24
|
+
# * Search by Driver Name or Vehicle registration number
|
25
|
+
# * Search by Fuel only transactions
|
26
|
+
# * Search by Product and/or Product group
|
27
|
+
def test_recent_transactions_new
|
28
|
+
# Parameters for the API call
|
29
|
+
request_id = '2b0cbe11-f109-4c43-9201-49af0370df1c'
|
30
|
+
body = RecentTransactionRequest.from_hash(APIHelper.json_deserialize(
|
31
|
+
'{"PageSize":1,"Page":1,"Filters":{"ColCoCode":14,"PayerNumber":"GB00001'\
|
32
|
+
'232","AccountNumber":"GB00001233","ProductCode":"22","PurchasedInCountr'\
|
33
|
+
'y":"GB","CardPAN":"700205******890645","FromDateTime":"2020-11-09 13:56'\
|
34
|
+
':03.000","ToDateTime":"2020-12-09 13:56:03.000","TransactionStatus":"AP'\
|
35
|
+
'PROVED","FuelOnly":"False","ProductGroupName":"Motor gasoline","Vehicle'\
|
36
|
+
'RegistrationNumber":"YG67OUM","IncludeDeclines":true,"CardIssuerName":"'\
|
37
|
+
'Mathew","ColumnList":"PayerNumber,AccountNumber,ProductName,FuelVolume,'\
|
38
|
+
'PAN"}}', false))
|
39
|
+
|
40
|
+
# Perform the API call through the SDK function
|
41
|
+
result = @controller.recent_transactions_new(request_id, body: body)
|
42
|
+
|
43
|
+
# Test response code
|
44
|
+
assert_equal(200, @response_catcher.response.status_code)
|
45
|
+
|
46
|
+
# Test headers
|
47
|
+
expected_headers = {}
|
48
|
+
expected_headers['content-type'] = 'application/json'
|
49
|
+
|
50
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
51
|
+
|
52
|
+
# Test whether the captured response is as we expected
|
53
|
+
refute_nil(result)
|
54
|
+
expected_body = JSON.parse(
|
55
|
+
'{"RequestId":"9d2dee33-7803-485a-a2b1-2c7538e597ee","Status":"SUCCESS",'\
|
56
|
+
'"Page":1,"RowCount":2,"TotalPages":1,"Data":[{"ColCoCode":84,"PayerNumb'\
|
57
|
+
'er":"MY00200653","AccountNumber":"MY00200653","CardIssueNumber":"1","Co'\
|
58
|
+
'llectingCompanyCurrencyCode":"MYR","CustDataCustomerEntered":"PartnerId'\
|
59
|
+
'","CustDataDriverId":"D123","CustDataFleetDescription":"Fleet-Truck","F'\
|
60
|
+
'leetIdInput":"AS2344","Amount":62.47,"EuroshellSiteNumber":"1231","Inco'\
|
61
|
+
'mingProductCode":"10","ProductCode":"23","ProductName":"Unleaded - Low '\
|
62
|
+
'octane","SiteCode":3350,"HostingCollectingCompanyName":"Shell Malaysia '\
|
63
|
+
'Trading Sdn Bhd","HostingCollectingCompanyNumber":"84","IccdataTranType'\
|
64
|
+
'Code":"1","TransactionType":"Transaction Type description","Latitude":"'\
|
65
|
+
'52.143814","Longitude":"101.72869","MerchantCategory":"5542","MerchantC'\
|
66
|
+
'ategoryDescription":"Description","PurchasedInCountry":"MY","MerchantId'\
|
67
|
+
'":"MY1737000000000","SiteName":"ShellPT3895 BATU 4 KUALA LUMPUR MY",'\
|
68
|
+
'"Network":"458","DelcoCode":"084","OdometerInput":"201620","OdometerRea'\
|
69
|
+
'dingKm":"201620","OdometerReadingMiles":"201620","CardPAN":"700214*****'\
|
70
|
+
'**780061","PINIndicator":"Y","POIReceiptNumber":"417662","ProductsCodeA'\
|
71
|
+
'dditional":"Additional Code","ProductsTaxCode":"0","FuelVolume":34.15,"'\
|
72
|
+
'SfgwCardDateOfExpiry":"2024-12","SiteCurrencyISOCode":"MYR","CardId":"3'\
|
73
|
+
'30743","TransactionDate":"2021-11-11","TransactionDateTime":"2021-11-11'\
|
74
|
+
' 16:32:09.000","TransactionId":"864220307","TransactionStatus":"Approve'\
|
75
|
+
'd","UnitOfMeasure":"L","VehicleRegistrationNumber":"WD33637","NetworkDe'\
|
76
|
+
'lcoName":"Shell Malaysia Trading Sdn Bhd","ProductGroupName":"Motor gas'\
|
77
|
+
'oline","FuelProduct":"All Fuels","AccountCustomerName":"WCT BERHAD","Pa'\
|
78
|
+
'yerName":"WCT BERHAD","TransactionTime":"2021-11-11","TransactionCurren'\
|
79
|
+
'cy":"RM","UnitPrice":0.02050073206442167,"AuthorisedFlag":"Y","Transact'\
|
80
|
+
'ionTimeGMT":"08:41:02","ReasonCode":"10","IssuerActionCode":"2","Issuer'\
|
81
|
+
'ActionCodeDescription":"Approved, partial","DeclinedReason":"partial","'\
|
82
|
+
'CardStatusReasonDescription":"Approved, partial","TransactionCountry":"'\
|
83
|
+
'458","IssuingCollectingCompanyName":"Partner Name","CardIssuerName":"Jo'\
|
84
|
+
'hn","DriverName":"PAK PAK","BearerDescription":"Description","CardCateg'\
|
85
|
+
'oryDescription":"Driver Card","CardTypeDescription":"SHELL FLEET- HONG '\
|
86
|
+
'KONG 7002821","CardTokenTypeDescription":"HK FLE NAT SIN R1 - CHIP","Em'\
|
87
|
+
'bossType":"Driver","EVPrintedNumber":"NL-TNM-C00122045-K","IsRFID":fals'\
|
88
|
+
'e}]}'
|
89
|
+
)
|
90
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
91
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
92
|
+
end
|
93
|
+
|
94
|
+
# This API allows querying transaction data (i.e. Priced, Billed and Unbilled sales items). It provides a flexible search criteria and supports paging.
|
95
|
+
#The version 2 is an enhancement to the version 1 where EV transactions and their details are added in the response.
|
96
|
+
#
|
97
|
+
#Transactions that are posted but not yet priced, billed or that are in error will not be returned by this API. The API also supports returning Fee Items.
|
98
|
+
#
|
99
|
+
##### Supported operations
|
100
|
+
# * Get sales items and fee transactions
|
101
|
+
# * Search by invoice status
|
102
|
+
# * Search by fixed date period
|
103
|
+
# * Search by date range
|
104
|
+
# * Search by account
|
105
|
+
# * Search by card
|
106
|
+
# * Get sales items only
|
107
|
+
# * Search by transaction Id or location
|
108
|
+
# * Search by transaction posting date
|
109
|
+
# * Search by invoice number or date
|
110
|
+
# * Search by driver name or vehicle registration number
|
111
|
+
# * Search by card group
|
112
|
+
# * Search by fuel only transactions
|
113
|
+
# * Search by product
|
114
|
+
# * EV transaction details - Below are EV specific parameters
|
115
|
+
# * EVOperator
|
116
|
+
# * EVSerialId
|
117
|
+
# * EVChargePointSerial
|
118
|
+
# * EVChargePointConnectorType
|
119
|
+
# * EVChargePointConnectorTypeDescription
|
120
|
+
# * EVChargeDuration
|
121
|
+
# * EVChargeStartDate
|
122
|
+
# * EVChargeStartTime
|
123
|
+
# * EVChargeEndDate
|
124
|
+
# * EVChargeEndTime
|
125
|
+
def test_priced_transactions_v2
|
126
|
+
# Parameters for the API call
|
127
|
+
request_id = '2b0cbe11-f109-4c43-9201-49af0370df1c'
|
128
|
+
body = PricedTransactionRequestV2.from_hash(APIHelper.json_deserialize(
|
129
|
+
'{"PageSize":1,"Page":1,"Filters":{"ColCoCode":"032","InvoiceStatus":"A"'\
|
130
|
+
',"PayerNumber":"DE26685263","AccountId":29484,"AccountNumber":"DE266670'\
|
131
|
+
'80","DriverName":"HH NX 508","CardGroupId":40000,"CardPAN":"70020510066'\
|
132
|
+
'29890645","ProductCode":"10","ProductName":"Diesel AGO","SiteCode":"050'\
|
133
|
+
'00100","IncomingSiteNumber":"100021","InvoiceDate":"2021-01-01","Invoic'\
|
134
|
+
'eNumber":"3201016193","PurchasedInCountryCode":"GB","PurchasedInCountry'\
|
135
|
+
'":"United Kingdom","SiteGroupId":202,"VehicleRegistrationNumber":"4K468'\
|
136
|
+
'01","FeeTypeId":275549,"LineItemDescription":"ABC3","Cards":[0],"SortOr'\
|
137
|
+
'der":"5","FromDate":"2022-01-01 00:00:00","ToDate":"2022-01-01 00:00:00'\
|
138
|
+
'","Period":3,"PostingDateFrom":"2022-01-01 00:00:00","PostingDateTo":"2'\
|
139
|
+
'022-01-01 00:00:00","TransactionItemId":"1208176398","FuelOnly":false,"'\
|
140
|
+
'IncludeFees":true,"IsMultipayer":true,"ValidInvoiceDateOnly":false,"Inv'\
|
141
|
+
'oiceFromDate":"2022-01-01 00:00:00","InvoiceToDate":"2022-01-01 00:00:0'\
|
142
|
+
'0","HostingCollectingCompanyNumber":"032","Search":"2K89909","Transacti'\
|
143
|
+
'onId":"io9KVXk1UkW57XWKyeaHHg"}}', false))
|
144
|
+
|
145
|
+
# Perform the API call through the SDK function
|
146
|
+
result = @controller.priced_transactions_v2(request_id, body: body)
|
147
|
+
|
148
|
+
# Test response code
|
149
|
+
assert_equal(200, @response_catcher.response.status_code)
|
150
|
+
|
151
|
+
# Test headers
|
152
|
+
expected_headers = {}
|
153
|
+
expected_headers['content-type'] = 'application/json'
|
154
|
+
|
155
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
156
|
+
|
157
|
+
# Test whether the captured response is as we expected
|
158
|
+
refute_nil(result)
|
159
|
+
expected_body = JSON.parse(
|
160
|
+
'{"RequestId":"9d2dee33-7803-485a-a2b1-2c7538e597ee","Status":"SUCCESS",'\
|
161
|
+
'"Data":[{"AccountName":"Blue Colour Ltd","AccountId":29484,"AccountNumb'\
|
162
|
+
'er":"DE26667080","AccountShortName":"Mathew","Additional1":"GBALLEGO000'\
|
163
|
+
'2452","Additional2":"GBALLEGO0002452","Additional3":"GBALLEGO0002452","'\
|
164
|
+
'Additional4":"GBALLEGO0002452","AllowClearing":"Null","AuthorisationCod'\
|
165
|
+
'e":300796,"TransactionStatus":"Y","DriverName":"SATTY BHAMRA","CardExpi'\
|
166
|
+
'ryPeriod":2204,"CardExpiry":"2022-01-01","CardGroupId":40000,"CardGroup'\
|
167
|
+
'Name":"006240 FIRE BRIGHT SOLUTIONS","IssuerCode":7002,"CardPAN":"70020'\
|
168
|
+
'53465789891000","ReleaseCode":9,"CardSequenceNumber":617,"CardType":"GB'\
|
169
|
+
' STD FLT NAT SINGLE R9","ColCoCode":"014","UnitDiscountInvoiceCurrency"'\
|
170
|
+
':-0.0051,"ColCoExchangeRate":0.851858,"InvoiceCurrencySymbol":"GBP","Co'\
|
171
|
+
'rrectionFlag":true,"CRMNumber":10,"CustomerCountry":"United Kingdom","C'\
|
172
|
+
'ustomerCurrencyCode":"GBP","CustomerCurrencySymbol":"£","RebateonNetAmo'\
|
173
|
+
'untInCustomerCurrency":0,"EffectiveDiscountInCustomerCurrency":-0.22,"E'\
|
174
|
+
'ffectiveUnitDiscountInCustomerCurrency":-0.0051,"UnitPriceInInvoiceCurr'\
|
175
|
+
'ency":1.1024,"InvoiceTax":0,"InvoiceGrossAmount":57.25,"InvoiceNetAmoun'\
|
176
|
+
't":47.71,"VATonNetAmountInCustomerCurrency":9.54,"CustomerRetailPriceUn'\
|
177
|
+
'itGross":0,"CustomerRetailValueTotalGross":57.52,"CustomerRetailValueTo'\
|
178
|
+
'talNet":47.93,"TransactionTypeDescription":9.59,"RebateonNetAmountInTra'\
|
179
|
+
'nsactionCurrency":-0.22,"EffectiveDiscountInTrxCurrency":-0.22,"DelCoTo'\
|
180
|
+
'ColCoExchangeRate":0,"Cards":[275549],"UnitDiscountTransactionCurrency"'\
|
181
|
+
':-0.005,"TransactionGrossAmount":57.25,"TransactionNetAmount":47.71,"Tr'\
|
182
|
+
'ansactionTax":9.54,"VATonNetAmount":9.54,"DelcoListPriceUnitNet":0,"Del'\
|
183
|
+
'coRetailPriceUnitGross":1.32888,"UnitPriceInTransactionCurrency":1.1074'\
|
184
|
+
',"DelcoRetailPriceUnitNet":1.1074,"DelcoRetailValueTotalGross":57.52,"D'\
|
185
|
+
'elcoRetailValueTotalNet":47.93,"TransactionCurrencySymbol":"$","Discoun'\
|
186
|
+
'tType":"Retail","DisputeStatus":false,"IsShellSite":false,"FleetIdInput'\
|
187
|
+
'":"YG67OUM","IncomingProductCode":23,"PostingDate":"2021-08-02","Postin'\
|
188
|
+
'gTime":"0001-01-01T14:15:22Z","ProductCode":30,"ProductName":"Unleaded '\
|
189
|
+
'- Medium octane","ProductGroupId":22,"IncomingCurrencyCode":"GBP","Inco'\
|
190
|
+
'mingSiteDescription":"Shell Broadway Ring","Location":"Shell Broadway R'\
|
191
|
+
'ing","SiteName":"Shell Broadway Ring","SiteCode":32,"IncomingSiteNumber'\
|
192
|
+
'":15,"InvoiceCurrencyCode":"GBP","InvoiceDate":"2021-08-02","InvoiceNum'\
|
193
|
+
'ber":3201016193,"FuelProduct":true,"VATApplicable":"Y","PayerName":"Col'\
|
194
|
+
'ours Services Ltd","PayerNumber":"GB12121212","ParentCustomerNumber":"G'\
|
195
|
+
'B12121212","PayerGroup":"H312066","PayerGroupName":"12162566 - FUEL CAR'\
|
196
|
+
'D SERVICE","CheckDigit":6,"NetInvoiceIndicator":"Y","DelcoCode":5,"Netw'\
|
197
|
+
'orkCode":3,"PurchasedInCountry":"United Kingdom","SiteCountry":"United '\
|
198
|
+
'Kingdom","VATCountry":"United Kingdom","DelcoName":"Shell U.K. Oil Prod'\
|
199
|
+
'ucts Limited","Network":"Shell","OdometerInput":0,"OriginalSalesItemId"'\
|
200
|
+
':"Null","FleetIDDescription":"YG67OUM","ParentCustomerId":6494,"PINIndi'\
|
201
|
+
'cator":"Y, N","ProductGroupName":"Fees","PurchasedInCountryCode":"GB","'\
|
202
|
+
'Quantity":43.28,"RebateRate":0.0022,"ReceiptNumber":6803,"RefundFlag":"'\
|
203
|
+
'Y","SiteGroupId":202,"SiteGroupName":"CZ 9100 ECONOMY NETWORK","Latitud'\
|
204
|
+
'e":53.83606,"Longitude":-1.61854,"DelCoExchangeRate":0.851858,"EuroReba'\
|
205
|
+
'teAmount":-0.258259,"NetEuroAmount":56.01,"EuroVATAmount":11.2,"ParentC'\
|
206
|
+
'ustomerName":"FUEL CARD SERVICES LTD","IsInvoiced":false,"TransactionCu'\
|
207
|
+
'rrencyCode":"GBP","CreditDebitCode":"D or C","TransactionDate":"2021-08'\
|
208
|
+
'-01","TransactionTime":"0001-01-01T12:16:58Z","TransactionItemId":"H305'\
|
209
|
+
'908971030","TrnIdentifier":"H305908971030","Type":"SALE","TransactionLi'\
|
210
|
+
'ne":1,"TransactionType":"Purchase","UTCOffset":"Europe/London","VATCate'\
|
211
|
+
'gory":"United Kingdom Standard VAT Rate","VATRate":0.2,"VehicleRegistra'\
|
212
|
+
'tion":"YG67OUM","IsCancelled":"Y","ColCoGrossAmount":57.25,"ColCoNetAmo'\
|
213
|
+
'unt":47.71,"ColCoVATAmount":9.54,"OriginalCurrencySymbol":"$","Original'\
|
214
|
+
'CurrencyCode":"$","OriginalVATAmount":0,"EmbossText":"PARKLANE PROPERTI'\
|
215
|
+
'ES LTD","OriginalExchangeRate":0,"OriginalTransactionItemInvoiceDate":"'\
|
216
|
+
'2022-02-02","FeeTypeId":1,"LineItemDescription":true,"FeeRuleDescriptio'\
|
217
|
+
'n":"Simple Fee","Frequency":1,"FeeRuleId":1,"SystemEntryDate":"2021-08-'\
|
218
|
+
'28","SystemEntryTime":"0001-01-01T20:21:08Z","IsManual":"Y","OriginalTr'\
|
219
|
+
'ansactionItemId":"Y","OriginalTransactionItemInvoiceNumber":6750802,"Or'\
|
220
|
+
'iginalTransactionItemInvoiceId":234,"PayerShortName":"FUEL CARD SERVICE'\
|
221
|
+
'S LTD","ReverseCharge":"Y","OriginalGrossAmount":57.25,"OriginalNetAmou'\
|
222
|
+
'nt":57.25,"UnitOfMeasure":"L","RoadType":"National Road","CustomerCount'\
|
223
|
+
'ryIsoCode":"DE","EVOperator":"Shell Recharge","EVSerialId":"GBALLEGO000'\
|
224
|
+
'2452","EVChargePointSerial":"GBALLEGO0002452","EVChargePointConnectorTy'\
|
225
|
+
'pe":5,"EVChargePointConnectorTypeDescription":"DC 50 kW","EVChargeDurat'\
|
226
|
+
'ion":"PT3205S","EVChargeStartDate":"2021-08-01","EVChargeStartTime":"00'\
|
227
|
+
'01-01-01T20:08:01Z","EVChargeEndDate":"2022-08-01","EVChargeEndTime":"0'\
|
228
|
+
'001-01-01T20:08:01Z","HostingCollectingCompanyNumber":0,"TransactionId"'\
|
229
|
+
':0,"FuelOnly":true}],"Page":3,"PageSize":30,"TotalPages":5}'
|
230
|
+
)
|
231
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
232
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
233
|
+
end
|
234
|
+
|
235
|
+
end
|