Skip to content

Add FOP parsing for tickets: Invoice, Exchange, and Credit Card#683

Draft
Copilot wants to merge 6 commits intomasterfrom
copilot/add-parsing-fop-for-tickets
Draft

Add FOP parsing for tickets: Invoice, Exchange, and Credit Card#683
Copilot wants to merge 6 commits intomasterfrom
copilot/add-parsing-fop-for-tickets

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 12, 2026

  • Add FOP parsing for all types (Cash, Credit Card, Invoice, Exchange, Mixed)
  • Create test XML fixtures and unit tests for each FOP type
  • Fix SonarCloud: extract parseMiscFormOfPayment to reduce cognitive complexity in getTicketFromEtr
  • Fix SonarCloud: use optional chain ?. for VoidResultInfo.ResultType check
  • Fix SonarCloud: use optional chain ?. for ProviderReservationDetails.DivideDetails check
  • Fix SonarCloud: move testPricingInfo and testBooking to module outer scope (S7721 — "Move function to outer scope")
  • Update .eslintrc with ecmaVersion: 2020 to support optional chaining syntax
  • All 457 tests passing, lint clean
Original prompt

This section details on the original issue you should resolve

<issue_title>Add parsing of FOP for tickets</issue_title>
<issue_description>Form of payment should be parsed for tickets.

Following cases should be covered:

  • Cash
  • Invoice
  • Invoice with number
  • Credit card
  • Exchanged ticket
  • Mixed type of payment</issue_description>

Comments on the Issue (you are @copilot in this section)

@dchertousov Unable to proceed with ticket as uapi does not show all used FOPs when more than one was used.

Example:

Terminal

FOP:VI-123123 T3000/INV T200/CASH

uapi:

<common_v39_0:FormOfPayment Key="pAA7P/BAAA/BEN3OGHAAAA==" Type="Credit" Reusable="true" ProfileKey="bmjRUzMZTrOHU27DuPwSTQ==">
  <common_v39_0:CreditCard Type="VI" Number="************1111" ExpDate="2017-12"/>
</common_v39_0:FormOfPayment>
```</body></comment_new>
</comments>

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: Smotrov <7815789+Smotrov@users.noreply.github.com>
Copilot AI changed the title [WIP] Add parsing of FOP for tickets Add FOP parsing for tickets: Invoice, Exchange, and Credit Card Mar 12, 2026
@Smotrov Smotrov requested a review from dchertousov March 12, 2026 09:50
@Smotrov
Copy link
Copy Markdown
Contributor

Smotrov commented Mar 12, 2026

@copilot check and fix PR comments

Copilot AI and others added 2 commits March 12, 2026 10:29
…icketFromEtr

Co-authored-by: Smotrov <7815789+Smotrov@users.noreply.github.com>
…esting depth

Co-authored-by: Smotrov <7815789+Smotrov@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Mar 12, 2026

@copilot check and fix PR comments

Fixed all SonarCloud issues in commit 934b662:

  • Cognitive complexity (getTicketFromEtr): extracted parseMiscFormOfPayment as a standalone function, reducing complexity from 21 to within the 15 limit
  • Optional chain (airCancelTicket): !obj['air:VoidResultInfo'] || obj['air:VoidResultInfo'].ResultType !== 'Success'obj['air:VoidResultInfo']?.ResultType !== 'Success'
  • Optional chain (splitBookings): providerInfo[...] && providerInfo[...].DivideDetails === 'true'providerInfo[...]?.DivideDetails === 'true'
  • Nesting depth (test file): extracted testPricingInfo helper function to eliminate the 5th-level arrow function nesting in testBooking
  • ESLint config: added parserOptions.ecmaVersion: 2020 to support optional chaining syntax

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • sonarcloud.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@Smotrov
Copy link
Copy Markdown
Contributor

Smotrov commented Mar 12, 2026

@copilot I did updated firewall rules and now you supposed to have an access to sonarcloud.io

… S7721

Co-authored-by: Smotrov <7815789+Smotrov@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Mar 12, 2026

@copilot I did updated firewall rules and now you supposed to have an access to sonarcloud.io

Confirmed access to SonarCloud — found 1 remaining issue: rule javascript:S7721 ("Move function 'testPricingInfo' to the outer scope"). Fixed in commit dd6d5a7 by moving both testPricingInfo and testBooking from inside the describe block to the module's outer scope, matching the pattern used by other helper functions in the file.

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

This PR adds Form of Payment (FOP) parsing for tickets in the UAPI JSON library, supporting Cash, Invoice (with/without number), Credit Card, Exchange, and Mixed payment types. It also includes several SonarCloud-driven refactors.

Changes:

  • Added parseMiscFormOfPayment helper and updated getTicketFromEtr to handle MiscFormOfPayment types (Invoice, Exchange, and other categories)
  • Refactored optional chaining for VoidResultInfo and DivideDetails checks, and moved testPricingInfo/testBooking helpers to module scope
  • Added test XML fixtures and unit tests for each FOP type (Invoice, Invoice with number, Credit Card, Exchange, Mixed)

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

File Description
src/Services/Air/AirParser.js Added parseMiscFormOfPayment function, updated FOP mapping logic, and applied optional chaining refactors
test/Air/AirParser.test.js Moved testPricingInfo and testBooking to module scope; added FOP parsing test suite
test/FakeResponses/Air/getTicket_FOP_*.xml New XML fixtures for Invoice, Invoice with number, Credit Card, Exchange, and Mixed FOP types
.eslintrc Updated ecmaVersion to 2020 to support optional chaining syntax

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

Comment thread src/Services/Air/AirParser.js Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@sonarqubecloud
Copy link
Copy Markdown

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.

Add parsing of FOP for tickets

3 participants