@mj-biz-apps/orders-core-entities-server 5.43.0 → 5.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/AccountingBridge.d.ts +26 -0
  2. package/dist/AccountingBridge.d.ts.map +1 -1
  3. package/dist/AccountingBridge.js +24 -0
  4. package/dist/AccountingBridge.js.map +1 -1
  5. package/dist/CapturePaymentOperation.js +2 -2
  6. package/dist/CapturePaymentOperation.js.map +1 -1
  7. package/dist/CheckoutAccountStep.d.ts +2 -0
  8. package/dist/CheckoutAccountStep.d.ts.map +1 -1
  9. package/dist/CheckoutAccountStep.js +11 -0
  10. package/dist/CheckoutAccountStep.js.map +1 -1
  11. package/dist/ExplainProductGLAccountsOperation.d.ts +43 -0
  12. package/dist/ExplainProductGLAccountsOperation.d.ts.map +1 -0
  13. package/dist/ExplainProductGLAccountsOperation.js +176 -0
  14. package/dist/ExplainProductGLAccountsOperation.js.map +1 -0
  15. package/dist/GLAccountResolver.d.ts +56 -7
  16. package/dist/GLAccountResolver.d.ts.map +1 -1
  17. package/dist/GLAccountResolver.js +92 -46
  18. package/dist/GLAccountResolver.js.map +1 -1
  19. package/dist/JournalEntryCustomer.d.ts +25 -0
  20. package/dist/JournalEntryCustomer.d.ts.map +1 -0
  21. package/dist/JournalEntryCustomer.js +26 -0
  22. package/dist/JournalEntryCustomer.js.map +1 -0
  23. package/dist/OrderEntityServer.d.ts +2 -0
  24. package/dist/OrderEntityServer.d.ts.map +1 -1
  25. package/dist/OrderEntityServer.js +35 -16
  26. package/dist/OrderEntityServer.js.map +1 -1
  27. package/dist/OrderJournalEntryFactory.d.ts.map +1 -1
  28. package/dist/OrderJournalEntryFactory.js +7 -4
  29. package/dist/OrderJournalEntryFactory.js.map +1 -1
  30. package/dist/OrderReview.d.ts +9 -0
  31. package/dist/OrderReview.d.ts.map +1 -1
  32. package/dist/OrderReview.js +59 -1
  33. package/dist/OrderReview.js.map +1 -1
  34. package/dist/OrdersSettings.d.ts +11 -0
  35. package/dist/OrdersSettings.d.ts.map +1 -1
  36. package/dist/OrdersSettings.js +13 -0
  37. package/dist/OrdersSettings.js.map +1 -1
  38. package/dist/PaymentAllocationFactory.d.ts +6 -0
  39. package/dist/PaymentAllocationFactory.d.ts.map +1 -1
  40. package/dist/PaymentAllocationFactory.js +3 -1
  41. package/dist/PaymentAllocationFactory.js.map +1 -1
  42. package/dist/PaymentHeaderEntityServer.d.ts +12 -1
  43. package/dist/PaymentHeaderEntityServer.d.ts.map +1 -1
  44. package/dist/PaymentHeaderEntityServer.js +86 -7
  45. package/dist/PaymentHeaderEntityServer.js.map +1 -1
  46. package/dist/PaymentIntentService.d.ts.map +1 -1
  47. package/dist/PaymentIntentService.js +2 -1
  48. package/dist/PaymentIntentService.js.map +1 -1
  49. package/dist/PaymentLineEntityServer.d.ts +2 -1
  50. package/dist/PaymentLineEntityServer.d.ts.map +1 -1
  51. package/dist/PaymentLineEntityServer.js +13 -9
  52. package/dist/PaymentLineEntityServer.js.map +1 -1
  53. package/dist/PaymentReviewNotices.d.ts +58 -0
  54. package/dist/PaymentReviewNotices.d.ts.map +1 -0
  55. package/dist/PaymentReviewNotices.js +105 -0
  56. package/dist/PaymentReviewNotices.js.map +1 -0
  57. package/dist/PollExternalPaymentsOperation.d.ts +37 -4
  58. package/dist/PollExternalPaymentsOperation.d.ts.map +1 -1
  59. package/dist/PollExternalPaymentsOperation.js +197 -27
  60. package/dist/PollExternalPaymentsOperation.js.map +1 -1
  61. package/dist/PreviewPriceOperation.d.ts +9 -0
  62. package/dist/PreviewPriceOperation.d.ts.map +1 -1
  63. package/dist/PreviewPriceOperation.js +4 -0
  64. package/dist/PreviewPriceOperation.js.map +1 -1
  65. package/dist/ProgressSupersede.d.ts +18 -22
  66. package/dist/ProgressSupersede.d.ts.map +1 -1
  67. package/dist/ProgressSupersede.js +13 -34
  68. package/dist/ProgressSupersede.js.map +1 -1
  69. package/dist/RecordProgressOperation.d.ts +21 -28
  70. package/dist/RecordProgressOperation.d.ts.map +1 -1
  71. package/dist/RecordProgressOperation.js +60 -78
  72. package/dist/RecordProgressOperation.js.map +1 -1
  73. package/dist/index.d.ts +2 -1
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +1 -0
  76. package/dist/index.js.map +1 -1
  77. package/package.json +8 -6
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentLineEntityServer.js","sourceRoot":"","sources":["../src/PaymentLineEntityServer.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,EACH,UAAU,EACV,gBAAgB,EAKhB,QAAQ,EACR,OAAO,EAEP,mBAAmB,EACnB,mBAAmB,GAEtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,WAAW,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACzJ,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAC9G,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAA4B,MAAM,8BAA8B,CAAC;AAClH,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,mBAAmB,GAAG,kCAAkC,CAAC;AAC/D,MAAM,mBAAmB,GAAG,kCAAkC,CAAC;AAC/D,MAAM,oCAAoC,GAAG,mDAAmD,CAAC;AACjG,MAAM,iBAAiB,GAAG,gCAAgC,CAAC;AAC3D,MAAM,qBAAq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CAAC,CAAC,0BAA0B,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC/D,yCAAyC,CAC5C,CAAC;QACN,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAEO,cAAc,CAAC,OAAe;QAClC,MAAM,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACtC,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC;QACvB,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;QACjD,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;QACzB,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QAC3F,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACnF,MAAM,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;QAC9B,MAAM,CAAC,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;QAC5B,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ,CAAA;AAxWY,uBAAuB;IADnC,aAAa,CAAC,UAAU,EAAE,mBAAmB,CAAC;GAClC,uBAAuB,CAwWnC;;AAED,0FAA0F;AAC1F,MAAM,UAAU,2BAA2B;IACvC,sBAAsB;AAC1B,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * One notice per external payment that newly needs a person (#1033).
3
+ *
4
+ * The poll re-decides every non-final payment on each pass, so a payment that waits for a person is
5
+ * seen again every hour. Reporting that as a failed run told the job's owner about the same payments
6
+ * every hour. Instead, a payment is announced once: on the pass that moves it INTO a waiting
7
+ * disposition, or from one waiting disposition to another. The disposition the `ExternalPayment` row
8
+ * held before the pass is the record of what was already announced, so no new column is needed.
9
+ *
10
+ * Delivery goes through MJ's `NotificationEngine` as the `Payment Needs Review` type (shipped in
11
+ * `metadata/notification-types/`): in-app and email by default, and the recipient can change either
12
+ * in their notification preferences. The engine writes the in-app row before it starts the email and
13
+ * never lets a failed email undo it, so a host with no email provider still gets the in-app notice.
14
+ *
15
+ * Best-effort and never thrown: the payments are already recorded when this runs, and a notice that
16
+ * cannot be sent is a log line, not a failed poll.
17
+ *
18
+ * @module @mj-biz-apps/orders-core-entities-server
19
+ */
20
+ import { type UserInfo } from '@memberjunction/core';
21
+ import { type SendNotificationParams } from '@memberjunction/notifications';
22
+ import type { ExternalPaymentDisposition, ExternalPaymentOutcome } from '@mj-biz-apps/orders-entities';
23
+ /** The `MJ: User Notification Types` name; the record ships in `metadata/notification-types/`. */
24
+ export declare const PAYMENT_NEEDS_REVIEW_NOTIFICATION_TYPE = "Payment Needs Review";
25
+ /** Where a person acts on a waiting payment. */
26
+ export declare const PAYMENT_REVIEW_LOCATION = "Orders \u2192 Receivables \u2192 Invoicing queue \u2192 Payment exceptions (the External Payments list)";
27
+ /** The dispositions that wait for a person. */
28
+ export type WaitingDisposition = Extract<ExternalPaymentDisposition, 'Unmatched' | 'Refused' | 'Reapplied' | 'ReversalNeeded'>;
29
+ export declare function IsWaitingDisposition(d: ExternalPaymentDisposition | null | undefined): d is WaitingDisposition;
30
+ /**
31
+ * Whether this pass moved the payment into a waiting disposition, or from one waiting disposition to
32
+ * another. A payment still in the disposition its row already held was announced on an earlier pass.
33
+ *
34
+ * A payment the rail itself reports Unmatched (HubSpot, which cannot name a payment's deal yet) is
35
+ * left out: every such payment is Unmatched by design, and the run already treats it as expected.
36
+ */
37
+ export declare function IsNewlyWaiting(priorDisposition: ExternalPaymentDisposition | null | undefined, outcome: Pick<ExternalPaymentOutcome, 'Disposition'>, railReportedUnmatched: boolean): boolean;
38
+ /** A payment that newly needs a person, and the rail it came from. */
39
+ export interface PaymentReviewItem {
40
+ Outcome: ExternalPaymentOutcome;
41
+ RailName: string;
42
+ }
43
+ /** The notification for one payment and one recipient. */
44
+ export declare function PaymentReviewNotification(item: PaymentReviewItem, userId: string): SendNotificationParams;
45
+ /** The engine call, as a seam so specs need neither a database nor the engine. */
46
+ export type PaymentReviewSend = (params: SendNotificationParams, contextUser: UserInfo) => Promise<{
47
+ success: boolean;
48
+ errors?: string[];
49
+ }>;
50
+ /**
51
+ * Send one notice per item to each recipient. Never throws; each failure is logged and counted.
52
+ * A send that returns `success: false` (for example a host not yet seeded with the type) counts as failed.
53
+ */
54
+ export declare function SendPaymentReviewNotices(items: readonly PaymentReviewItem[], recipientUserIDs: readonly string[], contextUser: UserInfo, send?: PaymentReviewSend): Promise<{
55
+ Sent: number;
56
+ Failed: number;
57
+ }>;
58
+ //# sourceMappingURL=PaymentReviewNotices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaymentReviewNotices.d.ts","sourceRoot":"","sources":["../src/PaymentReviewNotices.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAsB,KAAK,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAChG,OAAO,KAAK,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEvG,kGAAkG;AAClG,eAAO,MAAM,sCAAsC,yBAAyB,CAAC;AAE7E,gDAAgD;AAChD,eAAO,MAAM,uBAAuB,4GAA6F,CAAC;AAElI,+CAA+C;AAC/C,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,0BAA0B,EAAE,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,gBAAgB,CAAC,CAAC;AAS/H,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,0BAA0B,GAAG,IAAI,GAAG,SAAS,GAAG,CAAC,IAAI,kBAAkB,CAE9G;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC1B,gBAAgB,EAAE,0BAA0B,GAAG,IAAI,GAAG,SAAS,EAC/D,OAAO,EAAE,IAAI,CAAC,sBAAsB,EAAE,aAAa,CAAC,EACpD,qBAAqB,EAAE,OAAO,GAC/B,OAAO,CAIT;AAED,sEAAsE;AACtE,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE,sBAAsB,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;CACpB;AAID,0DAA0D;AAC1D,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,GAAG,sBAAsB,CAqBzG;AAED,kFAAkF;AAClF,MAAM,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,sBAAsB,EAAE,WAAW,EAAE,QAAQ,KAAK,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAAC;AAO5I;;;GAGG;AACH,wBAAsB,wBAAwB,CAC1C,KAAK,EAAE,SAAS,iBAAiB,EAAE,EACnC,gBAAgB,EAAE,SAAS,MAAM,EAAE,EACnC,WAAW,EAAE,QAAQ,EACrB,IAAI,GAAE,iBAAqC,GAC5C,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAqB3C"}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * One notice per external payment that newly needs a person (#1033).
3
+ *
4
+ * The poll re-decides every non-final payment on each pass, so a payment that waits for a person is
5
+ * seen again every hour. Reporting that as a failed run told the job's owner about the same payments
6
+ * every hour. Instead, a payment is announced once: on the pass that moves it INTO a waiting
7
+ * disposition, or from one waiting disposition to another. The disposition the `ExternalPayment` row
8
+ * held before the pass is the record of what was already announced, so no new column is needed.
9
+ *
10
+ * Delivery goes through MJ's `NotificationEngine` as the `Payment Needs Review` type (shipped in
11
+ * `metadata/notification-types/`): in-app and email by default, and the recipient can change either
12
+ * in their notification preferences. The engine writes the in-app row before it starts the email and
13
+ * never lets a failed email undo it, so a host with no email provider still gets the in-app notice.
14
+ *
15
+ * Best-effort and never thrown: the payments are already recorded when this runs, and a notice that
16
+ * cannot be sent is a log line, not a failed poll.
17
+ *
18
+ * @module @mj-biz-apps/orders-core-entities-server
19
+ */
20
+ import { LogError } from '@memberjunction/core';
21
+ import { NotificationEngine } from '@memberjunction/notifications';
22
+ /** The `MJ: User Notification Types` name; the record ships in `metadata/notification-types/`. */
23
+ export const PAYMENT_NEEDS_REVIEW_NOTIFICATION_TYPE = 'Payment Needs Review';
24
+ /** Where a person acts on a waiting payment. */
25
+ export const PAYMENT_REVIEW_LOCATION = 'Orders → Receivables → Invoicing queue → Payment exceptions (the External Payments list)';
26
+ const WHY = {
27
+ Unmatched: 'it could not be matched to invoices Orders issued, so nothing was recorded',
28
+ Refused: 'recording it was refused, so nothing was recorded',
29
+ Reapplied: 'it was re-applied to different invoices on the rail after it was recorded here, so the allocation here is out of date',
30
+ ReversalNeeded: 'it was recorded here and then voided or refunded on the rail, so the recorded payment needs reversing',
31
+ };
32
+ export function IsWaitingDisposition(d) {
33
+ return d != null && Object.prototype.hasOwnProperty.call(WHY, d);
34
+ }
35
+ /**
36
+ * Whether this pass moved the payment into a waiting disposition, or from one waiting disposition to
37
+ * another. A payment still in the disposition its row already held was announced on an earlier pass.
38
+ *
39
+ * A payment the rail itself reports Unmatched (HubSpot, which cannot name a payment's deal yet) is
40
+ * left out: every such payment is Unmatched by design, and the run already treats it as expected.
41
+ */
42
+ export function IsNewlyWaiting(priorDisposition, outcome, railReportedUnmatched) {
43
+ if (!IsWaitingDisposition(outcome.Disposition))
44
+ return false;
45
+ if (outcome.Disposition === 'Unmatched' && railReportedUnmatched)
46
+ return false;
47
+ return priorDisposition !== outcome.Disposition;
48
+ }
49
+ const amountText = (n) => Number(n).toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
50
+ /** The notification for one payment and one recipient. */
51
+ export function PaymentReviewNotification(item, userId) {
52
+ const o = item.Outcome;
53
+ const disposition = o.Disposition;
54
+ const why = WHY[disposition];
55
+ const amount = amountText(o.Amount);
56
+ return {
57
+ userId,
58
+ typeNameOrId: PAYMENT_NEEDS_REVIEW_NOTIFICATION_TYPE,
59
+ title: `Payment ${o.ExternalPaymentRef} (${amount}) needs review`,
60
+ message: `${item.RailName} payment ${o.ExternalPaymentRef} for ${amount} is ${disposition}: ${why}. ${o.Reason} Review it in ${PAYMENT_REVIEW_LOCATION}.`,
61
+ resourceConfiguration: { type: 'ExternalPayment', paymentProviderId: o.PaymentProviderID, externalPaymentRef: o.ExternalPaymentRef },
62
+ templateData: {
63
+ PaymentRef: o.ExternalPaymentRef,
64
+ Amount: amount,
65
+ RailName: item.RailName,
66
+ Disposition: disposition,
67
+ Why: why,
68
+ Reason: o.Reason,
69
+ WhereToAct: PAYMENT_REVIEW_LOCATION,
70
+ },
71
+ };
72
+ }
73
+ async function sendThroughEngine(params, contextUser) {
74
+ await NotificationEngine.Instance.Config(false, contextUser);
75
+ return NotificationEngine.Instance.SendNotification(params, contextUser);
76
+ }
77
+ /**
78
+ * Send one notice per item to each recipient. Never throws; each failure is logged and counted.
79
+ * A send that returns `success: false` (for example a host not yet seeded with the type) counts as failed.
80
+ */
81
+ export async function SendPaymentReviewNotices(items, recipientUserIDs, contextUser, send = sendThroughEngine) {
82
+ let sent = 0;
83
+ let failed = 0;
84
+ for (const item of items) {
85
+ for (const userId of recipientUserIDs) {
86
+ const ref = item.Outcome.ExternalPaymentRef;
87
+ try {
88
+ const result = await send(PaymentReviewNotification(item, userId), contextUser);
89
+ if (result.success) {
90
+ sent++;
91
+ }
92
+ else {
93
+ failed++;
94
+ LogError(`Orders.PollExternalPayments: the review notice for payment ${ref} was not sent: ${(result.errors ?? []).join('; ') || 'no reason given'}`);
95
+ }
96
+ }
97
+ catch (err) {
98
+ failed++;
99
+ LogError(`Orders.PollExternalPayments: the review notice for payment ${ref} failed: ${err instanceof Error ? err.message : String(err)}`);
100
+ }
101
+ }
102
+ }
103
+ return { Sent: sent, Failed: failed };
104
+ }
105
+ //# sourceMappingURL=PaymentReviewNotices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaymentReviewNotices.js","sourceRoot":"","sources":["../src/PaymentReviewNotices.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,QAAQ,EAAiB,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAA+B,MAAM,+BAA+B,CAAC;AAGhG,kGAAkG;AAClG,MAAM,CAAC,MAAM,sCAAsC,GAAG,sBAAsB,CAAC;AAE7E,gDAAgD;AAChD,MAAM,CAAC,MAAM,uBAAuB,GAAG,0FAA0F,CAAC;AAKlI,MAAM,GAAG,GAAuC;IAC5C,SAAS,EAAE,4EAA4E;IACvF,OAAO,EAAE,mDAAmD;IAC5D,SAAS,EAAE,uHAAuH;IAClI,cAAc,EAAE,uGAAuG;CAC1H,CAAC;AAEF,MAAM,UAAU,oBAAoB,CAAC,CAAgD;IACjF,OAAO,CAAC,IAAI,IAAI,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AACrE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC1B,gBAA+D,EAC/D,OAAoD,EACpD,qBAA8B;IAE9B,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,WAAW,CAAC;QAAE,OAAO,KAAK,CAAC;IAC7D,IAAI,OAAO,CAAC,WAAW,KAAK,WAAW,IAAI,qBAAqB;QAAE,OAAO,KAAK,CAAC;IAC/E,OAAO,gBAAgB,KAAK,OAAO,CAAC,WA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CAAC"}
@@ -21,10 +21,14 @@
21
21
  * `PaymentHeaderEntityServer` books the cash leg — the same path a keyed check takes (A-US2).
22
22
  *
23
23
  * WHAT NEEDS A PERSON. `Unmatched` (an invoice we did not issue — pre-cutover AR, or created directly
24
- * in Bill.com) and `ReversalNeeded` (captured, then voided on the rail) are reported as `ATTENTION`
25
- * with Success false so a job that notifies on failure tells somebody; the rows stay in
26
- * `ExternalPayment` until dealt with. A payment the rail itself records Unmatched (HubSpot, which
27
- * cannot name a payment's deal yet) is counted but does not fail the run on its own.
24
+ * in Bill.com), `Refused`, `Reapplied` and `ReversalNeeded` (captured, then voided on the rail) stay in
25
+ * `ExternalPayment` until dealt with. A live pass that leaves any reports `ATTENTION` with Success
26
+ * TRUE: the pass did its work, and these rows are re-read every pass, so failing the run told the
27
+ * job's owner about the same payments every hour (#1033). Instead each payment is announced once,
28
+ * through the `Payment Needs Review` notification, on the pass that moves it into a waiting
29
+ * disposition or from one to another (`PaymentReviewNotices.ts`). A payment the rail itself records
30
+ * Unmatched (HubSpot, which cannot name a payment's deal yet) is counted but neither raises
31
+ * `ATTENTION` nor a notice on its own.
28
32
  *
29
33
  * @module @mj-biz-apps/orders-core-entities-server
30
34
  */
@@ -42,7 +46,23 @@ export interface ExternalPaymentRow extends Record<string, unknown> {
42
46
  }
43
47
  export declare class PollExternalPaymentsOperation extends OrdersPollExternalPaymentsOperationBase {
44
48
  protected InternalExecute(input: OrdersPollExternalPaymentsInput, provider: IMetadataProvider, user: UserInfo): Promise<OrdersPollExternalPaymentsOutput>;
49
+ /**
50
+ * Notify about the payments live passes moved into a waiting disposition. Recipients are the
51
+ * governing poll job's notify user, else its owner (the people MJ's scheduler tells when the run
52
+ * fails); when no job names anybody, or the jobs were not read, the user running the poll.
53
+ * Returns a sentence for the run's message, empty when there was nothing to announce. Never throws.
54
+ */
55
+ private announceNewlyWaiting;
45
56
  private pollProvider;
57
+ /**
58
+ * Re-decides the provider's open `Unmatched` rows the rail did not return this pass, but only those
59
+ * whose every invoice now has an `ExternalInvoice` row: the capture rule stays all invoices or
60
+ * nothing, and a payment still missing one is not rewritten. Like the re-applied recheck, a failure
61
+ * is logged and left for the next pass and does not hold the watermark back. A recheck that ends
62
+ * in a disposition finance must act on (`Refused`, say) is added to `newlyWaiting`, as the other
63
+ * two paths do.
64
+ */
65
+ private recheckOpenUnmatched;
46
66
  private handlePayment;
47
67
  }
48
68
  /** Registers {@link PollExternalPaymentsOperation}. Called from the server bootstrap. */
@@ -56,6 +76,19 @@ export declare function ReappliedRowsToRecheck(rows: readonly ExternalPaymentRow
56
76
  Row: ExternalPaymentRow;
57
77
  Record: RailPaymentRecord;
58
78
  }>;
79
+ /**
80
+ * The open `Unmatched` rows that could capture once their invoices exist, each with the rail record
81
+ * rebuilt from its stored payload (bc-aidp-next-golive#446). Left out: a row the rail returned this
82
+ * pass (the fetch already re-decided it), one with a payment header, a payload the rail cannot
83
+ * rebuild, a payment the rail itself cannot match (HubSpot) or sets aside, and one applied to no
84
+ * invoice — loading an invoice can never match that.
85
+ */
86
+ export declare function UnmatchedRowsToRecheck(rows: readonly ExternalPaymentRow[], fetchedRefs: readonly string[], rail: Pick<BaseInvoiceRail, 'RestorePaymentRecord'>): Array<{
87
+ Row: ExternalPaymentRow;
88
+ Record: RailPaymentRecord;
89
+ }>;
90
+ /** Whether every invoice a payment settles has an `ExternalInvoice` row. All or nothing, as the capture is. */
91
+ export declare function EveryInvoiceIssued(record: Pick<RailPaymentRecord, 'InvoicePayments'>, issuedRefs: ReadonlySet<string>): boolean;
59
92
  /**
60
93
  * Best effort: refresh the rail's view of the invoices a payment touched. A failure here is logged, never fatal.
61
94
  *
@@ -1 +1 @@
1
- {"version":3,"file":"PollExternalPaymentsOperation.d.ts","sourceRoot":"","sources":["../src/PollExternalPaymentsOperation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAuE,KAAK,iBAAiB,EAAyB,KAAK,QAAQ,E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,CAExD;AAiED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAClC,IAAI,EAAE,SAAS,kBAAkB,EAAE,EACnC,WAAW,EAAE,SAAS,MAAM,EAAE,EAC9B,IAAI,EAAE,IAAI,CAAC,eAAe,EAAE,sBAAsB,CAAC,GACpD,KAAK,CAAC;IAAE,GAAG,EAAE,kBAAkB,CAAC;IAAC,MAAM,EAAE,iBAAiB,CAAA;CAAE,CAAC,CAS/D;AA2BD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAClC,IAAI,EAAE,SAAS,kBAAkB,EAAE,EACnC,WAAW,EAAE,SAAS,MAAM,EAAE,EAC9B,IAAI,EAAE,IAAI,CAAC,eAAe,EAAE,sBAAsB,CAAC,GACpD,KAAK,CAAC;IAAE,GAAG,EAAE,kBAAkB,CAAC;IAAC,MAAM,EAAE,iBAAiB,CAAA;CAAE,CAAC,CAW/D;AAED,+GAA+G;AAC/G,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,EAAE,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,OAAO,CAE/H;AAqID;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,kBAAkB,EAAE,EAAE,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAY5J"}
@@ -27,19 +27,24 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
27
27
  * `PaymentHeaderEntityServer` books the cash leg — the same path a keyed check takes (A-US2).
28
28
  *
29
29
  * WHAT NEEDS A PERSON. `Unmatched` (an invoice we did not issue — pre-cutover AR, or created directly
30
- * in Bill.com) and `ReversalNeeded` (captured, then voided on the rail) are reported as `ATTENTION`
31
- * with Success false so a job that notifies on failure tells somebody; the rows stay in
32
- * `ExternalPayment` until dealt with. A payment the rail itself records Unmatched (HubSpot, which
33
- * cannot name a payment's deal yet) is counted but does not fail the run on its own.
30
+ * in Bill.com), `Refused`, `Reapplied` and `ReversalNeeded` (captured, then voided on the rail) stay in
31
+ * `ExternalPayment` until dealt with. A live pass that leaves any reports `ATTENTION` with Success
32
+ * TRUE: the pass did its work, and these rows are re-read every pass, so failing the run told the
33
+ * job's owner about the same payments every hour (#1033). Instead each payment is announced once,
34
+ * through the `Payment Needs Review` notification, on the pass that moves it into a waiting
35
+ * disposition or from one to another (`PaymentReviewNotices.ts`). A payment the rail itself records
36
+ * Unmatched (HubSpot, which cannot name a payment's deal yet) is counted but neither raises
37
+ * `ATTENTION` nor a notice on its own.
34
38
  *
35
39
  * @module @mj-biz-apps/orders-core-entities-server
36
40
  */
37
41
  import { BaseRemotableOperation, CompositeKey, LogError, RunView } from '@memberjunction/core';
38
42
  import { RegisterClass } from '@memberjunction/global';
39
- import { AllocateInvoicePayments, DecideExternalPayment, ExternalPaymentIdempotencyKey, PaymentStatusVocabularyFor, TenderFor, OrdersCapturePaymentOperation, OrdersPollExternalPaymentsOperation as OrdersPollExternalPaymentsOperationBase, Today, ClassifyPollJobsFor, LoadPollJobs, } from '@mj-biz-apps/orders-entities';
43
+ import { AllocateInvoicePayments, DecideExternalPayment, ExternalPaymentIdempotencyKey, PaymentStatusVocabularyFor, TenderFor, OrdersCapturePaymentOperation, OrdersPollExternalPaymentsOperation as OrdersPollExternalPaymentsOperationBase, Today, ClassifyPollJobsFor, LoadPollJobs, PollJobRecipients, } from '@mj-biz-apps/orders-entities';
40
44
  import { EXTERNAL_PAYMENT_ENTITY, ORDER_HEADER_ENTITY, PAYMENT_LINE_ENTITY, PAYMENT_PROVIDER_SYNC_STATE_ENTITY, } from './entity-names.js';
41
45
  import { ListPaymentSourceProviderIDs, ResolveInvoiceRail } from './InvoiceRailResolver.js';
42
46
  import { LoadExternalInvoicesByRef, updateExternalInvoice } from './IssueExternalInvoiceOperation.js';
47
+ import { IsNewlyWaiting, SendPaymentReviewNotices } from './PaymentReviewNotices.js';
43
48
  import { EscapeText, RequireUUID } from './sql-guards.js';
44
49
  const RAIL_OBJECT = 'receivable-payments';
45
50
  /**
@@ -53,6 +58,10 @@ async function functionalCurrencyFor(companyID, provider, user) {
53
58
  }
54
59
  const OVERLAP_MS = 24 * 60 * 60 * 1000;
55
60
  const DEFAULT_MAX = 100;
61
+ /** Invoice refs per `ExternalInvoice` read when re-checking open Unmatched payments. */
62
+ const INVOICE_REF_CHUNK = 500;
63
+ /** The `ExternalPayment` columns the open-Unmatched recheck reads. */
64
+ const OPEN_UNMATCHED_FIELDS = ['ID', 'ExternalPaymentRef', 'Disposition', 'DispositionReason', 'PaymentHeaderID', 'ExternalUpdatedAt', 'Payload'];
56
65
  /** Canonical ISO-Z, or null when the value cannot be read — an unreadable watermark must never throw. */
57
66
  const instant = (v) => {
58
67
  if (v == null || v === '')
@@ -110,12 +119,29 @@ let PollExternalPaymentsOperation = class PollExternalPaymentsOperation extends
110
119
  previewed.push(`provider ${p.ID}: ${job.Why}`);
111
120
  }
112
121
  }
113
- const result = await this.pollProvider(p.ID, { preview: providerPreview, maxCount, since: input?.SinceWatermark ?? null }, provider, user);
114
- passes.push({ Preview: providerPreview, Outcomes: result.Outcomes, RailUnmatched: result.RailUnmatched ?? 0 });
115
- out.Outcomes.push(...result.Outcomes);
116
- out.NewWatermarks.push({ PaymentProviderID: p.ID, Watermark: result.NewWatermark });
117
- if (result.Fault)
118
- faults.push(result.Fault);
122
+ // Filled as the pass goes, so payments it already moved into a waiting disposition are
123
+ // still announced when the pass throws part-way.
124
+ const newlyWaiting = [];
125
+ try {
126
+ const result = await this.pollProvider(p.ID, { preview: providerPreview, maxCount, since: input?.SinceWatermark ?? null }, newlyWaiting, provider, user);
127
+ passes.push({ ProviderID: p.ID, Preview: providerPreview, Outcomes: result.Outcomes, RailUnmatched: result.RailUnmatched ?? 0, NewlyWaiting: newlyWaiting });
128
+ out.Outcomes.push(...result.Outcomes);
129
+ out.NewWatermarks.push({ PaymentProviderID: p.ID, Watermark: result.NewWatermark });
130
+ if (result.Fault)
131
+ faults.push(result.Fault);
132
+ }
133
+ catch (err) {
134
+ // One provider throwing (a rail that is missing, inactive or not registered) must not
135
+ // drop what the other providers recorded and collected: it is reported as a fault.
136
+ const why = err instanceof Error ? err.message : String(err);
137
+ LogError(`Orders.PollExternalPayments: provider ${p.ID} failed: ${why}`);
138
+ faults.push(`provider ${p.ID}: ${why}`);
139
+ if (newlyWaiting.length)
140
+ passes.push({ ProviderID: p.ID, Preview: providerPreview, Outcomes: [], RailUnmatched: 0, NewlyWaiting: newlyWaiting });
141
+ }
142
+ }
143
+ if (!passes.length && faults.length) {
144
+ return { ...out, Success: false, ResultCode: 'ERROR', Message: `The poll hit a fault on ${faults.length} provider(s): ${faults.join(' | ')}` };
119
145
  }
120
146
  if (!passes.length) {
121
147
  return {
@@ -151,8 +177,11 @@ let PollExternalPaymentsOperation = class PollExternalPaymentsOperation extends
151
177
  else
152
178
  out.Ignored++;
153
179
  }
180
+ // Announced before a fault is reported: the rows are already written, so the next pass reads
181
+ // them as already waiting and would never announce them.
182
+ const notices = await this.announceNewlyWaiting(passes.filter((x) => !x.Preview), jobs, user);
154
183
  if (faults.length) {
155
- return { ...out, Success: false, ResultCode: 'ERROR', Message: `${previewNote}The poll hit a fault on ${faults.length} provider(s): ${faults.join(' | ')}` };
184
+ return { ...out, Success: false, ResultCode: 'ERROR', Message: `${previewNote}The poll hit a fault on ${faults.length} provider(s): ${faults.join(' | ')}${notices}` };
156
185
  }
157
186
  // A payment the rail itself records Unmatched (every HubSpot payment, until its deal can be read) is the
158
187
  // expected state, not something this run found wrong: it is counted and listed, but on its own it does
@@ -160,17 +189,19 @@ let PollExternalPaymentsOperation = class PollExternalPaymentsOperation extends
160
189
  const railUnmatched = passes.filter((x) => x.Preview === preview).reduce((n, x) => n + x.RailUnmatched, 0);
161
190
  const awaitingNote = railUnmatched > 0 ? ` ${railUnmatched} recorded Unmatched by a rail that cannot match payments to orders yet (see External Payments).` : '';
162
191
  const needsPerson = out.Unmatched - railUnmatched + out.Refused + out.Reapplied + out.ReversalNeeded;
192
+ // Waiting payments are not a failed run (#1033): each was announced once, on the pass that
193
+ // moved it into the state it waits in.
163
194
  if (!preview && needsPerson > 0) {
164
195
  return {
165
196
  ...out,
166
- Success: false,
197
+ Success: true,
167
198
  ResultCode: 'ATTENTION',
168
- Message: `${previewNote}${out.Captured} payment(s) captured; ${out.Unmatched - railUnmatched} unmatched, ${out.Refused} refused, ${out.Reapplied} re-applied on the rail and ${out.ReversalNeeded} needing reversal are waiting for a person (see External Payments).${awaitingNote}`,
199
+ Message: `${previewNote}${out.Captured} payment(s) captured; ${out.Unmatched - railUnmatched} unmatched, ${out.Refused} refused, ${out.Reapplied} re-applied on the rail and ${out.ReversalNeeded} needing reversal are waiting for a person (see External Payments).${awaitingNote}${notices}`,
169
200
  };
170
201
  }
171
202
  out.Message = preview
172
203
  ? `${previewNote}Would capture ${out.Outcomes.filter((o) => o.Disposition === 'Captured').length} payment(s); ${out.Held} held, ${out.Unmatched} unmatched.`
173
- : `${previewNote}${out.Captured} payment(s) captured, ${out.Held} held, ${out.Ignored} already known.${awaitingNote}`;
204
+ : `${previewNote}${out.Captured} payment(s) captured, ${out.Held} held, ${out.Ignored} already known.${awaitingNote}${notices}`;
174
205
  return out;
175
206
  }
176
207
  catch (err) {
@@ -178,7 +209,44 @@ let PollExternalPaymentsOperation = class PollExternalPaymentsOperation extends
178
209
  return { ...out, Success: false, ResultCode: 'ERROR', Message: err instanceof Error ? err.message : String(err) };
179
210
  }
180
211
  }
181
- async pollProvider(paymentProviderID, opts, provider, user) {
212
+ /**
213
+ * Notify about the payments live passes moved into a waiting disposition. Recipients are the
214
+ * governing poll job's notify user, else its owner (the people MJ's scheduler tells when the run
215
+ * fails); when no job names anybody, or the jobs were not read, the user running the poll.
216
+ * Returns a sentence for the run's message, empty when there was nothing to announce. Never throws.
217
+ */
218
+ async announceNewlyWaiting(livePasses, jobs, user) {
219
+ let count = 0;
220
+ let sent = 0;
221
+ let failed = 0;
222
+ for (const pass of livePasses) {
223
+ if (!pass.NewlyWaiting.length)
224
+ continue;
225
+ count += pass.NewlyWaiting.length;
226
+ try {
227
+ const named = jobs ? PollJobRecipients(jobs, pass.ProviderID) : [];
228
+ const recipients = named.length ? named : user?.ID ? [user.ID] : [];
229
+ if (!recipients.length) {
230
+ LogError(`Orders.PollExternalPayments: ${pass.NewlyWaiting.length} payment(s) newly need review, but there is nobody to notify.`);
231
+ continue;
232
+ }
233
+ const r = await SendPaymentReviewNotices(pass.NewlyWaiting, recipients, user);
234
+ sent += r.Sent;
235
+ failed += r.Failed;
236
+ }
237
+ catch (err) {
238
+ failed += pass.NewlyWaiting.length;
239
+ LogError(`Orders.PollExternalPayments: review notices failed: ${err instanceof Error ? err.message : String(err)}`);
240
+ }
241
+ }
242
+ if (!count)
243
+ return '';
244
+ return ` ${count} payment(s) newly need review; ${sent} notification(s) sent${failed ? `, ${failed} failed (see the server log)` : ''}.`;
245
+ }
246
+ async pollProvider(paymentProviderID, opts,
247
+ // Receives the payments this pass moved into a waiting disposition. A preview writes nothing,
248
+ // so a later live pass still finds them new; only a live pass collects them.
249
+ newlyWaiting, provider, user) {
182
250
  const outcomes = [];
183
251
  let railUnmatched = 0;
184
252
  const rail = await ResolveInvoiceRail(paymentProviderID, provider, user);
@@ -232,6 +300,8 @@ let PollExternalPaymentsOperation = class PollExternalPaymentsOperation extends
232
300
  outcomes.push(outcome);
233
301
  if (outcome.Disposition === 'Unmatched' && p.UnmatchedReason)
234
302
  railUnmatched++;
303
+ if (!opts.preview && IsNewlyWaiting(prior?.Disposition, outcome, !!p.UnmatchedReason))
304
+ newlyWaiting.push({ Outcome: outcome, RailName: rail.Config.Name });
235
305
  }
236
306
  catch (err) {
237
307
  // One bad payment must not stop the pass — but it must stop the watermark.
@@ -248,12 +318,21 @@ let PollExternalPaymentsOperation = class PollExternalPaymentsOperation extends
248
318
  // the watermark covers, so they do not hold it back.
249
319
  for (const { Row, Record } of ReappliedRowsToRecheck(await loadOpenReapplied(paymentProviderID, provider, user), all.map((p) => p.ExternalPaymentRef), rail)) {
250
320
  try {
251
- outcomes.push(await this.handlePayment(rail, Record, Row, opts.preview, bookingCurrency, provider, user));
321
+ const outcome = await this.handlePayment(rail, Record, Row, opts.preview, bookingCurrency, provider, user);
322
+ outcomes.push(outcome);
323
+ if (!opts.preview && IsNewlyWaiting(Row.Disposition, outcome, !!Record.UnmatchedReason))
324
+ newlyWaiting.push({ Outcome: outcome, RailName: rail.Config.Name });
252
325
  }
253
326
  catch (err) {
254
327
  LogError(`Orders.PollExternalPayments: re-checking re-applied payment ${Row.ExternalPaymentRef} failed: ${err instanceof Error ? err.message : String(err)}`);
255
328
  }
256
329
  }
330
+ // OPEN UNMATCHED PAYMENTS WHOSE INVOICES HAVE SINCE BEEN LOADED (bc-aidp-next-golive#446). The same
331
+ // gap as above: an Unmatched payment was re-decided only while the rail returned it, so an
332
+ // invoice loaded here more than a day after the payment last changed on the rail never let it
333
+ // capture. Each open row is rebuilt from its stored payload; one whose every invoice now has an
334
+ // `ExternalInvoice` row is captured the normal way, and the rest are left exactly as they are.
335
+ outcomes.push(...(await this.recheckOpenUnmatched(rail, all.map((p) => p.ExternalPaymentRef), opts.preview, bookingCurrency, provider, user, newlyWaiting)));
257
336
  // THE WATERMARK: on a clean, uncapped pass, the newest instant the rail returned. On a capped
258
337
  // pass, the newest instant among the payments actually processed — everything older is done
259
338
  // (the list is sorted), and the one-day overlap re-reads the boundary next time. A fault keeps
@@ -270,6 +349,46 @@ let PollExternalPaymentsOperation = class PollExternalPaymentsOperation extends
270
349
  }
271
350
  return { Outcomes: outcomes, NewWatermark: newWatermark, Fault: fault ? `${rail.Config.Name}: ${fault}` : null, RailUnmatched: railUnmatched };
272
351
  }
352
+ /**
353
+ * Re-decides the provider's open `Unmatched` rows the rail did not return this pass, but only those
354
+ * whose every invoice now has an `ExternalInvoice` row: the capture rule stays all invoices or
355
+ * nothing, and a payment still missing one is not rewritten. Like the re-applied recheck, a failure
356
+ * is logged and left for the next pass and does not hold the watermark back. A recheck that ends
357
+ * in a disposition finance must act on (`Refused`, say) is added to `newlyWaiting`, as the other
358
+ * two paths do.
359
+ */
360
+ async recheckOpenUnmatched(rail, fetchedRefs, preview, bookingCurrency, provider, user, newlyWaiting) {
361
+ const providerID = rail.Config.PaymentProviderID;
362
+ const outcomes = [];
363
+ try {
364
+ const candidates = UnmatchedRowsToRecheck(await loadOpenUnmatched(providerID, provider, user), fetchedRefs, rail);
365
+ if (!candidates.length)
366
+ return outcomes;
367
+ const refs = [...new Set(candidates.flatMap((c) => c.Record.InvoicePayments.map((ip) => ip.ExternalInvoiceRef)))];
368
+ const issued = new Set();
369
+ for (let i = 0; i < refs.length; i += INVOICE_REF_CHUNK) {
370
+ for (const inv of await LoadExternalInvoicesByRef(providerID, refs.slice(i, i + INVOICE_REF_CHUNK), provider, user)) {
371
+ if (inv.ExternalInvoiceRef)
372
+ issued.add(String(inv.ExternalInvoiceRef));
373
+ }
374
+ }
375
+ for (const { Row, Record } of candidates.filter((c) => EveryInvoiceIssued(c.Record, issued))) {
376
+ try {
377
+ const outcome = await this.handlePayment(rail, Record, Row, preview, bookingCurrency, provider, user);
378
+ outcomes.push(outcome);
379
+ if (!preview && IsNewlyWaiting(Row.Disposition, outcome, !!Record.UnmatchedReason))
380
+ newlyWaiting.push({ Outcome: outcome, RailName: rail.Config.Name });
381
+ }
382
+ catch (err) {
383
+ LogError(`Orders.PollExternalPayments: re-checking unmatched payment ${Row.ExternalPaymentRef} failed: ${err instanceof Error ? err.message : String(err)}`);
384
+ }
385
+ }
386
+ }
387
+ catch (err) {
388
+ LogError(`Orders.PollExternalPayments: re-checking unmatched payments for ${providerID} failed: ${err instanceof Error ? err.message : String(err)}`);
389
+ }
390
+ return outcomes;
391
+ }
273
392
  async handlePayment(rail, p, prior, preview, bookingCurrency, provider, user) {
274
393
  const providerID = rail.Config.PaymentProviderID;
275
394
  const base = { PaymentProviderID: providerID, ExternalPaymentRef: p.ExternalPaymentRef, Amount: money(p.Amount), ExternalStatus: p.Status };
@@ -478,21 +597,72 @@ export function ReappliedRowsToRecheck(rows, fetchedRefs, rail) {
478
597
  for (const row of rows) {
479
598
  if (row.Disposition !== 'Reapplied' || !row.PaymentHeaderID || fetched.has(row.ExternalPaymentRef))
480
599
  continue;
481
- let payload;
482
- try {
483
- payload = typeof row.Payload === 'string' ? JSON.parse(row.Payload) : row.Payload;
484
- }
485
- catch {
486
- continue;
487
- }
488
- if (!payload || typeof payload !== 'object' || Array.isArray(payload))
489
- continue;
490
- const record = rail.RestorePaymentRecord(row.ExternalPaymentRef, payload);
600
+ const record = restoreFromPayload(row, rail);
491
601
  if (record)
492
602
  out.push({ Row: row, Record: record });
493
603
  }
494
604
  return out;
495
605
  }
606
+ /**
607
+ * Every `Unmatched` row for this provider, with the payload the poller stored from the rail. Not capped
608
+ * by the entity's row limit: a capped read returns the same first rows by ID every pass, so a payment
609
+ * past the limit would never be re-checked. `Fields` are what the selection and `handlePayment` read.
610
+ */
611
+ async function loadOpenUnmatched(paymentProviderID, provider, user) {
612
+ const rv = new RunView(provider);
613
+ const r = await rv.RunView({
614
+ EntityName: EXTERNAL_PAYMENT_ENTITY,
615
+ ExtraFilter: `PaymentProviderID = '${RequireUUID(paymentProviderID, 'PaymentProviderID')}' AND Disposition = 'Unmatched'`,
616
+ Fields: OPEN_UNMATCHED_FIELDS,
617
+ ResultType: 'simple',
618
+ IgnoreMaxRows: true,
619
+ BypassCache: true,
620
+ }, user);
621
+ if (!r?.Success) {
622
+ LogError(`Orders.PollExternalPayments: could not read open unmatched payments for ${paymentProviderID}: ${r?.ErrorMessage ?? 'no result'}`);
623
+ return [];
624
+ }
625
+ return r.Results ?? [];
626
+ }
627
+ /**
628
+ * The open `Unmatched` rows that could capture once their invoices exist, each with the rail record
629
+ * rebuilt from its stored payload (bc-aidp-next-golive#446). Left out: a row the rail returned this
630
+ * pass (the fetch already re-decided it), one with a payment header, a payload the rail cannot
631
+ * rebuild, a payment the rail itself cannot match (HubSpot) or sets aside, and one applied to no
632
+ * invoice — loading an invoice can never match that.
633
+ */
634
+ export function UnmatchedRowsToRecheck(rows, fetchedRefs, rail) {
635
+ const fetched = new Set(fetchedRefs);
636
+ const out = [];
637
+ for (const row of rows) {
638
+ if (row.Disposition !== 'Unmatched' || row.PaymentHeaderID || fetched.has(row.ExternalPaymentRef))
639
+ continue;
640
+ const record = restoreFromPayload(row, rail);
641
+ if (!record || record.UnmatchedReason || record.SetAsideReason)
642
+ continue;
643
+ if (!record.InvoicePayments.length || record.InvoicePayments.some((ip) => !ip.ExternalInvoiceRef))
644
+ continue;
645
+ out.push({ Row: row, Record: record });
646
+ }
647
+ return out;
648
+ }
649
+ /** Whether every invoice a payment settles has an `ExternalInvoice` row. All or nothing, as the capture is. */
650
+ export function EveryInvoiceIssued(record, issuedRefs) {
651
+ return record.InvoicePayments.length > 0 && record.InvoicePayments.every((ip) => issuedRefs.has(ip.ExternalInvoiceRef));
652
+ }
653
+ /** The rail record rebuilt from a row's stored payload, or null when the payload or the rail cannot. */
654
+ function restoreFromPayload(row, rail) {
655
+ let payload;
656
+ try {
657
+ payload = typeof row.Payload === 'string' ? JSON.parse(row.Payload) : row.Payload;
658
+ }
659
+ catch {
660
+ return null;
661
+ }
662
+ if (!payload || typeof payload !== 'object' || Array.isArray(payload))
663
+ return null;
664
+ return rail.RestorePaymentRecord(row.ExternalPaymentRef, payload);
665
+ }
496
666
  async function upsertExternalPayment(provider, user, paymentProviderID, p, prior, disposition, reason, paymentHeaderID) {
497
667
  const entity = await provider.GetEntityObject(EXTERNAL_PAYMENT_ENTITY, user);
498
668
  if (prior) {