Skip to content

Commit

Permalink
Rename to 'saleReferenceId' property to 'saleTransactionId'
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwok-he-Chu committed Oct 16, 2023
1 parent c91fba0 commit 06b34a9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
9 changes: 6 additions & 3 deletions in-person-payments-example/Models/PaymentStatusDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ public class PaymentStatusDetails

/// <summary>
/// The POI Transaction Id, populated when a <see cref="TableStatus"/> is set to <see cref="PaymentStatus.Paid"/>.
/// Example value: CmI6001693237705007.TG6DVRZ3HVTFWR82.
/// Format: "PoiTransactionId.PspReference"
/// Example value: "CmI6001693237705007.TG6DVRZ3HVTFWR82" - The second part after the period refers to the PspReference.
/// If you abort the transaction, no PspReference is appended after the period, e.g. "CmI6001693237705007".
/// </summary>
public string PoiTransactionId { get; set; } = null;

Expand All @@ -25,8 +27,9 @@ public class PaymentStatusDetails
public DateTime? PoiTransactionTimeStamp { get; set; } = null;

/// <summary>
/// The SaleTransactionId (SaleReferenceId), populated when a <see cref="TableStatus"/> is set to <see cref="PaymentStatus.Paid"/>.
/// Example value: 6abcb27d-9082-40d9-969d-1c7f283ebd52.
/// The SaleTransactionId populated when a <see cref="TableStatus"/> is set to <see cref="PaymentStatus.Paid"/>.
/// This appears as your "MerchantReference" in the customer area.
/// Example value: "6abcb27d-9082-40d9-969d-1c7f283ebd52"
/// </summary>
public string SaleTransactionId { get; set; } = null;

Expand Down
23 changes: 15 additions & 8 deletions in-person-payments-example/Services/PosReversalService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public interface IPosReversalService
/// For error-scenarios, see: https://docs.adyen.com/point-of-sale/error-scenarios/#error-conditions.
/// </summary>
/// <param name="reversalReasonType"><see cref="ReversalReasonType"/>.</param>
/// <param name="saleReferenceId">Unique Id of a sale global transaction. Appears as MerchantReference in your Customer Area.</param>
/// <param name="saleTransactionId">Unique Id of a sale global transaction. Appears as MerchantReference in your Customer Area.</param>
/// <param name="poiTransactionId">Unique Id of a POI transaction.</param>
/// <param name="poiId">Your unique ID of the terminal to send this request to. Format: [device model]-[serial number]. Seealso <seealso cref="Options.AdyenOptions.ADYEN_POS_POI_ID"/></param>
/// <param name="saleId">Your unique ID for the POS system (cash register) to send this request from. Seealso <see cref="Options.AdyenOptions.ADYEN_POS_SALE_ID"/>.</param>
/// <param name="cancellationToken"><see cref="CancellationToken"/>.</param>
/// <returns><see cref="SaleToPOIResponse"/>.</returns>
Task<SaleToPOIResponse> SendReversalRequestAsync(ReversalReasonType reversalReasonType, string saleReferenceId, string poiTransactionId, string poiId, string saleId, CancellationToken cancellationToken = default);
Task<SaleToPOIResponse> SendReversalRequestAsync(ReversalReasonType reversalReasonType, string saleTransactionId, string poiTransactionId, string poiId, string saleId, CancellationToken cancellationToken = default);
}

public class PosReversalService : IPosReversalService
Expand All @@ -34,13 +34,13 @@ public PosReversalService(IPosPaymentCloudApi posPaymentCloudApi)
_posPaymentCloudApi = posPaymentCloudApi;
}

public Task<SaleToPOIResponse> SendReversalRequestAsync(ReversalReasonType reversalReasonType, string saleReferenceId, string poiTransactionId, string poiId, string saleId, CancellationToken cancellationToken)
public Task<SaleToPOIResponse> SendReversalRequestAsync(ReversalReasonType reversalReasonType, string saleTransactionId, string poiTransactionId, string poiId, string saleId, CancellationToken cancellationToken)
{
SaleToPOIRequest request = GetReversalRequest(reversalReasonType, saleReferenceId, poiTransactionId, poiId, saleId);
SaleToPOIRequest request = GetReversalRequest(reversalReasonType, saleTransactionId, poiTransactionId, poiId, saleId);
return _posPaymentCloudApi.TerminalApiCloudSynchronousAsync(request);
}

private SaleToPOIRequest GetReversalRequest(ReversalReasonType reversalReasonType, string saleReferenceId, string poiTransactionId, string poiId, string saleId)
private SaleToPOIRequest GetReversalRequest(ReversalReasonType reversalReasonType, string saleTransactionId, string poiTransactionId, string poiId, string saleId)
{
SaleToPOIRequest request = new SaleToPOIRequest()
{
Expand All @@ -63,10 +63,17 @@ private SaleToPOIRequest GetReversalRequest(ReversalReasonType reversalReasonTyp
{
TimeStamp = DateTime.UtcNow,
TransactionID = poiTransactionId
}
},
},
ReversalReason = reversalReasonType,
SaleReferenceID = saleReferenceId
SaleData = new SaleData()
{
SaleTransactionID = new TransactionIdentification()
{
TimeStamp = DateTime.UtcNow,
TransactionID = saleTransactionId
}
},
ReversalReason = reversalReasonType
}
};

Expand Down

0 comments on commit 06b34a9

Please sign in to comment.