Feature/18 devkit pos system api supports query of payment result via post payresponse#22
Merged
MaximilianFT merged 4 commits intoMay 28, 2026
Conversation
… 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
There was a problem hiding this comment.
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)toPosAPIPayand an optionalhttpTimeoutSecondsparameter toUtils.InitFtPosSystemAPIClient. - Rework HOWTO_01 and HOWTO_08 payment flows to poll
/PayResponseafter a communication failure, with special handling for400 BadRequest(unknown operation ID). - Add integration tests
TestPayResponseByOperationIdandTestPayResponseByUnknownOperationId, plus a.vscode/settings.jsonauto-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
approved these changes
May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
/PayResponseendpoint. 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:
HOWTO_01_Payment_csharp/Program.csandHOWTO_08_pay_sign_issue_csharp/Program.csto implement the recommended pattern: after a failed/payrequest due to communication issues, the code now queries the payment status using/PayResponsewith the same operation ID, rather than retrying/payautomatically. 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:
GetPayResponseAsync(Guid operationId)method toPosAPIPay.cs, allowing clients to query the result of a previously started payment transaction by operation ID, with comprehensive documentation of API behavior.Utils.InitFtPosSystemAPIClientto accept an optional HTTP timeout parameter, making the API client initialization more flexible. [1] [2]Testing and validation:
IntegrationTestsPayment.cs: one verifies that/PayResponsereturns 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:
System.NetandSystem.Text.Jsonimports where required. [1] [2] [3]Development environment:
.vscode/settings.jsonto enable auto-approval for certain terminal commands, streamlining development workflows.