Skip to content

Commit

Permalink
[ANCHOR-746] Update NotifyCustomerInfoUpdate RPC (stellar#938)
Browse files Browse the repository at this point in the history
* Text changes

* Update flow diagrams

* Remove `RequestCustomerInfoUpdate`
  • Loading branch information
philipliu authored and lijamie98 committed Aug 26, 2024
1 parent 94d5a0d commit ed95a2b
Show file tree
Hide file tree
Showing 15 changed files with 305 additions and 658 deletions.
18 changes: 18 additions & 0 deletions openrpc/src/anchor-platform/contentDescriptors/customer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"customer_id": {
"name": "customer_id",
"description": "The SEP-12 ID of the customer",
"required": "false",
"schema": {
"type": "string"
}
},
"customer_type": {
"name": "customer_type",
"description": "The SEP-12 type of the customer",
"required": "false",
"schema": {
"type": "string"
}
}
}
10 changes: 10 additions & 0 deletions openrpc/src/anchor-platform/examples/customer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"customer_id": {
"name": "customer_id",
"value": "45f8884d-d6e1-477f-a680-503179263359"
},
"customer_type": {
"name": "customer_type",
"value": "sep31-receiver"
}
}
180 changes: 88 additions & 92 deletions openrpc/src/anchor-platform/examples/message.json
Original file line number Diff line number Diff line change
@@ -1,94 +1,90 @@
{
"message": {
"name": "message",
"value": "Transaction status message"
},
"do_stellar_payment_message": {
"name": "message",
"value": "Do Stellar payment"
},
"do_stellar_refund_message": {
"name": "message",
"value": "Do Stellar refund"
},
"notify_amounts_updated_message": {
"name": "message",
"value": "Amounts updated"
},
"notify_customer_info_updated_message": {
"name": "message",
"value": "Customer info updated"
},
"notify_interactive_flow_completed_message": {
"name": "message",
"value": "Interactive flow completed successfully."
},
"notify_offchain_funds_available_message": {
"name": "message",
"value": "Offchain funds available"
},
"notify_offchain_funds_pending_message": {
"name": "message",
"value": "Offchain funds pending"
},
"notify_offchain_funds_received_message": {
"name": "message",
"value": "Funds received successfully"
},
"notify_offchain_funds_sent_message": {
"name": "message",
"value": "Offchain funds sent"
},
"notify_onchain_funds_received_message": {
"name": "message",
"value": "Onchain funds received"
},
"notify_onchain_funds_sent_message": {
"name": "message",
"value": "Onchain funds sent"
},
"notify_refund_pending_message": {
"name": "message",
"value": "Refund pending"
},
"notify_refund_sent_message": {
"name": "message",
"value": "Refund sent"
},
"notify_transaction_error_message": {
"name": "message",
"value": "Transaction error"
},
"notify_transaction_expired_message": {
"name": "message",
"value": "Transaction expired"
},
"notify_transaction_on_hold_message": {
"name": "message",
"value": "Transaction on hold, please contact customer service to lift the hold."
},
"notify_transaction_recovery_message": {
"name": "message",
"value": "Transaction recovered"
},
"notify_trust_set_message": {
"name": "message",
"value": "Trustline set"
},
"request_customer_info_update_message": {
"name": "message",
"value": "Customer info requested"
},
"request_offchain_funds_message": {
"name": "message",
"value": "Request offchain funds"
},
"request_onchain_funds_message": {
"name": "message",
"value": "Requesting onchain funds"
},
"request_trust_message": {
"name": "message",
"value": "Request trust"
}
"message": {
"name": "message",
"value": "Transaction status message"
},
"do_stellar_payment_message": {
"name": "message",
"value": "Do Stellar payment"
},
"do_stellar_refund_message": {
"name": "message",
"value": "Do Stellar refund"
},
"notify_amounts_updated_message": {
"name": "message",
"value": "Amounts updated"
},
"notify_customer_info_updated_message": {
"name": "message",
"value": "Customer info updated"
},
"notify_interactive_flow_completed_message": {
"name": "message",
"value": "Interactive flow completed successfully."
},
"notify_offchain_funds_available_message": {
"name": "message",
"value": "Offchain funds available"
},
"notify_offchain_funds_pending_message": {
"name": "message",
"value": "Offchain funds pending"
},
"notify_offchain_funds_received_message": {
"name": "message",
"value": "Funds received successfully"
},
"notify_offchain_funds_sent_message": {
"name": "message",
"value": "Offchain funds sent"
},
"notify_onchain_funds_received_message": {
"name": "message",
"value": "Onchain funds received"
},
"notify_onchain_funds_sent_message": {
"name": "message",
"value": "Onchain funds sent"
},
"notify_refund_pending_message": {
"name": "message",
"value": "Refund pending"
},
"notify_refund_sent_message": {
"name": "message",
"value": "Refund sent"
},
"notify_transaction_error_message": {
"name": "message",
"value": "Transaction error"
},
"notify_transaction_expired_message": {
"name": "message",
"value": "Transaction expired"
},
"notify_transaction_on_hold_message": {
"name": "message",
"value": "Transaction on hold, please contact customer service to lift the hold."
},
"notify_transaction_recovery_message": {
"name": "message",
"value": "Transaction recovered"
},
"notify_trust_set_message": {
"name": "message",
"value": "Trustline set"
},
"request_offchain_funds_message": {
"name": "message",
"value": "Request offchain funds"
},
"request_onchain_funds_message": {
"name": "message",
"value": "Requesting onchain funds"
},
"request_trust_message": {
"name": "message",
"value": "Request trust"
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
{
"name": "notify_customer_info_updated",
"summary": "Customer info updated",
"description": "Additional customer information was received and updated.",
"description": "The customer's status for the transaction has been updated. Use this method to notify the wallet of the status change. If `customer_id` and `customer_type` are provided, the transaction status will reflect the customer's status. If not, the transaction status will default to the standard pending status for the SEP.",
"paramStructure": "by-name",
"tags": [
{ "name": "SEP-31" }
],
"tags": [{ "name": "SEP-6" }, { "name": "SEP-31" }],
"params": [
{ "$ref": "#/components/contentDescriptors/transaction_id" },
{ "$ref": "#/components/contentDescriptors/message" }
{ "$ref": "#/components/contentDescriptors/message" },
{
"$ref": "#/components/contentDescriptors/customer_id"
},
{
"$ref": "#/components/contentDescriptors/customer_type"
}
],
"result": {
"name": "notify_customer_info_updatedResponse",
Expand All @@ -22,7 +26,15 @@
"description": "Example request to the `notify_customer_info_updated` method.",
"params": [
{ "$ref": "#/components/examples/transaction_id" },
{ "$ref": "#/components/examples/notify_customer_info_updated_message" }
{
"$ref": "#/components/examples/notify_customer_info_updated_message"
},
{
"$ref": "#/components/examples/customer_id"
},
{
"$ref": "#/components/examples/customer_type"
}
],
"result": { "$ref": "#/components/examples/AnchorPlatformResponse" }
}
Expand Down

This file was deleted.

15 changes: 14 additions & 1 deletion platforms/anchor-platform/admin-guide/sep10/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,17 @@ clients:
# If the type is `custodial`,
# - signing_keys: (required) the custodial SEP-10 signing key of the client.
# - callback_url: (optional) the URL of the client's callback API endpoint.
# If one of SEP-specific URLs is also provided, then this URL will be used as a fallback.
# For example, if `callback_url_sep6` is not provided, but `callback_url_sep24` is,
# SEP-6 transactions will use the `callback_url` as the callback URL. This field is
# deprecated and will be removed in 3.0.
# - callback_url_sep6: (optional) the URL of the client's SEP-6 callback API endpoint.
# - callback_url_sep24: (optional) the URL of the client's SEP-24 callback API endpoint.
# - callback_url_sep31: (optional) the URL of the client's SEP-31 callback API endpoint.
# - callback_url_sep12: (optional) the URL of the client's SEP-10 callback API endpoint.
# - allow_any_destination: (optional) default to false. If set to true, allows any destination for deposits.
# - destination_accounts: (optional) list of accounts allowed to be used for the deposit. If allows_any_destinations set to true, this configuration option is ignored.
# - destination_accounts: (optional) list of accounts allowed to be used for the deposit.
# If allows_any_destinations set to true, this configuration option is ignored.
#
# If the type is `noncustodial`,
# - domains: (required) the domains of the client.
Expand All @@ -73,6 +82,8 @@ clients:
type: custodial
signing_keys: "the signing key 1 of the client1","the signing key 2 of the client1"
callback_url: https://callback.custodial-client1.com/api/v1/anchor/callback
callback_url_sep6: https://callback.custodial-client1.com/api/v1/anchor/callback/sep6
callback_url_sep12: https://callback.custodial-client1.com/api/v1/anchor/callback/sep12
allow_any_destination: false
destination_accounts: destAccount1,destAccount2
- name: custodial-client2
Expand All @@ -84,6 +95,8 @@ clients:
type: noncustodial
domains: noncustodial-client1.co,noncustodial-client1.com
callback_url: https://callback.noncustodial-client1.co/api/v2/anchor/callback
callback_url_sep6: https://callback.noncustodial-client1.co/api/v2/anchor/callback/sep6
callback_url_sep12: https://callback.noncustodial-client1.co/api/v2/anchor/callback/sep12
- name: noncustodial-client2
type: noncustodial
domains: noncustodial-client2.com
Expand Down
39 changes: 5 additions & 34 deletions platforms/anchor-platform/admin-guide/sep31/integration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -355,42 +355,11 @@ To execute this, you need to run:

</CodeExample>

### Customer Info Needed
### Verifying Customer Information

In some cases, the Receiving Anchor might need to request an updated information from the Sending Anchor. For example, the bank tells the Receiving Anchor that the provided Receiving Client's name is incorrect or missing a middle initial. Since this information was sent via SEP-12, the transaction should go into the `pending_customer_info_update` status until the Sending Anchor makes another SEP-12 `PUT /customer` request to update. The Sending Anchor can check which fields need to be updated by making a SEP-12 `GET /customer` request including the id or account & memo parameters. The Receiving Anchor should respond with a `NEEDS_INFO` status and `last_name` included in the fields described.

<CodeExample>

```json
// pending-customer-info-update.json
[
{
"id": 1,
"jsonrpc": "2.0",
"method": "pending_customer_info_update",
"params": {
"transaction_id": "<transaction_id>",
"message": "Customer info needed"
}
}
]
```

</CodeExample>

To execute this, you need to run:

<CodeExample>

```bash
./call-json-rpc.sh pending-customer-info-update.json
```

</CodeExample>

### Customer Info Updated

After the Sending Anchor has made another SEP-12 `PUT /customer` request to update customer info, the Receiving Anchor should change the status of the transaction to `pending_receiver`.
After the Sending Anchor makes a SEP-12 `PUT /customer` request, call the `notify_customer_info_updated` JSON-RPC method againto update the transaction status. Additionally, call this method whenever the SEP-12 status for a customer changes, such as when the customer's information is being validated and the status changes from `NEEDS_INFO` to `PROCESSING`. This ensures that any clients configured with a callback URL are notified of the latest customer status, allowing the client to prompt the user to update their information.

<CodeExample>

Expand All @@ -403,7 +372,9 @@ After the Sending Anchor has made another SEP-12 `PUT /customer` request to upda
"method": "notify_customer_info_updated",
"params": {
"transaction_id": "<transaction_id>",
"message": "Customer info updated"
"message": "Customer info updated",
"customer_id": "45f8884d-d6e1-477f-a680-503179263359",
"customer_type": "sep31-receiver" // or sep31-sender
}
}
]
Expand Down
Loading

0 comments on commit ed95a2b

Please sign in to comment.