Skip to content

Commit

Permalink
Merge branch 'master' into adv-logic-src-third-part-declarative-delegate
Browse files Browse the repository at this point in the history
  • Loading branch information
vrolland committed Jun 30, 2021
2 parents 3ee42f0 + cae7fc0 commit 54807a9
Showing 1 changed file with 64 additions and 12 deletions.
Expand Up @@ -11,7 +11,8 @@ Prerequisite: Having read the advanced logic specification (see [here](/packages

This extension allows to declare payments and the refunds in any currency.

The payments and refunds are documented by the payer, the payee of the request and optionnally a third party declared at the creation of the payment network (e.g: The third party could be a payment processor).
The payments and refunds are documented by the payer and the payee of the request.
Optionnally, the payee and the payer can delegate the declaration to a third party. (e.g: The third party could be a payment processor).

This extension does not ensure payment detection, only a consensus is made between the payer and the payee or by a third party.

Expand All @@ -33,7 +34,8 @@ As a payment network, this extension allows to deduce a payment `balance` for th
| **values.receivedRefundAmount** | Amount | Amount of refund declared received | **Mandatory** |
| **values.paymentInstruction** | String | Instruction to make payments | Optional |
| **values.refundInstruction** | String | Instruction to make refunds | Optional |
| **values.thirdparty** | [Identity](../request-logic/specs/request-logic-specification.md#identity-role-and-signature) | Identity of the third party | Optional |
| **values.payeeDelegate** | [Identity](../request-logic/specs/request-logic-specification.md#identity-role-and-signature) | Identity of the payee's delegate | Optional |
| **values.payerDelegate** | [Identity](../request-logic/specs/request-logic-specification.md#identity-role-and-signature) | Identity of the payer's delegate | Optional |

---

Expand All @@ -51,11 +53,15 @@ As a payment network, this extension allows to deduce a payment `balance` for th
| **parameters** | Object | | |
| **parameters.paymentInstruction** | String | Instruction to make payments | Optional |
| **parameters.refundInstruction** | String | Instruction to make refunds | Optional |
| **parameters.thirdparty** | [Identity](../request-logic/specs/request-logic-specification.md#identity-role-and-signature) | Identity of the third party | Optional |
| **parameters.payeeDelegate** | [Identity](../request-logic/specs/request-logic-specification.md#identity-role-and-signature) | Identity of the payee's delegate | Optional |
| **parameters.payerDelegate** | [Identity](../request-logic/specs/request-logic-specification.md#identity-role-and-signature) | Identity of the payer's delegate | Optional |

#### Conditions

None.
This action is valid, if:

- The `payeeDelegate` is given The signer must be the `payee`
- The `payerDelegate` is given The signer must be the `payer`

#### Warnings

Expand Down Expand Up @@ -84,7 +90,8 @@ A extension state is created with the following properties:
| **values.sentRefundAmount** | "0" |
| **values.receivedRefundAmount** | "0" |
| **values.receivedPaymentAmount** | "0" |
| **values.thirdparty** | `thirdparty` from parameters if given, undefined otherwise |
| **values.payeeDelegate** | `payeeDelegate` from parameters if given, undefined otherwise |
| **values.payerDelegate** | `payerDelegate` from parameters if given, undefined otherwise |
| **events** | Array with one 'create' event (see below) |

the 'create' event:
Expand All @@ -95,7 +102,8 @@ the 'create' event:
| **parameters** | |
| **parameters.paymentInstruction** | `paymentInstruction` from parameters if given, undefined otherwise |
| **parameters.refundInstruction** | `refundInstruction` from parameters if given, undefined otherwise |
| **parameters.thirdparty** | `thirdparty` from parameters if given, undefined otherwise |
| **parameters.payeeDelegate** | `payeeDelegate` from parameters if given, undefined otherwise |
| **parameters.payerDelegate** | `payerDelegate` from parameters if given, undefined otherwise |

---

Expand All @@ -118,7 +126,7 @@ the 'create' event:
This action is valid, if:

- The extension state with the id "pn-any-declarative" exists
- The signer is the `payer` or the `thirdparty`
- The signer is the `payer` or the `payerDelegate`

##### Warnings

Expand Down Expand Up @@ -159,7 +167,7 @@ the 'declareSentPayment' event:
This action is valid, if:

- The extension state with the id "pn-any-declarative" exists
- The signer is the `payee` or the `thirdparty`
- The signer is the `payee` or the `payeeDelegate`

##### Warnings

Expand Down Expand Up @@ -200,7 +208,7 @@ the 'declareReceivedPayment' event:
This action is valid, if:

- The extension state with the id "pn-any-declarative" exists
- The signer is the `payee` or the `thirdparty`
- The signer is the `payee` or the `payeeDelegate`

##### Warnings

Expand Down Expand Up @@ -241,7 +249,7 @@ the 'declareSentPayment' event:
This action is valid, if:

- The extension state with the id "pn-any-declarative" exists
- The signer is the `payer` or the `thirdparty`
- The signer is the `payer` or the `payerDelegate`

##### Warnings

Expand Down Expand Up @@ -281,7 +289,7 @@ the 'declareReceivedRefund' event:
This action is valid, if:

- The extension state with the id "pn-any-declarative" exists
- The signer is the `payer` or the `thirdparty`
- The signer is the `payer` or the `payerDelegate`
- The extension property `refundInstruction` is undefined

##### Warnings
Expand Down Expand Up @@ -321,7 +329,7 @@ The 'addRefundInstruction' event:
This action is valid, if:

- The extension state with the id "pn-any-declarative" exists
- The signer is the `payer` or the `thirdparty`
- The signer is the `payer` or the `payerDelegate`
- The extension property `paymentInstruction` is undefined

##### Warnings
Expand All @@ -347,6 +355,50 @@ The 'addPaymentInstruction' event:

---

#### addDelegate

##### Parameters

| | Type | Description | Requirement |
| --------------------------------- | ------ | ------------------------------------ | ------------- |
| **id** | String | constant value: "pn-any-declarative" | **Mandatory** |
| **action** | String | constant value: "addDelegate" | **Mandatory** |
| **parameters** | Object | | |
| **parameters.delegate** | [Identity](../request-logic/specs/request-logic-specification.md#identity-role-and-signature) | Identity of the delegate | **Mandatory** |

##### Conditions

This action is valid, if:

- The extension state with the id "pn-any-declarative" exists
- The signer is the `payee` and the extension property `payeeDelegate` is undefined
- The signer is the `payer` and the extension property `payerDelegate` is undefined

##### Warnings

None.

##### Results

An extension state is updated with the following properties:

|  Property |  Value |
| ----------------------------- | ----------------------------------------------------------- |
| **values.payeeDelegate** | `delegate` from parameters if signer is the `payee`, unchanged otherwise |
| **values.payerDelegate** | `delegate` from parameters if signer is the `payer`, unchanged otherwise |
| **events** | add an 'addDelegate' event (see below) at its end |

The 'addDelegate' event:

|  Property |  Value |
| --------------------------------- | ------------------------------------ |
| **name** | 'addDelegate' |
| **parameters** | |
| **parameters.payeeDelegate** | `delegate` from parameters if signer is the `payee`, undefined otherwise |
| **parameters.payerDelegate** | `delegate` from parameters if signer is the `payer`, undefined otherwise |

---

## Interpretation

The `balance` starts from `0`.
Expand Down

0 comments on commit 54807a9

Please sign in to comment.