Chainlink Virtual Hackathon Spring 2021
The European Union's PSD2 directive allows third parties to access bank functions. The Open Banking API is a response to these problems. It describes Payment Initiation Service (PIS), Account Information Service (AIS), and Confirmation of the Availability of Funds (CAF). In the AquaProtocol now only domestic payment is implemented in fiat currency deposition and withdrawal. This component is not the only API it is also mock bank account functions that are invoked during the change owner procedure. Thanks to this approach, the testing process is not dependent on Bank Access.
The base of the API was created from the swagger file obtained from https://developers.pkobp.pl/documentation
For purpose of this project ProvideDomesticTransfer function is mocking.
- Read data from the database
- Modification of the Sender account balance
- Modification of the Recipient account balance
- Save data to database/ update amount state
- Create AddPaymentResponse
Request:
type PaymentDomesticRequest struct {
Sender *SenderPisDomestic `json:"sender"`
// The way the transfer should be settled
System string `json:"system"`
// Payment execution mode. The superior information deciding which mode is to be used to execute payment.
ExecutionMode string `json:"executionMode,omitempty"`
RequestHeader *RequestHeaderCallback `json:"requestHeader"`
// Tryb pilności / Urgency mode
DeliveryMode string `json:"deliveryMode"`
Recipient *RecipientPis `json:"recipient"`
TransferData *TransferDataCurrencyRequired `json:"transferData"`
// Indicates if payment should be holded
Hold bool `json:"hold,omitempty"`
// Transaction ID (TPP)
TppTransactionId string `json:"tppTransactionId"`
}Response:
type AddPaymentResponse struct {
// Detailed payment status
DetailedStatus string `json:"detailedStatus"`
GeneralStatus *PaymentStatus `json:"generalStatus"`
PaymentId *PaymentId `json:"paymentId"`
ResponseHeader *ResponseHeader `json:"responseHeader"`
}CREATE DATABASE bank_mock;
use bank_mock;
CREATE TABLE account_info (
account_number VARCHAR(30),
booking_balance FLOAT(20,2),
currency VARCHAR(20),
available_balance FLOAT(20,2),
account_type_name VARCHAR(255)
);
show tables;
#drop table account_info;
select * from account_info;
INSERT INTO account_info (account_number, booking_balance, currency, available_balance, account_type_name)
VALUES ('58150017805507845039441513', 100.00, 'PLN', '100.00', 'Junior');
INSERT INTO account_info (account_number, booking_balance, currency, available_balance, account_type_name)
VALUES ('45858110278832612545618695', 100.00, 'PLN', '100.00', 'Firma');go run main.go