Skip to content
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
11 changes: 10 additions & 1 deletion src/CheckoutSdk/CheckoutApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Checkout.Forward;
using Checkout.Instruments;
using Checkout.Metadata;
using Checkout.NetworkTokens;
using Checkout.Payments;
using Checkout.Payments.Contexts;
using Checkout.Payments.Hosted;
Expand All @@ -29,7 +30,7 @@
private readonly IPaymentsClient _paymentsClient;
private readonly IInstrumentsClient _instrumentsClient;
private readonly IDisputesClient _disputesClient;
private readonly IRiskClient _riskClient;

Check warning on line 33 in src/CheckoutSdk/CheckoutApi.cs

View workflow job for this annotation

GitHub Actions / NET 3.1

'IRiskClient' is obsolete: 'Risk endpoints are no longer supported officially, This module will be removed in a future release.'
private readonly IForexClient _forexClient;
private readonly IWorkflowsClient _workflowsClient;
private readonly ISessionsClient _sessionsClient;
Expand All @@ -45,6 +46,7 @@
private readonly IPaymentContextsClient _paymentContextsClient;
private readonly IPaymentSessionsClient _paymentSessionsClient;
private readonly IForwardClient _forwardClient;
private readonly INetworkTokensClient _networkTokensClient;

public CheckoutApi(CheckoutConfiguration configuration)
{
Expand Down Expand Up @@ -75,6 +77,7 @@
_paymentContextsClient = new PaymentContextsClient(baseApiClient, configuration);
_paymentSessionsClient = new PaymentSessionsClient(baseApiClient, configuration);
_forwardClient = new ForwardClient(baseApiClient, configuration);
_networkTokensClient = new NetworkTokensClient(baseApiClient, configuration);
}

private static ApiClient BaseApiClient(CheckoutConfiguration configuration)
Expand Down Expand Up @@ -133,7 +136,7 @@
return _disputesClient;
}

public IRiskClient RiskClient()

Check warning on line 139 in src/CheckoutSdk/CheckoutApi.cs

View workflow job for this annotation

GitHub Actions / NET 3.1

'IRiskClient' is obsolete: 'Risk endpoints are no longer supported officially, This module will be removed in a future release.'
{
return _riskClient;
}
Expand Down Expand Up @@ -212,5 +215,11 @@
{
return _forwardClient;
}

public INetworkTokensClient NetworkTokensClient()
{
return _networkTokensClient;
}

}
}
}
5 changes: 5 additions & 0 deletions src/CheckoutSdk/Common/Resource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ public Link GetUploadLink()
return GetLink("upload");
}

public Link GetCryptogramLink()
{
return GetLink("cryptogram");
}

public bool HasLink(string relation)
{
return Links.ContainsKey(relation);
Expand Down
15 changes: 14 additions & 1 deletion src/CheckoutSdk/Forward/ForwardClient.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using Checkout.Forward.Requests;
using Checkout.Forward.Responses;
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Checkout.Forward
{
/// <summary>
/// Forward
/// </summary>
public class ForwardClient : AbstractClient, IForwardClient
{
private const string Forward = "forward";
Expand All @@ -15,6 +17,12 @@ public ForwardClient(IApiClient apiClient, CheckoutConfiguration configuration)
{
}

/// <summary>
/// Forward an API request
/// [BETA]
/// Forwards an API request to a third-party endpoint.
/// For example, you can forward payment credentials you've stored in our Vault to a third-party payment processor.
/// </summary>
public Task<ForwardAnApiResponse> ForwardAnApiRequest(ForwardRequest forwardRequest,
CancellationToken cancellationToken = default)
{
Expand All @@ -27,6 +35,11 @@ public Task<ForwardAnApiResponse> ForwardAnApiRequest(ForwardRequest forwardRequ
);
}

/// <summary>
/// Get forward request
/// Retrieve the details of a successfully forwarded API request.
/// The details can be retrieved for up to 14 days after the request was initiated.
/// </summary>
public Task<GetForwardResponse> GetForwardRequest(string forwardId,
CancellationToken cancellationToken = default)
{
Expand Down
17 changes: 10 additions & 7 deletions src/CheckoutSdk/Forward/IForwardClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,24 @@

namespace Checkout.Forward
{
/// <summary>
/// Forward
/// </summary>
public interface IForwardClient
{
/// <summary>
/// Forward an API request<br />
/// <b>Beta</b><br />
/// Forwards an API request to a third-party endpoint.<br />
/// For example, you can forward payment credentials you've stored in our Vault to a third-party payment processor.
/// Forward an API request
/// [BETA]
/// Forwards an API request to a third-party endpoint.
/// For example, you can forward payment credentials you've stored in our Vault to a third-party payment processor.
/// </summary>
Task<ForwardAnApiResponse> ForwardAnApiRequest(ForwardRequest forwardRequest,
CancellationToken cancellationToken = default);

/// <summary>
/// Get forward request<br />
/// Retrieve the details of a successfully forwarded API request.<br />
/// The details can be retrieved for up to 14 days after the request was initiated.
/// Get forward request
/// Retrieve the details of a successfully forwarded API request.
/// The details can be retrieved for up to 14 days after the request was initiated.
/// </summary>
Task<GetForwardResponse> GetForwardRequest(string forwardId, CancellationToken cancellationToken = default);
}
Expand Down
5 changes: 4 additions & 1 deletion src/CheckoutSdk/ICheckoutApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Checkout.Forward;
using Checkout.Instruments;
using Checkout.Metadata;
using Checkout.NetworkTokens;
using Checkout.Payments;
using Checkout.Payments.Contexts;
using Checkout.Payments.Hosted;
Expand All @@ -34,7 +35,7 @@

IDisputesClient DisputesClient();

IRiskClient RiskClient();

Check warning on line 38 in src/CheckoutSdk/ICheckoutApi.cs

View workflow job for this annotation

GitHub Actions / NET 3.1

'IRiskClient' is obsolete: 'Risk endpoints are no longer supported officially, This module will be removed in a future release.'

IForexClient ForexClient();

Expand Down Expand Up @@ -65,5 +66,7 @@
IPaymentSessionsClient PaymentSessionsClient();

IForwardClient ForwardClient();

INetworkTokensClient NetworkTokensClient();
}
}
}
14 changes: 14 additions & 0 deletions src/CheckoutSdk/NetworkTokens/Common/Responses/Card.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Checkout.NetworkTokens.Common.Responses
{
public class Card
{
/// <summary> The last four digits of the card number (Required, constraints: ^[0-9]{4}$) </summary>
public string Last4 { get; set; }

/// <summary> The card's expiration month (Required, constraints: [ 1 .. 12 ], ^[0-9]{1,2}$) </summary>
public string ExpiryMonth { get; set; }

/// <summary> The card's expiration year (Required, constraints: ^[0-9]{4}$) </summary>
public string ExpiryYear { get; set; }
}
}
45 changes: 45 additions & 0 deletions src/CheckoutSdk/NetworkTokens/Common/Responses/NetworkToken.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
namespace Checkout.NetworkTokens.Common.Responses
{
public class NetworkToken
{
/// <summary> Unique token ID assigned by Checkout.com for each token (Required) </summary>
public string Id { get; set; }

/// <summary> Token status (Required) </summary>
public StateType State { get; set; }

/// <summary>
/// The network token number. This field is only returned when the network token status is one of the
/// following: active, suspended, inactive (Constraints: ^[0-9]+$)
/// </summary>
public string Number { get; set; }

/// <summary>
/// The network token's expiration month. This field is only returned when the network token status is
/// one of the following: active, suspended, inactive (Constraints: ^[0-9]{1,2}$)
/// </summary>
public string ExpiryMonth { get; set; }

/// <summary>
/// The network token's expiration year. This field is only returned when the network token status is
/// one of the following: active, suspended, inactive (Constraints: ^[0-9]{4}$)
/// </summary>
public string ExpiryYear { get; set; }

/// <summary> The type of token (Required) </summary>
public NetworkTokenType Type { get; set; }

/// <summary> When the network token was created (Required) </summary>
public string CreatedOn { get; set; }

/// <summary> When the network token was modified (Required) </summary>
public string ModifiedOn { get; set; }

/// <summary>
/// Unique Payment account reference value assigned to payment account. All affiliated payment tokens,
/// as well as the underlying PAN, have the same payment_account_reference (Optional)
/// </summary>
public string PaymentAccountReference { get; set; }

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Checkout.Common;

namespace Checkout.NetworkTokens.Common.Responses
{
public class NetworkTokenResponse : Resource
{
/// <summary> The card details (Required) </summary>
public Card Card { get; set; }

/// <summary> Network token details (Required) </summary>
public NetworkToken NetworkToken { get; set; }

/// <summary> Token requestor ID (Optional) </summary>
public string TokenRequestorId { get; set; }
}
}
12 changes: 12 additions & 0 deletions src/CheckoutSdk/NetworkTokens/Common/Responses/NetworkTokenType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Runtime.Serialization;

namespace Checkout.NetworkTokens.Common.Responses
{
public enum NetworkTokenType
{
[EnumMember(Value = "vts")] Vts,

[EnumMember(Value = "mdes")] Mdes,

}
}
22 changes: 22 additions & 0 deletions src/CheckoutSdk/NetworkTokens/Common/Responses/StateType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Runtime.Serialization;

namespace Checkout.NetworkTokens.Common.Responses
{
public enum StateType
{
[EnumMember(Value = "active")]
Active,

[EnumMember(Value = "suspended")]
Suspended,

[EnumMember(Value = "inactive")]
Inactive,

[EnumMember(Value = "declined")]
Declined,

[EnumMember(Value = "requested")]
Requested
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Checkout.NetworkTokens.Common.Responses;

namespace Checkout.NetworkTokens.GetNetworkTokens.Responses
{
public class NetworkTokenByIdResponse : NetworkTokenResponse
{

}
}
59 changes: 59 additions & 0 deletions src/CheckoutSdk/NetworkTokens/INetworkTokensClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using Checkout.NetworkTokens.GetNetworkTokens.Responses;
using Checkout.NetworkTokens.PatchDelete.Requests;
using Checkout.NetworkTokens.PostCryptograms.Requests;
using Checkout.NetworkTokens.PostCryptograms.Responses;
using Checkout.NetworkTokens.PostNetworkTokens.Requests;
using Checkout.NetworkTokens.PostNetworkTokens.Responses;
using System.Threading;
using System.Threading.Tasks;

namespace Checkout.NetworkTokens
{
/// <summary>
/// Network Tokens
/// </summary>
public interface INetworkTokensClient
{
/// <summary>
/// Provision a Network Token
/// [BETA]
/// Provisions a network token synchronously. If the merchant stores their cards with Checkout.com, then
/// source ID can be used to request a network token for the given card. If the merchant does not store their
/// cards with Checkout.com, then card details have to be provided.
/// </summary>
Task<ProvisionANetworkTokenResponse> ProvisionANetworkToken(
ProvisionANetworkTokenRequest provisionANetworkTokenRequest,
CancellationToken cancellationToken = default);

/// <summary>
/// Get Network Token
/// [BETA]
/// Given network token ID, this endpoint returns network token details: DPAN, expiry date, state, TRID and also
/// card details like last four and expiry date.
/// </summary>
Task<NetworkTokenByIdResponse> GetNetworkToken(
string networkTokenId,
CancellationToken cancellationToken = default);

/// <summary>
/// Request a cryptogram
/// [BETA]
/// Using network token ID as an input, this endpoint returns token cryptogram.
/// </summary>
Task<NetworkTokenCryptogramResponse> RequestACryptogram(
string networkTokenId,
NetworkTokenCryptogramRequest networkTokenCryptogramRequest,
CancellationToken cancellationToken = default);

/// <summary>
/// Permanently deletes a network token
/// [BETA]
/// This endpoint is for permanently deleting a network token. A network token should be deleted when a payment
/// instrument it is associated with is removed from file or if the security of the token has been compromised.
/// </summary>
Task<EmptyResponse> PermanentlyDeletesANetworkToken(
string networkTokenId,
PermanentlyDeleteANetworkTokenRequest permanentlyDeleteANetworkTokenRequest,
CancellationToken cancellationToken = default);
}
}
Loading
Loading