Invoice & Pay On Delivery Service
This service includes Invoice and Pay On Delivery flows.
Pay On Delivery - Omnitron
When an order is created with pay on delivery, the Order Management System (OMS) queries the
pay_on_delivery_transaction_amount
service in Omnitron. This service, which contains theamount_without_loyalty_money
value, is used to add this information to the package.The
amount_without_loyalty_money
value is the order amount minus the portion paid with loyalty money. For example, if the order amount is 100 TL and the loyalty money amount is 30 TL, then the amount to be paid at the door is 70 TL.This service is directly called from Omnitron, and no action is taken on the OMS side. To track this amount, the
pay_on_delivery_amount
field in the shipment information on the package is used. You can also check the discounted portion and the final payable amount in the payment information section of the order on Omnitron.
Invoice - Omnitron
In OMS, invoice processing is not carried out. Invoice information is obtained from a remote invoice service.
To retrieve invoice information, the configuration setting for state transitions must include
remote_invoice_call
.{"remote_invoice_call":{
"auth":{"password":"password",
"username":"username",
"request_type":"basic_auth"},
"remote_url":"invoice-url"}}
When this setting is configured, the invoice information for an order is fetched from the remote invoice service.
Additionally, if the parameters
generate_invoice_url":true
andgenerate_invoice_number":true
are added to the same configuration, the invoice number and invoice URL are created on the OMS side.If these settings are not provided, the invoice information is directly obtained from the remote invoice service. The invoice number and URL information on the invoice service are used.
This setting is only available for the following commands;
- CompletePackagingCommand
- CompletePackagingWithoutShipmentCommand
- ChannelBasedCompletePackagingCommand
- ShipThePackageAdvancedCommand
- UpdateInvoiceOfThePackageCommand
Pay On Delivery - Akinon Invoicer
The order's pay on delivery amount is calculated using the Akinon Invoicer service.
The pay on delivery amount of the order is calculated using the calculate_pay_on_delivery_amount
service. This calculation takes place in the Akinon Invoicer.
- OMS performs three transactions with Akinon Invoicer:
- The
create_invoice
service is used to generate an invoice for the order. - The
calculate_pay_on_delivery_amount
service is used to calculate the pay on delivery amount for the order. - The
mark_void
service is used to cancel the invoice if any issues arise after OMS sends a request.
- The
The generated invoice number is added to the akinon_invoice_number
field on the package.
First, the create_invoice
service is called. When this service is invoked,
an invoice is generated, and the invoice number is added to the '
akinon_invoice_number' field on the package.
Next, the calculate_pay_on_delivery_amount
service is called to calculate
the pay on delivery amount for the order.
This process occurs when the packaging command is triggered. The existing
operations are only completed with the Complete Packaging
command.
If an issue arises, the mark_void
service is called, and the invoice is
canceled. The command throws an exception.
To use Akinon Invoicer in OMS:
- First, enter the
AKINON_INVOICER
setting in the application settings.
Example format:
```python
import requests
import json
url = "<omnitron-url>/api/v1/oms/settings/application_settings/"
payload = json.dumps({
"key": "AKİNON_INVOICER",
"json_value": {
"urls": {
"base_url": "http://company-bo.akinon.net/api/v1"
},
"auth": {
"username": "<sample username>",
"password": "<sample password>"
},
"timeouts": {
"read": 5,
"connect": 30
}
}
})
headers = {
'Authorization': 'Token <token>',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
```
- When this setting is entered, the invoice and pay on delivery process will proceed through Akinon Invoicer.