In this article
The payment interface allows you to generate payment messages (xml files) that can be transmitted to a financial institution to make payments.
The payment interface is based on the JsAction class. This class allows you to define through a javascript file all operations on table's fields of Mime Data Type, which contains json objects, such as an invoice or a payment. The various operations allow you to update the transaction row that contains the object and to update the object itself.
See the Payment Extension for Switzerland on Github
Documentation Payment Extension
JsAction::JsAction(banDocument)
/*
* Class Constructor
*/
JsAction::create(tabPos, uuid)
/*
* Creates the payment data object
* Returns a json patch document to be applied or null if the user discard the changes.
* @tabPos: Table name and position row
* @uuid: unique id to identify the payment/data object generated by c++
*/
JsAction::createTransferFile(paymentFile)
/*
* Create a payment file (pain.001 A-level)
* @param paymentData contains a json object of type payment/file
*/
JsAction::edit(tabPos, isModified)
/*
* It is like the updateRow() method, except for displaying the dialog with the properties of the object
* @tabPos: Table name and position row
* @isModified:
*/
JsAction::exportTransferFile(xml, fileName)
/*
* Save the xml pain file to the selected destination folder
* @fileName: suggested fileName
*/
JsAction::getInfo()
/*
* Returns the info to show in the info panel as object (see class InfoMessage)
*/
JsAction::listPainFormats()
/*
* Return the list of the supported transfer file formats
*/
JsAction::scanCode(tabPos, code)
/*
* Scans an invoice QRCode and creates the related transaction
* Returns a json patch document to be applied, null if no changes, or an Error object.
* @tabPos: Table name and position row
* @code: QR-Code text
*/
JsAction::updateRow(tabPos, uuid)
/*
* This method updates the transaction row according to the payment object.
* It returns a json patch document, null if no changes, or an Error object.
* Uuid is used only for new rows (copied or duplicated rows)
*/
JsAction::validateTransferFile(xml, painFormat)
/*
* Validate xml pain file against schema available in package
*/
Example of Payment/Data object
The Payment/Data object is a JSON object which contains the information for making a payment.
{
"methodId":"QRCODE",
"creditorAccountId":";8004",
"creditorName":"Ernesto Verdi",
"creditorStreet1":"Piazza Luvini","creditorStreet2":"",
"creditorCity":"Chiasso",
"creditorPostalCode":"6800",
"creditorCountry":"",
"creditorBankName":"",
"creditorBankAddress1":"",
"creditorBankAddress2":"",
"creditorBankAccount":"",
"creditorIban":"CH58 0900 0000 6525 0122 4",
"creditorBic":"",
"ultimateDebtorName":"",
"ultimateDebtorStreet1":"",
"ultimateDebtorStreet2":"",
"ultimateDebtorCity":"",
"ultimateDebtorPostalCode":"",
"ultimateDebtorCountry":"",
"amount":"140.00",
"currency":"CHF",
"referenceType":"NON",
"reference":"",
"unstructuredMessage":"",
"billingInfo":"",
"categoryPurpose":"",
"invoiceNo":"1002",
"transactionDate":"2022-05-05",
"dueDate":"2022-07-31",
"description":"Fattura Verdi",
"syncTransaction":true,
"@appId":"ch.banana.switzerland.pain001",
"@type":"payment/data",
"@version":"1.0",
"@uuid":"c4ab8cf6-b9e7-4904-80e8-39bfa433ec6a"
}
Example of Payment/File object
The Payment/File object is a JSON object, which contains one or more Payment/Data objects and the pain XML file transmitted to the financial institution.
{
"@appId": "ch.banana.switzerland.pain001",
"@format": "pain.001.001.03.ch.02",
"@title": "Payment June",
"@type": "payment/file",
"@uuid": "c05f6a7b8c9a4c27a55255fcd19c444a",
"@version": "1.0",
"confirmationDetailed": true,
"confirmationExecution": true,
"debtorAccountId": "1020",
"debtorBic": "POFICHBEXXX",
"debtorIban": "CH5809000000652501224",
"debtorName": "Tarchini SA",
"requestExecutionDate": "2022-06-08",
"requestExecutionDateApplyAll": false,
"transactions": [
{
"@appId": "ch.banana.switzerland.pain001",
"@type": "payment/data",
"@uuid": "c4ab8cf6-b9e7-4904-80e8-39bfa433ec6a",
"@version": "1.0",
"amount": "140.00",
"billingInfo": "",
"categoryPurpose": "",
"creditorAccountId": ";8004",
"creditorBankAccount": "",
"creditorBankAddress1": "",
"creditorBankAddress2": "",
"creditorBankName": "",
"creditorBic": "",
"creditorCity": "Chiasso",
"creditorCountry": "",
"creditorIban": "CH58 0900 0000 6525 0122 4",
"creditorName": "Ernesto Verdi",
"creditorPostalCode": "6800",
"creditorStreet1": "Piazza Luvini",
"creditorStreet2": "",
"currency": "CHF",
"description": "Fattura Verdi",
"dueDate": "2022-07-31",
"invoiceNo": "1002",
"methodId": "QRCODE",
"reference": "",
"referenceType": "NON",
"syncTransaction": true,
"transactionDate": "2022-05-05",
"ultimateDebtorCity": "",
"ultimateDebtorCountry": "",
"ultimateDebtorName": "",
"ultimateDebtorPostalCode": "",
"ultimateDebtorStreet1": "",
"ultimateDebtorStreet2": "",
"unstructuredMessage": ""
}
],
"transferFile": "\n\n \n \n c05f6a7b8c9a4c27a55255fcd19c444a \n 2022-06-08T15:35:37 \n 1 \n 140.00 \n \n message sender name missing \n \n Banana Accounting+/Banana.ch SA \n 10.0.12.22152 \n \n \n \n \n PAYMT-2022068133537178-000 \n TRF \n true \n 1 \n 140.00 \n 2022-07-31 \n \n Tarchini SA \n \n \n \n CH5809000000652501224 \n \n \n CWD \n \n \n \n \n POFICHBEXXX \n \n \n CRED \n \n \n INSTRID-1 \n c4ab8cf6b9e7490480e839bfa433ec6a \n \n \n \n 140.00 \n \n \n Ernesto Verdi \n \n Piazza Luvini \n 6800 Chiasso \n \n \n \n \n CH5809000000652501224 \n \n \n \n \n \n \n"
}