diff --git a/assets/images/tutorial3/reserves.png b/assets/images/tutorial3/reserves.png new file mode 100644 index 0000000..d06e23f Binary files /dev/null and b/assets/images/tutorial3/reserves.png differ diff --git a/assets/images/tutorial_helloworld/active_helloworld.png b/assets/images/tutorial_helloworld/active_helloworld.png new file mode 100644 index 0000000..0654f16 Binary files /dev/null and b/assets/images/tutorial_helloworld/active_helloworld.png differ diff --git a/assets/images/tutorial_helloworld/add_automation_helloworld.png b/assets/images/tutorial_helloworld/add_automation_helloworld.png new file mode 100644 index 0000000..654e7b9 Binary files /dev/null and b/assets/images/tutorial_helloworld/add_automation_helloworld.png differ diff --git a/assets/images/tutorial_helloworld/logs_helloworld.png b/assets/images/tutorial_helloworld/logs_helloworld.png new file mode 100644 index 0000000..339b448 Binary files /dev/null and b/assets/images/tutorial_helloworld/logs_helloworld.png differ diff --git a/docs/payscript/example_scripts/topup.groovy b/docs/payscript/example_scripts/topup.groovy new file mode 100644 index 0000000..f02bc05 --- /dev/null +++ b/docs/payscript/example_scripts/topup.groovy @@ -0,0 +1,26 @@ +trigger = "time"; + +def account_parent = ${account_parent:scan}; +def account_child = ${account_child:scan}; +def topUpGoal = ${topUpGoal:decimal}; + +balance = getBalance(account_child); + +if (balance < topUpGoal) { + def payment = PaymentInfo.builder() + .payer(AccountInfo.builder() + .type(AccountIdentifierType.SCAN) + .identifier(account_parent) + .build()) + .payee(AccountInfo.builder() + .type(AccountIdentifierType.SCAN) + .identifier(account_child) + .build()) + .amountInfo(AmountInfo.builder() + .currency(CurrencyEnum.GBP) + .amount(topUpGoal - balance) + .build()) + .paymentReference("Top-up payment.") + .build(); + createPayment(payment); +} \ No newline at end of file diff --git a/docs/payscript/example_scripts/topup.md b/docs/payscript/example_scripts/topup.md new file mode 100644 index 0000000..7325ba4 --- /dev/null +++ b/docs/payscript/example_scripts/topup.md @@ -0,0 +1,16 @@ +--- +title: Top-up +parent: Example Scripts +layout: page +--- + +# Top-up +This script runs periodically to top up another account with funds up to a specified amount. + +
+[Download](topup.groovy){: .btn } +
+ +{% highlight groovy %} +{% include_relative topup.groovy %} +{% endhighlight %} diff --git a/docs/tutorials/tutorial_automated_transfer.md b/docs/tutorials/tutorial_automated_transfer.md index ea0401e..257561f 100644 --- a/docs/tutorials/tutorial_automated_transfer.md +++ b/docs/tutorials/tutorial_automated_transfer.md @@ -90,9 +90,9 @@ In the next tutorial we will introduce the concept of consent, which will be nec # Next: -- WIP +- [Top-up] -[2 - Consent]: /docs/tutorials/tutorial2 +[Top-up]: /docs/tutorials/tutorial_topup [sandbox]: /docs/sandbox [scan]: /docs/payscript/built_in_functions#scan \ No newline at end of file diff --git a/docs/tutorials/tutorial_hello_world.md b/docs/tutorials/tutorial_hello_world.md index adc257e..fdcc113 100644 --- a/docs/tutorials/tutorial_hello_world.md +++ b/docs/tutorials/tutorial_hello_world.md @@ -30,9 +30,34 @@ In the developer tab of the Sandbox, import the script through the import button Once the script has been imported into the Sandbox, it needs to be deployed. You can do this by clicking the green rocket button under the "ACTIONS" column. You should see the script's value in the "Status" column change from "Not Deployed" to "Deployed". -## 3. +## 3. Create an automation +Select the customer view from the top tab. +
+ +
+Go to the Automations tab and click the button to create a new automation. +
+ +
+ +Name it "Hello world" and, on the next page, tick the Activate Automation on Save box before submitting. +
+ +
+ +You should see your automation listed as above. + +# 4. Run it +Click the green button to run the automation. Once you are notified that the automation has been run successfully, you should see the results of the execution by clicking on the logs button, beside the green button. +
+ +
+ +# Next: +- [Automated transfer] +[Automated transfer]: /docs/tutorials/tutorial_automated_transfer [sandbox]: /docs/sandbox [hello world]: /docs/payscript/example_scripts/hello_world diff --git a/docs/tutorials/tutorial_reserves.md b/docs/tutorials/tutorial_reserves.md new file mode 100644 index 0000000..383ea36 --- /dev/null +++ b/docs/tutorials/tutorial_reserves.md @@ -0,0 +1,15 @@ +--- +title: Reserves +parent: Tutorials +layout: page +nav_order: 4 +--- + +# Reserves +Reserves are an abstract segregation of funds that can be used to help manage an account's funds. Funds that are moved to a reserve are still in that acconut, and count toward its total balance, however they won't count towards their available balance and won't be able to be used until it is moved out of the reserve. + +
+ +
+ +Reserves also keep a history of the transactions made to and from them. \ No newline at end of file diff --git a/docs/tutorials/tutorial_topup.md b/docs/tutorials/tutorial_topup.md index 9c7f43d..f69183f 100644 --- a/docs/tutorials/tutorial_topup.md +++ b/docs/tutorials/tutorial_topup.md @@ -5,7 +5,7 @@ layout: page nav_order: 3 --- -# Automated Transfer +# Top-Up This tutorial will introduce the concept of Consent, guiding you through the example case of a parent setting up an automation to top up their child's account at the end of the month. We will use the [Sandbox][sandbox] environment to create an automation and run it. ### Prerequisites: @@ -72,6 +72,11 @@ Then, navigating to the user whose consent you requested, you will see the reque After this, you can run the automation and see the desired effects. +# Next: +- [Reserves] + +[Reserves]: /docs/tutorials/tutorial_reserves + [builtinfunction]: /docs/payscript/built_in_functions [sandbox]: /docs/sandbox \ No newline at end of file