Skip to content

Feature/18 devkit pos system api supports query of payment result via post payresponse#22

Merged
MaximilianFT merged 4 commits into
mainfrom
feature/18-devkit-pos-system-api-supports-query-of-payment-result-via-post-payresponse
May 28, 2026
Merged

Feature/18 devkit pos system api supports query of payment result via post payresponse#22
MaximilianFT merged 4 commits into
mainfrom
feature/18-devkit-pos-system-api-supports-query-of-payment-result-via-post-payresponse

Conversation

@turtletramp
Copy link
Copy Markdown
Collaborator

This pull request improves the payment handling flow for the POS System API integration, focusing on robust recovery from communication failures and providing better documentation and test coverage for the /PayResponse endpoint. The main changes clarify the recommended retry pattern, implement support for querying payment status by operation ID, and add integration tests for these scenarios.

Enhancements to payment flow and error handling:

  • Updated the payment flow in HOWTO_01_Payment_csharp/Program.cs and HOWTO_08_pay_sign_issue_csharp/Program.cs to implement the recommended pattern: after a failed /pay request due to communication issues, the code now queries the payment status using /PayResponse with the same operation ID, rather than retrying /pay automatically. It also adds detailed comments and logging to clarify expected behaviors and edge cases, especially when the operation ID is unknown to the backend. [1] [2] [3] [4]

API and utility improvements:

  • Added the GetPayResponseAsync(Guid operationId) method to PosAPIPay.cs, allowing clients to query the result of a previously started payment transaction by operation ID, with comprehensive documentation of API behavior.
  • Modified Utils.InitFtPosSystemAPIClient to accept an optional HTTP timeout parameter, making the API client initialization more flexible. [1] [2]

Testing and validation:

  • Added two integration tests in IntegrationTestsPayment.cs: one verifies that /PayResponse returns the correct result for a known operation ID, and the other checks the behavior for an unknown operation ID, ensuring proper error handling and response validation.

Minor updates:

  • Added missing System.Net and System.Text.Json imports where required. [1] [2] [3]

Development environment:

  • Added .vscode/settings.json to enable auto-approval for certain terminal commands, streamlining development workflows.

… need for the ftPosAPIRunner) but UNTESTED because of an issue in backend POS System API (response with 422 status...)
…ery-of-payment-result-via-post-payresponse

# Conflicts:
#	HOWTO_01_Payment_csharp/Program.cs
#	HOWTO_08_pay_sign_issue_csharp/Program.cs
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements the recommended recovery pattern for /pay failures by introducing a new GetPayResponseAsync method that queries /PayResponse with the original operation ID, updates HOWTO_01 and HOWTO_08 to use this pattern instead of blindly retrying /pay, and adds integration tests for known and unknown operation IDs.

Changes:

  • Add GetPayResponseAsync(Guid operationId) to PosAPIPay and an optional httpTimeoutSeconds parameter to Utils.InitFtPosSystemAPIClient.
  • Rework HOWTO_01 and HOWTO_08 payment flows to poll /PayResponse after a communication failure, with special handling for 400 BadRequest (unknown operation ID).
  • Add integration tests TestPayResponseByOperationId and TestPayResponseByUnknownOperationId, plus a .vscode/settings.json auto-approve config.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
libPosSystemAPI/PosAPIClient/PosAPIPay.cs Adds GetPayResponseAsync for querying a previously started payment by operation ID.
libPosSystemAPI/PosAPIUtils/Utils.cs Makes the HTTP timeout configurable in InitFtPosSystemAPIClient.
HOWTO_01_Payment_csharp/Program.cs Switches from automatic /pay retry to polling /PayResponse, with BadRequest handling.
HOWTO_08_pay_sign_issue_csharp/Program.cs Replaces ftPosAPIOperationRunner for /pay with the new /PayResponse recovery loop.
libPosSystemAPI.Test/IntegrationTestsPayment.cs Adds integration tests for known/unknown operation IDs against /PayResponse.
.vscode/settings.json Adds chat terminal auto-approve entries for ForEach-Object and dotnet test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ErrorResponse? errorResponse = await payResponseResult.Operation.GetResponseErrorAsync();
Assert.NotNull(errorResponse);

Assert.Equal(404, errorResponse.Status);
Comment on lines +103 to +106
else
{
errorMsg = payResult.ErrorMessage;
}
@MaximilianFT MaximilianFT merged commit d5b9d3f into main May 28, 2026
2 checks passed
@MaximilianFT MaximilianFT deleted the feature/18-devkit-pos-system-api-supports-query-of-payment-result-via-post-payresponse branch May 28, 2026 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DevKit] POS System API supports query of payment result via POST /PayResponse

3 participants