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

Allow .NET Library to send encrypted payloads to the /sync and /async Cloud Terminal API endpoints #1060

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Kwok-he-Chu
Copy link
Contributor

@Kwok-he-Chu Kwok-he-Chu commented Sep 13, 2024

Description
Allows developers to send encrypted payloads using the Terminal Cloud API (/sync & /async endpoints)

Fixed issue:
#995

Changes:

  • Added:
    • TerminalApiAsyncService -> Allows sending both unencrypted and encrypted requests to /async-endpoint
    • TerminalApiSyncService -> Allows sending both unencrypted and encrypted requests to /sync-endpoint
    • TerminalApiLocalService -> Allows sending both unencrypted and encrypted requests to a custom endpoint (e.g. https://198.51.100.1:8443/nexo)
  • Adyen/Service/Resource/Terminal/TerminalApi.cs has been removed/refactored into; it simply contained the endpoint name
    • TerminalApiLocalClient -> TerminalApiLocalService
    • TerminalApiSyncClient -> TerminalApiSyncService
    • TerminalApiAsyncClient -> TerminalApiAsyncService
  • Marked Adyen/Service/TerminalCloudApi.cs as [Obsolete], developers should use one of the three service-classes above instead
    • Reason for change: The following TerminalRequestAsynchronousAsync(...), TerminalRequestSynchronousAsync(...), TerminalRequestAsync(...), TerminalRequestSync(...) were confusing because of the name of the endpoints, I've split the two concerns: /async & /sync into the respective services

Fixes:

  • BaseTest returns the mocked response when RequestAsync(...) is called, previously it only would return the response when Request(...) is called
  • Adyen/ApiSerialization/SaleToPoiMessageSecuredSerializer.cs is now marked public, developers can use this class when needed

Breaking change:

  • None, I've marked previous classes as [Obsolete] and mentioned the name of the new to the new class

DjoykeAbyah and others added 3 commits September 10, 2024 15:54
…ndpoints

Split CloudTerminalApi into a /sync and /async service, to avoid confusion with the '-Async` (csharp) suffix for asynchronous functions.
@Kwok-he-Chu Kwok-he-Chu requested a review from a team as a code owner September 13, 2024 14:41
: base(client)
{
// Set default server certificate validation to true so no certificate check is performed
var handler = new HttpClientHandler { ServerCertificateCustomValidationCallback = (message, certificate2, arg3, arg4) => true };
HttpClientHandler handler = new HttpClientHandler { ServerCertificateCustomValidationCallback = (message, certificate2, arg3, arg4) => true };

Check failure

Code scanning / SonarCloud

Server certificates should be verified during SSL/TLS connections

<!--SONAR_ISSUE_KEY:AZHsEoQlM-BVcIQueMYt-->Enable server certificate validation on this SSL/TLS connection <p>See more on <a href="https://sonarcloud.io/project/issues?id=Adyen_adyen-dotnet-api-library&issues=AZHsEoQlM-BVcIQueMYt&open=AZHsEoQlM-BVcIQueMYt&pullRequest=1060">SonarCloud</a></p>
@jillingk
Copy link
Contributor

Also for most services in the lib we provide a non async method by awaiting the async methods task. It's a bit trivial for most .NET developers but maybe nice to have.

Copy link
Contributor Author

@Kwok-he-Chu Kwok-he-Chu left a comment

Choose a reason for hiding this comment

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

@jillingk Also for most services in the lib we provide a non async method by awaiting the async methods task. It's a bit trivial for most .NET developers but maybe nice to have.

I'll add the functionality and add the HttpClient.Request(...) synchronous calls as well

@jillingk @wboereboom I noticed that with these changes, we'd be breaking the library. Should I can reintroduce the previous name of the class, mark it as [Obsolete] & point it to the new function? That way, we don't introduce a breaking change, what do you think?

Adyen/Service/TerminalApiAsyncService.cs Show resolved Hide resolved
@jillingk
Copy link
Contributor

@jillingk @wboereboom I noticed that with these changes, we'd be breaking the library. Should I can reintroduce the previous name of the class, mark it as [Obsolete] & point it to the new function? That way, we don't introduce a breaking change, what do you think?

Hmm yeah we just did a major. Maybe good to make it non breaking for now and add the tag that we will remove the old stuff next major release

@wboereboom
Copy link
Contributor

I'm also all for a Deprecation strategy with a softer landing. Might be good to already plan when you actually want to remove the old stuff. We could also communicate this to our community so they know what to expect.

@Kwok-he-Chu
Copy link
Contributor Author

I'll modify the PR and apply a non-breaking change fix next tuesday

Copy link

sonarcloud bot commented Sep 24, 2024

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.

4 participants