Skip to content

[Shopify] Automatic Transaction Posting#9525

Draft
onbuyuka wants to merge 2 commits into
mainfrom
bugs/620951-shopify-automatic-transaction-posting
Draft

[Shopify] Automatic Transaction Posting#9525
onbuyuka wants to merge 2 commits into
mainfrom
bugs/620951-shopify-automatic-transaction-posting

Conversation

@onbuyuka

@onbuyuka onbuyuka commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Introduces automatic posting of Shopify order/refund payment transactions as general journal lines when the related invoice or credit memo is posted in Business Central. This is a reworked, hardened version of the feature originally proposed in #6515.

Changes

New functionality

  • Automatic-posting setup on Shpfy Payment Method Mapping (table + page): Post Automatically, Auto-Post Jnl. Template, Auto-Post Jnl. Batch (validated to require a balancing account on the batch).
  • Visibility: Auto-Post Enabled flow field on Shpfy Order Transaction (table + page).
  • Automatic posting: when a sales invoice/credit memo linked to a Shopify order/refund is posted, the related successful, not-yet-posted transactions are posted as customer payments if their payment method mapping is set up for automatic posting.
  • Filtering: Filter Postable Transactions / Clear Filter actions on the Shopify Transactions list.

Prerequisites to post automatically

  • On the Shpfy Payment Method Mapping: Post Automatically = true and Auto-Post Jnl. Template / Auto-Post Jnl. Batch filled in (the batch must have a balancing account).
  • The transaction relates to a mapping that is set up for automatic posting.

Design notes (safety around the posting routine)

  • Posting runs from Sales-Post.OnAfterPostSalesDoc, which fires after the document has been committed. No broad COMMIT is added to the posting routine.
  • PreviewMode and CommitIsSuppressed postings are respected — automatic posting is skipped in those cases so previews and caller-controlled transactions are never disturbed.
  • Payment posting is synchronous (via Gen. Jnl.-Post Batch), independent of the Post with Job Queue setting.
  • Posting is best-effort: a failure is logged as a Shopify skipped record and never blocks, reverses, or errors the document posting, and never leaves an orphaned journal line behind.

Tests

Added ShpfyAutoPostTransTest.Codeunit.al (ID 139627) covering:

  • Auto-Post Jnl. Batch validation with / without a balancing account and with an empty value.
  • Auto-posting an order transaction when Post Automatically is true, and not posting when it is false.
  • Auto-posting multiple transactions of an order.
  • Posting only transactions linked to an auto-post mapping (and skipping non-linked ones).
  • Auto-posting a refund transaction on credit memo posting.
  • Synchronous posting even when Post with Job Queue is enabled.
  • Best-effort behavior: on a payment-posting failure the document still posts, no ledger entry is created, no journal line is left behind, and a skipped record is logged.
  • Preview posting does not auto-post and does not break the preview.

Fixes AB#620951

Automatically post Shopify order and refund payment transactions as general
journal lines when the related sales invoice or credit memo is posted, when the
transaction's payment method mapping is configured for automatic posting.

Posting is synchronous and best-effort: a failure to post a payment is logged as
a Shopify skipped record and never blocks or reverses the document posting.
Preview posting and commit-suppressed postings are respected (auto-posting is
skipped in those cases).

Fixes AB#620951

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 42e38781-540d-47bf-8a06-86ee9aceb050
@github-actions github-actions Bot added the AL: Apps (W1) Add-on apps for W1 label Jul 16, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 16, 2026
…620951-shopify-automatic-transaction-posting
@JesperSchulz JesperSchulz added the Integration GitHub request for Integration area label Jul 16, 2026
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 Integration GitHub request for Integration area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants