-
Notifications
You must be signed in to change notification settings - Fork 12
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
feat(acl- 111): add support to get transactions for merchant account #216
feat(acl- 111): add support to get transactions for merchant account #216
Conversation
….GetAsync - remove OneOf.SourceGenerator - improved OneOfJsonConverter - fixed uriExtensions.AppendQueryParameters
var statusTypeDiscriminator = string.Join("_", statusValue, discriminatorValue); | ||
if (!string.IsNullOrWhiteSpace(statusTypeDiscriminator) | ||
&& (_descriptor.TypeFactories.TryGetValue(statusTypeDiscriminator, out typeFactory))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the payout payments resulted from the GetTransactions
for the MerchantAccounts
, the discriminator is the concatenation of the status
and type
field: status_type
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for context: On the Java lib we treat them as the same item, just with some optional fields, for simplicity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, added some questions/comments
string merchantAccountId, | ||
DateTimeOffset from, | ||
DateTimeOffset to, | ||
bool getPaginatedResult = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to set this by default, without giving the option to opt-out initially (and without exposing anything here at the interface level)? I'd be surprised if there are new or old customers building the integration now without pagination. As such, I would personally treat that as an exception when/if needed (I don't have context on the clients that are currently interested). Mine is just a suggestion though, If we are on the same page, I'd suggest you to anyway double-check on this with Fede and MAP.
On the java lib we had added an overload because we had the unpaginated endpoint already integrated :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, I will set it to false
by default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move this on Slack
@@ -83,8 +83,50 @@ public async Task<ApiResponse<GetPaymentSourcesResponse>> GetPaymentSources(stri | |||
} | |||
|
|||
return await _apiClient.GetAsync<GetPaymentSourcesResponse>( | |||
_baseUri.Append($"merchant-accounts/{merchantAccountId}/payment-sources?user_id={userId}"), | |||
_baseUri.Append($"{merchantAccountId}/payment-sources?user_id={userId}"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did the base URI change? Or, there was an oversight in the previous implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it didn't change. The previous implementation was wrong as the merchant-account
segment of the url was already added here
merchantAccountId.NotNullOrWhiteSpace(nameof(merchantAccountId)); | ||
merchantAccountId.NotAUrl(nameof(merchantAccountId)); | ||
to.GreaterThan(from, nameof(to), nameof(from)); | ||
cursor.NotAUrl(nameof(cursor)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we validating this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For security reasons. A few months ago we had a security breach where consumers of the SDK could inject URLs into string parameters. This check prevents it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good to know! Is this validated also at the API level if you know the answer? I think we could replicate this on the Java lib as well, I just would like to know how urgent it is (This does not help with the case where a malicious user use a previous lib version...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I am not aware of any issues at api level. Maybe it is worth implementing it in the Java lib as well,
var statusTypeDiscriminator = string.Join("_", statusValue, discriminatorValue); | ||
if (!string.IsNullOrWhiteSpace(statusTypeDiscriminator) | ||
&& (_descriptor.TypeFactories.TryGetValue(statusTypeDiscriminator, out typeFactory))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for context: On the Java lib we treat them as the same item, just with some optional fields, for simplicity
5be428c
to
8500139
Compare
No description provided.