@firedrill-tools/trolley 0.1.1
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.
- package/LICENSE +201 -0
- package/README.md +219 -0
- package/firedrill/agent.target.json +16 -0
- package/firedrill/baseline.scenario.json +2109 -0
- package/firedrill/conformance.suite.json +19 -0
- package/firedrill/partner-outage.scenario.json +11 -0
- package/firedrill/processing-response-lost.scenario.json +11 -0
- package/firedrill/rate-limited.scenario.json +11 -0
- package/firedrill/tight-limits.scenario.json +16 -0
- package/firedrill/tools/trolley/app/assets/ATTRIBUTION.md +35 -0
- package/firedrill/tools/trolley/app/assets/cropped-Site-Icon-512x512-px-1-192x192.png +0 -0
- package/firedrill/tools/trolley/app/assets/fonts/OFL.txt +93 -0
- package/firedrill/tools/trolley/app/assets/full-logo.svg +1 -0
- package/firedrill/tools/trolley/app/assets/logo-black.svg +18 -0
- package/firedrill/tools/trolley/app/site/app.js +139 -0
- package/firedrill/tools/trolley/app/site/assets/fonts/inter-latin.woff2 +0 -0
- package/firedrill/tools/trolley/app/site/assets/trolley-icon.png +0 -0
- package/firedrill/tools/trolley/app/site/assets/trolley-logo.svg +1 -0
- package/firedrill/tools/trolley/app/site/base.css +99 -0
- package/firedrill/tools/trolley/app/site/batch-actions.js +139 -0
- package/firedrill/tools/trolley/app/site/components.css +149 -0
- package/firedrill/tools/trolley/app/site/icons.js +50 -0
- package/firedrill/tools/trolley/app/site/index.html +53 -0
- package/firedrill/tools/trolley/app/site/list.js +87 -0
- package/firedrill/tools/trolley/app/site/ui.js +181 -0
- package/firedrill/tools/trolley/app/site/view-balances.js +30 -0
- package/firedrill/tools/trolley/app/site/view-batch.js +86 -0
- package/firedrill/tools/trolley/app/site/view-batches.js +78 -0
- package/firedrill/tools/trolley/app/site/view-dashboard.js +79 -0
- package/firedrill/tools/trolley/app/site/view-methods.js +80 -0
- package/firedrill/tools/trolley/app/site/view-recipient.js +124 -0
- package/firedrill/tools/trolley/app/site/view-recipients.js +115 -0
- package/firedrill/tools/trolley/behavior.mjs +78 -0
- package/firedrill/tools/trolley/lib/access.mjs +21 -0
- package/firedrill/tools/trolley/lib/ids.mjs +28 -0
- package/firedrill/tools/trolley/lib/money.mjs +55 -0
- package/firedrill/tools/trolley/lib/paging.mjs +65 -0
- package/firedrill/tools/trolley/lib/pricing.mjs +88 -0
- package/firedrill/tools/trolley/lib/records.mjs +87 -0
- package/firedrill/tools/trolley/lib/serialize.mjs +152 -0
- package/firedrill/tools/trolley/lib/store.mjs +61 -0
- package/firedrill/tools/trolley/lib/time.mjs +60 -0
- package/firedrill/tools/trolley/lib/validate.mjs +111 -0
- package/firedrill/tools/trolley/lib/wire.mjs +145 -0
- package/firedrill/tools/trolley/ops/accounts-write.mjs +117 -0
- package/firedrill/tools/trolley/ops/accounts.mjs +129 -0
- package/firedrill/tools/trolley/ops/balances.mjs +23 -0
- package/firedrill/tools/trolley/ops/batches.mjs +139 -0
- package/firedrill/tools/trolley/ops/payment-build.mjs +79 -0
- package/firedrill/tools/trolley/ops/payments.mjs +112 -0
- package/firedrill/tools/trolley/ops/processing.mjs +104 -0
- package/firedrill/tools/trolley/ops/recipients-list.mjs +58 -0
- package/firedrill/tools/trolley/ops/recipients.mjs +127 -0
- package/firedrill/tools/trolley/trolley.tool.json +10095 -0
- package/firedrill/trolley-accounts.drill.json +205 -0
- package/firedrill/trolley-batch-lifecycle.drill.json +522 -0
- package/firedrill/trolley-denied.drill.json +74 -0
- package/firedrill/trolley-fresh-install.drill.json +68 -0
- package/firedrill/trolley-invalid-key.drill.json +743 -0
- package/firedrill/trolley-partner-outage.drill.json +97 -0
- package/firedrill/trolley-processing-rules.drill.json +138 -0
- package/firedrill/trolley-rate-limited.drill.json +118 -0
- package/firedrill/trolley-read-only.drill.json +468 -0
- package/firedrill/trolley-recipients.drill.json +183 -0
- package/firedrill/trolley-response-lost.drill.json +127 -0
- package/firedrill/trolley-tight-limits.drill.json +348 -0
- package/firedrill/world.json +2539 -0
- package/firedrill.json +5 -0
- package/package.json +64 -0
- package/starter.json +2108 -0
- package/test/conformance.mjs +12 -0
- package/test/flow-access.mjs +54 -0
- package/test/flow-accounts.mjs +63 -0
- package/test/flow-batches.mjs +107 -0
- package/test/flow-faults.mjs +58 -0
- package/test/flow-processing.mjs +41 -0
- package/test/flow-recipients.mjs +93 -0
- package/test/harness.mjs +87 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Reload Tech Inc.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# @firedrill-tools/trolley
|
|
2
|
+
|
|
3
|
+
A synthetic **Trolley payouts merchant account (sandbox mode)** for [Firedrill](https://firedrill.run). An agent that pays
|
|
4
|
+
freelancers, creators or suppliers through Trolley's REST API v1 can run against this Tool instead of the real service:
|
|
5
|
+
recipients, payout accounts, batches with FX quotes and processing, payments and balances behave statefully, with
|
|
6
|
+
Trolley's JSON field names, page-number paging and `{ ok: false, errors: [...] }` error envelope.
|
|
7
|
+
|
|
8
|
+
Nothing here contacts Trolley, a bank, PayPal, Venmo or a check printer. No money moves, no e-mail or webhook is sent,
|
|
9
|
+
and no identity or tax verification happens. All state lives in the Firedrill world (SQLite, reset, virtual time,
|
|
10
|
+
evidence); every operation computes its result from that state.
|
|
11
|
+
|
|
12
|
+
It also ships a browser app, a recreation of the Trolley merchant dashboard that reads and writes the same records as the API routes (see "Browser app").
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
firedrill tool add @firedrill-tools/trolley --install
|
|
18
|
+
firedrill serve
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
A new world receives the starter data below and grants for all 24 operations. For an existing world, add the starter
|
|
22
|
+
rows you need and grant the operations (`packageId: "trolley"`, operation ids from the table below) to your actors.
|
|
23
|
+
|
|
24
|
+
Point your agent's Trolley client at the served HTTP binding (connection recipe `trolley-rest`):
|
|
25
|
+
|
|
26
|
+
| client variable | Firedrill value |
|
|
27
|
+
|---|---|
|
|
28
|
+
| `TROLLEY_API_BASE_URL` | `FIREDRILL_HTTP_URL` |
|
|
29
|
+
| `TROLLEY_ACCESS_TOKEN` | `FIREDRILL_HTTP_TOKEN` |
|
|
30
|
+
|
|
31
|
+
Requests authenticate with `Authorization: prsign <token>` or `Authorization: Bearer <token>` (see Compatibility).
|
|
32
|
+
|
|
33
|
+
## Identities and access
|
|
34
|
+
|
|
35
|
+
A Trolley API key belongs to one merchant and is account-wide, so access is modelled with actor attributes, not row owners:
|
|
36
|
+
|
|
37
|
+
| attribute | effect |
|
|
38
|
+
|---|---|
|
|
39
|
+
| `merchantId` | Optional. Must equal the seeded merchant id `M-4Lk9Qx2Rb7Tn3Vw8Yz1Ca6` (`meta/merchant.id`). A different value makes every operation answer **401 `invalid_api_key`**. |
|
|
40
|
+
| `accessLevel` | Optional, `full` (default) or `read_only`. A `read_only` key may list, get and summarise; every create, update, delete, generate-quote and start-processing answers **403 `not_authorized`**. Any other value is `invalid_api_key`. |
|
|
41
|
+
| `displayName` | Optional; not used by the backend. |
|
|
42
|
+
|
|
43
|
+
**Fresh-install fallback:** an actor with neither attribute (as created by `firedrill tool add`) is the seeded merchant with
|
|
44
|
+
full access. Framework grants still decide whether an actor may call an operation at all; a missing grant is a Firedrill
|
|
45
|
+
denial (HTTP 403, rendered in Trolley's envelope with code `not_authorized`).
|
|
46
|
+
|
|
47
|
+
## Starting data
|
|
48
|
+
|
|
49
|
+
`starter.json` (and `firedrill/baseline.scenario.json`) seed 89 fictional rows at virtual time 2026-09-15T14:00:00Z for the
|
|
50
|
+
merchant **Larkspur Creator Studio** (US, USD, sandbox). All names, e-mails (`@example.com`), phone numbers and bank data
|
|
51
|
+
are invented; account numbers exist only as their last four digits.
|
|
52
|
+
|
|
53
|
+
- `meta`: `merchant`, `counters` (`next: 1000`), `fx` (synthetic rates per USD: CAD 1.352, EUR 0.912, GBP 0.781,
|
|
54
|
+
AUD 1.498, MXN 17.24), `fees` (fixed fee and route minimum per payout method, in USD).
|
|
55
|
+
- 3 balances: `paymentrails` USD 18,420.55 (primary), `paymentrails` CAD 2,150.00, `paypal` USD 640.00.
|
|
56
|
+
- 14 recipients: 8 active (US ACH bank, US business paid by check, CA EFT bank with a second PayPal account and a disabled
|
|
57
|
+
former bank account, GB bank, DE IBAN bank, US PayPal, US Venmo, MX bank), 2 incomplete (no address; no payout method),
|
|
58
|
+
1 archived (same e-mail as a newer active recipient), 1 suspended, 1 compliance-blocked, 1 disabled.
|
|
59
|
+
- 11 batches (two pages at the default page size): 6 open batches arranged to exercise every processing rule (ready to
|
|
60
|
+
process; expired FX quote; insufficient funds; one payment to a recipient disabled after it was added; a check below the
|
|
61
|
+
route minimum; empty), 4 complete August batches and 1 failed batch.
|
|
62
|
+
- 22 payments (plus 22 `payment_index` rows) with fees and FX computed by the Tool's own pricing rules.
|
|
63
|
+
|
|
64
|
+
Row ids follow Trolley's format `<prefix>-<22 characters>` (`R-` recipient, `A-` account, `B-` batch, `P-` payment); new ids
|
|
65
|
+
come from `meta/counters`, so runs are deterministic.
|
|
66
|
+
|
|
67
|
+
## Operations and routes
|
|
68
|
+
|
|
69
|
+
No MCP aliases are declared (Trolley publishes no MCP tool contract); MCP clients use the canonical `trolley.<operation>` tools.
|
|
70
|
+
Every route answers 200 on success with `ok: true`.
|
|
71
|
+
|
|
72
|
+
| operation | HTTP route | notes |
|
|
73
|
+
|---|---|---|
|
|
74
|
+
| `recipients.create` | `POST /v1/recipients` | optional `accounts` array; status derived (active needs address + primary account) |
|
|
75
|
+
| `recipients.get` | `GET /v1/recipients/{recipientId}` | computed `payoutMethod`, `primaryCurrency`, `routeType`, `routeMinimum`, `estimatedFees`, masked `accounts` |
|
|
76
|
+
| `recipients.update` | `PATCH /v1/recipients/{recipientId}` | `address` merged per field; `status: "active"` restores an archived recipient |
|
|
77
|
+
| `recipients.delete` | `DELETE /v1/recipients/{recipientId}` | archives; refused while the recipient has a pending payment in an open batch |
|
|
78
|
+
| `recipients.list` | `GET /v1/recipients` | `page`, `pageSize` (≤ 1000), `search`, `name`, `email`, `referenceId`, `status`, `complianceStatus`, `country`, `payoutMethod`, `currency`, `tags`, `orderBy`, `sortBy` |
|
|
79
|
+
| `recipient_accounts.create` | `POST /v1/recipients/{recipientId}/accounts` | `bank-transfer`, `paypal`, `check`, `venmo` |
|
|
80
|
+
| `recipient_accounts.list` | `GET /v1/recipients/{recipientId}/accounts` | active accounts, primary first |
|
|
81
|
+
| `recipient_accounts.get` | `GET /v1/recipients/{recipientId}/accounts/{accountId}` | includes disabled accounts |
|
|
82
|
+
| `recipient_accounts.update` | `PATCH /v1/recipients/{recipientId}/accounts/{accountId}` | `primary: true` demotes siblings; number, IBAN, type and country are immutable |
|
|
83
|
+
| `recipient_accounts.delete` | `DELETE /v1/recipients/{recipientId}/accounts/{accountId}` | disables the account |
|
|
84
|
+
| `batches.create` | `POST /v1/batches` | optional `payments` (≤ 1000) |
|
|
85
|
+
| `batches.get` | `GET /v1/batches/{batchId}` | computed `amount`, `totalPayments` |
|
|
86
|
+
| `batches.update` | `PATCH /v1/batches/{batchId}` | open batches only |
|
|
87
|
+
| `batches.delete` | `DELETE /v1/batches/{batchId}` | open batches only; removes their payments |
|
|
88
|
+
| `batches.list` | `GET /v1/batches` | `page`, `pageSize`, `search`, `status`, `currency`, `tags`, `orderBy` (`createdAt`, `amount`, `status`), `sortBy` |
|
|
89
|
+
| `batches.generate_quote` | `POST /v1/batches/{batchId}/generate-quote` | quote valid for 90 minutes of virtual time; 406 when the batch is not open |
|
|
90
|
+
| `batches.start_processing` | `POST /v1/batches/{batchId}/start-processing` | 409 when not open or empty; see processing rules |
|
|
91
|
+
| `batches.summary` | `GET /v1/batches/{batchId}/summary` | per payout method and total |
|
|
92
|
+
| `payments.create` | `POST /v1/batches/{batchId}/payments` | `recipient` `{ id \| email \| referenceId }`; `amount` + `currency` in the batch currency or the payout currency |
|
|
93
|
+
| `payments.list` | `GET /v1/batches/{batchId}/payments` | `page`, `pageSize`, `status`, `search` |
|
|
94
|
+
| `payments.get` | `GET /v1/batches/{batchId}/payments/{paymentId}`, `GET /v1/payments/{paymentId}` | |
|
|
95
|
+
| `payments.update` | `PATCH /v1/batches/{batchId}/payments/{paymentId}` | pending payments in open batches only |
|
|
96
|
+
| `payments.delete` | `DELETE /v1/batches/{batchId}/payments/{paymentId}` | pending payments in open batches only |
|
|
97
|
+
| `balances.list` | `GET /v1/balances`, `GET /v1/balances/{kind}` | `kind` is `paymentrails` or `paypal`; adds `serverTime` (virtual time) |
|
|
98
|
+
|
|
99
|
+
Errors use Trolley's envelope `{ "ok": false, "errors": [{ "code", "field"?, "message" }] }` with codes `invalid_api_key` (401),
|
|
100
|
+
`not_authorized` (403), `not_found` (404), `empty_field`, `invalid_field`, `expired_quote`, `non_sufficient_funds` (400),
|
|
101
|
+
`invalid_status` (409 on `start-processing`, 406 on `generate-quote`, 400 elsewhere), `rate_limit_exceeded` (429), `partner_integration_error`
|
|
102
|
+
and `internal_server_error` (500).
|
|
103
|
+
An `Idempotency-Key` request header (1 to 255 characters; blank is ignored) is forwarded as the Firedrill idempotency key, a Firedrill
|
|
104
|
+
addition: Trolley documents no idempotency header, so the outcomes are rendered with the closest documented code. Reusing a key with
|
|
105
|
+
the same body on the same route replays the recorded successful response; a call that failed with an error records nothing (the
|
|
106
|
+
framework rolls it back) and is re-executed on retry, so it may then succeed. Reusing a key with a different body answers
|
|
107
|
+
400 `invalid_field` on field `Idempotency-Key` ("Idempotency-Key was already used with a different request body"); sending it to a
|
|
108
|
+
read endpoint (every `GET`) or with more than 255 characters also answers 400 `invalid_field` on `Idempotency-Key`. Over the canonical
|
|
109
|
+
`/v1/operations/trolley/<operation>` path the same cases carry the framework codes `world.IDEMPOTENCY_CONFLICT` and
|
|
110
|
+
`framework.IDEMPOTENCY_NOT_SUPPORTED`.
|
|
111
|
+
|
|
112
|
+
### Processing rules
|
|
113
|
+
|
|
114
|
+
`start-processing` checks everything before writing, so a refused call changes nothing: the batch is open and has payments;
|
|
115
|
+
a payment needing currency conversion requires an unexpired quote (`expired_quote`); every attempted payment meets its route
|
|
116
|
+
minimum (`invalid_field` on `amount`); the `paymentrails` balance in the batch currency covers the sending amounts plus merchant
|
|
117
|
+
fees (`non_sufficient_funds`). The batch then settles in the same call: payments whose recipient is no longer active or has no
|
|
118
|
+
primary payout method fail with a `failureMessage`, the others are processed and debited, and the batch ends `complete` (at
|
|
119
|
+
least one processed) or `failed`.
|
|
120
|
+
|
|
121
|
+
Fees and minimums come from `meta/fees` (USD, converted at the `meta/fx` rate); `coverFees: true` moves the fee from the
|
|
122
|
+
recipient to the merchant. Cross rates are `rates[target] / rates[source]` rounded half up to six decimals; amounts round half up
|
|
123
|
+
to cents. PayPal payments pay in the batch currency.
|
|
124
|
+
|
|
125
|
+
## Events and faults
|
|
126
|
+
|
|
127
|
+
| id | kind | when |
|
|
128
|
+
|---|---|---|
|
|
129
|
+
| `batch.processing` | event | once per settled batch, payload `{ model: "batch", action: "processing", body: { batch } }` |
|
|
130
|
+
| `payment.processed` | event | per processed payment, `{ model: "payment", action: "processed", body: { payment } }` |
|
|
131
|
+
| `payment.failed` | event | per failed payment, `{ model: "payment", action: "failed", body: { payment } }` |
|
|
132
|
+
| `rate-limited` | fault (before) | `recipients.list`, `batches.list`, `payments.list` answer 429 `rate_limit_exceeded` |
|
|
133
|
+
| `payout-partner-outage` | fault (before) | `recipient_accounts.create`, `batches.generate_quote` answer 500 `partner_integration_error`; nothing changes |
|
|
134
|
+
| `processing-response-lost` | fault (after commit) | `batches.start_processing` settles the batch, debits the balance and emits events, then answers 500 `internal_server_error` |
|
|
135
|
+
|
|
136
|
+
The events mirror Trolley's webhook body so a consumer-declared callback can forward them; the package declares no callbacks.
|
|
137
|
+
|
|
138
|
+
## Browser app
|
|
139
|
+
|
|
140
|
+
`firedrill serve` prints the app link (also under **Tools → Open app**). The app is declared as `"ui": { "root": "app/site", "entry": "index.html" }`
|
|
141
|
+
and is plain local HTML/CSS/JS using `/_firedrill/client.js`; every screen calls the operations above, so a change made in the app is visible over
|
|
142
|
+
HTTP and MCP and vice versa, and a world reset restores both.
|
|
143
|
+
|
|
144
|
+
- **Chrome**: collapsible icon rail with the Trolley app tile (Overview, Recipients, Payments, Invoices, Balances, Tax Center, Reports, Approvals,
|
|
145
|
+
Developers, Settings), top bar with page title, notification bell, the synthetic actor id with a `SANDBOX` pill, and the account menu.
|
|
146
|
+
- **Overview**: available Trolley balance, value of completed batches, recipient count and incomplete profiles, batches awaiting processing,
|
|
147
|
+
recently completed batches.
|
|
148
|
+
- **Recipients**: status tabs, search (`search`), payout-method and country filters, sortable columns, page/pageSize paging, **Add recipient**.
|
|
149
|
+
- **Recipient profile**: details with **Edit**, payout methods (masked numbers, primary badge, **Make primary**, **Remove** with confirmation),
|
|
150
|
+
**Add payout method** (bank transfer, Venmo, PayPal, check), **Archive** / **Restore recipient**.
|
|
151
|
+
- **Payments**: batch list with status tabs, search, sorting, paging and **Create batch**. **Batch detail**: status, amount, payment count and quote
|
|
152
|
+
expiry computed from world virtual time (`balances.list` `serverTime`), payments table with search and paging, **Add payment** with a recipient
|
|
153
|
+
search picker, edit/remove pending payments, **Generate quote**, **Review** (batch summary by payout method), **Process batch** confirmation
|
|
154
|
+
showing the debit and available balance, **Delete batch**.
|
|
155
|
+
- **Balances**: Trolley and PayPal balances with kind tabs.
|
|
156
|
+
|
|
157
|
+
Every mutation sends a fresh idempotency key per confirmed action and is never retried silently; a 500 or partner error while processing tells the
|
|
158
|
+
user the result is unknown and re-reads the batch. Loading skeletons, empty states, error states with **Try again**, and `not_authorized` /
|
|
159
|
+
`invalid_api_key` panels are rendered from the real outcomes. The app refreshes when `getContext().revision` changes, except while a form is open.
|
|
160
|
+
All record text is rendered with `textContent`.
|
|
161
|
+
|
|
162
|
+
Not simulated (the controls are present and open a "not simulated by this Tool" panel, with no invented data): Invoices, Tax Center, Reports,
|
|
163
|
+
Approvals, Developers, Settings, the notification feed, account settings and live mode. The app cannot read actor attributes, so it shows the
|
|
164
|
+
actor id instead of `displayName`, and a read-only key is discovered when a write is refused. Logos are the vendor's own files (see
|
|
165
|
+
`firedrill/tools/trolley/app/assets/ATTRIBUTION.md`); the typeface is Inter (OFL) standing in for the proprietary face.
|
|
166
|
+
|
|
167
|
+
## Compatibility
|
|
168
|
+
|
|
169
|
+
**Not verified against a real Trolley client.** `compatibility` is empty. Trolley's official SDKs sign each request
|
|
170
|
+
(`Authorization: prsign <accessKey>:<HMAC signature>` plus `X-PR-Timestamp`). Firedrill's HTTP binding compares the credential
|
|
171
|
+
after the scheme exactly with the world token, so a caller must send `Authorization: prsign <FIREDRILL_HTTP_TOKEN>` (or
|
|
172
|
+
`Bearer`). Signed SDK requests cannot authenticate unmodified; timestamps and signatures are never checked.
|
|
173
|
+
|
|
174
|
+
Framework-owned outcomes (a missing grant, input that fails the declared schema, a request the codec cannot map) keep the
|
|
175
|
+
framework's HTTP status and are rendered in Trolley's envelope (`not_authorized`, `invalid_field`, `not_found`). A missing or
|
|
176
|
+
wrong token answers the framework's 401 (`framework.HTTP_UNAUTHORIZED`), and trailing-slash paths (`/v1/recipients/`) and
|
|
177
|
+
endpoints outside the table answer the framework's 404; those responses never reach the Tool, so they keep framework bodies.
|
|
178
|
+
|
|
179
|
+
`generate-quote` and `start-processing` accept an empty body or `{}` (the routes are declared as text bodies because the framework
|
|
180
|
+
rejects empty JSON bodies).
|
|
181
|
+
|
|
182
|
+
## Limitations
|
|
183
|
+
|
|
184
|
+
1. Processing settles synchronously: no `initiating` or `processing` status is observable over REST (only in the
|
|
185
|
+
`batch.processing` event), and there are no delayed bank settlements, returns or `payment.returned` events.
|
|
186
|
+
2. Not simulated (404): bulk deletes, recipient logs and payment history, offline payments, invoices, verifications, tax forms and
|
|
187
|
+
profiles, webhook subscription management, recipient widget or portal URLs, approval workflows, funding and deposits, live mode.
|
|
188
|
+
3. Withholding and returned amounts are always `"0.00"`; `debit-card`, `mobile-wallet` and `interac` accounts cannot be created.
|
|
189
|
+
4. FX rates, fees and route minimums are synthetic (`meta/fx`, `meta/fees`), not Trolley's pricing. Cross-currency payment amounts
|
|
190
|
+
are always shown at the table rate; a quote locks them for 90 minutes of virtual time.
|
|
191
|
+
5. Balances are a seeded snapshot; processing debits only `paymentrails:<batch currency>`.
|
|
192
|
+
6. Recipient status uses a simplified rule (address + primary account + holds); country-specific bank rules are reduced to digit
|
|
193
|
+
checks for account number, routing/transit/sort code and CA institution number, and an IBAN shape check.
|
|
194
|
+
7. Full account numbers and IBANs are never stored: only the last four characters, always shown masked.
|
|
195
|
+
8. Lists are page-number based. A page whose JSON would exceed 900 KB answers `invalid_field` on `pageSize`. Every state scan is
|
|
196
|
+
bounded by 10,000 rows (lower with `meta/limits.maxRows`); exceeding it answers `internal_server_error` instead of truncating.
|
|
197
|
+
9. Unsupported list query parameters (for example `startDate`) answer `invalid_field` rather than being ignored.
|
|
198
|
+
10. The default exclusion of archived recipients from lists, e-mail uniqueness among non-archived recipients and several error
|
|
199
|
+
messages are inferred from public documentation, not verified against the live API. Recipient responses omit `gravatarUrl`,
|
|
200
|
+
`compliance`, `governmentIds` and similar fields that the Tool does not model.
|
|
201
|
+
11. `balances.list` adds `serverTime`, and idempotent replay via `Idempotency-Key` is a Firedrill addition (see "Operations and routes"
|
|
202
|
+
for how key reuse and misuse are rendered). A replayed response carries the same values as the original, but the framework
|
|
203
|
+
stores the recorded result in canonical form, so its JSON keys come back in alphabetical rather than Trolley's field order.
|
|
204
|
+
|
|
205
|
+
## Conformance
|
|
206
|
+
|
|
207
|
+
`firedrill tool test trolley` runs 12 drills (Node built-ins only, `test/conformance.mjs`) twice and checks determinism: recipients,
|
|
208
|
+
accounts, batch lifecycle, processing rules, read-only key, another merchant's key, fresh-install actor, framework denial, and one
|
|
209
|
+
scenario per fault plus a lowered scan bound. Together they observe every operation, declared error, event and fault.
|
|
210
|
+
|
|
211
|
+
## Trademarks
|
|
212
|
+
|
|
213
|
+
Trolley, the Trolley name and the Trolley logos are trademarks of their owner. The name and the unmodified logo files bundled in the
|
|
214
|
+
browser app (sources recorded in `firedrill/tools/trolley/app/assets/ATTRIBUTION.md`) are used only to identify the simulated service in a
|
|
215
|
+
test environment; this package is not affiliated with or endorsed by Trolley. PayPal and Venmo are named only as payout-method types.
|
|
216
|
+
|
|
217
|
+
## License
|
|
218
|
+
|
|
219
|
+
Apache-2.0
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"target": {
|
|
4
|
+
"id": "conformance-agent",
|
|
5
|
+
"kind": "command",
|
|
6
|
+
"bindings": [
|
|
7
|
+
"http"
|
|
8
|
+
],
|
|
9
|
+
"executable": "node",
|
|
10
|
+
"arguments": [
|
|
11
|
+
"test/conformance.mjs"
|
|
12
|
+
],
|
|
13
|
+
"workingDirectory": ".",
|
|
14
|
+
"timeoutMs": 120000
|
|
15
|
+
}
|
|
16
|
+
}
|