Skip to content

Commit

Permalink
feat(2662/2671): document updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
koekiebox committed May 15, 2024
1 parent 0cb4d3a commit cd92203
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ The `incoming_payment.created` event indicates that an incoming payment has been

The `incoming_payment.completed` event indicates that an incoming payment has been completed, either automatically or manually, and that any funds that have been received into this incoming payment should be withdrawn and credited to the recipient's account with the Account Servicing Entity.

Example: An incoming payment was completed and received $10.
In addition, the `CreateIncomingPaymentWithdrawal` supports two-phase transfers [see more](https://en.wikipedia.org/wiki/Two-phase_commit_protocol).

Example: An incoming payment was completed and received **$10**.

<Mermaid
graph={`sequenceDiagram
Expand All @@ -39,11 +41,27 @@ Example: An incoming payment was completed and received $10.
`}
/>

Example: An incoming payment supporting two-phase transfers was completed and recieved **$10**.

<Mermaid
graph={`sequenceDiagram
participant ASE as Account Servicing Entity
participant R as Rafiki
R->>ASE: webhook event: incoming payment completed,<br>receivedAmount: $10
ASE->>R: admin API call: CreateIncomingPaymentWithdrawal
ASE->>ASE: credit receiver's account with $10
ASE->>R: admin API call: PostLiquidityWithdrawal
R->>R: 2-phase transfer completed
`}
/>

## `incoming_payment.expired`

The `incoming_payment.expired` event indicates that an incoming payment has expired, and that any funds that have been received into this incoming payment should be withdrawn and credited to the recipient's account with the Account Servicing Entity. Note that this event is not fired if there were no funds received by the incoming payment since there is no action required by the Account Servicing Entity.

Example: An incoming payment has expired and received $2.55.
Example: An incoming payment has expired and received **$2.55**.

<Mermaid
graph={`sequenceDiagram
Expand All @@ -63,7 +81,7 @@ The `outgoing_payment.created` event indicates that an outgoing payment has been
In case that outgoing payment should not be fullfilled, the Account Servicing Entity can cancel outgoing payment.
Otherwise, the Account Servicing Entity should put a hold on the sender’s account and deposit the funds into Rafiki.

Example: An outgoing payment for $12 has been created.
Example: An outgoing payment for **$12** has been created.

<Mermaid
graph={`sequenceDiagram
Expand All @@ -86,7 +104,9 @@ Example: An outgoing payment for $12 has been created.

The `outgoing_payment.completed` event indicates that an outgoing payment has successfully sent as many funds as possible to the receiver. The Account Servicing Entity should withdraw any excess liquidity from that outgoing payment in Rafiki and use it as they see fit. One option would be to return it to the sender. Another option is that the excess liquidity is considered a fee and retained by the Account Servicing Entity. Furthermore, the Account Servicing Entity should remove the hold on the sender's account and debit it.

Example: An outgoing payment for $12 has been completed. $11.50 were sent. The Account Servicing Entity keeps $0.50 as fees.
In addition, the `CreateOutgoingPaymentWithdrawal` supports two-phase transfers [see more](https://en.wikipedia.org/wiki/Two-phase_commit_protocol).

Example: An outgoing payment amount for **&dollar;12** has been completed. **&dollar;11.50** were sent. The Account Servicing Entity keeps **$0.50** as fees.

<Mermaid
graph={`sequenceDiagram
Expand All @@ -100,11 +120,27 @@ Example: An outgoing payment for $12 has been completed. $11.50 were sent. The A
`}
/>

Example: An outgoing payment supporting two-phase transfers for **$12** has been completed. **$11.50** were sent. The Account Servicing Entity keeps **$0.50** as fees.

<Mermaid
graph={`sequenceDiagram
participant ASE as Account Servicing Entity
participant R as Rafiki
R->>ASE: webhook event: outgoing completed,<br>debitAmount: $12, sentAmount:$11.50
ASE->>R: admin API call: CreateOutgoingPaymentWithdrawal
ASE->>ASE: remove the hold and deduct $12 from the sender's account,<br>credit ASE's account with $0.50
ASE->>R: admin API call: PostLiquidityWithdrawal
R->>R: 2-phase transfer completed
`}
/>

## `outgoing_payment.failed`

The `outgoing_payment.failed` event indicates that an outgoing payment has either partially or completely failed and a retry was also unsuccessful. The Account Servicing Entity should withdraw any remaining liquidity from that outgoing payment in Rafiki. If the payment failed completely (the `sentAmount` was 0), the Account Servicing Entity should remove the hold from the sender's account. If the payment failed partially, the Account Servicing Entity should remove the hold from the sender's account and debit it with the amount that has been sent, but they should refrain from taking a sending fee.

Example: An outgoing payment for $12 has failed. $8 were sent.
Example: An outgoing payment for **$12** has failed. **$8** were sent.

<Mermaid
graph={`sequenceDiagram
Expand All @@ -122,7 +158,7 @@ Example: An outgoing payment for $12 has failed. $8 were sent.

The `wallet_address.web_monetization` event indicates that a wallet address has received web monetization payments via STREAM (raw ILP access). The Account Servicing Entity should withdraw that liquidity from the wallet address and credit the receiver's account.

Example: A wallet address received $0.33
Example: A wallet address received **$0.33**

<Mermaid
graph={`sequenceDiagram
Expand Down
29 changes: 15 additions & 14 deletions packages/documentation/src/content/docs/playground/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,20 +126,21 @@ pnpm localenv:compose down --volumes

### Commands

| Command | Description |
| ------------------------------------------- | ------------------------------------------- |
| `pnpm localenv:compose config` | Show all merged config (with Tigerbeetle) |
| `pnpm localenv:compose up` | Start (with Tigerbeetle) |
| `pnpm localenv:compose up -d` | Start (with Tigerbeetle) detached |
| `pnpm localenv:compose down` | Down (with Tigerbeetle) |
| `pnpm localenv:compose down --volumes` | Down and kill volumes (with Tigerbeetle) |
| `pnpm localenv:compose:psql config` | Show all merged config (with Postgresql) |
| `pnpm localenv:compose build` | Build all the containers (with Tigerbeetle) |
| `pnpm localenv:compose:psql up` | Start (with Postgresql) |
| `pnpm localenv:compose:psql up -d` | Start (with Postgresql) detached |
| `pnpm localenv:compose:psql down` | Down (with Postgresql) |
| `pnpm localenv:compose:psql down --volumes` | Down (with Postgresql) and kill volumes |
| `pnpm localenv:compose:psql build` | Build all the containers (with Postgresql) |
| Command | Description |
| ------------------------------------------------ | ------------------------------------------------ |
| `pnpm localenv:compose config` | Show all merged config (with Tigerbeetle) |
| `pnpm localenv:compose up` | Start (with Tigerbeetle) |
| `pnpm localenv:compose up -d` | Start (with Tigerbeetle) detached |
| `pnpm localenv:compose down` | Down (with Tigerbeetle) |
| `pnpm localenv:compose down --volumes` | Down and kill volumes (with Tigerbeetle) |
| `pnpm localenv:compose down --volumes --rmi all` | Down, kill volumes (with Tigerbeetle) and images |
| `pnpm localenv:compose:psql config` | Show all merged config (with Postgresql) |
| `pnpm localenv:compose build` | Build all the containers (with Tigerbeetle) |
| `pnpm localenv:compose:psql up` | Start (with Postgresql) |
| `pnpm localenv:compose:psql up -d` | Start (with Postgresql) detached |
| `pnpm localenv:compose:psql down` | Down (with Postgresql) |
| `pnpm localenv:compose:psql down --volumes` | Down (with Postgresql) and kill volumes |
| `pnpm localenv:compose:psql build` | Build all the containers (with Postgresql) |

### Usage

Expand Down

0 comments on commit cd92203

Please sign in to comment.