Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SEP-6] Add location_id to withdrawal #1433

Merged
merged 6 commits into from
Feb 21, 2024
Merged

[SEP-6] Add location_id to withdrawal #1433

merged 6 commits into from
Feb 21, 2024

Conversation

Ifropc
Copy link
Contributor

@Ifropc Ifropc commented Jan 27, 2024

Background

One of partners requires for user to choose a location to be selected. This location will be used to pick up funds

Proposed change

Add location_id to withdrawal requests

### Extra object schema

This object is used to pass any additional info to the anchor. Anchors are free to add any field to this object. Anchors
should notify wallets about fields they are expecting to receive. However, it's recommended to submit a change to this
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will Anchors communicate this to the wallet? Should the schema be included in the /info response?

@Ifropc Ifropc marked this pull request as draft January 29, 2024 20:34
@JakeUrban
Copy link
Contributor

JakeUrban commented Jan 30, 2024

Its unclear if fields listed in /info need to be SEP-9 or can be custom. The fields dest and dest_extra are defined in the SEP itself, where as others in the example are SEP-9 fields, so its unclear if location_id should be defined somewhere as well. As long as we clarify I think this approach is fine.

I'm not opposed to simply adding an optional location_id argument. It is unclear how using an object like extra would work in the context of GET URL arguments.

@Ifropc Ifropc changed the title [SEP-6] Add extra field [SEP-6] Add types to /info deposits, update description for withdrawal Jan 30, 2024
@Ifropc Ifropc marked this pull request as ready for review January 30, 2024 20:51
Copy link
Contributor

@JakeUrban JakeUrban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% convinced we should be adding a types map to deposit info objects.

I understand that this approach makes sense because the withdraw objects use the same approach, but withdraws and deposits are different. With withdraws, you need to tell the anchor your financial account information so they can send you funds off-chain. But with deposits, the anchor actually needs to tell you their financial account information so you can send the funds off-chain. Thats why the deposit info objects don't have a types map today -- there is typically no extra non-KYC information that is needed, and that is why we have an instructions field in the deposit endpoints response.

Location selection seems like the one exception to that rule. The anchor can't tell the user which location to go to, the user needs to pick. I can't think of another type of deposit that would require extra arguments from the client.

Because of that, I think I still prefer adding location_id as a first-class parameter to deposit request endpoints, rather than it being a custom field defined in GET /info. If you can point out other potential uses of a types array for deposits, I'm willing to change my mind.

EDIT: actually, I know its not a requirement for MGI since you can pick up cash at any location, but should we consider adding location_id to withdraw request endpoints as well?

Comment on lines 1061 to 1067
"types": {
"location": {
"fields": {
"id": {
"description": "ID of location user must visit to pick up cash"
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the example should be something like:

Suggested change
"types": {
"location": {
"fields": {
"id": {
"description": "ID of location user must visit to pick up cash"
}
}
"types": {
"cash": {
"fields": {
"location_id": {
"description": "ID of location user must visit to pick up cash"
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for the other examples

Comment on lines 1113 to 1124
"bank_account": {
"fields": {
"dest": {"description": "your bank account number" },
"dest_extra": { "description": "your routing number" },
"bank_branch": { "description": "address of your bank branch" },
"phone_number": { "description": "your phone number in case there's an issue" },
"country_code": {
"description": "The ISO 3166-1 alpha-3 code of the user's current address",
"choices": ["USA", "PRI"]
}
}
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To confirm, we're removing this because the bank_account type is requesting the user's KYC info like phone number and bank account number right? And we want them to do this via SEP-12?

Don't we still need the client to provide the type=bank_account query parameter though, so the anchor knows to request bank account fields in the GET /customer response? If that is the case, then we need to do something like this:

"bank_account": {}

This signals that the type should be passed but there are no extra fields that need to passed in the transaction creation request.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do it like described above, that would mean that we accept field named bank_account with empty body though, am I wrong?
We still have type in the request, it should be used as before

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do it like described above, that would mean that we accept field named bank_account with empty body though, am I wrong?

On what endpoint would anchors accept a "bank_account": {} key-value pair from wallet requests? I'm referring to the fact that GET /info responses should have all possible values of the type query parameter as keys. So we shouldn't remove the entire bank_account object, just the items within the object, since no additional parameters should be sent to the anchor other than the type parameter in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

types in info describes type of on object, not of a string. type of type parameter from the request is string. With current protocol we can't describe acceptable values of type`, because it's not an object.
That being said, I agree with just adding location_id

Comment on lines 1162 to 1164
type of deposit. In the case that the Anchor requires additional fields for a deposit, it should set the
transaction status to `pending_customer_info_update`. The wallet can query the `/transaction` endpoint to get the
fields needed to complete the transaction in `required_customer_info_updates` and then use
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This stops mid-sentence. I also think you mean pending_transaction_info_update and required_info_updates.

@Ifropc
Copy link
Contributor Author

Ifropc commented Jan 31, 2024

I don't mind just adding location_id directly, but I think it's more flexible if we allow anchors to define their own fields, so we don't need to modify protocol for any small deviation from SEP-6 protocol

@JakeUrban
Copy link
Contributor

JakeUrban commented Jan 31, 2024

I agree it is valuable that your solution provides anchors a way to request their own custom fields, and if we were starting from scratch I think this is the right approach. The reason I think we should try to avoid making this change is simply because it is breaking, and it is unclear how common the need for custom fields will be.

I also think that a location_id parameter makes sense to include in an on/off ramp standard API. Right now MGI is the only cash-agent network that supports a stellar on/off ramp standard, but any future cash-agent network anchor will need this. And if we don't standardize the location_id parameter, they'll define their own parameter in GET /info which could use a different name.

@JakeUrban
Copy link
Contributor

Ok, it sounds like we're on the same page of adding location_id to request parameters rather than the approach defined here, so I'll close this PR.

@JakeUrban JakeUrban closed this Feb 5, 2024
@Ifropc Ifropc reopened this Feb 6, 2024
@Ifropc Ifropc changed the title [SEP-6] Add types to /info deposits, update description for withdrawal [SEP-6] Add location_id to withdrawal Feb 6, 2024
@Ifropc
Copy link
Contributor Author

Ifropc commented Feb 6, 2024

Reopened PR to preserve discussion history

philipliu
philipliu previously approved these changes Feb 8, 2024
JakeUrban
JakeUrban previously approved these changes Feb 9, 2024
Copy link
Contributor

@JakeUrban JakeUrban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with edits

@@ -828,6 +829,7 @@ Request Parameters:
| `country_code` | string | (optional) The [ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) code of the user's current address. This field may be necessary for the anchor to determine what KYC information is necessary to collect. |
| `claimable_balance_supported` | string | (optional) `true` if the client supports receiving deposit transactions as a claimable balance, `false` otherwise. |
| `customer_id` | string | (optional) id of an off-chain account (managed by the anchor) associated with this user's Stellar account (identified by the JWT's `sub` field). If the anchor supports [SEP-12], the `customer_id` field should match the [SEP-12] customer's id. `customer_id` should be passed only when the off-chain id is know to the client, but the relationship between this id and the user's Stellar account is not known to the Anchor. |
| `location_id` | string | (optional) id of the chosen location for cash pick up cash |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `location_id` | string | (optional) id of the chosen location for cash pick up cash |
| `location_id` | string | (optional) id of the chosen location to drop off cash |

@@ -726,6 +726,7 @@ Request parameters:
| `refund_memo` | string | (optional) The memo the anchor must use when sending refund payments back to the user. If not specified, the anchor should use the same memo used by the user to send the original payment. If specified, `refund_memo_type` must also be specified. |
| `refund_memo_type` | string | (optional) The type of the `refund_memo`. Can be `id`, `text`, or `hash`. See the [memos](https://developers.stellar.org/docs/encyclopedia/memos) documentation for more information. If specified, `refund_memo` must also be specified. |
| `customer_id` | string | (optional) id of an off-chain account (managed by the anchor) associated with this user's Stellar account (identified by the JWT's `sub` field). If the anchor supports [SEP-12], the `customer_id` field should match the [SEP-12] customer's id. `customer_id` should be passed only when the off-chain id is know to the client, but the relationship between this id and the user's Stellar account is not known to the Anchor. |
| `location_id` | string | (optional) id of the chosen location for cash pick up cash |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `location_id` | string | (optional) id of the chosen location for cash pick up cash |
| `location_id` | string | (optional) id of the chosen location to pick up cash |

@JakeUrban
Copy link
Contributor

Also, don't forget to update the updated-at and version fields.

@Ifropc Ifropc dismissed stale reviews from JakeUrban and philipliu via 2ba38f0 February 9, 2024 20:37
@Ifropc Ifropc enabled auto-merge (squash) February 21, 2024 19:05
@Ifropc Ifropc merged commit c521ed4 into master Feb 21, 2024
2 checks passed
@Ifropc Ifropc deleted the SEP-6-extra branch February 21, 2024 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants