# Evidence of Account Pool test
These tests were made using the default container with all the old accounts still enabled. This is to show the resilience of the account pool code.
OBS: All bank accounts have a "-" sign in the number.
# Adapter Genial (Not Account Pool)
## PayIn
All PayIn requests were sent to the URL http://20.206.67.236/webhook of the AKS deployment on 28/06/2023
### Cases
1. PayIn for an account without an associated CaasId with by partner 132
2. PayIn for an account without an associated CaasId with by partner 140
3. PayIn for an account with an associated CaasId
4. PayIn without ReferenceId or associated CaasId
### Case 1: PayIn for an account without an associated CaasId with by partner 132
Body received through the webhook endpoint:
```json
{
"instantPaymentId": "ee8c1693d9",
"endToEndId": "f2dbb6dfe5",
"timestampUTC": "2023-06-28T20:53:41.121Z",
"settlementId": "7155fd8d93",
"receiverReconciliationIdentifier": "132TG19f479662b",
"value": 0.8,
"receiver": {
"psp": {
"ispb": "45246410",
"name": "7ddf23e6d3"
},
"taxId": "34882109000111",
"addressKey": "3f1bf725-28db-4576-a7eb-cf51b38819a6",
"account": {
"accountNumber": "48623",
"accountType": "CACC",
"branch": "1"
}
},
"payer": {
"psp": {
"ispb": "18236120",
"name": "d62c0bf958"
},
"taxId": "02312744163",
"name": "5003962162",
"account": {
"accountNumber": "700837563",
"accountType": "TRAN",
"branch": "1"
}
},
"spiTimestampUTC": "2023-06-28T20:53:41.121Z",
"customerInitiationTimestampUTC": "2023-03-02T13:35:45.049",
"remittanceInformation": "",
"mipTransactionType": "EXTERNAL",
"eventType": {
"code": 2,
"description": "Receipt"
},
"eventStatus": {
"code": 3,
"description": "Success"
},
"instructionType": "PAGPRI",
"initiationForm": "QRDN",
"transactionPurpose": "IPAY",
"instructionPriority": "HIGH",
"isRigthsAndObligationSettlement": false,
"return": null
}
```
This body produces the following document in the container "caas-adapter-genial":
```json
{
"transactionId": "ee8c1693d9",
"caasId": "1138",
"endToEndId": "f2dbb6dfe5",
"amount": 0.8,
"description": "",
"accountId": "48623",
"movimentDate": "2023-06-28T20:53:41.121Z",
"createdAt": "2023-06-28T20:52:25.0172269Z",
"migrated": "2023-06-28T20:52:25.438947Z",
"counterPart": {
"name": "5003962162",
"taxId": "02312744163",
"bankName": "d62c0bf958",
"bankCode": "260",
"agency": "1",
"account": "700837563",
"pixKey": null,
"ispb": "18236120"
},
"status": null,
"transactionType": 0,
"referenceId": "132TG19f479662b",
"uniqueKey": "f2dbb6dfe5",
"partition": "Transaction_48623",
"settlementBank": 125,
"_etag": "\"3b009aee-0000-0b00-0000-649c9d890000\"",
"timeToLive": null,
"createdTimeUtc": "2023-06-28T20:52:25.017236Z",
"id": "f2dbb6dfe5",
"type": "Transaction",
"_rid": "MUJ8APRkMygUFgAAAAAAAA==",
"_self": "dbs/MUJ8AA==/colls/MUJ8APRkMyg=/docs/MUJ8APRkMygUFgAAAAAAAA==/",
"_attachments": "attachments/",
"_ts": 1687985545
}
```
And the associated Transaction in the "openbanking" container:
```json
{
"id": "91fc5347-916b-439e-bffe-abc763a9eb0b",
"ExternalId": null,
"TransactionBankId": "8bfec2f7a5",
"ReferenceId": "132TG2e18488d47",
"AccountId": "132",
"Type": 0,
"Amount": 0.18,
"AmountNet": 0.18,
"AmountNetDollar": 0,
"DollarPrice": 0,
"TimeStamp": "2023-06-28T20:50:40.364+00:00",
"Currency": 0,
"Blockchain": 0,
"Description": "8bfec2f7a5",
"TransactionHash": null,
"TransactionURL": null,
"OriginWallet": null,
"CounterpartWallet": null,
"OriginTag": null,
"CounterpartTag": null,
"AccountIdOfBRLTransaction": null,
"TransactionIdOfBRLTransaction": null,
"Counterpart": {
"KycCustomerId": null,
"KycBankAccountId": null,
"Name": "659b8a64fd",
"TaxIdCountry": "BRA",
"TaxId": "02312744163",
"PixKey": null,
"Bank": null,
"BankAccount": "700837563",
"BankBranch": "1",
"Iban": null,
"CounterpartType": 0
},
"PayerCounterpart": {
"KycCustomerId": null,
"KycBankAccountId": null,
"Name": "659b8a64fd",
"TaxIdCountry": "BRA",
"TaxId": "02312744163",
"PixKey": null,
"Bank": {
"BankCode": "260",
"BankName": ""
},
"BankAccount": "700837563",
"BankBranch": "1",
"Iban": null,
"CounterpartType": 0
},
"Status": 1,
"ReprovedTransactionFromPending": false,
"ApprovedTransactionFromPending": false,
"HasPayInFeeBeenApplied": false,
"HasPayOutFeeBeenApplied": false,
"HasBankReconciliationFeeBeenApplied": false,
"HasFlatFeeBeenApplied": false,
"Flags": {},
"NotifyApplication": null,
"Source": "AdapterGenial@8bfec2f7a5",
"PartitionKey": "Transaction_132",
"DocumentType": 2,
"SettlementBank": "GenialBank",
"_etag": "\"1f00d5ec-0000-0b00-0000-649c9cd50000\"",
"CreatedAt": "2023-06-28T20:49:25.5589313+00:00",
"UniqueKey": "8bfec2f7a5",
"Links": [],
"_rid": "Ts8iAOS3FeyOjBQAAAAACg==",
"_self": "dbs/Ts8iAA==/colls/Ts8iAOS3Few=/docs/Ts8iAOS3FeyOjBQAAAAACg==/",
"_attachments": "attachments/",
"_ts": 1687985365
}
```
#### Discussion of Case 1
Note that the "ReferenceId" for that PayIn comes from the field "receiverReconciliationIdentifier" received in our webhook. This field is related to "referenceId" in the adapter, and "ReferenceId" in the openbanking container.
It's also important to notice that the transaction inside the adapter has no associated CaasId. The CaasId is parsed within the Transaction Service.
Both the accountId and the partition key of the document in the adapter's container is related to the bank account in question, which in this case is "2950847"
In this case, the ReferenceId has the prefix "132TG" indicating that the transaction is related the CaaS account 132.
### Case 2: PayIn for an account without an associated CaasId with by partner 140
The body received through the adapter's webhook:
```json
{
"instantPaymentId": "96d63cb90e",
"endToEndId": "bae438ce15",
"timestampUTC": "2023-06-28T21:05:25.637Z",
"settlementId": "52d5686525",
"receiverReconciliationIdentifier": "140TG37217c7481",
"value": 0.83,
"receiver": {
"psp": {
"ispb": "45246410",
"name": "44f36ceb52"
},
"taxId": "34882109000111",
"addressKey": "3f1bf725-28db-4576-a7eb-cf51b38819a6",
"account": {
"accountNumber": "2950847",
"accountType": "CACC",
"branch": "1"
}
},
"payer": {
"psp": {
"ispb": "18236120",
"name": "b98c3113f7"
},
"taxId": "02312744163",
"name": "4e6e091699",
"account": {
"accountNumber": "700837563",
"accountType": "TRAN",
"branch": "1"
}
},
"spiTimestampUTC": "2023-06-28T21:05:25.637Z",
"customerInitiationTimestampUTC": "2023-03-02T13:35:45.049",
"remittanceInformation": "",
"mipTransactionType": "EXTERNAL",
"eventType": {
"code": 2,
"description": "Receipt"
},
"eventStatus": {
"code": 3,
"description": "Success"
},
"instructionType": "PAGPRI",
"initiationForm": "QRDN",
"transactionPurpose": "IPAY",
"instructionPriority": "HIGH",
"isRigthsAndObligationSettlement": false,
"return": null
}
```
This body produces the following documentin "caas-adapter-genial":
```json
{
"transactionId": "96d63cb90e",
"caasId": null,
"endToEndId": "bae438ce15",
"amount": 0.83,
"description": "",
"accountId": "2950847",
"movimentDate": "2023-06-28T21:05:25.637Z",
"createdAt": "2023-06-28T21:04:09.5747053Z",
"migrated": "2023-06-28T21:04:10.2664282Z",
"counterPart": {
"name": "4e6e091699",
"taxId": "02312744163",
"bankName": "b98c3113f7",
"bankCode": "260",
"agency": "1",
"account": "700837563",
"pixKey": null,
"ispb": "18236120"
},
"status": null,
"transactionType": 0,
"referenceId": "140TG37217c7481",
"uniqueKey": "bae438ce15",
"partition": "Transaction_2950847",
"settlementBank": 125,
"_etag": "\"3b00b2f1-0000-0b00-0000-649ca04a0000\"",
"timeToLive": null,
"createdTimeUtc": "2023-06-28T21:04:09.5747085Z",
"id": "bae438ce15",
"type": "Transaction",
"_rid": "MUJ8APRkMygVFgAAAAAAAA==",
"_self": "dbs/MUJ8AA==/colls/MUJ8APRkMyg=/docs/MUJ8APRkMygVFgAAAAAAAA==/",
"_attachments": "attachments/",
"_ts": 1687986250
}
```
And the associated document in the "openbanking" container:
```json
{
"id": "a0c306fd-a7d2-4839-91e3-566011b6496b",
"ExternalId": null,
"TransactionBankId": "bae438ce15",
"ReferenceId": "140TG37217c7481",
"AccountId": "140",
"Type": 0,
"Amount": 0.83,
"AmountNet": 0.83,
"AmountNetDollar": 0,
"DollarPrice": 0,
"TimeStamp": "2023-06-28T21:05:25.637+00:00",
"Currency": 0,
"Blockchain": 0,
"Description": "bae438ce15",
"TransactionHash": null,
"TransactionURL": null,
"OriginWallet": null,
"CounterpartWallet": null,
"OriginTag": null,
"CounterpartTag": null,
"AccountIdOfBRLTransaction": null,
"TransactionIdOfBRLTransaction": null,
"Counterpart": {
"KycCustomerId": null,
"KycBankAccountId": null,
"Name": "4e6e091699",
"TaxIdCountry": "BRA",
"TaxId": "02312744163",
"PixKey": null,
"Bank": null,
"BankAccount": "700837563",
"BankBranch": "1",
"Iban": null,
"CounterpartType": 0
},
"PayerCounterpart": {
"KycCustomerId": null,
"KycBankAccountId": null,
"Name": "4e6e091699",
"TaxIdCountry": "BRA",
"TaxId": "02312744163",
"PixKey": null,
"Bank": {
"BankCode": "260",
"BankName": ""
},
"BankAccount": "700837563",
"BankBranch": "1",
"Iban": null,
"CounterpartType": 0
},
"Status": 1,
"ReprovedTransactionFromPending": false,
"ApprovedTransactionFromPending": false,
"HasPayInFeeBeenApplied": false,
"HasPayOutFeeBeenApplied": false,
"HasBankReconciliationFeeBeenApplied": false,
"HasFlatFeeBeenApplied": false,
"Flags": {},
"NotifyApplication": null,
"Source": "AdapterGenial@bae438ce15",
"PartitionKey": "Transaction_140",
"DocumentType": 2,
"SettlementBank": "GenialBank",
"_etag": "\"0600e3d4-0000-0b00-0000-649ca04a0000\"",
"CreatedAt": "2023-06-28T21:04:10.1161217+00:00",
"UniqueKey": "bae438ce15",
"Links": [],
"_rid": "Ts8iAOS3FexbchMAAAAAAg==",
"_self": "dbs/Ts8iAA==/colls/Ts8iAOS3Few=/docs/Ts8iAOS3FexbchMAAAAAAg==/",
"_attachments": "attachments/",
"_ts": 1687986250
}
```
#### Discussion of Case 2
This case is very similar to Case 1, the only difference being that the ReferenceId contains the prefix "140TG" indicating that the deposit is related to the CaaS account 140.
Both the accountId and the partition key are also related to the account "2950847", just like Case 1.
### Case 3: PayIn for an account with an associated CaasId
Body received through the webhook endpoint:
```json
{
"instantPaymentId": "0e84d4e0ec",
"endToEndId": "f0f7dd4c66",
"timestampUTC": "2023-06-28T21:07:59.806Z",
"settlementId": "3883f8d669",
"receiverReconciliationIdentifier": "132TGf2d40f9e5d",
"value": 0.93,
"receiver": {
"psp": {
"ispb": "45246410",
"name": "f8653a9daf"
},
"taxId": "34882109000111",
"addressKey": "3f1bf725-28db-4576-a7eb-cf51b38819a6",
"account": {
"accountNumber": "48623",
"accountType": "CACC",
"branch": "1"
}
},
"payer": {
"psp": {
"ispb": "18236120",
"name": "5d5141cb70"
},
"taxId": "02312744163",
"name": "bde7691895",
"account": {
"accountNumber": "700837563",
"accountType": "TRAN",
"branch": "1"
}
},
"spiTimestampUTC": "2023-06-28T21:07:59.807Z",
"customerInitiationTimestampUTC": "2023-03-02T13:35:45.049",
"remittanceInformation": "",
"mipTransactionType": "EXTERNAL",
"eventType": {
"code": 2,
"description": "Receipt"
},
"eventStatus": {
"code": 3,
"description": "Success"
},
"instructionType": "PAGPRI",
"initiationForm": "QRDN",
"transactionPurpose": "IPAY",
"instructionPriority": "HIGH",
"isRigthsAndObligationSettlement": false,
"return": null
}
```
This body produced the following document in "caas-adapter-genial":
```json
{
"transactionId": "0e84d4e0ec",
"caasId": "1138",
"endToEndId": "f0f7dd4c66",
"amount": 0.93,
"description": "",
"accountId": "48623",
"movimentDate": "2023-06-28T21:07:59.806Z",
"createdAt": "2023-06-28T21:06:43.8738133Z",
"migrated": "2023-06-28T21:06:44.3014417Z",
"counterPart": {
"name": "bde7691895",
"taxId": "02312744163",
"bankName": "5d5141cb70",
"bankCode": "260",
"agency": "1",
"account": "700837563",
"pixKey": null,
"ispb": "18236120"
},
"status": null,
"transactionType": 0,
"referenceId": "132TGf2d40f9e5d",
"uniqueKey": "f0f7dd4c66",
"partition": "Transaction_48623",
"settlementBank": 125,
"_etag": "\"3b0066f2-0000-0b00-0000-649ca0e40000\"",
"timeToLive": null,
"createdTimeUtc": "2023-06-28T21:06:43.8738198Z",
"id": "f0f7dd4c66",
"type": "Transaction",
"_rid": "MUJ8APRkMygWFgAAAAAAAA==",
"_self": "dbs/MUJ8AA==/colls/MUJ8APRkMyg=/docs/MUJ8APRkMygWFgAAAAAAAA==/",
"_attachments": "attachments/",
"_ts": 1687986404
}
```
And the associated Transaction in the openbanking container:
```json
{
"id": "10301ae4-984b-4632-8bc9-3b8fadca3055",
"ExternalId": null,
"TransactionBankId": "f0f7dd4c66",
"ReferenceId": "132TGf2d40f9e5d",
"AccountId": "1138",
"Type": 0,
"Amount": 0.93,
"AmountNet": 0.93,
"AmountNetDollar": 0,
"DollarPrice": 0,
"TimeStamp": "2023-06-28T21:07:59.806+00:00",
"Currency": 0,
"Blockchain": 0,
"Description": "f0f7dd4c66",
"TransactionHash": null,
"TransactionURL": null,
"OriginWallet": null,
"CounterpartWallet": null,
"OriginTag": null,
"CounterpartTag": null,
"AccountIdOfBRLTransaction": null,
"TransactionIdOfBRLTransaction": null,
"Counterpart": {
"KycCustomerId": null,
"KycBankAccountId": null,
"Name": "bde7691895",
"TaxIdCountry": "BRA",
"TaxId": "02312744163",
"PixKey": null,
"Bank": null,
"BankAccount": "700837563",
"BankBranch": "1",
"Iban": null,
"CounterpartType": 0
},
"PayerCounterpart": {
"KycCustomerId": null,
"KycBankAccountId": null,
"Name": "bde7691895",
"TaxIdCountry": "BRA",
"TaxId": "02312744163",
"PixKey": null,
"Bank": {
"BankCode": "260",
"BankName": ""
},
"BankAccount": "700837563",
"BankBranch": "1",
"Iban": null,
"CounterpartType": 0
},
"Status": 1,
"ReprovedTransactionFromPending": false,
"ApprovedTransactionFromPending": false,
"HasPayInFeeBeenApplied": false,
"HasPayOutFeeBeenApplied": false,
"HasBankReconciliationFeeBeenApplied": false,
"HasFlatFeeBeenApplied": false,
"Flags": {},
"NotifyApplication": null,
"Source": "AdapterGenial@f0f7dd4c66",
"PartitionKey": "Transaction_1138",
"DocumentType": 2,
"SettlementBank": "GenialBank",
"_etag": "\"0600acd5-0000-0b00-0000-649ca0e40000\"",
"CreatedAt": "2023-06-28T21:06:44.3179969+00:00",
"UniqueKey": "f0f7dd4c66",
"Links": [],
"_rid": "Ts8iAOS3FexechMAAAAAAg==",
"_self": "dbs/Ts8iAA==/colls/Ts8iAOS3Few=/docs/Ts8iAOS3FexechMAAAAAAg==/",
"_attachments": "attachments/",
"_ts": 1687986404
}
```
#### Discussion of Case 3
Differently from Case 1, in this case, the account "48623" is exclusively used by the partner associated with the account 1138. All transactions received in this account will be migrated to the account 1138. In this case, the caasId field in genial adapter's container is filled.
Do note that for this example, the ReferenceId contains the prefix "132TG". This intended to show that for exlusive accounts, the ReferenceId won't be parsed.
### Case 4: PayIn without ReferenceId or associated CaasId
The body received from the webhook:
```json
{
"instantPaymentId": "7f9970e53e",
"endToEndId": "8a22cf2e6c",
"timestampUTC": "2023-06-28T21:21:15.611Z",
"settlementId": "c9b1cc0ee9",
"receiverReconciliationIdentifier": "",
"value": 0.84,
"receiver": {
"psp": {
"ispb": "45246410",
"name": "58265e0963"
},
"taxId": "34882109000111",
"addressKey": "3f1bf725-28db-4576-a7eb-cf51b38819a6",
"account": {
"accountNumber": "2950847",
"accountType": "CACC",
"branch": "1"
}
},
"payer": {
"psp": {
"ispb": "18236120",
"name": "2e1d5a4544"
},
"taxId": "02312744163",
"name": "c27692d213",
"account": {
"accountNumber": "700837563",
"accountType": "TRAN",
"branch": "1"
}
},
"spiTimestampUTC": "2023-06-28T21:21:15.612Z",
"customerInitiationTimestampUTC": "2023-03-02T13:35:45.049",
"remittanceInformation": "",
"mipTransactionType": "EXTERNAL",
"eventType": {
"code": 2,
"description": "Receipt"
},
"eventStatus": {
"code": 3,
"description": "Success"
},
"instructionType": "PAGPRI",
"initiationForm": "QRDN",
"transactionPurpose": "IPAY",
"instructionPriority": "HIGH",
"isRigthsAndObligationSettlement": false,
"return": null
}
```
This body produced the following document in "caas-adapter-genial"
```json
{
"transactionId": "7f9970e53e",
"caasId": null,
"endToEndId": "8a22cf2e6c",
"amount": 0.84,
"description": "",
"accountId": "2950847",
"movimentDate": "2023-06-28T21:21:15.611Z",
"createdAt": "2023-06-28T21:19:59.5600199Z",
"migrated": null,
"counterPart": {
"name": "c27692d213",
"taxId": "02312744163",
"bankName": "2e1d5a4544",
"bankCode": "260",
"agency": "1",
"account": "700837563",
"pixKey": null,
"ispb": "18236120"
},
"status": null,
"transactionType": 0,
"referenceId": "",
"uniqueKey": "8a22cf2e6c",
"partition": "Transaction_2950847",
"settlementBank": 125,
"_etag": "\"3b0087f6-0000-0b00-0000-649ca3ff0000\"",
"timeToLive": null,
"createdTimeUtc": "2023-06-28T21:19:59.5600243Z",
"id": "8a22cf2e6c",
"type": "Transaction",
"_rid": "MUJ8APRkMygXFgAAAAAAAA==",
"_self": "dbs/MUJ8AA==/colls/MUJ8APRkMyg=/docs/MUJ8APRkMygXFgAAAAAAAA==/",
"_attachments": "attachments/",
"_ts": 1687987199
}
```
No associated Transaction in "openbanking" was created.
#### Discussion of Case 4
Note that the field "receiverReconciliationIdentifier" is empty.
In case 4, the deposit was made in an account without an associated CaasId, and the field "receiverReconciliationIdentifier" is empty, which means no ReferenceId was received. A case in which this happens is a direct deposit (like static QR code or TED) to an account that isn't exclusive and does not support said method of deposit.
In this case the transaction will not even be migrated. It'll be impossible to determine the associated CaaS account, and the issue will have to be handled manually
A related case is if the field "receiverReconciliationIdentifier" contains a referenceId that doesn't have the proper prefix. In this case, the transaction will be migrated but an error will be thrown in Transaction Processor saying that the account id is required.
## QR Code generation
All the requests were made to the URL http://20.226.206.127/api/v2/accounts/{accountId}/depositDynamicQRCode related to Openbanking-API's AKS deployment, on 28/06/2023.
### Cases
1. QR Code generated for the partner account 132
2. QR Code generated for the partner account 140
### Case 1: QR Code generated for the partner account 132
The body sent to BankingService with accountId = 132 in the route:
```json
{
"amount": 0.87,
"imageOnly": false,
"expiration": 18000,
"externalId": "1dc1547f2e"
}
```
Produced the following response:
```json
{
"referenceId": "132TG23062802454041143E224",
"qrCodeString": "00020101021226990014br.gov.bcb.pix2577pix-h.bancogenial.com/qrs1/v2/01b12W1KJbfYcvmHiFL6JyzgD5YW8SVB1v2UXD8Ge9wHGuA52040000530398654040.435802BR5920Just Pagamentos Ltda6014Rio de Janeiro62070503***63049E35"
}
```
### Case 2: QR Code generated for the partner account 140
The body sent to BankingService with accountId = 140 in the route:
```json
{
"amount": 0.68,
"imageOnly": false,
"expiration": 18000,
"externalId": "ef13e84619"
}
```
Produced the following response:
```json
{
"referenceId": "140TG2306280326908738334FE",
"qrCodeString": "00020101021226990014br.gov.bcb.pix2577pix-h.bancogenial.com/qrs1/v2/01YpkdOQ6KwUtOTar18r2YPUA5gZibBBHwZnmdyDeAXjR5K52040000530398654040.685802BR5920Just Pagamentos Ltda6014Rio de Janeiro62070503***6304F439"
}
```
### Discussion of QR Code generation
This flow produced a referenceId containing the partner's Account. The bank account for the deposit is decided through the load balancing component.
## PayOut
All requests were made to http://20.226.206.127/api/v2/accounts/{accountId}/paymentgroup on 29/06/2023
### Cases
1. PayOut request by partner account 140
2. PayOut request by partner account 132
### Case 1: PayOut request by partner account 140
The body sent to the openbanking api:
```json
[
{
"amount": 0.58,
"currency": "BRL",
"name": "735db44807",
"taxIdCountry": "BRA",
"taxId": "11480809000184",
"pixKey": "7e8c35bc-5544-472b-9a57-347ffe3f5f19"
}
]
```
Produced the following document in the "openbanking" container:
```json
{
"id": "2a5f7617-b994-40d4-9da9-ad0ddf15b2a8",
"AccountId": "140",
"Payments": [
{
"PaymentId": "4fd1c16c-36db-44b5-831a-3ad7dcddfc01",
"ExternalId": null,
"TransactionId": "511a0406-3ee2-4c99-bc8d-d91647a52350",
"TransactionHash": "E452464102023062918412Sb0FNqnjcD",
"TransactionIdForPaymentCompletedWithError": null,
"TransactionIdBRZ": null,
"TransactionIdBRZReproved": null,
"PaymentCounterpart": {
"KycCustomerId": null,
"KycBankAccountId": null,
"Name": "735db44807",
"TaxIdCountry": "BRA",
"TaxId": "11480809000184",
"PixKey": "7e8c35bc-5544-472b-9a57-347ffe3f5f19",
"Bank": null,
"BankAccount": null,
"BankBranch": null,
"Iban": null,
"CounterpartType": 1
},
"DebitCounterpart": {
"KycCustomerId": null,
"KycBankAccountId": null,
"Name": "735db44807",
"TaxIdCountry": "BRA",
"TaxId": "11480809000184",
"PixKey": null,
"Bank": null,
"BankAccount": null,
"BankBranch": null,
"Iban": null,
"CounterpartType": 1
},
"PaymentSchedule": "2023-06-29T18:41:10.0121499+00:00",
"Amount": 0.58,
"AmountNet": 0.58,
"AmountDeductedFromAccount": 0.58,
"Wallet": null,
"OriginWallet": null,
"SourceAddress": null,
"FeePayerAddress": null,
"BlockchainFee": 0,
"AlternativeIdentifier": null,
"Currency": 0,
"Blockchain": 0,
"Approver": {
"Email": "Plural Adapter",
"DateApproved": "2023-06-29T18:41:48.4854034+00:00"
},
"PaymentStatus": 4,
"ReasonsForPaymentRejection": null,
"NotifyApplication": null,
"HasBeenSentToAdapter": true,
"RefundId": null,
"AdditionalInformation": {}
}
],
"PaymentGroupStatus": 1,
"Type": 19,
"Approver": {
"Email": null,
"DateApproved": "2023-06-29T18:41:11.3644291+00:00"
},
"isVirtual": false,
"PointerToPayments": [],
"HasSispagFileBeenGenerated": false,
"HasBeenTakenInVirtualPaymentGroup": false,
"HasBeenSentToAdapter": true,
"PartitionKey": "PaymentGroup_140",
"DocumentType": 5,
"_etag": "\"22000159-0000-0b00-0000-649dd06d0000\"",
"CreatedAt": "2023-06-29T18:41:10.0120635+00:00",
"UniqueKey": "cb662f0d763f97fd0eb67cb37a14317f50d1fef532880210099709bb06661b70",
"Links": [
{
"Id": "511a0406-3ee2-4c99-bc8d-d91647a52350",
"ChildId": null,
"isHidden": false,
"DocumentType": 2,
"Description": "Debit Transaction from Payment",
"LinkType": 0,
"PartitionKey": "Transaction_140"
}
],
"_rid": "Ts8iAOS3FexpjRQAAAAACg==",
"_self": "dbs/Ts8iAA==/colls/Ts8iAOS3Few=/docs/Ts8iAOS3FexpjRQAAAAACg==/",
"_attachments": "attachments/",
"_ts": 1688064109
}
```
Which, in turn, produced the following PaymentGroup document in "caas-adapter-genial":
```json
{
"accountId": "48623",
"caasId": "140",
"status": "SuccessfullyProcessed",
"paymentBankId": "01890875-a996-9849-3f0f-0aa763c9b863",
"ispb": "45246410",
"bankName": null,
"bankDestination": "125",
"agencyDestination": "1",
"accountDestination": "2950847",
"accountDigit": "",
"taxId": "11480809000184",
"personType": "CNPJ",
"name": "735db44807",
"observation": "4fd1c16c-36db-44b5-831a-3ad7dcddfc01",
"accountType": "CACC",
"amount": 0.58,
"migrated": "2023-06-29T18:41:47.4727217+00:00",
"dateOfReceiptData": null,
"createdAt": "2023-06-29T18:41:14.2643904+00:00",
"dateChangeStatus": "2023-06-29T18:41:47.2740897+00:00",
"message": "",
"pixKey": "7e8c35bc-5544-472b-9a57-347ffe3f5f19",
"pixKeyType": "EVP",
"hasPix": true,
"endToEndId": "E452464102023062918412Sb0FNqnjcD",
"uniqueKey": "4fd1c16c-36db-44b5-831a-3ad7dcddfc01",
"statusChangeHistory": [
{
"status": "Pending",
"changeDate": "2023-06-29T18:41:14.2643992+00:00",
"note": null,
"requestId": null,
"isRetry": false,
"machineName": "caas-adapter-genial-dev-98599cff4-dvsvx",
"retryId": null
},
{
"status": "Created",
"changeDate": "2023-06-29T18:41:15.3669793+00:00",
"note": null,
"requestId": null,
"isRetry": false,
"machineName": "caas-adapter-genial-dev-98599cff4-dvsvx",
"retryId": null
},
{
"status": "Processing",
"changeDate": "2023-06-29T18:41:16.4074495+00:00",
"note": "Payment confirmed. (E452464102023062918412Sb0FNqnjcD)",
"requestId": null,
"isRetry": false,
"machineName": "caas-adapter-genial-dev-98599cff4-rbzf7",
"retryId": null
},
{
"status": "SuccessfullyProcessed",
"changeDate": "2023-06-29T18:41:47.2740842+00:00",
"note": "",
"requestId": null,
"isRetry": false,
"machineName": "caas-adapter-genial-dev-98599cff4-rbzf7",
"retryId": null
}
],
"refundId": null,
"credentials": {
"bankAccount": "48623"
},
"partition": "Payment_48623",
"_etag": "\"3e00ee0f-0000-0b00-0000-649dd06b0000\"",
"timeToLive": null,
"createdTimeUtc": "2023-06-29T18:41:14.4648406Z",
"id": "4fd1c16c-36db-44b5-831a-3ad7dcddfc01",
"type": "Payment",
"_rid": "MUJ8APRkMygzFwAAAAAAAA==",
"_self": "dbs/MUJ8AA==/colls/MUJ8APRkMyg=/docs/MUJ8APRkMygzFwAAAAAAAA==/",
"_attachments": "attachments/",
"_ts": 1688064107
}
```
### Case 2: PayOut request by partner account 132
The request was made with the body:
```json
[
{
"amount": 0.8,
"currency": "BRL",
"name": "3a328d3503",
"taxIdCountry": "BRA",
"taxId": "11480809000184",
"pixKey": "7e8c35bc-5544-472b-9a57-347ffe3f5f19"
}
]
```
And produced the following document in the "openbanking" container:
```json
{
"id": "9add154f-d460-4e5b-a2f7-5d85bf16232a",
"AccountId": "132",
"Payments": [
{
"PaymentId": "f73523b8-319a-4315-aa03-e688b5845c04",
"ExternalId": null,
"TransactionId": "01da1503-7643-4c56-a48d-c61048cd3b76",
"TransactionHash": "E45246410202306291844dYX5Wjg1LVJ",
"TransactionIdForPaymentCompletedWithError": null,
"TransactionIdBRZ": null,
"TransactionIdBRZReproved": null,
"PaymentCounterpart": {
"KycCustomerId": null,
"KycBankAccountId": null,
"Name": "3a328d3503",
"TaxIdCountry": "BRA",
"TaxId": "11480809000184",
"PixKey": "7e8c35bc-5544-472b-9a57-347ffe3f5f19",
"Bank": null,
"BankAccount": null,
"BankBranch": null,
"Iban": null,
"CounterpartType": 1
},
"DebitCounterpart": {
"KycCustomerId": null,
"KycBankAccountId": null,
"Name": "3a328d3503",
"TaxIdCountry": "BRA",
"TaxId": "11480809000184",
"PixKey": null,
"Bank": null,
"BankAccount": null,
"BankBranch": null,
"Iban": null,
"CounterpartType": 1
},
"PaymentSchedule": "2023-06-29T18:44:42.5752755+00:00",
"Amount": 0.8,
"AmountNet": 0.8,
"AmountDeductedFromAccount": 0.8,
"Wallet": null,
"OriginWallet": null,
"SourceAddress": null,
"FeePayerAddress": null,
"BlockchainFee": 0,
"AlternativeIdentifier": null,
"Currency": 0,
"Blockchain": 0,
"Approver": {
"Email": "Plural Adapter",
"DateApproved": "2023-06-29T18:45:03.7476213+00:00"
},
"PaymentStatus": 4,
"ReasonsForPaymentRejection": null,
"NotifyApplication": null,
"HasBeenSentToAdapter": true,
"RefundId": null,
"AdditionalInformation": {}
}
],
"PaymentGroupStatus": 1,
"Type": 19,
"Approver": {
"Email": null,
"DateApproved": "2023-06-29T18:44:44.1458524+00:00"
},
"isVirtual": false,
"PointerToPayments": [],
"HasSispagFileBeenGenerated": false,
"HasBeenTakenInVirtualPaymentGroup": false,
"HasBeenSentToAdapter": true,
"PartitionKey": "PaymentGroup_132",
"DocumentType": 5,
"_etag": "\"2200205a-0000-0b00-0000-649dd1300000\"",
"CreatedAt": "2023-06-29T18:44:42.5752061+00:00",
"UniqueKey": "598258b0c857cdc19a9d8eee2507b34c05b4c392e5386b46e3b1d353b8ea0b9d",
"Links": [
{
"Id": "01da1503-7643-4c56-a48d-c61048cd3b76",
"ChildId": null,
"isHidden": false,
"DocumentType": 2,
"Description": "Debit Transaction from Payment",
"LinkType": 0,
"PartitionKey": "Transaction_132"
}
],
"_rid": "Ts8iAOS3FexvjRQAAAAACg==",
"_self": "dbs/Ts8iAA==/colls/Ts8iAOS3Few=/docs/Ts8iAOS3FexvjRQAAAAACg==/",
"_attachments": "attachments/",
"_ts": 1688064304
}
```
Which, in turn, produced the following PaymentGroup document in "caas-adapter-genial":
```json
{
"accountId": "48623",
"caasId": "132",
"status": "SuccessfullyProcessed",
"paymentBankId": "01890878-e9d4-3892-9288-b6e6b8163a22",
"ispb": "45246410",
"bankName": null,
"bankDestination": "125",
"agencyDestination": "1",
"accountDestination": "2950847",
"accountDigit": "",
"taxId": "11480809000184",
"personType": "CNPJ",
"name": "3a328d3503",
"observation": "f73523b8-319a-4315-aa03-e688b5845c04",
"accountType": "CACC",
"amount": 0.8,
"migrated": "2023-06-29T18:45:02.7171107+00:00",
"dateOfReceiptData": null,
"createdAt": "2023-06-29T18:44:47.0671965+00:00",
"dateChangeStatus": "2023-06-29T18:45:01.568391+00:00",
"message": "Payment confirmed. (E45246410202306291844dYX5Wjg1LVJ)",
"pixKey": "7e8c35bc-5544-472b-9a57-347ffe3f5f19",
"pixKeyType": "EVP",
"hasPix": true,
"endToEndId": "E45246410202306291844dYX5Wjg1LVJ",
"uniqueKey": "f73523b8-319a-4315-aa03-e688b5845c04",
"statusChangeHistory": [
{
"status": "Pending",
"changeDate": "2023-06-29T18:44:47.0671977+00:00",
"note": null,
"requestId": null,
"isRetry": false,
"machineName": "caas-adapter-genial-dev-98599cff4-dvsvx",
"retryId": null
},
{
"status": "Created",
"changeDate": "2023-06-29T18:44:48.4483638+00:00",
"note": null,
"requestId": null,
"isRetry": false,
"machineName": "caas-adapter-genial-dev-98599cff4-dvsvx",
"retryId": null
},
{
"status": "Processing",
"changeDate": "2023-06-29T18:44:49.5962508+00:00",
"note": "Payment confirmed. (E45246410202306291844dYX5Wjg1LVJ)",
"requestId": null,
"isRetry": false,
"machineName": "caas-adapter-genial-dev-98599cff4-rbzf7",
"retryId": null
},
{
"status": "SuccessfullyProcessed",
"changeDate": "2023-06-29T18:45:01.5683652+00:00",
"note": "change by polling",
"requestId": null,
"isRetry": false,
"machineName": "caas-adapter-genial-dev-98599cff4-dvsvx",
"retryId": null
}
],
"refundId": null,
"credentials": {
"bankAccount": "48623"
},
"partition": "Payment_48623",
"_etag": "\"3e00fe10-0000-0b00-0000-649dd12e0000\"",
"timeToLive": null,
"createdTimeUtc": "2023-06-29T18:44:47.0684233Z",
"id": "f73523b8-319a-4315-aa03-e688b5845c04",
"type": "Payment",
"_rid": "MUJ8APRkMyg2FwAAAAAAAA==",
"_self": "dbs/MUJ8AA==/colls/MUJ8APRkMyg=/docs/MUJ8APRkMyg2FwAAAAAAAA==/",
"_attachments": "attachments/",
"_ts": 1688064302
}
```
### Discussions of PayOut
Note that both PayOuts were made from the same bank account, even though they are from different CaaS partner accounts.
The PayOut bank account is decided by the load balancing component. A field "BankAcccount" was added to DistributionConfiguration (in our Model) and is propagated to the adapter by the load balancer through the "Credentials" dictionary in the DTO.
# Adapter BS2
## QR Code Generation
All requests were made to http://dev-openbanking.bit.one/api/v2/accounts/{accountId}/depositDynamicQRCode on 05/04/2023
### Cases
1. QR Code generated for the partner account 139
2. QR Code generated for the partner account 138
### Case 1: QR Code generated for the partner account 139
The body sent to BankingService with accountId = 139 in the route:
```json
{
"amount": 0.45,
"imageOnly": false,
"expiration": 18000,
"externalId": "3f0c005536"
}
```
Produced the following response:
```json
{
"referenceId": "139TG230328503456996649F4D",
"qrCodeString": "00020126910014BR.GOV.BCB.PIX2569api-pix-h.bancobs2.com.br/spi/v2/5c5448d0-fc6c-4290-8f53-e3b0d6d79bef52040000530398654040.455802BR5915Just Pagamentos6014Belo Horizonte61083038040362070503***630481A5"
}
```
### Case 2: QR Code generated for the partner account 138
The body sent to BankingService with accountId = 138 in the route:
```json
{
"amount": 0.79,
"imageOnly": false,
"expiration": 18000,
"externalId": "23048c1a28"
}
```
Produced the following response:
```json
{
"referenceId": "138TG230328500507968559668",
"qrCodeString": "00020126910014BR.GOV.BCB.PIX2569api-pix-h.bancobs2.com.br/spi/v2/eb15f12b-716a-4e2e-a94f-a83a232553bb52040000530398654040.795802BR5915Just Pagamentos6014Belo Horizonte61083038040362070503***6304B897
}
```
### Discussion of QR Code generation
This flow produced a referenceId containing the partner’s Account. The bank account for the deposit is decided through the load balancing component. In this case, both requests quere made to the same bank account.
## PayIn
All requests were made to the URL https://transferocaas-adapter-bs2-dev.azurewebsites.net/pix/ProcessWebhook/{accountId} of the local build of the BS2 Adapter. This accountId is a parameter passed when generating a QR code, that bs2 uses to decide the webhook path. For account pool, this parameter will always be the number of a bank account.
### Cases
1. PayIn for an account without an associated CaasId with by partner 138
2. PayIn for an account without an associated CaasId with by partner 139
3. PayIn for an account with an associated CaasId
4. PayIn without ReferenceId or associated CaasId
### Case 1: PayIn for an account without an associated CaasId with by partner 138
Body received through the webhook endpoint with accountId = "9866124".
```json
{
"pix": [
{
"Status": "EFETIVADO",
"InfoPagador": null,
"Devolucoes": null,
"Motivo": null,
"txid": "139TGfa7cfaa352",
"Horario": "2023-03-28T17:55:26.122Z",
"EndToEndId": "ea523a8fe5",
"Valor": 0.4,
"Pagador": {
"Cnpj": "000000",
"Nome": "Contas Pool Test 14mar"
}
}
]
}
```
This body produces the following document in the container "caas-adapter-bs2":
```json
{
"transactionId": null,
"caasId": null,
"endToEndId": "ea523a8fe5",
"recebimentoId": 0,
"amount": 0.4,
"description": null,
"operationType": null,
"accountId": "9866124",
"createdAt": "2023-03-28T17:55:26.122Z",
"migrated": "2023-03-28T17:53:34.4286643Z",
"counterPart": {
"name": "Contas Pool Test 14mar",
"taxId": "000000",
"bankName": null,
"bankCode": null,
"agency": null,
"account": null,
"pixKey": null
},
"receiver": null,
"protocol": null,
"status": "EFETIVADO",
"transactionType": 0,
"referenceId": "139TGfa7cfaa352",
"ispb": null,
"uniqueKey": "ea523a8fe5",
"partition": "Transaction_9866124",
"settlementBank": 218,
"flags": {
"blockList": false
},
"statusChangeHistory": null,
"dateChangeStatus": null,
"_etag": "\"0200a339-0000-0b00-0000-6423299e0000\"",
"timeToLive": null,
"createdTimeUtc": "2023-03-28T17:53:34.3449644Z",
"id": "3a3f5424-6dfb-4f6d-9fbe-81426731c87f",
"type": "Transaction",
"_rid": "NrQyAIFz8ivSXwIAAAAAAA==",
"_self": "dbs/NrQyAA==/colls/NrQyAIFz8is=/docs/NrQyAIFz8ivSXwIAAAAAAA==/",
"_attachments": "attachments/",
"_ts": 1680026014
}
```
And the associated Transaction in the "openbanking" container:
```json
{
"id": "455b378f-d4ee-4c51-a0b8-d991c6397db4",
"ExternalId": null,
"TransactionBankId": "ea523a8fe5",
"ReferenceId": "139TGfa7cfaa352",
"AccountId": "139",
"Type": 0,
"Amount": 0.4,
"AmountNet": 0.4,
"AmountNetDollar": 0,
"DollarPrice": 0,
"TimeStamp": "2023-03-28T17:55:26.122+00:00",
"Currency": 0,
"Blockchain": 0,
"Description": "ea523a8fe5",
"TransactionHash": null,
"TransactionURL": null,
"OriginWallet": null,
"CounterpartWallet": null,
"OriginTag": null,
"CounterpartTag": null,
"AccountIdOfBRLTransaction": null,
"TransactionIdOfBRLTransaction": null,
"Counterpart": {
"KycCustomerId": null,
"KycBankAccountId": null,
"Name": "Contas Pool Test 14mar",
"TaxIdCountry": "BRA",
"TaxId": "000000",
"PixKey": null,
"Bank": null,
"BankAccount": null,
"BankBranch": null,
"Iban": null,
"CounterpartType": 0
},
"Status": 1,
"ReprovedTransactionFromPending": false,
"ApprovedTransactionFromPending": false,
"HasPayInFeeBeenApplied": false,
"HasPayOutFeeBeenApplied": false,
"HasBankReconciliationFeeBeenApplied": false,
"HasFlatFeeBeenApplied": false,
"Flags": {},
"NotifyApplication": null,
"Source": "AdapterBS2@3a3f5424-6dfb-4f6d-9fbe-81426731c87f",
"PartitionKey": "Transaction_139",
"DocumentType": 2,
"SettlementBank": "BS2Bank",
"_etag": "\"100012fc-0000-0b00-0000-6423299e0000\"",
"CreatedAt": "2023-03-28T17:53:34.4510822+00:00",
"UniqueKey": "ea523a8fe5",
"Links": [],
"_rid": "Ts8iAOS3FewiTRMAAAAAAg==",
"_self": "dbs/Ts8iAA==/colls/Ts8iAOS3Few=/docs/Ts8iAOS3FewiTRMAAAAAAg==/",
"_attachments": "attachments/",
"_ts": 1680026014
}
```
#### Discussion of Case 1
Note that the "ReferenceId" for that PayIn comes from the field "txid" received in our webhook. This field is related to "referenceId" in the adapter, and "ReferenceId" in the openbanking container.
This Reference Id is the field generated by our Banking Service dynamic QR code flow.
It's also important to notice that the transaction inside the adapter has no associated CaasId. The CaasId is parsed within the Transaction Service.
Both the accountId and the partition key of the document in the adapter's container is related to the bank account in question, which in this case is "9866124"
In this case, the ReferenceId has the prefix "132TG" indicating that the transaction is related the CaaS account 132.
### Case 2: PayIn for an account without an associated CaasId with by partner 139
Body received through the webhook endpoint with accountId = "9866124":
```json
{
"pix": [
{
"Status": "EFETIVADO",
"InfoPagador": null,
"Devolucoes": null,
"Motivo": null,
"txid": "138TGf813d169a0",
"Horario": "2023-03-28T17:58:12.532Z",
"EndToEndId": "1b360127da",
"Valor": 0.68,
"Pagador": {
"Cnpj": "000000",
"Nome": "Contas Pool Test 14mar"
}
}
]
}
```
This body produces the following document in the container "caas-adapter-bs2":
```json
{
"transactionId": null,
"caasId": null,
"endToEndId": "1b360127da",
"recebimentoId": 0,
"amount": 0.68,
"description": null,
"operationType": null,
"accountId": "9866124",
"createdAt": "2023-03-28T17:58:12.532Z",
"migrated": "2023-03-28T17:56:21.3838826Z",
"counterPart": {
"name": "Contas Pool Test 14mar",
"taxId": "000000",
"bankName": null,
"bankCode": null,
"agency": null,
"account": null,
"pixKey": null
},
"receiver": null,
"protocol": null,
"status": "EFETIVADO",
"transactionType": 0,
"referenceId": "138TGf813d169a0",
"ispb": null,
"uniqueKey": "1b360127da",
"partition": "Transaction_9866124",
"settlementBank": 218,
"flags": {
"blockList": false
},
"statusChangeHistory": null,
"dateChangeStatus": null,
"_etag": "\"0200e139-0000-0b00-0000-64232a450000\"",
"timeToLive": null,
"createdTimeUtc": "2023-03-28T17:56:20.6994962Z",
"id": "a7441d9f-9742-4c92-bd52-467ac1920bca",
"type": "Transaction",
"_rid": "NrQyAIFz8ivTXwIAAAAAAA==",
"_self": "dbs/NrQyAA==/colls/NrQyAIFz8is=/docs/NrQyAIFz8ivTXwIAAAAAAA==/",
"_attachments": "attachments/",
"_ts": 1680026181
}
```
And the associated Transaction in the "openbanking" container:
```json
{
"id": "15c62c32-d702-4924-845e-de2f47ace225",
"ExternalId": null,
"TransactionBankId": "1b360127da",
"ReferenceId": "138TGf813d169a0",
"AccountId": "138",
"Type": 0,
"Amount": 0.68,
"AmountNet": 0.68,
"AmountNetDollar": 0,
"DollarPrice": 0,
"TimeStamp": "2023-03-28T17:58:12.532+00:00",
"Currency": 0,
"Blockchain": 0,
"Description": "1b360127da",
"TransactionHash": null,
"TransactionURL": null,
"OriginWallet": null,
"CounterpartWallet": null,
"OriginTag": null,
"CounterpartTag": null,
"AccountIdOfBRLTransaction": null,
"TransactionIdOfBRLTransaction": null,
"Counterpart": {
"KycCustomerId": null,
"KycBankAccountId": null,
"Name": "Contas Pool Test 14mar",
"TaxIdCountry": "BRA",
"TaxId": "000000",
"PixKey": null,
"Bank": null,
"BankAccount": null,
"BankBranch": null,
"Iban": null,
"CounterpartType": 0
},
"Status": 1,
"ReprovedTransactionFromPending": false,
"ApprovedTransactionFromPending": false,
"HasPayInFeeBeenApplied": false,
"HasPayOutFeeBeenApplied": false,
"HasBankReconciliationFeeBeenApplied": false,
"HasFlatFeeBeenApplied": false,
"Flags": {},
"NotifyApplication": null,
"Source": "AdapterBS2@a7441d9f-9742-4c92-bd52-467ac1920bca",
"PartitionKey": "Transaction_138",
"DocumentType": 2,
"SettlementBank": "BS2Bank",
"_etag": "\"2600c36c-0000-0b00-0000-64232a450000\"",
"CreatedAt": "2023-03-28T17:56:21.3970991+00:00",
"UniqueKey": "1b360127da",
"Links": [],
"_rid": "Ts8iAOS3Fex8PhQAAAAACg==",
"_self": "dbs/Ts8iAA==/colls/Ts8iAOS3Few=/docs/Ts8iAOS3Fex8PhQAAAAACg==/",
"_attachments": "attachments/",
"_ts": 1680026181
}
```
#### Discussion of Case 2
This case is very similar to Case 1, the only difference being that the ReferenceId contains the prefix "139TG" indicating that the deposit is related to the CaaS account 139.
Both the accountId and the partition key are also related to the account "9866124", just like Case 1.
An unintended detail is that the adapter's document was generated without the field "caasId" because of a mistake (already fixed) in the memory cache implementation. The entire flow still worked in this case.
### Case 3: PayIn for an account with an associated CaasId
Body received through the webhook endpoint with accountId = "9866116":
```json
{
"pix": [
{
"Status": "EFETIVADO",
"InfoPagador": null,
"Devolucoes": null,
"Motivo": null,
"txid": "138TG4e9f66fae1",
"Horario": "2023-03-28T18:00:26.865Z",
"EndToEndId": "28ede48620",
"Valor": 0.9,
"Pagador": {
"Cnpj": "000000",
"Nome": "Contas Pool Test 14mar"
}
}
]
}
```
This body produces the following document in the container "caas-adapter-bs2":
```json
{
"transactionId": null,
"caasId": "1138",
"endToEndId": "28ede48620",
"recebimentoId": 0,
"amount": 0.9,
"description": null,
"operationType": null,
"accountId": "9866116",
"createdAt": "2023-03-28T18:00:26.865Z",
"migrated": "2023-03-28T17:58:35.9906058Z",
"counterPart": {
"name": "Contas Pool Test 14mar",
"taxId": "000000",
"bankName": null,
"bankCode": null,
"agency": null,
"account": null,
"pixKey": null
},
"receiver": null,
"protocol": null,
"status": "EFETIVADO",
"transactionType": 0,
"referenceId": "138TG4e9f66fae1",
"ispb": null,
"uniqueKey": "28ede48620",
"partition": "Transaction_9866116",
"settlementBank": 218,
"flags": {
"blockList": false
},
"statusChangeHistory": null,
"dateChangeStatus": null,
"_etag": "\"0200193a-0000-0b00-0000-64232acb0000\"",
"timeToLive": null,
"createdTimeUtc": "2023-03-28T17:58:35.0855544Z",
"id": "00866e0e-5503-4209-a1e5-502461b94a1f",
"type": "Transaction",
"_rid": "NrQyAIFz8ivUXwIAAAAAAA==",
"_self": "dbs/NrQyAA==/colls/NrQyAIFz8is=/docs/NrQyAIFz8ivUXwIAAAAAAA==/",
"_attachments": "attachments/",
"_ts": 1680026315
}
```
And the associated Transaction in the "openbanking" container:
```json
{
"id": "728c2160-07dd-46d0-928a-e61e603a9451",
"ExternalId": null,
"TransactionBankId": "28ede48620",
"ReferenceId": "138TG4e9f66fae1",
"AccountId": "1138",
"Type": 0,
"Amount": 0.9,
"AmountNet": 0.9,
"AmountNetDollar": 0,
"DollarPrice": 0,
"TimeStamp": "2023-03-28T18:00:26.865+00:00",
"Currency": 0,
"Blockchain": 0,
"Description": "28ede48620",
"TransactionHash": null,
"TransactionURL": null,
"OriginWallet": null,
"CounterpartWallet": null,
"OriginTag": null,
"CounterpartTag": null,
"AccountIdOfBRLTransaction": null,
"TransactionIdOfBRLTransaction": null,
"Counterpart": {
"KycCustomerId": null,
"KycBankAccountId": null,
"Name": "Contas Pool Test 14mar",
"TaxIdCountry": "BRA",
"TaxId": "000000",
"PixKey": null,
"Bank": null,
"BankAccount": null,
"BankBranch": null,
"Iban": null,
"CounterpartType": 0
},
"Status": 1,
"ReprovedTransactionFromPending": false,
"ApprovedTransactionFromPending": false,
"HasPayInFeeBeenApplied": false,
"HasPayOutFeeBeenApplied": false,
"HasBankReconciliationFeeBeenApplied": false,
"HasFlatFeeBeenApplied": false,
"Flags": {},
"NotifyApplication": null,
"Source": "AdapterBS2@00866e0e-5503-4209-a1e5-502461b94a1f",
"PartitionKey": "Transaction_1138",
"DocumentType": 2,
"SettlementBank": "BS2Bank",
"_etag": "\"1000bdfe-0000-0b00-0000-64232acc0000\"",
"CreatedAt": "2023-03-28T17:58:36.0046451+00:00",
"UniqueKey": "28ede48620",
"Links": [],
"_rid": "Ts8iAOS3FewoTRMAAAAAAg==",
"_self": "dbs/Ts8iAA==/colls/Ts8iAOS3Few=/docs/Ts8iAOS3FewoTRMAAAAAAg==/",
"_attachments": "attachments/",
"_ts": 1680026316
}
```
#### Discussion of Case 3
Differently from Case 1, in this case, the account "9866116" is exclusively used by the partner associated with the account 1138. All transactions received in this account will be migrated to the account 1138. In this case, the caasId field in bs2 adapter's container is filled.
Do note that for this example, the ReferenceId contains the prefix "138TG". This intended to show that for exlusive accounts, the ReferenceId won't be parsed. But in general, transactions in this case wont have a referenceId.
### Case 4: PayIn without ReferenceId or associated CaasId
Body received through the webhook endpoint with accountId = "9866124":
```json
{
"pix": [
{
"Status": "EFETIVADO",
"InfoPagador": null,
"Devolucoes": null,
"Motivo": null,
"txid": "",
"Horario": "2023-03-28T18:02:05.122Z",
"EndToEndId": "13bd0d049b",
"Valor": 0.24,
"Pagador": {
"Cnpj": "000000",
"Nome": "Contas Pool Test 14mar"
}
}
]
}
```
This body produces the following document in the container "caas-adapter-bs2":
```json
{
"transactionId": null,
"caasId": null,
"endToEndId": "13bd0d049b",
"recebimentoId": 0,
"amount": 0.24,
"description": null,
"operationType": null,
"accountId": "9866124",
"createdAt": "2023-03-28T18:02:05.122Z",
"migrated": null,
"counterPart": {
"name": "Contas Pool Test 14mar",
"taxId": "000000",
"bankName": null,
"bankCode": null,
"agency": null,
"account": null,
"pixKey": null
},
"receiver": null,
"protocol": null,
"status": "EFETIVADO",
"transactionType": 0,
"referenceId": "",
"ispb": null,
"uniqueKey": "13bd0d049b",
"partition": "Transaction_9866124",
"settlementBank": 218,
"flags": {
"blockList": false
},
"statusChangeHistory": null,
"dateChangeStatus": null,
"_etag": "\"02004a3a-0000-0b00-0000-64232b2d0000\"",
"timeToLive": null,
"createdTimeUtc": "2023-03-28T18:00:13.2388967Z",
"id": "d01e44d1-d9ee-4986-b7bc-a855aad15b4c",
"type": "Transaction",
"_rid": "NrQyAIFz8ivWXwIAAAAAAA==",
"_self": "dbs/NrQyAA==/colls/NrQyAIFz8is=/docs/NrQyAIFz8ivWXwIAAAAAAA==/",
"_attachments": "attachments/",
"_ts": 1680026413
}
```
No associated Transaction in "openbanking" was created.
#### Discussion of Case 4
Note that the field "txid" is empty.
In case 4, the deposit was made in an account without an associated CaasId, and the field "txid" is empty, which means no ReferenceId was received. A case in which this happens is a direct deposit (like static QR code or TED) to an account that isn't exclusive and does not support said method of deposit.
In this case the transaction will not even be migrated. It'll be impossible to determine the associated CaaS account, and the issue will have to be handled manually
A related case is if the field "txid" contains a referenceId that doesn't have the proper prefix. In this case, the transaction will be migrated but an error will be thrown in Transaction Processor saying that the account id is required.
## PayOut
All requests were made to http://dev-openbanking.bit.one/api/v2/accounts/{accountId}/paymentgroup
### Cases
1. PayOut request by partner account 140
2. PayOut request by partner account 132
### Case 1: PayOut request by partner account 138
The body sent to the openbanking api:
```json
[
{
"amount": 0.52,
"currency": "BRL",
"name": "AuthTestContasPool-23-03",
"taxIdCountry": "BRA",
"taxId": "11480809000184",
"pixKey": "acb22099-9ea3-4f8e-805e-9064e36a1256"
}
]
```
Produced the following document in the "openbanking" container:
```json
{
"id": "bc538649-600d-4792-a4b0-2602183e7aa1",
"AccountId": "138",
"Payments": [
{
"PaymentId": "9b233409-cd1a-4a43-b5fe-775c4c97f279",
"ExternalId": null,
"TransactionId": null,
"TransactionHash": null,
"TransactionIdForPaymentCompletedWithError": null,
"TransactionIdBRZ": null,
"TransactionIdBRZReproved": null,
"PaymentCounterpart": {
"KycCustomerId": null,
"KycBankAccountId": null,
"Name": "AuthTestContasPool-23-03",
"TaxIdCountry": "BRA",
"TaxId": "11480809000184",
"PixKey": "acb22099-9ea3-4f8e-805e-9064e36a1256",
"Bank": null,
"BankAccount": null,
"BankBranch": null,
"Iban": null,
"CounterpartType": 1
},
"PaymentSchedule": "2023-03-28T18:02:16.2899449+00:00",
"Amount": 0.52,
"AmountNet": 0.52,
"AmountDeductedFromAccount": 0.52,
"Wallet": null,
"OriginWallet": null,
"SourceAddress": null,
"FeePayerAddress": null,
"BlockchainFee": 0,
"AlternativeIdentifier": null,
"Currency": 0,
"Blockchain": 0,
"Approver": null,
"PaymentStatus": 1,
"ReasonsForPaymentRejection": null,
"NotifyApplication": null,
"HasBeenSentToAdapter": false,
"RefundId": null,
"AdditionalInformation": {}
}
],
"PaymentGroupStatus": 1,
"Type": 17,
"Approver": null,
"isVirtual": false,
"PointerToPayments": [],
"HasSispagFileBeenGenerated": false,
"HasBeenTakenInVirtualPaymentGroup": false,
"HasBeenSentToAdapter": false,
"PartitionKey": "PaymentGroup_138",
"DocumentType": 5,
"_etag": "\"2600f476-0000-0b00-0000-64232bad0000\"",
"CreatedAt": "2023-03-28T18:02:16.2895316+00:00",
"UniqueKey": "b24ecbbb56bd9e581ecf17997d88fdd05ac94ef9af9b67b3c05b8d5cb3d4b119",
"Links": [],
"_rid": "Ts8iAOS3FeyCPhQAAAAACg==",
"_self": "dbs/Ts8iAA==/colls/Ts8iAOS3Few=/docs/Ts8iAOS3FeyCPhQAAAAACg==/",
"_attachments": "attachments/",
"_ts": 1680026541
}
```
Which, in turn, produced the following PaymentGroup document in "caas-adapter-bs2"
```json
{
"accountId": "9866124",
"status": "SuccessfullyProcessed",
"paymentBankId": "db5bfc2d-0b76-4fa7-b28a-55d9c067b8c9",
"ispb": "45246410",
"bankName": "BANCO GENIAL",
"bankDestination": "125",
"agencyDestination": "0001",
"accountDestination": "48623",
"paymentDate": "0001-01-01T00:00:00+00:00",
"accountDigit": "",
"taxId": "11480809000184",
"personType": "CNPJ",
"personAccount": null,
"name": "Account1",
"friendlyName": null,
"observation": "510c31be-630c-426c-9ec9-a4a695b37f65",
"accountType": "ContaCorrente",
"amount": 0.22,
"transactionId": null,
"migrated": "2023-03-14T15:03:16.008773+00:00",
"dateOfReceiptData": null,
"createdAt": "2023-03-14T15:01:06.4081079+00:00",
"dateChangeStatus": "2023-03-14T15:03:15.4849565+00:00",
"message": "Payment confirmed. (E710278662023031414592453950822P)",
"pixKey": "acb22099-9ea3-4f8e-805e-9064e36a1256",
"hasPix": true,
"endToEndId": "E710278662023031414592453950822P",
"uniqueKey": "510c31be-630c-426c-9ec9-a4a695b37f65",
"statusChangeHistory": [
{
"status": "Pending",
"changeDate": "2023-03-14T15:01:06.4081089+00:00",
"note": null,
"requestId": null
},
{
"status": "Created",
"changeDate": "2023-03-14T15:01:12.0453495+00:00",
"note": null,
"requestId": null
},
{
"status": "Created",
"changeDate": "2023-03-14T14:59:27.4994544+00:00",
"note": "Retry due: ",
"requestId": null
},
{
"status": "Processing",
"changeDate": "2023-03-14T15:01:15.2536553+00:00",
"note": "Payment confirmed. (E710278662023031414592453950822P)",
"requestId": null
},
{
"status": "SuccessfullyProcessed",
"changeDate": "2023-03-14T15:03:15.4849371+00:00",
"note": null,
"requestId": null
}
],
"solicitationTED": null,
"approvedTED": false,
"refundId": null,
"credentials": {
"bankAccount": "9866124"
},
"partition": "Payment_9866124",
"_etag": "\"22000efd-0000-0b00-0000-64108cb40000\"",
"timeToLive": null,
"createdTimeUtc": "2023-03-14T15:01:06.4269841Z",
"id": "510c31be-630c-426c-9ec9-a4a695b37f65",
"type": "Payment",
"_rid": "NrQyAIFz8iuJXgIAAAAAAA==",
"_self": "dbs/NrQyAA==/colls/NrQyAIFz8is=/docs/NrQyAIFz8iuJXgIAAAAAAA==/",
"_attachments": "attachments/",
"_ts": 1678806196
}
```
### Case 2: PayOut request by partner account 139
The request was made with the body:
```json
[
{
"amount": 0.35,
"currency": "BRL",
"name": "AuthTestContasPool-23-03",
"taxIdCountry": "BRA",
"taxId": "11480809000184",
"pixKey": "acb22099-9ea3-4f8e-805e-9064e36a1256"
}
]
```
And produced the following document in the "openbanking" container:
```json
{
"id": "7ee3f16d-75bc-4ba4-926c-9c2b7a3adda6",
"AccountId": "139",
"Payments": [
{
"PaymentId": "88d3c6f4-63e6-4538-ab17-f584e7a2f8e4",
"ExternalId": null,
"TransactionId": null,
"TransactionHash": null,
"TransactionIdForPaymentCompletedWithError": null,
"TransactionIdBRZ": null,
"TransactionIdBRZReproved": null,
"PaymentCounterpart": {
"KycCustomerId": null,
"KycBankAccountId": null,
"Name": "AuthTestContasPool-23-03",
"TaxIdCountry": "BRA",
"TaxId": "11480809000184",
"PixKey": "acb22099-9ea3-4f8e-805e-9064e36a1256",
"Bank": null,
"BankAccount": null,
"BankBranch": null,
"Iban": null,
"CounterpartType": 1
},
"PaymentSchedule": "2023-03-28T18:03:03.5287462+00:00",
"Amount": 0.35,
"AmountNet": 0.35,
"AmountDeductedFromAccount": 0.35,
"Wallet": null,
"OriginWallet": null,
"SourceAddress": null,
"FeePayerAddress": null,
"BlockchainFee": 0,
"AlternativeIdentifier": null,
"Currency": 0,
"Blockchain": 0,
"Approver": null,
"PaymentStatus": 1,
"ReasonsForPaymentRejection": null,
"NotifyApplication": null,
"HasBeenSentToAdapter": true,
"RefundId": null,
"AdditionalInformation": {}
}
],
"PaymentGroupStatus": 1,
"Type": 17,
"Approver": null,
"isVirtual": false,
"PointerToPayments": [],
"HasSispagFileBeenGenerated": false,
"HasBeenTakenInVirtualPaymentGroup": false,
"HasBeenSentToAdapter": true,
"PartitionKey": "PaymentGroup_139",
"DocumentType": 5,
"_etag": "\"3d008a20-0000-0b00-0000-64232bdf0000\"",
"CreatedAt": "2023-03-28T18:03:03.5286796+00:00",
"UniqueKey": "324451cfa343ef7a337cf9ddc6a84050f2323fa30b9bec76ab0f3894362c3617",
"Links": [],
"_rid": "Ts8iAOS3FezUBBMAAAAABg==",
"_self": "dbs/Ts8iAA==/colls/Ts8iAOS3Few=/docs/Ts8iAOS3FezUBBMAAAAABg==/",
"_attachments": "attachments/",
"_ts": 1680026591
}
```
Which, in turn, produced the following PaymentGroup document in "caas-adapter-bs2"
```json
{
"accountId": "9866124",
"status": "SuccessfullyProcessed",
"paymentBankId": "0ebf169c-8339-4234-aa8d-05422ced14b2",
"ispb": "45246410",
"bankName": "BANCO GENIAL",
"bankDestination": "125",
"agencyDestination": "0001",
"accountDestination": "48623",
"paymentDate": "0001-01-01T00:00:00-02:00",
"accountDigit": "",
"taxId": "11480809000184",
"personType": "CNPJ",
"personAccount": null,
"name": "Account1",
"friendlyName": null,
"observation": "d564e796-b623-4a20-88cd-f505a2cf1927",
"accountType": "ContaCorrente",
"amount": 0.83,
"transactionId": null,
"migrated": "2023-03-14T15:13:16.675978+00:00",
"dateOfReceiptData": null,
"createdAt": "2023-03-14T12:12:11.1161052-03:00",
"dateChangeStatus": "2023-03-14T12:15:02.3949283-03:00",
"message": "Payment confirmed. (E710278662023031415102920850856P)",
"pixKey": "acb22099-9ea3-4f8e-805e-9064e36a1256",
"hasPix": true,
"endToEndId": "E710278662023031415102920850856P",
"uniqueKey": "d564e796-b623-4a20-88cd-f505a2cf1927",
"statusChangeHistory": [
{
"status": "Pending",
"changeDate": "2023-03-14T12:12:11.1161058-03:00",
"note": null,
"requestId": null
},
{
"status": "Created",
"changeDate": "2023-03-14T12:12:17.9072797-03:00",
"note": null,
"requestId": null
},
{
"status": "Created",
"changeDate": "2023-03-14T12:12:19.6096113-03:00",
"note": "Retry due: ",
"requestId": null
},
{
"status": "Created",
"changeDate": "2023-03-14T12:10:34.2683054-03:00",
"note": "Retry due: ",
"requestId": null
},
{
"status": "Processing",
"changeDate": "2023-03-14T12:12:21.3892808-03:00",
"note": "Payment confirmed. (E710278662023031415102920850856P)",
"requestId": null
},
{
"status": "SuccessfullyProcessed",
"changeDate": "2023-03-14T12:15:02.3949259-03:00",
"note": null,
"requestId": null
}
],
"solicitationTED": null,
"approvedTED": false,
"refundId": null,
"credentials": {
"bankAccount": "9866124"
},
"partition": "Payment_9866124",
"_etag": "\"2200beff-0000-0b00-0000-64108f0c0000\"",
"timeToLive": null,
"createdTimeUtc": "2023-03-14T15:12:11.1203345Z",
"id": "d564e796-b623-4a20-88cd-f505a2cf1927",
"type": "Payment",
"_rid": "NrQyAIFz8iuLXgIAAAAAAA==",
"_self": "dbs/NrQyAA==/colls/NrQyAIFz8is=/docs/NrQyAIFz8iuLXgIAAAAAAA==/",
"_attachments": "attachments/",
"_ts": 1678806796
}
```
### Discussions of PayOut
Note that both PayOuts were made from the same bank account, even though they are from different CaaS partner accounts.
The PayOut bank account is decided by the load balancing component. A field "BankAcccount" was added to DistributionConfiguration (in our Model) and is propagated to the adapter by the load balancer through the "Credentials" dictionary in the DTO.