Skip to content

Commit

Permalink
Merge pull request #636 from SwedbankPay/release/4.1.0
Browse files Browse the repository at this point in the history
Release/4.1.0
  • Loading branch information
zunkas authored May 22, 2024
2 parents 1cca999 + d30ded6 commit 4a963b3
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 46 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ public async Task<IPaymentOrderResponse> 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
Expand Down
4 changes: 4 additions & 0 deletions src/SwedbankPay.Sdk.Infrastructure/PayeeInfoDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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; }
Expand Down
45 changes: 0 additions & 45 deletions src/SwedbankPay.Sdk/IPayeeInfo.cs

This file was deleted.

38 changes: 38 additions & 0 deletions src/SwedbankPay.Sdk/PayeeInfo.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,47 @@
namespace SwedbankPay.Sdk;

/// <summary>
/// Identifies the merchant that initiated the payment.
/// </summary>
public record PayeeInfo(string PayeeReference)
{
/// <summary>
/// The name of the payee, usually the name of the merchant.
/// </summary>
public string? PayeeName { get; init; }

/// <summary>
/// The order reference should reflect the order reference found in the merchant's systems.
/// </summary>
public string? OrderReference { get; init; }

/// <summary>
/// This is the unique id that identifies this payee (like merchant) set by PayEx.
/// </summary>
public string? PayeeId { get; init; }

/// <summary>
/// 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.
/// </summary>
public string PayeeReference { get; } = PayeeReference;

/// <summary>
/// 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.
/// </summary>
public string? Subsite { get; init; }

/// <summary>
/// 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.
/// </summary>
public string? SiteId { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
2 changes: 2 additions & 0 deletions src/SwedbankPay.Sdk/PaymentOrder/PaymentOrderRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PaymentInstrument>? RestrictedToInstruments { get; set; }
public bool? GenerateRecurrenceToken { get; set; }
public bool? GenerateUnscheduledToken { get; set; }
public bool? DisableStoredPaymentDetails { get; set; }
Expand Down

0 comments on commit 4a963b3

Please sign in to comment.