diff --git a/README.md b/README.md index 1197cceac3..5414a297fb 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ support, please wait for a future, stable release. - Collect and store payment details for future usage. - Collect and replace current payment details (Subscriptions) - Instrument Mode (Build your own menu) + - Customise payment selection & favorite method ## Sample App diff --git a/src/Samples/Sample.AspNetCore/Controllers/CheckOutController.cs b/src/Samples/Sample.AspNetCore/Controllers/CheckOutController.cs index 835d5ad121..97147e2645 100644 --- a/src/Samples/Sample.AspNetCore/Controllers/CheckOutController.cs +++ b/src/Samples/Sample.AspNetCore/Controllers/CheckOutController.cs @@ -161,7 +161,9 @@ public async Task CreatePaymentOrder(bool? generatePaymen new PayeeInfo(_payeeInfoOptions.PayeeReference) { PayeeId = _payeeInfoOptions.PayeeId, - OrderReference = $"PO-{DateTime.UtcNow.Ticks}" + OrderReference = $"PO-{DateTime.UtcNow.Ticks}", + Subsite = "TestSubsiteId", + SiteId = "TestSiteId" }) { OrderItems = paymentOrderItems diff --git a/src/SwedbankPay.Sdk.Infrastructure/PayeeInfoDto.cs b/src/SwedbankPay.Sdk.Infrastructure/PayeeInfoDto.cs index bf4f3f8701..0c85f09f28 100644 --- a/src/SwedbankPay.Sdk.Infrastructure/PayeeInfoDto.cs +++ b/src/SwedbankPay.Sdk.Infrastructure/PayeeInfoDto.cs @@ -8,10 +8,14 @@ public PayeeInfoDto(PayeeInfo payeeInfo) PayeeReference = payeeInfo.PayeeReference; PayeeName = payeeInfo.PayeeName; OrderReference = payeeInfo.OrderReference; + Subsite = payeeInfo.Subsite; + SiteId = payeeInfo.SiteId; } public string? PayeeId { get; init; } public string PayeeReference { get; init; } public string? PayeeName { get; init; } public string? OrderReference { get; init; } + public string? Subsite { get; init; } + public string? SiteId { get; init; } } \ No newline at end of file diff --git a/src/SwedbankPay.Sdk.Infrastructure/PaymentOrder/PayeeInfo/PayeeInfoResponse.cs b/src/SwedbankPay.Sdk.Infrastructure/PaymentOrder/PayeeInfo/PayeeInfoResponse.cs index 96d0022c75..e5826c5434 100644 --- a/src/SwedbankPay.Sdk.Infrastructure/PaymentOrder/PayeeInfo/PayeeInfoResponse.cs +++ b/src/SwedbankPay.Sdk.Infrastructure/PaymentOrder/PayeeInfo/PayeeInfoResponse.cs @@ -11,6 +11,8 @@ internal record PayeeInfoResponse : Identifiable, IPayeeInfoResponse public string? CorporationId { get; init; } public string? CorporationName { get; init; } public string? SalesChannel { get; init; } + public string? Subsite { get; init; } + public string? SiteId { get; init; } internal PayeeInfoResponse(PayeeInfoResponseDto dto) : base(dto.Id) { @@ -21,5 +23,7 @@ internal PayeeInfoResponse(PayeeInfoResponseDto dto) : base(dto.Id) CorporationId = dto.CorporationId; CorporationName = dto.CorporationName; SalesChannel = dto.SalesChannel; + Subsite = dto.Subsite; + SiteId = dto.SiteId; } } \ No newline at end of file diff --git a/src/SwedbankPay.Sdk.Infrastructure/PaymentOrder/PayeeInfo/PayeeInfoResponseDto.cs b/src/SwedbankPay.Sdk.Infrastructure/PaymentOrder/PayeeInfo/PayeeInfoResponseDto.cs index d84fda0724..f7178defe8 100644 --- a/src/SwedbankPay.Sdk.Infrastructure/PaymentOrder/PayeeInfo/PayeeInfoResponseDto.cs +++ b/src/SwedbankPay.Sdk.Infrastructure/PaymentOrder/PayeeInfo/PayeeInfoResponseDto.cs @@ -11,6 +11,8 @@ internal record PayeeInfoResponseDto : IdentifiableDto public string? CorporationId { get; init; } public string? CorporationName { get; init; } public string? SalesChannel { get; init; } + public string? Subsite { get; init; } + public string? SiteId { get; init; } public IPayeeInfoResponse Map() { diff --git a/src/SwedbankPay.Sdk.Infrastructure/PaymentOrder/PaymentOrderDto.cs b/src/SwedbankPay.Sdk.Infrastructure/PaymentOrder/PaymentOrderDto.cs index a1461c14c8..74cd4ff484 100644 --- a/src/SwedbankPay.Sdk.Infrastructure/PaymentOrder/PaymentOrderDto.cs +++ b/src/SwedbankPay.Sdk.Infrastructure/PaymentOrder/PaymentOrderDto.cs @@ -22,6 +22,8 @@ internal PaymentOrderDto(PaymentOrderRequest paymentOrderRequest) PaymentToken = paymentOrderRequest.PaymentToken; GeneratePaymentToken = paymentOrderRequest.GeneratePaymentToken; Language = paymentOrderRequest.Language.ToString(); + ExpandFirstInstrument = paymentOrderRequest.ExpandFirstInstrument; + RestrictedToInstruments = paymentOrderRequest.RestrictedToInstruments?.Select(x => x.Value).ToArray(); GenerateRecurrenceToken = paymentOrderRequest.GenerateRecurrenceToken; GenerateUnscheduledToken = paymentOrderRequest.GenerateUnscheduledToken; DisableStoredPaymentDetails = paymentOrderRequest.DisableStoredPaymentDetails; @@ -59,6 +61,8 @@ internal PaymentOrderDto(PaymentOrderRequest paymentOrderRequest) public bool? GeneratePaymentToken { get; } public string? PaymentToken { get; } public string Language { get; } + public string[]? RestrictedToInstruments { get; } + public bool? ExpandFirstInstrument { get; } public bool? GenerateRecurrenceToken { get; } public bool? GenerateUnscheduledToken { get; } public bool? DisableStoredPaymentDetails { get; } diff --git a/src/SwedbankPay.Sdk/IPayeeInfo.cs b/src/SwedbankPay.Sdk/IPayeeInfo.cs deleted file mode 100644 index aba6199f47..0000000000 --- a/src/SwedbankPay.Sdk/IPayeeInfo.cs +++ /dev/null @@ -1,45 +0,0 @@ -namespace SwedbankPay.Sdk; - -/// -/// Identifies the merchant that initiated the payment. -/// -public interface IPayeeInfo -{ - /// - /// The order reference should reflect the order reference found in the merchant's systems. - /// - string OrderReference { get; } - - /// - /// This is the unique id that identifies this payee (like merchant) set by PayEx. - /// - string PayeeId { get; } - - /// - /// The name of the payee, usually the name of the merchant. - /// - string PayeeName { get; } - - /// - /// A unique reference, max 30 characters, set by the merchant system - this must be unique for each operation! - /// NOTE://PayEx may send either the transaction number OR the payeeReference as a reference to the acquirer. - /// This will be used in reconciliation and reporting back to PayEx and you. - /// If PayEx sends the transaction number to the acquirer, then the payeeReference parameter may have the format of - /// String(30). - /// If PayEx sends the payeeRef to the acquirer, the parameter is limited to the format of String(12) AND all - /// characters must be digits/numbers. - /// - string PayeeReference { get; } - - /// - /// A product category or number sent in from the payee/merchant. This is not validated by PayEx, but will be passed - /// through the payment process and may be used in the settlement process.9 - /// - string ProductCategory { get; } - - /// - /// The subsite field can be used to perform split settlement on the payment. The subsites must be resolved with PayEx - /// reconciliation before being used. - /// - string Subsite { get; } -} \ No newline at end of file diff --git a/src/SwedbankPay.Sdk/PayeeInfo.cs b/src/SwedbankPay.Sdk/PayeeInfo.cs index 1ac3e8d148..92d5389fb3 100644 --- a/src/SwedbankPay.Sdk/PayeeInfo.cs +++ b/src/SwedbankPay.Sdk/PayeeInfo.cs @@ -1,9 +1,47 @@ namespace SwedbankPay.Sdk; +/// +/// Identifies the merchant that initiated the payment. +/// public record PayeeInfo(string PayeeReference) { + /// + /// The name of the payee, usually the name of the merchant. + /// public string? PayeeName { get; init; } + + /// + /// The order reference should reflect the order reference found in the merchant's systems. + /// public string? OrderReference { get; init; } + + /// + /// This is the unique id that identifies this payee (like merchant) set by PayEx. + /// public string? PayeeId { get; init; } + + /// + /// A unique reference, max 30 characters, set by the merchant system - this must be unique for each operation! + /// NOTE://PayEx may send either the transaction number OR the payeeReference as a reference to the acquirer. + /// This will be used in reconciliation and reporting back to PayEx and you. + /// If PayEx sends the transaction number to the acquirer, then the payeeReference parameter may have the format of + /// String(30). + /// If PayEx sends the payeeRef to the acquirer, the parameter is limited to the format of String(12) AND all + /// characters must be digits/numbers. + /// public string PayeeReference { get; } = PayeeReference; + + /// + /// The subsite field can be used to perform split settlement on the payment. + /// The different subsite values must be resolved with Swedbank Pay reconciliation before being used. + /// If you send in an unknown subsite value, it will be ignored and the payment will be settled using the merchant’s default settlement account. + /// Must be in the format of A-Za-z0-9. + /// + public string? Subsite { get; init; } + + /// + /// siteId is used for split settlement transactions when you, as a merchant, need to specify towards AMEX which sub-merchant the transaction belongs to. + /// Must be in the format of A-Za-z0-9. + /// + public string? SiteId { get; init; } } \ No newline at end of file diff --git a/src/SwedbankPay.Sdk/PaymentOrder/PayeeInfo/IPayeeInfoResponse.cs b/src/SwedbankPay.Sdk/PaymentOrder/PayeeInfo/IPayeeInfoResponse.cs index 5c9c4da77d..de7da008c5 100644 --- a/src/SwedbankPay.Sdk/PaymentOrder/PayeeInfo/IPayeeInfoResponse.cs +++ b/src/SwedbankPay.Sdk/PaymentOrder/PayeeInfo/IPayeeInfoResponse.cs @@ -9,4 +9,6 @@ public interface IPayeeInfoResponse public string? CorporationId { get; } public string? CorporationName { get; } public string? SalesChannel { get; } + public string? Subsite { get; init; } + public string? SiteId { get; init; } } \ No newline at end of file diff --git a/src/SwedbankPay.Sdk/PaymentOrder/PaymentOrderRequest.cs b/src/SwedbankPay.Sdk/PaymentOrder/PaymentOrderRequest.cs index 9eae42729d..a608885126 100644 --- a/src/SwedbankPay.Sdk/PaymentOrder/PaymentOrderRequest.cs +++ b/src/SwedbankPay.Sdk/PaymentOrder/PaymentOrderRequest.cs @@ -27,6 +27,8 @@ public record PaymentOrderRequest( public bool? GeneratePaymentToken { get; set; } public string? PaymentToken { get; set; } public Language Language { get; } = Language; + public bool? ExpandFirstInstrument { get; set; } + public List? RestrictedToInstruments { get; set; } public bool? GenerateRecurrenceToken { get; set; } public bool? GenerateUnscheduledToken { get; set; } public bool? DisableStoredPaymentDetails { get; set; }