Adyen / adyen-dotnet-api-library

Adyen API Library for .NET
MIT License
105 stars 114 forks source link

Allow using encrypted payload with Cloud API #995

Open jsyrjala opened 5 months ago

jsyrjala commented 5 months ago

Is your feature request related to a problem? Please describe.

We'd like to use encrypted payloads with Cloud API. Especially we'd like to receive encrypted async responses in Event notifications. And seems that responses would be encrypted if we would encrypt our requests. But currently SDK doesn't allow specifying encryption details.

With local api you can give EncryptionCredentialDetails

public interface ITerminalLocalApi
  {
    SaleToPOIResponse TerminalRequest(
      SaleToPOIMessage saleToPoiRequest,
      EncryptionCredentialDetails encryptionCredentialDetails);

    Task<SaleToPOIResponse> TerminalRequestAsync(
      SaleToPOIMessage saleToPoiRequest,
      EncryptionCredentialDetails encryptionCredentialDetails,
      CancellationToken cancellationToken = default (CancellationToken));

    SaleToPOIResponse TerminalRequest(
      SaleToPOIMessage saleToPoiRequest,
      EncryptionCredentialDetails encryptionCredentialDetails,
      RemoteCertificateValidationCallback remoteCertificateValidationCallback);

    string DecryptNotification(
      string notification,
      EncryptionCredentialDetails encryptionCredentialDetails);
  }

With cloud api there is no way to give EncryptionCredentialDetails

  public interface ITerminalCloudApi
  {
    SaleToPOIResponse TerminalRequestAsync(SaleToPOIMessage saleToPoiRequest);

    SaleToPOIResponse TerminalRequestSync(SaleToPOIMessage saleToPoiRequest);

    Task<SaleToPOIResponse> TerminalRequestAsynchronousAsync(
      SaleToPOIMessage saleToPoiRequest,
      CancellationToken cancellationToken = default (CancellationToken));

    Task<SaleToPOIResponse> TerminalRequestSynchronousAsync(
      SaleToPOIMessage saleToPoiRequest,
      CancellationToken cancellationToken = default (CancellationToken));
  }

Describe the solution you'd like

I'd like be able to specify encryption also with Cloud API

Describe alternatives you've considered

Kwok-he-Chu commented 4 months ago

Hi @jsyrjala

As you mentioned, you'll need to set up the EncryptionCredentialDetails (see docs).

There are two endpoints:

For this step, you will not require the EncryptionCredentialDetails from the library, but instead, configure the username, password, your server URL, and the `enableEncryption"-flag in the Customer Area. Event notifications will now be sent to the endpoint you specified. If you're using cloud communications with an asynchronous result, the Terminal API responses are also sent to this endpoint.

Edit: I re-read your question, I thought you were asking about the event notifications. You want to send an encrypted response and expect an encrypted response back from the /async (terminal) endpoint and our interface is not supporting that behavior similar to the TerminalLocalApi-class.

DjoykeAbyah commented 2 months ago

Marked as stale. Reopen if this is still an issue.

jsyrjala commented 2 months ago

This is still an issue

DjoykeAbyah commented 2 months ago

Hi @jsyrjala!

Thanks for letting us know you're still experiencing this issue. I'll need to investigate this a bit further and I'll get back to you as soon as I know more.

Regards,

Djoyke Adyen