Skip to content

Conversation

@onbuyuka
Copy link
Contributor

@onbuyuka onbuyuka commented Jan 8, 2026

Summary

This PR improves the Shopify Payments synchronization logic by implementing targeted GraphQL queries to update payment transaction payout IDs and payout statuses in batches, rather than relying on the previous approach that coupled transaction imports with payout imports.

Changes

New GraphQL Codeunits

  • ShpfyGQLPaymTransByIds (ID 30421): New GraphQL query to retrieve payment transactions by ID filter, returning transaction IDs with their associated payout IDs
  • ShpfyGQLPayoutsByIds (ID 30420): New GraphQL query to retrieve payouts by ID filter, returning payout IDs with their statuses

GraphQL Type Enum Extension

  • Added new enum values GetPaymTransByIds (145) and GetPayoutsByIds (146) to ShpfyGraphQLType.Enum.al with implementations pointing to the new codeunits

Payments Codeunit Refactoring

  • ShpfyPayments.Codeunit.al:
    • Renamed SyncPaymentTransactions to SyncPayouts for clarity
    • Added new procedures: UpdatePaymentTransactionPayoutIds and UpdatePendingPayouts
    • Implemented batch processing (up to 200 at a time) for updating transactions without payout IDs and payouts with pending statuses
    • Organized code into #region Payouts and #region Disputes sections

Payments API Enhancements

  • ShpfyPaymentsAPI.Codeunit.al:
    • Added UpdatePaymentTransactionPayoutIds(IdFilter: Text) - queries Shopify for transactions by ID and updates their payout IDs
    • Added UpdatePayouts(IdFilter: Text) - queries Shopify for payouts by ID and updates their statuses
    • Simplified ImportPaymentTransactions signature (removed var parameter)
    • Simplified ImportPaymentTransaction to handle both new record creation and existing record updates
    • Added region organization for better code structure

Report Update

  • ShpfySyncPayments.Report.al: Updated to call the renamed SyncPayouts procedure

Permission Set Update

  • ShpfyObjects.PermissionSet.al: Added execute permissions for the two new GraphQL codeunits

Test Updates

  • ShpfyPaymentsTest.Codeunit.al: Updated test to use the simplified ImportPaymentTransaction signature

Benefits

  1. Targeted Updates: Payment transactions without payout IDs and pending payouts are now updated independently using efficient batch queries
  2. Better Performance: Batch processing with first: 200 reduces API calls when updating multiple records
  3. Cleaner Code: Reorganized with regions and simplified method signatures
  4. Maintainability: Separated concerns between importing new data and updating existing records

Work Item(s)

Fixes AB#617855

@github-actions github-actions bot added the AL: Apps (W1) Add-on apps for W1 label Jan 8, 2026
@onbuyuka onbuyuka marked this pull request as ready for review January 12, 2026 12:45
@onbuyuka onbuyuka requested a review from a team as a code owner January 12, 2026 12:45
@onbuyuka onbuyuka enabled auto-merge (squash) January 12, 2026 12:45
@github-actions github-actions bot added this to the Version 28.0 milestone Jan 12, 2026
@onbuyuka onbuyuka closed this Jan 13, 2026
auto-merge was automatically disabled January 13, 2026 08:59

Pull request was closed

@onbuyuka onbuyuka reopened this Jan 13, 2026
@onbuyuka onbuyuka enabled auto-merge (squash) January 13, 2026 08:59
@onbuyuka onbuyuka merged commit 03c2b5c into main Jan 15, 2026
93 of 96 checks passed
@onbuyuka onbuyuka deleted the private/onbuyuka/shpfypayoutrefactor branch January 15, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants