Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/images/tutorial3/reserves.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions docs/payscript/example_scripts/topup.groovy
Original file line number Diff line number Diff line change
@@ -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);
}
16 changes: 16 additions & 0 deletions docs/payscript/example_scripts/topup.md
Original file line number Diff line number Diff line change
@@ -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.

<div style="text-align: center;" markdown="1">
[Download](topup.groovy){: .btn }
</div>

{% highlight groovy %}
{% include_relative topup.groovy %}
{% endhighlight %}
4 changes: 2 additions & 2 deletions docs/tutorials/tutorial_automated_transfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
27 changes: 26 additions & 1 deletion docs/tutorials/tutorial_hello_world.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<div style="text-align: center;">
<img src="/assets/images/tutorial1/create_automation.png" width="90%">
</div>
Go to the Automations tab and click the button to create a new automation.
<div style="text-align: center;">
<img src="/assets/images/tutorial_helloworld/add_automation_helloworld.png" width="90%">
</div>

Name it "Hello world" and, on the next page, tick the Activate Automation on Save box before submitting.
<div style="text-align: center;">
<img src="/assets/images/tutorial_helloworld/active_helloworld.png" width="90%">
</div>

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.
<div style="text-align: center;">
<img src="/assets/images/tutorial_helloworld/logs_helloworld.png" width="90%">
</div>

# Next:
- [Automated transfer]

[Automated transfer]: /docs/tutorials/tutorial_automated_transfer

[sandbox]: /docs/sandbox
[hello world]: /docs/payscript/example_scripts/hello_world
Expand Down
15 changes: 15 additions & 0 deletions docs/tutorials/tutorial_reserves.md
Original file line number Diff line number Diff line change
@@ -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.

<div style="text-align: center;">
<img src="/assets/images/tutorial3/reserves.png" width="90%">
</div>

Reserves also keep a history of the transactions made to and from them.
7 changes: 6 additions & 1 deletion docs/tutorials/tutorial_topup.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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