Skip to content

Commit

Permalink
SDP: customize disbursement options (#210)
Browse files Browse the repository at this point in the history
Added how to customize countries, assets, and wallets in the SDP
  • Loading branch information
torisamples authored Aug 10, 2023
1 parent fa78b1f commit 74f2ae2
Showing 1 changed file with 82 additions and 2 deletions.
84 changes: 82 additions & 2 deletions docs/stellar-disbursement-platform/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ Keep an eye on the dashboard until the payment status reaches Success. If everyt

## Next Up: Updating Application Secrets

Now that you've been able to make a disbursement, lets go back to our docker compose files and update some values. **This is an important step before going to production. We'll be updating encryption keys and application secrets.**
Now that you've been able to make a disbursement, let's go back to our docker compose files and update some values. **This is an important step before going to production. We'll be updating encryption keys and application secrets.**

### Email and SMS Messages

Expand Down Expand Up @@ -243,13 +243,93 @@ SECRET_SEP24_INTERACTIVE_URL_JWT_SECRET:
SECRET_SEP24_MORE_INFO_URL_JWT_SECRET:
# used to encrypt passwords of the SDP users
# NOTE: you'll need to recreate any existing users in the database if this is reset
EC256_PRIVATE_KEY:
EC256_PRIVATE_KEY:
```

</CodeExample>

There are many other configuration values to update when moving to a production environment, such as database credentials, URLs, and more.

## Level Up: Customize Default Options

The SDP contains a list of assets, countries, and wallets available for disbursements out-of-the-box. You might want to customize these, either to limit/expand options or to prepare for going live in production. Now that you've made a disbursement and added application secrets, let's look at how to customize the new disbursement options.

### Assets

You can add and remove assets easily in the SDP dashboard. The SDP backend handles the request seamlessly, including checking for outstanding balance and adding/removing trustlines on the Stellar network. When assets are removed, the record is still retained in the database to preserve a full history. However, the asset will no longer be available for disbursements or holding a balance in the distribution account.

Head to the Wallets page of the SDP dashboard to add and remove assets. You'll need the Stellar asset code and the public key of the asset issuer.

### Countries

To customize wallets and countries, you’ll need to do some backend work.

The list of available countries is seeded with a database patch. The default list includes every country except North Korea, Iran, Cuba, and Syria for easy testing. If you want to narrow the list, you will need to remove the country record directly from the countries table within the SDP database.

Here is an example of how to remove France with its three-character ISO 3166 code:

<CodeExample>

```sql
DELETE FROM countries WHERE code = 'FRA';
```

</CodeExample>

### Wallets

Remember you’ll need an agreement with a wallet provider before sending disbursements into their wallet. This ensures the wallets are comfortable receiving funds from your organization and governs any commercial arrangement between the organizations. The wallet will need to whitelist your SDP domain before you send disbursements. When you add the wallet’s domain to your SDP, you are effectively whitelisting them. Both sides listing the other allows them to retrieve the Stellar toml file and check the signing key needed for the SEP-10 handshake.

The default list of SDP wallets depends on which network you’re using (testnet or pubnet). The network is passed as an environment variable and then the list of wallets is seeded appropriately on SDP startup. You can add new wallets through the code when you deploy your SDP, or you can insert directly into the SDP database. Both methods require adding the wallet name, homepage, SEP-10 client domain, and deep link schema.

To insert into the database directly, update your values and run the following. Make sure to check your database and namespace first.

<CodeExample>

```sql
INSERT INTO wallets (name, homepage, deep_link_schema, sep_10_client_domain)
VALUES ('Vibrant Assist', 'https://vibrantapp.com', 'https://vibrantapp.com/sdp', 'api.vibrantapp.com');
```

</CodeExample>

To configure a wallet through the code, add it to the testnet or pubnet section of `DefaultWalletsNetworkMap`. This will get picked up by the `SetupWalletsForProperNetwork` function, which updates the SDP database and makes the wallet available for new disbursements. You’ll see a default list in the code. Add your new wallet using the same format.

<CodeExample>

```go
var DefaultWalletsNetworkMap = WalletsNetworkMapType{
utils.PubnetNetworkType: {
{
Name: "Vibrant Assist",
Homepage: "https://vibrantapp.com/assist",
DeepLinkSchema: "https://vibrantapp.com/sdp",
SEP10ClientDomain: "api.vibrantapp.com",
},
},
utils.TestnetNetworkType: {
{
Name: "Vibrant Assist",
Homepage: "https://vibrantapp.com",
DeepLinkSchema: "https://vibrantapp.com/sdp-dev",
SEP10ClientDomain: "api-dev.vibrantapp.com",
},
{
Name: "Demo Wallet",
Homepage: "https://demo-wallet.stellar.org",
DeepLinkSchema: "https://demo-wallet.stellar.org",
SEP10ClientDomain: "demo-wallet-server.stellar.org",
},
},
}
```

</CodeExample>

Once you’ve added the new wallet, make sure the wallet has whitelisted your SDP domain (the domain that appears in the deep link).

Now you should be set with whichever countries and wallets you want available for new disbursements!

[demo-wallet]: https://demo-wallet.stellar.org
[circle-sandbox]: https://login-sandbox.circle.com/
[circle-sample-app]: https://sample-sandbox.circle.com/

0 comments on commit 74f2ae2

Please sign in to comment.