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

Update Payment Request Authentication #438

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions src/CheckoutSdk/Common/Exemption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,32 @@ namespace Checkout.Common
{
public enum Exemption
{
[EnumMember(Value = "3ds_outage")] ThreeDsOutage,
[EnumMember(Value = "3ds_outage")]
ThreeDsOutage,

[EnumMember(Value = "low_risk_program")]
LowRiskProgram,

[EnumMember(Value = "low_value")] LowValue,
[EnumMember(Value = "none")] None,
[EnumMember(Value = "other")] Other,
[EnumMember(Value = "low_value")]
LowValue,

[EnumMember(Value = "none")]
None,

[EnumMember(Value = "other")]
Other,

[EnumMember(Value = "out_of_sca_scope")]
OutOfScaScope,

[EnumMember(Value = "recurring_operation")]
RecurringOperation,

[EnumMember(Value = "sca_delegation")] ScaDelegation,
[EnumMember(Value = "data_share")]
DataShare,

[EnumMember(Value = "sca_delegation")]
ScaDelegation,

[EnumMember(Value = "secure_corporate_payment")]
SecureCorporatePayment,
Expand Down
13 changes: 13 additions & 0 deletions src/CheckoutSdk/Payments/PreferredExperiences.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Runtime.Serialization;

namespace Checkout.Payments
{
public enum PreferredExperiences
{
[EnumMember(Value = "google_spa")]
GoogleSpa,

[EnumMember(Value = "3ds")]
ThreeDs,
}
}
9 changes: 9 additions & 0 deletions src/CheckoutSdk/Payments/Request/Authentication.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Collections.Generic;

namespace Checkout.Payments.Request
{
public class Authentication
{
public IList<PreferredExperiences> PreferredExperiences { get; set; }
}
}
2 changes: 2 additions & 0 deletions src/CheckoutSdk/Payments/Request/PaymentRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class PaymentRequest
public string Reference { get; set; }

public string Description { get; set; }

public Authentication Authentication { get; set; }

public AuthorizationType? AuthorizationType { get; set; }

Expand Down
35 changes: 35 additions & 0 deletions test/CheckoutSdkTest/Disputes/DisputesClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,24 @@ private async Task ShouldSubmitEvidence()
response.ShouldNotBeNull();
}

[Fact]
private async Task ShouldSubmitArbitrationEvidence()
{
const string disputeId = "dsp_s5151531";

_apiClient.Setup(apiClient =>
apiClient.Post<EmptyResponse>($"disputes/{disputeId}/evidence/arbitration", _authorization, null,
CancellationToken.None,
null))
.ReturnsAsync(() => new EmptyResponse());

IDisputesClient client = new DisputesClient(_apiClient.Object, _configuration.Object);

var response = await client.SubmitArbitrationEvidence(disputeId);

response.ShouldNotBeNull();
}

[Fact]
private async Task ShouldGetCompiledSubmittedEvidence()
{
Expand All @@ -148,6 +166,23 @@ private async Task ShouldGetCompiledSubmittedEvidence()

response.ShouldNotBeNull();
}

[Fact]
private async Task ShouldGetCompiledSubmittedArbitrationEvidence()
{
const string disputeId = "dispute_id";

_apiClient.Setup(apiClient =>
apiClient.Get<DisputeCompiledSubmittedEvidenceResponse>($"disputes/{disputeId}/evidence/arbitration/submitted", _authorization,
CancellationToken.None))
.ReturnsAsync(() => new DisputeCompiledSubmittedEvidenceResponse());

IDisputesClient client = new DisputesClient(_apiClient.Object, _configuration.Object);

var response = await client.GetCompiledSubmittedArbitrationEvidence(disputeId);

response.ShouldNotBeNull();
}

[Fact]
private async Task ShouldGetDisputeSchemeFiles()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ private async Task ShouldCreateAndGetHostedPayment()
createResponse.Reference.ShouldNotBeNullOrEmpty();
createResponse.Links.ShouldNotBeNull();
createResponse.Links.ContainsKey("redirect").ShouldBeTrue();
createResponse.Warnings.Count.ShouldBe(1);

var getResponse = await DefaultApi.HostedPaymentsClient().GetHostedPaymentsPageDetails(createResponse.Id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ private async Task ShouldCreateAndGetPaymentLink()
response.Links.ShouldNotBeNull();
response.Links.Count.ShouldBe(2);
response.Reference.ShouldNotBeNull();
response.Warnings.Count.ShouldBe(1);

var responseGet = await DefaultApi.PaymentLinksClient().Get(response.Id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Checkout.Payments.Sender;
using Shouldly;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xunit;

Expand Down Expand Up @@ -98,7 +99,15 @@ private async Task<PaymentResponse> MakeAuthorizationEstimatedPayment()
PartialAuthorization = new PartialAuthorization
{
Enabled = true
},
Authentication = new Authentication
{
PreferredExperiences = new List<PreferredExperiences>
{
PreferredExperiences.GoogleSpa
}
}

};

var paymentResponse = await DefaultApi.PaymentsClient().RequestPayment(paymentRequest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private async Task ShouldMakeIdealPayment()
source.Type().ShouldBe(PaymentSourceType.Ideal);
}

[Fact]
[Fact(Skip = "payment method not supported")]
private async Task ShouldMakeSofortPayment()
{
var sofortSource = new RequestSofortSource();
Expand Down
Loading