Account
Internal Account | Address |
---|---|
TEST_ASSET_INTERNAL_ACCOUNT | DEFAULT |
LOAN_PENALTIES_UNPAID_INTERNAL | DEFAULT |
LOAN_PENALTIES_PAID_INTERNAL | DEFAULT |
OVERDRAFT_FEES_PAID_INTERNAL | DEFAULT |
OVERDRAFT_FEES_UNPAID_INTERNAL | DEFAULT |
OVERDRAFT_PAID_INTERNAL | DEFAULT |
OVERDRAFT_UNPAID_INTERNAL | DEFAULT |
OVERDRAFT_PENALTIES_PAID_INTERNAL | DEFAULT |
OVERDRAFT_PENALTIES_UNPAID_INTERNAL | DEFAULT |
SUBSCRIPTION_FEES_PAID_INTERNAL | DEFAULT |
SUBSCRIPTION_FEES_UNPAID_INTERNAL | DEFAULT |
Overdraft | Smart Contract | Address |
---|---|---|
test_main_account_product | DEFAULT | |
WHT | ||
INTEREST | ||
OVERDRAFT |
Loan | Smart Contract | Address |
---|---|---|
test_loan_account_product | DEFAULT | |
PREPAID | ||
INTEREST_PAID | ||
PRINCIPAL | ||
INTEREST_DUE | ||
PRINCIPAL_DUE | ||
INTEREST_OVERDUE | ||
PRINCIPAL_OVERDUE | ||
ACCRUED_INTEREST | ||
INTERNAL_CONTRA |
Smart Contract | Address | |
---|---|---|
test_pocket_account_product | DEFAULT | |
Transactions
Kotlin Transactions:
Transaction | Posting Transaction | Transaction Type | Debit Account | Debit Address | Credit Account | Credit Address | Previous Example | Example |
---|---|---|---|---|---|---|---|---|
Open Overdraft |
| OVERDRAFT_IMBURSEMENT | TEST_ASSET_INTERNAL_ACCOUNT | Default | 29370f04-0f0a-4a1a-8c0f-839a33f263ea | OVERDRAFT | ||
Repay Overdraft |
| OVERDRAFT_REPAYMENT | 29370f04-0f0a-4a1a-8c0f-839a33f263ea | Default | TEST_ASSET_INTERNAL_ACCOUNT | Default | ||
Apply Fee |
| OVERDRAFT_REPAYMENT | 1317435c-4798-4311-9fb7-f759bbc455b7 | Default | TEST_ASSET_INTERNAL_ACCOUNT | Default | ||
Claim Debt |
| CLAIM_PAYMENT | 1317435c-4798-4311-9fb7-f759bbc455b7 | DEFAULT | OVERDRAFT_PENALTIES_UNPAID_INTERNAL | DEFAULT | ||
Repay Loan |
|
| 29370f04-0f0a-4a1a-8c0f-839a33f263ea | DEFAULT | 1183045f-6f15-40c3-8e40-728ca914a507 | DEFAULT | ||
Repay Loan with Pocket |
| LOAN_REPAYMENT_POCKET | fca42a44-d4d5-427c-bc8b-3f078ad62b4f | DEFAULT | 29370f04-0f0a-4a1a-8c0f-839a33f263ea | DEFAULT | ||
Direct Repay |
| DIRECT_DEBT_REPAY | 1317435c-4798-4311-9fb7-f759bbc455b7 | DEFAULT | TEST_ASSET_INTERNAL_ACCOUNT | DEFAULT |
Smart Contract Transactions
Transaction | Posting Transaction | Transaction Type | Debit Account | Debit Address | Credit Account | Credit Address | Instruction Details |
---|---|---|---|---|---|---|---|
Handlers
Previous Posting Handler
Handler | Transaction Type | Debt Type | Repayment Type | Event | Account Address | Action | Status |
---|---|---|---|---|---|---|---|
|
|
| DONE | ||||
|
|
| DONE | ||||
|
|
| DONE | ||||
|
|
|
| DONE | |||
|
|
| DONE | ||||
|
|
|
| DONE | |||
|
|
| DONE |
Current Posting Handler:
Handler | Transaction Type | Action | Previous Handler | Status | Test |
---|---|---|---|---|---|
|
|
| MATCH | ||
|
| MATCH | |||
|
|
| MATCH | ||
|
|
| MATCH | ||
|
|
| MATCH | step1: open loan step 2: repay loan | |
|
|
|
| MATCH | Step1: open overdraft Step2: repay |
|
| MATCH | |||
|
| MATCH | |||
|
|
| MATCH | ||
|
| MATCH |
Test Issues:
Issue Number | Description |
---|---|
1 | LoanRepayInterestDueWithDefaultByEarlyRepaymentTransactionHandler - Failed to construct LoanRepayInterestDueWithDefaultByEarlyRepaymentTransaction transaction from instruction with clientTransactionId '261f4970-fe2d-441f-b112-d8cf331d2211', instructionMetadata InstructionMetadata(instructionId=a4f66d8f-0de8-4483-aa55-019d05aa95f6, batchId=c1244d9c-bdfd-47b3-9ec1-2010719632a7, requestId=a66d856c-4b22-3863-a454-6afa995d4115, clientId=LoanManagerPostingsClient, clientBatchId=f389e386-83b3-41a2-9844-3ff2c3c50281, batchStatus=ACCEPTED, valueTimestamp=2023-02-08T09:08:09.229904Z, insertionTimestamp=2023-02-08T09:08:09.229904Z, captureTimestamp=null, errorMessage=null) |
2 | Failed to construct DebtRepayCustomerOverdraftPenaltiesTransaction transaction from instruction with clientTransactionId '9458bd71-d039-440e-a1ea-57a36ad4d171', instructionMetadata InstructionMetadata(instructionId=98caadde-05d7-4d01-aae4-b65f0a974df4, batchId=f80b8ec9-1437-4756-8788-cb5aa3d6531c, requestId=eefb04cf-9643-3924-b924-83ee05ed4403, clientId=LoanManagerPostingsClient, clientBatchId=f00416ee-4c88-40a0-9db3-099a050ac53d, batchStatus=ACCEPTED, valueTimestamp=2023-02-08T09:10:43.185717Z, insertionTimestamp=2023-02-08T09:10:43.185717Z, captureTimestamp=null, errorMessage=null) |
3 | Failed to construct LoanOverdraftApplyFeeTransaction transaction from instruction with clientTransactionId '9458bd71-d039-440e-a1ea-57a36ad4d171', instructionMetadata InstructionMetadata(instructionId=98caadde-05d7-4d01-aae4-b65f0a974df4, batchId=f80b8ec9-1437-4756-8788-cb5aa3d6531c, requestId=eefb04cf-9643-3924-b924-83ee05ed4403, clientId=LoanManagerPostingsClient, clientBatchId=f00416ee-4c88-40a0-9db3-099a050ac53d, batchStatus=ACCEPTED, valueTimestamp=2023-02-08T09:10:43.185717Z, insertionTimestamp=2023-02-08T09:10:43.185717Z, captureTimestamp=null, errorMessage=null) |
4 | Failed to construct LoanPayOffWithPrepaidAmountTransaction transaction from instruction with clientTransactionId '4346f2e9-64df-4d13-8ad5-6fefd3e1187e', instructionMetadata InstructionMetadata(instructionId=c5e22119-ac0f-4ab2-846e-c58fc993a185, batchId=1a216cbb-8a7a-46e8-9444-97d823b5b451, requestId=e47edcb6-6f4a-3e98-a8a3-e7adb6bfdc30, clientId=LoanManagerPostingsClient, clientBatchId=e3842178-1608-46a6-8096-73a5106c023e, batchStatus=ACCEPTED, valueTimestamp=2023-02-08T09:24:43.963094Z, insertionTimestamp=2023-02-08T09:24:43.963094Z, captureTimestamp=null, errorMessage=null) |
5 | |
6 | |
Questions:
The type of
debitAccountId
andcreditAccountId
is UUID, so we can’t use transfer transaction to pay overdraft, one option to fix this is to update the type ofdebitAccountId
andcreditAccountId
to UUID, this will affect other squad, the other way is to follow up current rules but need to update smart contract.PostingApiClient: https://documentation.tm5.sandbox.safibank.online/api/postings_api/overview/#creating_postings_api_clients
Financial Requirement
https://advancegroup.larksuite.com/sheets/shtusym2fb4TdGS7FPbZgiwRTPc?sheet=1WLqqY
How to debug:
1: Update the SaFiMono/common/tm-client/transactionsDefinitions.yml file and generate the latest tm-client lib
gradle clean build -x test -x integrationTest
2: Copy the tm-client.jar to libs folder(loan-manager\libs) in loan manager service
├── account-manager-api-client-1.jar ├── advanceai-gateway-api-client-8.jar ├── authorization-lib-3.20221104-081556.jar ├── avro-model-4.20230116-035139.jar ├── iam-auth-lib-3.20221109-144652.jar ├── micronaut-gcp-common-4.8.0.jar ├── opentelemetry-api-1.22.0.jar ├── opentelemetry-context-1.22.0.jar ├── opentelemetry-sdk-common-1.22.0.jar ├── opentelemetry-sdk-metrics-1.22.0.jar ├── product-recommendation-manager-api-client-2.jar ├── test-utils-2.20230106-075056.jar ├── tm-client-runner.jar ├── tm-client.jar └── utils-9.20221222-021144.jar
3: Add below codes in SaFiMono/services/loan-manager/build.gradle.kts
repositories { mavenLocal() ... } dependencies { ... implementation( files( "libs/account-manager-api-client-1.jar", "libs/advanceai-gateway-api-client-8.jar", "libs/authorization-lib-3.20221104-081556.jar", "libs/avro-model-4.20230116-035139.jar", "libs/iam-auth-lib-3.20221109-144652.jar", "libs/product-recommendation-manager-api-client-2.jar", "libs/utils-9.20221222-021144.jar", "libs/opentelemetry-api-1.22.0.jar", "libs/opentelemetry-sdk-common-1.22.0.jar", "libs/opentelemetry-context-1.22.0.jar", "libs/opentelemetry-sdk-metrics-1.22.0.jar", "libs/tm-client.jar", "libs/tm-client-runner.jar" ) ) testImplementation(files("libs/test-utils-2.20230106-075056.jar")) api("com.google.protobuf:protobuf-kotlin:3.21.5") ... }
Attachments:
截屏2023-02-09 12.51.47.png (image/png)
截屏2023-02-09 14.27.31.png (image/png)
截屏2023-02-09 15.28.29.png (image/png)
截屏2023-02-10 16.14.03.png (image/png)
截屏2023-02-13 12.23.36.png (image/png)