Skip to content

Commit

Permalink
Add Subsite and SiteId to PayeeInfo (#635)
Browse files Browse the repository at this point in the history
* Add Subsite and SiteId to PayeeInfo

The PayeeInfo class and related interfaces and DTOs have been extended with Subsite and SiteId properties. The IPayeeInfo interface has been removed and its functionality moved to the PayeeInfo record. The changes provide a more consistent and useful model for working with payee information.

* Refactor PayeeInfo class and add SiteId property

This update refactors the PayeeInfo class, removing unnecessary spaces, and improving the explanation of the Subsite property. A new property, SiteId has been added for handling split settlement transactions. The SiteId is used to specify the sub-merchant for AMEX transactions.
  • Loading branch information
lounge authored May 20, 2024
1 parent c6d1764 commit c2f7096
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 46 deletions.
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
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; }
}

0 comments on commit c2f7096

Please sign in to comment.