Add transaction_id field to SEP-12 requests#165
Conversation
Also improves typing by adding a separate CustomerBinaryInfoMap type only for the binary (Buffer) fields
transaction_id field to SEP-12 requests
| * @param {CustomerInfoMap} [params.sep9Info] - Customer information. What fields you should | ||
| * give is indicated by the anchor. | ||
| * @param {CustomerInfoMap} [params.sep9BinaryInfo] - Customer information that is in binary | ||
| * @param {CustomerBinaryInfoMap} [params.sep9BinaryInfo] - Customer information that is in binary |
There was a problem hiding this comment.
How does passing Buffer vs passing a string will work?
My question, is how exactly both of this types will be included in the request?
Can we add a unit test that makes sure that the body layout is correct (I believe type of binary fields should NOT be text/plain) when passing either string or buffer
And in the future add an integration test with Anchor Platform to pass any of binary fields?
(I see we currently have tests with Polaris testanchor but it might just ignore this fields, so I don't think it's a very trustworthy test)
There was a problem hiding this comment.
@ifropc thanks for the review!
This is how it currently works: any string field should be passed through the sep9Info object and any binary field (e.g. KYC images) should be passed through the sep9BinaryInfo object.
If you pass any field on the sep9BinaryInfo object then the request Content-Type header will be set to multipart/form-data.
How does that sound?
There was a problem hiding this comment.
I was a bit confused by
export type CustomerBinaryInfoMap = {
[key: string]: Buffer | string;
};
My guess is that it will have an appropriate body layout depending on the type of the value in the map?
In any case, adding a unit test would be a great addition.
There was a problem hiding this comment.
I was a bit confused by
export type CustomerBinaryInfoMap = { [key: string]: Buffer | string; };
Fixed this is: 6f38db4
Now the types look like this:
export type CustomerInfoMap = {
[key: string]: string;
};
export type CustomerBinaryInfoMap = {
[key: string]: Buffer;
};
My guess is that it will have an appropriate body layout depending on the type of the value in the map?
In any case, adding a unit test would be a great addition.
Created a task to tackle this unit test: https://github.com/orgs/stellar/projects/58/views/1?pane=issue&itemId=78332363
ifropc
left a comment
There was a problem hiding this comment.
LGTM, thanks for clarifying comment
Also improves typing by adding a separate
CustomerBinaryInfoMaptype only for the binary (Buffer) fields.Closes: Add transaction id to SEP-12 requests