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

feat(acl- 111): add support to get transactions for merchant account #216

Conversation

tl-mauro-franchi
Copy link
Contributor

No description provided.

@tl-mauro-franchi tl-mauro-franchi requested review from a team as code owners September 10, 2024 17:19
Comment on lines +53 to +55
var statusTypeDiscriminator = string.Join("_", statusValue, discriminatorValue);
if (!string.IsNullOrWhiteSpace(statusTypeDiscriminator)
&& (_descriptor.TypeFactories.TryGetValue(statusTypeDiscriminator, out typeFactory)))
Copy link
Contributor Author

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.

Copy link
Contributor

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

dili91
dili91 previously approved these changes Sep 11, 2024
Copy link
Contributor

@dili91 dili91 left a 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,
Copy link
Contributor

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 :(

Copy link
Contributor Author

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

Copy link
Contributor

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}"),
Copy link
Contributor

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?

Copy link
Contributor Author

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));
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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...)

Copy link
Contributor Author

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,

Comment on lines +53 to +55
var statusTypeDiscriminator = string.Join("_", statusValue, discriminatorValue);
if (!string.IsNullOrWhiteSpace(statusTypeDiscriminator)
&& (_descriptor.TypeFactories.TryGetValue(statusTypeDiscriminator, out typeFactory)))
Copy link
Contributor

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

@tl-mauro-franchi tl-mauro-franchi force-pushed the acl-111/add-support-to-get-transactions-for-merchant-account branch from 5be428c to 8500139 Compare September 11, 2024 13:18
@tl-mauro-franchi tl-mauro-franchi merged commit c1d4dc9 into main Sep 11, 2024
1 check passed
@tl-mauro-franchi tl-mauro-franchi deleted the acl-111/add-support-to-get-transactions-for-merchant-account branch September 11, 2024 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants