Skip to content

Commit fd77e05

Browse files
committed
update tutorial 1
1 parent 34b1435 commit fd77e05

19 files changed

Lines changed: 224 additions & 115 deletions
66.3 KB
Loading
167 KB
Loading
105 KB
Loading
69.6 KB
Loading
101 KB
Loading

docs/payscript/concepts/index.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: Concepts
3+
parent: Payscript
4+
layout: page
5+
nav_order: 4
6+
---
7+
8+
9+
## Automation
10+
An entity created by a [customer] into their bank account. The automation is created from a PayScript from among the ones that have been deployed by [developers]. If the selected payscript uses a trigger type that requires [trigger parameters], those need to be specified as part of creating the automation. If the selected payscript defines [script parameters], those need to be specified as part of creating the automation.
11+
12+
## Reserve
13+
An abstract segregation of funds in a customer's account with a name and a purpose, so that those funds can be considered unavailable for other purposes, effectively reserving them. Funds can be added to and removed from the reserve by the account owner, or by whoever the account owner has given [consent] to do this.
14+
15+
## Consent
16+
Consent is given by a [customer] to another customer perform specific actions on their accounts. The types of consent that can be given are:
17+
Fund check: Allows checking if the owner has more available funds than a given amount
18+
Automations:
19+
Balance: Allows seeing the balance of the owner
20+
Transactions: Allows making transactions on behalf of the owner
21+
22+
[customer]: /docs/quant_flow/personas#customer
23+
[developers]: /docs/quant_flow/personas#developer

docs/payscript/data_types.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,7 @@ A string composed of 6 numerical characters.
2020
### To Reserve
2121
A string containing the UUID of a reserve.
2222

23-
23+
### Scan
24+
An account identifier composed of the following attributes:
25+
- String sortCode
26+
- String accountNumber
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
title: Automated Transfer
3+
parent: Example Scripts
4+
layout: page
5+
---
6+
7+
```groovy
8+
trigger = "on_demand";
9+
10+
11+
def payer = ${payer:scan};
12+
def payee = ${payee:scan};
13+
def amount = ${amount:decimal};
14+
15+
def payment = PaymentInfo.builder()
16+
.payer(AccountInfo.builder()
17+
.type(AccountIdentifierType.SCAN)
18+
.identifier(payer)
19+
.build())
20+
.payee(AccountInfo.builder()
21+
.type(AccountIdentifierType.SCAN)
22+
.identifier(payee)
23+
.build())
24+
.amountInfo(AmountInfo.builder()
25+
.currency(CurrencyEnum.GBP)
26+
.amount(amount)
27+
.build())
28+
.paymentReference("Automated transfer")
29+
.build();
30+
31+
def newPaymentId = createPayment(payment);
32+
```

docs/payscript/index.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22
title: Payscript
33
layout: page
44
nav_order: 2
5-
---
6-
7-
The
5+
---

docs/payscript/language_reference.md

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,11 @@ Payscript is a domain specific language (DSL) derived from Groovy. Using the Gro
1111
For Syntax, this version does not differ from Groovy. please consult the [Groovy syntax reference][groovy syntax].
1212

1313
## Script Structure
14-
A payscript is structured in such a way to best meet the needs of the architecture proposed by Quant Flow. During the script’s lifecycle it's expected to be deployed by developers into a collection, and to be made available to use with Automations.
15-
16-
[comment]: Add image
17-
18-
## Triggers
19-
Triggers specify which type of event will cause the script to run. They take parameters, which are only given during the creation of an Automation (not when the script is written or deployed). These are the types of triggers available:
20-
21-
**time**: This trigger will cause the script to be run on a schedule, specified at the time when the automation is created. For example, daily at 14:00, or monthly on the first day of the month, at 00:00.
22-
23-
**balance**: This trigger will cause the script to run whenever the balance oft owns it is a certain number or above or below a specified number.
24-
25-
**transaction**: This trigger will cause the script to run whenever a transaction happens on the account who owns the script.
26-
27-
The actual values for these triggers (trigger parameters) will only be specified at the time when it is used in the creation of an automation.
28-
29-
The trigger definition follows the syntax:
30-
31-
trigger="[trigger]";
32-
33-
where [trigger] is replaced by a trigger type name. Example: trigger="time";
34-
14+
PayScript has two special structures, beyond the programming logic; A [trigger] definition and [script parameters]. The trigger specifies what type of event will cause the script to run. When an automation is created with the script, the parameters of the trigger will be specified. For example, if the script's trigger type is "time", the parameters would be which date and time it should run on.
15+
Also during the creation of the automation, the script parameters required by the script will be supplied.
3516

3617
## Parameters
37-
The script parameters are values which will be used by the script but will be specified by the user who creates an automation which uses this script. At that time they will be prompted for the values, much like the trigger parameters.
18+
The script parameters are values which will be used by the script but will be specified by the customer who creates an automation which uses this script. At that time they will be prompted for the values, much like the trigger parameters.
3819

3920
Parameters are specified in the script using the following syntax:
4021

@@ -49,4 +30,7 @@ The logic section contains what the script needs to accomplish, utilizing groovy
4930

5031

5132
[groovy syntax]: https://groovy-lang.org/single-page-documentation.html
52-
[built-in functions]: built_in_functions
33+
[built-in functions]: built_in_functions
34+
[callScript]: built_in_functions#callScript
35+
[trigger]: /docs/payscript/triggers
36+
[script parameters]: #parameters

0 commit comments

Comments
 (0)