@startuml PB-197_UC17_SQD_get_transfers
title
PB-197 UC17 SQD: Get transfer details
end title
autonumber

actor "Next Customer" as UI

box "Next Platform"
participant "Core Next" as Next
database "Next DB" as DB
end box

participant "Bradesco Core" as BR

note right UI
**Note:**
It has been discussed with Bradesco that there should be a standard API for
returning a list of all transfers (between dates). As this endpoint has been
deprecated confirmation is required from Capco development that un-deprecating
this will not cause significant issues e.g. defects
end note

note right UI #plum
**API:**
GET /transfers

**__Deprecated__ implementation:**
Returns transfer details between a START_DATE and END_DATE.

Transfer details include:
amount
authenticationCode
availableTransferLimit
categoryId
categoryName
controlNumber
description
documentNumber
duplicateTransfer
fee
paymentDate
purposeCode
purposeDescription
recipientAccountNumber
recipientAccountType
recipientAccountTypeDescription
recipientBankCode
recipientBankName
recipientBranch
recipientCpfCnpj
recipientName
schedulingNumber
senderAccount
senderAccountType
senderBankName
senderBranch
senderCpf
senderName
totalAmount
totalTransferLimit
transferId
transferType

**Required implementation:**
Re-instate as deprecated.
end note

UI->Next: Get transfers (START_DATE, END_DATE)

note right Next
**Note:**
The TRANSFER_METADATA table is keyed to CUSTOMER_BANK_ACCOUNT_TRANS
table using TRANSACTION_UID.
end note

note right Next #plum
**API:**
GET /transaction

**Current implementation:**
Return all the customer transactions within a date range, including transferId
and TRANSACTION_UID.

**Required implementation:**
As is.
end note

activate Next

note right Next
**Note:**
Filter transfers within START_DATE and END_DATE where transferId IS NOT NULL
i.e. the transaction is of type transfer
end note


Next->DB: Get transfer transactions (START_DATE, END_DATE)
activate DB

note right DB
**Note:**
Read Next DB tables:
* CUSTOMER_BANK_ACCOUNT_TRANS
end note

DB->DB: Read transfer transactions
DB-->Next: Return transfer transaction details (TRANSACTION_UID)
deactivate DB

note right Next
**Note:**
Return transfer details on matched TRANSACTION_UID
end note

Next->DB: Get transfer details ([TRANSACTION_UID])
activate DB
note right DB
**Note:**
Read Next DB tables:
* TRANSFER_METADATA
end note
DB->DB: Read transfers
DB-->Next: Return transfer details (TRANSFER_DETAILS)
deactivate DB
Next-->UI: Return transfer details (TRANSFER_DETAILS)
deactivate Next

@enduml
