Skip to content

Commit

Permalink
docs: Credit account postman collections and initial sequence diagrams (
Browse files Browse the repository at this point in the history
  • Loading branch information
john-fletcher-aot authored Mar 26, 2024
1 parent 88755eb commit c6bce36
Show file tree
Hide file tree
Showing 19 changed files with 2,261 additions and 27 deletions.
27 changes: 0 additions & 27 deletions common/payment/CFS Sequence.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Sequence to create a new credit account in onRouteBC
Note that this is used for clients who do not have a pre-existing credit account in TPS.

```mermaid
sequenceDiagram
participant PPC
participant onRouteBC
participant CFS
PPC->>onRouteBC: Request to create credit<br/>account for client
note over PPC, onRouteBC: Include selected profile class
alt CFS is unavailable
onRouteBC-->>PPC: Return error message
else CFS is available
onRouteBC->>CFS: Create CFS party
note over onRouteBC,CFS: Provide ORBC client number as<br/>customer name
CFS-->>onRouteBC: Return new CFS party ID
onRouteBC->>onRouteBC: Save party ID to DB
onRouteBC->>onRouteBC: Generate credit<br/>account number
note over onRouteBC: Use database sequence
onRouteBC->>CFS: Create CFS Account for Party
note over onRouteBC,CFS: Supply new credit account number.<br/>Supply 'Credit Account' as description.<br/>Supply profile class (TBD).
CFS-->>onRouteBC: Return response (success/fail)
note over CFS, onRouteBC: Assuming success for all transactions.<br/>If any failures, these will result in failure<br/>message being returned to PPC.
onRouteBC->>onRouteBC: Save credit account details to DB
onRouteBC->>CFS: Create site for account
CFS-->>onRouteBC: Return CFS site number
onRouteBC->>onRouteBC: Save site number to DB
onRouteBC-->>PPC: Return success message<br/>with credit account number
end
```
62 changes: 62 additions & 0 deletions common/payment/Credit Accounts/Credit Account CFS Data Model.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Data Model for Credit Accounts in CFS

This ERD describes the structure of credit accounts and transactions against those accounts as recorded in CFS.

```mermaid
erDiagram
Party ||--o{ Account : has
Party {
int party_number PK "Auto-generated by CFS"
string business_number "BC business number, null for onRouteBC"
string customer_name "Provided by onRouteBC"
}
Account ||--o{ Site : "located at"
Account {
string account_number PK "Provided by onRouteBC"
string account_description "Provided by onRouteBC"
string customer_profile_class "TBD"
}
Site ||--o{ Invoice : generates
Site {
int site_number PK "Auto-generated by CFS"
string customer_site_id "Provided by onRouteBC"
string site_name "Provided by onRouteBC"
bool primary_bill_to "Y or N, provided by onRouteBC (TBD)"
string address_line_1 "Provided by onRouteBC"
string address_line_2 "Provided by onRouteBC"
string address_line_3 "Provided by onRouteBC"
string city "Provided by onRouteBC"
string postal_code "Provided by onRouteBC"
string province "Provided by onRouteBC"
string state "Provided by onRouteBC"
string country "Provided by onRouteBC"
string customer_profile_class "TBD"
string receipt_method "TBD"
string provider "Always 'Transportation and Infrastructure'"
}
Invoice ||--|{ Line : "defined by"
Invoice {
string invoice_number PK "Provided by onRouteBC"
string cust_trx_type "TBD"
date transaction_date "Provided by onRouteBC"
string batch_source "TBD"
string term_name "TBD"
date term_due_date "TBD"
string comments "TBD"
string late_charges_flag "TBD"
number total "Calculated from sum of lines"
number amount_due "TBD"
number amount_adjusted "TBD"
number amount_adjusted_pending "TBD"
string status "TBD"
string provider "Always 'Transportation and Infrastructure'"
}
Line {
int line_number PK "Incremental starting with 1, onRouteBC-provided"
string line_type "TBD"
string memo_line_name "TBD"
string description "TBD - appears CFS-provided"
number unit_price "Provided by onRouteBC"
int quantity "Provided by onRouteBC"
}
```
48 changes: 48 additions & 0 deletions common/payment/Credit Accounts/Credit Account CFS Sequence.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# CFS Sequence for Payment on Credit Account

This sequence diagram describes the process whereby a customer purchases one or more permits on account from onRouteBC.

```mermaid
sequenceDiagram
participant onRouteBC
participant CFS
note over onRouteBC,CFS: Note that CFS may be unavailable (down<br/>for maintenance) at this point. If this<br/>is the case, onRouteBC will queue the<br/>transaction to be recorded in CFS at<br/>a later time, likely on a schedule (TBD).
onRouteBC->>onRouteBC: Look up CFS account<br/>details for client
note over onRouteBC,CFS: onRouteBC will maintain a link to the <br/>CFS party number in its internal database.<br/>If the party number is null, the party will<br/>be created in CFS. onRouteBC does not need<br/>to look up the company in CFS with a party<br/>search.
opt CFS party does not exist
onRouteBC->>CFS: Create CFS party
CFS-->>onRouteBC: Return new CFS party ID
onRouteBC->>onRouteBC: Save party ID to DB
alt Client has no TPS WS account
onRouteBC->>onRouteBC: Generate unique account number
note over onRouteBC,CFS: The account number will follow the same<br/>naming format as existing weight scale<br/>accounts in TPS for consistency.
else Client has existing TPS WS account
note over onRouteBC,CFS: Use the WS account number imported<br/>from TPS. TBD how to keep this account<br/>and the Great Plains account in sync.
end
onRouteBC->>CFS: Create CFS account for party
note over onRouteBC,CFS: Supply unique account number
CFS-->>onRouteBC: Return response (success/fail)
onRouteBC->>onRouteBC: Save credit account details to DB
onRouteBC->>CFS: Create site for account
CFS-->>onRouteBC: Return CFS site number
onRouteBC->>onRouteBC: Save site number to DB
end
onRouteBC->>CFS: Request credit limit and balance
CFS-->>onRouteBC: Return credit limit and balance
note over onRouteBC,CFS: If CFS down for evening reconcile, use the<br/>last known limit and balance from database.
opt CFS is available and returned limit/balance
onRouteBC->>onRouteBC: Save last known credit<br/>limit and balance to DB
note over onRouteBC,CFS: TBD how to synchronize TPS and onRouteBC<br/>when CFS unavailable.
end
alt Sufficient available credit
onRouteBC->>CFS: Create invoice
note over onRouteBC,CFS: Generate transaction number in identical<br/>format to CC transaction number, will be<br/>used as invoice number in CFS.
note over onRouteBC,CFS: Include one line per permit included in<br/>the transaction.
CFS-->>onRouteBC: Return response (success/fail)
onRouteBC->>onRouteBC: Save invoice details to DB
onRouteBC->>onRouteBC: Update credit limit and<br/>balance in DB
else Insufficient available credit
onRouteBC->>onRouteBC: Notify customer
end
note over onRouteBC,CFS: Statements sent out to customers on a<br/>monthly basis (by CAS)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Sequence to import a credit account from TPS

```mermaid
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Sequence to adjust a credit account (positive or negative) by Ministry staff

```mermaid
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Sequence to make a payment against a credit account via cheque

```mermaid
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Sequence to make a payment against a credit account via EFT/Wire Transfer

```mermaid
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Sequence to make a payment against a credit account via online banking bill payment

```mermaid
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Sequence to make a payment against a credit account via PayBC / Credit Card

```mermaid
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Master sequence to make a payment against a credit account

```mermaid
```
Loading

0 comments on commit c6bce36

Please sign in to comment.