toga-ai 1.0.101 → 1.0.102

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.
@@ -2,5 +2,6 @@
2
2
 
3
3
  | Doc | Framework | Summary | Files |
4
4
  |-----|-----------|---------|-------|
5
+ | [Rate Monthly Reconciliation Report](features/monthly-reconciliation-report.md) | 1.0 | A monthly cron that emails an Excel reconciliation report covering all Rate subscription sales orders and their linked PayPal payments for the prior calendar mo | worker/crons/notifications/reports/rate/send_monthly_rate_purchases_report.php, worker/schedules/cron.worker.notification.json |
5
6
  | [Rate SAML SSO](features/saml-sso.md) | 2.0 | Rate uses Azure AD as its IdP (`login.rate.com`). | _underscore/Model/Rate/ClientAuthentication.php, saml/Controller/Index.php, toga2-view/src/hooks/useAuthenticationFlow.ts |
6
7
  | [Rate](profile.md) | 2.0 | Rate is a mortgage/lending client. | |
@@ -0,0 +1,85 @@
1
+ ---
2
+ title: Rate Monthly Reconciliation Report
3
+ framework: "1.0"
4
+ repo: worker
5
+ project: Worker
6
+ client: rate
7
+ type: client-feature
8
+ status: active
9
+ updated: 2026-06-16
10
+ owners: ["rgirish"]
11
+ files:
12
+ - worker/crons/notifications/reports/rate/send_monthly_rate_purchases_report.php
13
+ - worker/schedules/cron.worker.notification.json
14
+ related:
15
+ - clients/rate/features/saml-sso.md
16
+ - clients/rate/profile.md
17
+ ---
18
+
19
+ ## Summary
20
+
21
+ A monthly cron that emails an Excel reconciliation report covering all Rate subscription
22
+ sales orders and their linked PayPal payments for the prior calendar month. Used by AIG
23
+ (for contract reconciliation) and the TOGA accounts team (for billing verification).
24
+
25
+ ## How it works
26
+
27
+ 1. Runs on the 1st of each month via `cron.worker.notification.json`.
28
+ 2. Queries `Client_Rate` for all `SalesOrders` whose `dateOrder` falls within the prior
29
+ month, joined through `Entitlements_SalesOrders` → `Entitlements` → `Subscriptions`.
30
+ Filtered to `Subscriptions.token LIKE 'I-%'` (PayPal recurring subscription tokens only).
31
+ 3. Also joins `SalesOrders_Payments` → `Payments` for transaction-level detail.
32
+ 4. Builds a 16-column Excel sheet ("Monthly Reconciliation") using PhpSpreadsheet.
33
+ 5. Emails the `.xlsx` as an attachment. If no orders found, sends a plain no-data notice.
34
+
35
+ ## Report columns
36
+
37
+ | # | Column | Source |
38
+ |---|---|---|
39
+ | 1 | Customer Name | `Customers.name` |
40
+ | 2 | Email | `ContactEmailAddresses.emailAddress` |
41
+ | 3 | Address | `Addresses` (line1, line2, city, state, zip via `CONCAT_WS`) |
42
+ | 4 | Entitlement # | `Entitlements.number` |
43
+ | 5 | AIG Contract # | `Entitlements.c_aigContractNumber` |
44
+ | 6 | Sales Order # | `SalesOrders.number` |
45
+ | 7 | Description | `SalesOrders.description` |
46
+ | 8 | Order Date | `SalesOrders.dateOrder` |
47
+ | 9 | Subscription Token | `Subscriptions.token` |
48
+ | 10 | Active | `Subscriptions.isActive` (Yes/No) |
49
+ | 11 | Date Cancelled | `Subscriptions.dateCancelled` |
50
+ | 12 | Date End | `Subscriptions.dateEnd` |
51
+ | 13 | Transaction ID | `Payments.transactionIdentifier` |
52
+ | 14 | Amount | `Payments.amount` |
53
+ | 15 | Payment Date | `Payments.dtStamp` |
54
+ | 16 | Payment Note | `Payments.note` |
55
+
56
+ ## Key design decisions
57
+
58
+ - **Filtered by `SalesOrders.dateOrder`**, not `Entitlements.dtCreated` — catches recurring
59
+ monthly payments, not just the original purchase date.
60
+ - **`Subscriptions.token LIKE 'I-%'`** — restricts to PayPal recurring billing agreement
61
+ tokens; excludes any one-off or non-PayPal orders.
62
+ - **LEFT JOIN on Payments** — a sales order with no payment record still appears in the
63
+ report (payment columns will be blank). This surfaces orders missing payment data.
64
+ - Ordered by `Subscriptions.id ASC, SalesOrders.dateOrder ASC` — groups all orders per
65
+ subscriber chronologically.
66
+
67
+ ## Recipients
68
+
69
+ Currently `$emailTo` in the script. Update there to add AIG or additional recipients.
70
+
71
+ ## Gotchas / known issues
72
+
73
+ - **`c_aigContractNumber`** is the display string from AIG (e.g. `1000045859462`). The
74
+ companion `c_aigContractId` (Int32) is used by the AIG cancel API but is not included
75
+ in this report — add it if AIG requests it for matching.
76
+ - **To run manually for testing**, comment out the `WHERE` date filter. Restore it before
77
+ leaving the script — the cron runs on the 1st and will pull all-time data otherwise.
78
+ - The script file is named `send_monthly_rate_purchases_report.php` (historical name) but
79
+ the report it generates is now the reconciliation report — the filename was not renamed.
80
+
81
+ ## Change history
82
+
83
+ - 2026-06-16 — Rebuilt from a new-purchases report into a full reconciliation report: query
84
+ now drives off `SalesOrders.dateOrder` (not `Entitlements.dtCreated`), adds Payments join,
85
+ 16-column sheet replacing the old 11-column sheet, filtered to PayPal tokens (rgirish)
@@ -5,15 +5,17 @@ apps:
5
5
  - _underscore
6
6
  - saml
7
7
  - toga2-view
8
+ - worker
8
9
  project: SAML SSO Gateway
9
10
  client: rate
10
11
  type: profile
11
12
  status: active
12
- updated: 2026-06-11
13
+ updated: 2026-06-16
13
14
  owners: ["rgirish"]
14
15
  files: []
15
16
  related:
16
17
  - clients/rate/features/saml-sso.md
18
+ - clients/rate/features/monthly-reconciliation-report.md
17
19
  ---
18
20
 
19
21
  ## Summary
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toga-ai",
3
- "version": "1.0.101",
3
+ "version": "1.0.102",
4
4
  "description": "TOGA Technology Team Claude Knowledge System — shared AI coding harness with skills, knowledge base CLI, and project installer for Claude Code.",
5
5
  "keywords": [
6
6
  "claude",