@proveanything/smartlinks 3.0.0-alpha.2 → 3.0.0-alpha.3
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/README.md +741 -741
- package/dist/README.md +573 -573
- package/dist/adminCardsView.js +55 -55
- package/dist/api/bookings.d.ts +49 -2
- package/dist/api/bookings.js +59 -2
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/payments.d.ts +60 -0
- package/dist/api/payments.js +94 -0
- package/dist/api/realtime.d.ts +3 -0
- package/dist/api/realtime.js +10 -2
- package/dist/baseline.css +194 -194
- package/dist/dataChanged.d.ts +74 -0
- package/dist/dataChanged.js +162 -0
- package/dist/docs/API_SUMMARY.md +1086 -858
- package/dist/docs/admin-cards.md +189 -189
- package/dist/docs/agent-tools.md +156 -156
- package/dist/docs/ai-tools-and-skills.md +180 -180
- package/dist/docs/ai.md +1721 -1721
- package/dist/docs/api-versions.md +85 -85
- package/dist/docs/app-data-storage.md +277 -277
- package/dist/docs/app-docs.md +73 -73
- package/dist/docs/app-manifest.md +852 -852
- package/dist/docs/app-records-pattern.md +388 -388
- package/dist/docs/appConfig.md +550 -550
- package/dist/docs/assistant-apps.md +172 -172
- package/dist/docs/assistant-context.md +119 -119
- package/dist/docs/bookings.md +105 -8
- package/dist/docs/caching.md +32 -3
- package/dist/docs/comms.md +689 -689
- package/dist/docs/connectors.md +340 -340
- package/dist/docs/css-baseline.md +133 -133
- package/dist/docs/customer-guide.md +70 -70
- package/dist/docs/data-changed.md +91 -0
- package/dist/docs/deploying-apps.md +340 -340
- package/dist/docs/dpp.md +115 -115
- package/dist/docs/entitlements.md +90 -90
- package/dist/docs/files.md +69 -69
- package/dist/docs/host-dependency-contract.md +252 -252
- package/dist/docs/iframe-responder.md +11 -0
- package/dist/docs/integrations.md +322 -322
- package/dist/docs/interactions.md +544 -544
- package/dist/docs/item-context.md +181 -181
- package/dist/docs/knowledge.md +105 -105
- package/dist/docs/lists.md +157 -157
- package/dist/docs/lots.md +112 -112
- package/dist/docs/loyalty.md +348 -348
- package/dist/docs/members.md +183 -183
- package/dist/docs/memberships.md +150 -150
- package/dist/docs/mobile-admin-container.md +693 -693
- package/dist/docs/operations.md +281 -281
- package/dist/docs/overview.md +487 -485
- package/dist/docs/payments.md +94 -0
- package/dist/docs/proof-comms-triggers.md +142 -142
- package/dist/docs/proof-ownership-transfer.md +155 -155
- package/dist/docs/proof-product-data-scoping.md +462 -462
- package/dist/docs/proof-share-grants.md +305 -305
- package/dist/docs/realtime.md +149 -139
- package/dist/docs/records-admin-pattern.md +304 -304
- package/dist/docs/service-accounts.md +64 -64
- package/dist/docs/standard-query.md +196 -187
- package/dist/docs/tag-codes.md +97 -97
- package/dist/docs/tag-ranges.md +106 -106
- package/dist/docs/theme-tokens.md +252 -252
- package/dist/docs/upgrading-to-3.md +550 -532
- package/dist/docs/wallet-passes.md +107 -107
- package/dist/docs/websites.md +123 -123
- package/dist/http.d.ts +6 -3
- package/dist/http.js +48 -19
- package/dist/iframeResponder.d.ts +7 -0
- package/dist/iframeResponder.js +10 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/openapi.yaml +426 -3
- package/dist/testing/bookingsMemory.d.ts +29 -1
- package/dist/testing/bookingsMemory.js +89 -1
- package/dist/testing/index.js +4 -1
- package/dist/theme-boot.js +82 -82
- package/dist/theme.css +75 -75
- package/dist/types/appManifest.d.ts +26 -4
- package/dist/types/bookings.d.ts +99 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/payments.d.ts +101 -0
- package/dist/types/payments.js +5 -0
- package/dist/types/realtime.d.ts +5 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/API_SUMMARY.md +1086 -858
- package/docs/admin-cards.md +189 -189
- package/docs/agent-tools.md +156 -156
- package/docs/ai-tools-and-skills.md +180 -180
- package/docs/ai.md +1721 -1721
- package/docs/api-versions.md +85 -85
- package/docs/app-data-storage.md +277 -277
- package/docs/app-docs.md +73 -73
- package/docs/app-manifest.md +852 -852
- package/docs/app-records-pattern.md +388 -388
- package/docs/appConfig.md +550 -550
- package/docs/assistant-apps.md +172 -172
- package/docs/assistant-context.md +119 -119
- package/docs/bookings.md +105 -8
- package/docs/caching.md +32 -3
- package/docs/comms.md +689 -689
- package/docs/connectors.md +340 -340
- package/docs/css-baseline.md +133 -133
- package/docs/customer-guide.md +70 -70
- package/docs/data-changed.md +91 -0
- package/docs/deploying-apps.md +340 -340
- package/docs/dpp.md +115 -115
- package/docs/entitlements.md +90 -90
- package/docs/files.md +69 -69
- package/docs/host-dependency-contract.md +252 -252
- package/docs/iframe-responder.md +11 -0
- package/docs/integrations.md +322 -322
- package/docs/interactions.md +544 -544
- package/docs/item-context.md +181 -181
- package/docs/knowledge.md +105 -105
- package/docs/lists.md +157 -157
- package/docs/lots.md +112 -112
- package/docs/loyalty.md +348 -348
- package/docs/members.md +183 -183
- package/docs/memberships.md +150 -150
- package/docs/mobile-admin-container.md +693 -693
- package/docs/operations.md +281 -281
- package/docs/overview.md +487 -485
- package/docs/payments.md +94 -0
- package/docs/proof-comms-triggers.md +142 -142
- package/docs/proof-ownership-transfer.md +155 -155
- package/docs/proof-product-data-scoping.md +462 -462
- package/docs/proof-share-grants.md +305 -305
- package/docs/realtime.md +149 -139
- package/docs/service-accounts.md +64 -64
- package/docs/standard-query.md +196 -187
- package/docs/tag-codes.md +97 -97
- package/docs/tag-ranges.md +106 -106
- package/docs/theme-lookbook.v1.json +120 -120
- package/docs/theme-tokens.md +252 -252
- package/docs/upgrading-to-3.md +550 -532
- package/docs/wallet-passes.md +107 -107
- package/docs/websites.md +123 -123
- package/openapi.yaml +426 -3
- package/package.json +91 -91
- package/scripts/headless-check.mjs +87 -87
- package/scripts/lib/bare-imports.mjs +57 -57
- package/scripts/lib/keyed-app-data.mjs +21 -21
- package/scripts/lib/upgrade.mjs +708 -668
- package/scripts/publish.mjs +272 -272
- package/scripts/register-release.mjs +91 -91
- package/scripts/upgrade.mjs +79 -79
- package/upgrade/3.json +2 -2
package/dist/openapi.yaml
CHANGED
|
@@ -6112,7 +6112,7 @@ paths:
|
|
|
6112
6112
|
post:
|
|
6113
6113
|
tags:
|
|
6114
6114
|
- order
|
|
6115
|
-
summary:
|
|
6115
|
+
summary: order.getAnalytics
|
|
6116
6116
|
operationId: order_getAnalytics
|
|
6117
6117
|
security:
|
|
6118
6118
|
- bearerAuth: []
|
|
@@ -7411,7 +7411,7 @@ paths:
|
|
|
7411
7411
|
post:
|
|
7412
7412
|
tags:
|
|
7413
7413
|
- proof
|
|
7414
|
-
summary:
|
|
7414
|
+
summary: proof.query
|
|
7415
7415
|
operationId: proof_query
|
|
7416
7416
|
security:
|
|
7417
7417
|
- bearerAuth: []
|
|
@@ -8913,7 +8913,7 @@ paths:
|
|
|
8913
8913
|
post:
|
|
8914
8914
|
tags:
|
|
8915
8915
|
- authKit
|
|
8916
|
-
summary:
|
|
8916
|
+
summary: authKit.linkedInLogin
|
|
8917
8917
|
operationId: authKit_linkedInLogin
|
|
8918
8918
|
security: []
|
|
8919
8919
|
parameters:
|
|
@@ -9894,6 +9894,32 @@ paths:
|
|
|
9894
9894
|
application/json:
|
|
9895
9895
|
schema:
|
|
9896
9896
|
$ref: "#/components/schemas/CreateBlockInput"
|
|
9897
|
+
/checkout:
|
|
9898
|
+
post:
|
|
9899
|
+
tags:
|
|
9900
|
+
- bookings
|
|
9901
|
+
summary: Book and pay.
|
|
9902
|
+
operationId: bookings_checkout
|
|
9903
|
+
security: []
|
|
9904
|
+
responses:
|
|
9905
|
+
200:
|
|
9906
|
+
description: Success
|
|
9907
|
+
content:
|
|
9908
|
+
application/json:
|
|
9909
|
+
schema:
|
|
9910
|
+
$ref: "#/components/schemas/BookingCheckoutResult"
|
|
9911
|
+
400:
|
|
9912
|
+
description: Bad request
|
|
9913
|
+
401:
|
|
9914
|
+
description: Unauthorized
|
|
9915
|
+
404:
|
|
9916
|
+
description: Not found
|
|
9917
|
+
requestBody:
|
|
9918
|
+
required: true
|
|
9919
|
+
content:
|
|
9920
|
+
application/json:
|
|
9921
|
+
schema:
|
|
9922
|
+
$ref: "#/components/schemas/BookingCheckoutInput"
|
|
9897
9923
|
/freebusy:
|
|
9898
9924
|
get:
|
|
9899
9925
|
tags:
|
|
@@ -13946,6 +13972,65 @@ paths:
|
|
|
13946
13972
|
description: Unauthorized
|
|
13947
13973
|
404:
|
|
13948
13974
|
description: Not found
|
|
13975
|
+
/{bookingId}/pay:
|
|
13976
|
+
post:
|
|
13977
|
+
tags:
|
|
13978
|
+
- bookings
|
|
13979
|
+
summary: "An approved request's pay link, for an app with its own pay page (the link in the email goes straight to Stripe)."
|
|
13980
|
+
operationId: bookings_pay
|
|
13981
|
+
security: []
|
|
13982
|
+
parameters:
|
|
13983
|
+
- name: bookingId
|
|
13984
|
+
in: path
|
|
13985
|
+
required: true
|
|
13986
|
+
schema:
|
|
13987
|
+
type: string
|
|
13988
|
+
responses:
|
|
13989
|
+
200:
|
|
13990
|
+
description: Success
|
|
13991
|
+
content:
|
|
13992
|
+
application/json:
|
|
13993
|
+
schema:
|
|
13994
|
+
$ref: "#/components/schemas/BookingPayLinkResult"
|
|
13995
|
+
400:
|
|
13996
|
+
description: Bad request
|
|
13997
|
+
401:
|
|
13998
|
+
description: Unauthorized
|
|
13999
|
+
404:
|
|
14000
|
+
description: Not found
|
|
14001
|
+
/{bookingId}/refund:
|
|
14002
|
+
post:
|
|
14003
|
+
tags:
|
|
14004
|
+
- bookings
|
|
14005
|
+
summary: "Refund a paid booking without cancelling it (admin): all that's left, or `amount` (minor units)."
|
|
14006
|
+
operationId: bookings_refund
|
|
14007
|
+
security: []
|
|
14008
|
+
parameters:
|
|
14009
|
+
- name: bookingId
|
|
14010
|
+
in: path
|
|
14011
|
+
required: true
|
|
14012
|
+
schema:
|
|
14013
|
+
type: string
|
|
14014
|
+
responses:
|
|
14015
|
+
200:
|
|
14016
|
+
description: Success
|
|
14017
|
+
content:
|
|
14018
|
+
application/json:
|
|
14019
|
+
schema:
|
|
14020
|
+
$ref: "#/components/schemas/BookingRefundResult"
|
|
14021
|
+
400:
|
|
14022
|
+
description: Bad request
|
|
14023
|
+
401:
|
|
14024
|
+
description: Unauthorized
|
|
14025
|
+
404:
|
|
14026
|
+
description: Not found
|
|
14027
|
+
requestBody:
|
|
14028
|
+
required: true
|
|
14029
|
+
content:
|
|
14030
|
+
application/json:
|
|
14031
|
+
schema:
|
|
14032
|
+
type: object
|
|
14033
|
+
additionalProperties: true
|
|
13949
14034
|
/{conditionId}:
|
|
13950
14035
|
get:
|
|
13951
14036
|
tags:
|
|
@@ -24474,6 +24559,8 @@ components:
|
|
|
24474
24559
|
$ref: "#/components/schemas/BookingAllocation"
|
|
24475
24560
|
editToken:
|
|
24476
24561
|
type: string
|
|
24562
|
+
payment:
|
|
24563
|
+
$ref: "#/components/schemas/BookingPayment"
|
|
24477
24564
|
required:
|
|
24478
24565
|
- id
|
|
24479
24566
|
- collectionId
|
|
@@ -25024,6 +25111,166 @@ components:
|
|
|
25024
25111
|
$ref: "#/components/schemas/ScheduleOverride"
|
|
25025
25112
|
required:
|
|
25026
25113
|
- timezone
|
|
25114
|
+
BookingPaymentLine:
|
|
25115
|
+
type: object
|
|
25116
|
+
properties:
|
|
25117
|
+
priceId:
|
|
25118
|
+
type: string
|
|
25119
|
+
label:
|
|
25120
|
+
type: string
|
|
25121
|
+
unitAmount:
|
|
25122
|
+
type: number
|
|
25123
|
+
quantity:
|
|
25124
|
+
type: number
|
|
25125
|
+
required:
|
|
25126
|
+
- priceId
|
|
25127
|
+
- label
|
|
25128
|
+
- unitAmount
|
|
25129
|
+
- quantity
|
|
25130
|
+
BookingPayment:
|
|
25131
|
+
type: object
|
|
25132
|
+
properties:
|
|
25133
|
+
status:
|
|
25134
|
+
type: string
|
|
25135
|
+
enum:
|
|
25136
|
+
- awaiting
|
|
25137
|
+
- paid
|
|
25138
|
+
- partially_refunded
|
|
25139
|
+
- refunded
|
|
25140
|
+
- waived
|
|
25141
|
+
total:
|
|
25142
|
+
type: number
|
|
25143
|
+
currency:
|
|
25144
|
+
type: string
|
|
25145
|
+
refunded:
|
|
25146
|
+
type: number
|
|
25147
|
+
lines:
|
|
25148
|
+
type: array
|
|
25149
|
+
items:
|
|
25150
|
+
$ref: "#/components/schemas/BookingPaymentLine"
|
|
25151
|
+
paidAt:
|
|
25152
|
+
type: string
|
|
25153
|
+
payBy:
|
|
25154
|
+
type: string
|
|
25155
|
+
requested:
|
|
25156
|
+
type: boolean
|
|
25157
|
+
link:
|
|
25158
|
+
type: string
|
|
25159
|
+
required:
|
|
25160
|
+
- status
|
|
25161
|
+
- total
|
|
25162
|
+
- currency
|
|
25163
|
+
- refunded
|
|
25164
|
+
- lines
|
|
25165
|
+
BookingPrice:
|
|
25166
|
+
type: object
|
|
25167
|
+
properties:
|
|
25168
|
+
id:
|
|
25169
|
+
type: string
|
|
25170
|
+
label:
|
|
25171
|
+
type: string
|
|
25172
|
+
amount:
|
|
25173
|
+
type: number
|
|
25174
|
+
durationMinutes:
|
|
25175
|
+
type: number
|
|
25176
|
+
resourceIds:
|
|
25177
|
+
type: array
|
|
25178
|
+
items:
|
|
25179
|
+
type: string
|
|
25180
|
+
required:
|
|
25181
|
+
- id
|
|
25182
|
+
- label
|
|
25183
|
+
- amount
|
|
25184
|
+
BookingPaymentsConfig:
|
|
25185
|
+
type: object
|
|
25186
|
+
properties:
|
|
25187
|
+
required:
|
|
25188
|
+
type: boolean
|
|
25189
|
+
currency:
|
|
25190
|
+
type: string
|
|
25191
|
+
prices:
|
|
25192
|
+
type: array
|
|
25193
|
+
items:
|
|
25194
|
+
$ref: "#/components/schemas/BookingPrice"
|
|
25195
|
+
sessionMinutes:
|
|
25196
|
+
type: number
|
|
25197
|
+
ownerCancelRefund:
|
|
25198
|
+
type: string
|
|
25199
|
+
enum:
|
|
25200
|
+
- full
|
|
25201
|
+
- none
|
|
25202
|
+
payWithinHours:
|
|
25203
|
+
type: number
|
|
25204
|
+
successUrl:
|
|
25205
|
+
type: string
|
|
25206
|
+
cancelUrl:
|
|
25207
|
+
type: string
|
|
25208
|
+
allowedHosts:
|
|
25209
|
+
type: array
|
|
25210
|
+
items:
|
|
25211
|
+
type: string
|
|
25212
|
+
BookingPriceLine:
|
|
25213
|
+
type: object
|
|
25214
|
+
properties:
|
|
25215
|
+
priceId:
|
|
25216
|
+
type: string
|
|
25217
|
+
quantity:
|
|
25218
|
+
type: number
|
|
25219
|
+
required:
|
|
25220
|
+
- priceId
|
|
25221
|
+
BookingCheckoutInput:
|
|
25222
|
+
type: object
|
|
25223
|
+
properties:
|
|
25224
|
+
lines:
|
|
25225
|
+
type: array
|
|
25226
|
+
items:
|
|
25227
|
+
$ref: "#/components/schemas/BookingPriceLine"
|
|
25228
|
+
priceId:
|
|
25229
|
+
type: string
|
|
25230
|
+
email:
|
|
25231
|
+
type: string
|
|
25232
|
+
successUrl:
|
|
25233
|
+
type: string
|
|
25234
|
+
cancelUrl:
|
|
25235
|
+
type: string
|
|
25236
|
+
customer:
|
|
25237
|
+
type: object
|
|
25238
|
+
additionalProperties: true
|
|
25239
|
+
BookingCheckoutResult:
|
|
25240
|
+
type: object
|
|
25241
|
+
properties:
|
|
25242
|
+
booking:
|
|
25243
|
+
$ref: "#/components/schemas/Booking"
|
|
25244
|
+
editToken:
|
|
25245
|
+
type: string
|
|
25246
|
+
checkoutUrl:
|
|
25247
|
+
type: string
|
|
25248
|
+
expiresAt:
|
|
25249
|
+
type: string
|
|
25250
|
+
total:
|
|
25251
|
+
type: number
|
|
25252
|
+
currency:
|
|
25253
|
+
type: string
|
|
25254
|
+
request:
|
|
25255
|
+
type: boolean
|
|
25256
|
+
required:
|
|
25257
|
+
- booking
|
|
25258
|
+
- checkoutUrl
|
|
25259
|
+
- expiresAt
|
|
25260
|
+
- total
|
|
25261
|
+
- currency
|
|
25262
|
+
BookingPayLinkResult:
|
|
25263
|
+
type: object
|
|
25264
|
+
properties:
|
|
25265
|
+
checkoutUrl:
|
|
25266
|
+
type: string
|
|
25267
|
+
done:
|
|
25268
|
+
type: string
|
|
25269
|
+
enum:
|
|
25270
|
+
- paid
|
|
25271
|
+
- closed
|
|
25272
|
+
url:
|
|
25273
|
+
type: string
|
|
25027
25274
|
BookingResourceRef:
|
|
25028
25275
|
type: object
|
|
25029
25276
|
properties:
|
|
@@ -25086,6 +25333,8 @@ components:
|
|
|
25086
25333
|
- fri
|
|
25087
25334
|
- sat
|
|
25088
25335
|
- sun
|
|
25336
|
+
BookingRefundResult:
|
|
25337
|
+
$ref: "#/components/schemas/Booking"
|
|
25089
25338
|
ListBroadcastsQuery:
|
|
25090
25339
|
type: object
|
|
25091
25340
|
properties:
|
|
@@ -33621,6 +33870,180 @@ components:
|
|
|
33621
33870
|
enum:
|
|
33622
33871
|
- sales
|
|
33623
33872
|
- purchase
|
|
33873
|
+
PaymentsPublicConfig:
|
|
33874
|
+
type: object
|
|
33875
|
+
properties:
|
|
33876
|
+
ready:
|
|
33877
|
+
type: boolean
|
|
33878
|
+
publishableKey:
|
|
33879
|
+
type: string
|
|
33880
|
+
accountId:
|
|
33881
|
+
type: string
|
|
33882
|
+
required:
|
|
33883
|
+
- ready
|
|
33884
|
+
- publishableKey
|
|
33885
|
+
- accountId
|
|
33886
|
+
PaymentIntentInput:
|
|
33887
|
+
type: object
|
|
33888
|
+
properties:
|
|
33889
|
+
appId:
|
|
33890
|
+
type: string
|
|
33891
|
+
amount:
|
|
33892
|
+
type: number
|
|
33893
|
+
currency:
|
|
33894
|
+
type: string
|
|
33895
|
+
email:
|
|
33896
|
+
type: string
|
|
33897
|
+
description:
|
|
33898
|
+
type: string
|
|
33899
|
+
reference:
|
|
33900
|
+
type: string
|
|
33901
|
+
metadata:
|
|
33902
|
+
type: object
|
|
33903
|
+
additionalProperties:
|
|
33904
|
+
type: object
|
|
33905
|
+
additionalProperties: true
|
|
33906
|
+
cardOnly:
|
|
33907
|
+
type: boolean
|
|
33908
|
+
idempotencyKey:
|
|
33909
|
+
type: string
|
|
33910
|
+
required:
|
|
33911
|
+
- appId
|
|
33912
|
+
- amount
|
|
33913
|
+
- currency
|
|
33914
|
+
PaymentIntentResult:
|
|
33915
|
+
type: object
|
|
33916
|
+
properties:
|
|
33917
|
+
paymentIntentId:
|
|
33918
|
+
type: string
|
|
33919
|
+
clientSecret:
|
|
33920
|
+
type: string
|
|
33921
|
+
publishableKey:
|
|
33922
|
+
type: string
|
|
33923
|
+
accountId:
|
|
33924
|
+
type: string
|
|
33925
|
+
amount:
|
|
33926
|
+
type: number
|
|
33927
|
+
currency:
|
|
33928
|
+
type: string
|
|
33929
|
+
fee:
|
|
33930
|
+
type: number
|
|
33931
|
+
required:
|
|
33932
|
+
- paymentIntentId
|
|
33933
|
+
- clientSecret
|
|
33934
|
+
- publishableKey
|
|
33935
|
+
- accountId
|
|
33936
|
+
- amount
|
|
33937
|
+
- currency
|
|
33938
|
+
- fee
|
|
33939
|
+
PaymentsStatus:
|
|
33940
|
+
type: object
|
|
33941
|
+
properties:
|
|
33942
|
+
connected:
|
|
33943
|
+
type: boolean
|
|
33944
|
+
accountId:
|
|
33945
|
+
type: string
|
|
33946
|
+
chargesEnabled:
|
|
33947
|
+
type: boolean
|
|
33948
|
+
detailsSubmitted:
|
|
33949
|
+
type: boolean
|
|
33950
|
+
payoutsEnabled:
|
|
33951
|
+
type: boolean
|
|
33952
|
+
platformReady:
|
|
33953
|
+
type: boolean
|
|
33954
|
+
publishableKeySet:
|
|
33955
|
+
type: boolean
|
|
33956
|
+
fees:
|
|
33957
|
+
type: array
|
|
33958
|
+
items:
|
|
33959
|
+
type: object
|
|
33960
|
+
additionalProperties: true
|
|
33961
|
+
required:
|
|
33962
|
+
- connected
|
|
33963
|
+
- platformReady
|
|
33964
|
+
- publishableKeySet
|
|
33965
|
+
- fees
|
|
33966
|
+
PaymentsConnectInput:
|
|
33967
|
+
type: object
|
|
33968
|
+
properties:
|
|
33969
|
+
returnUrl:
|
|
33970
|
+
type: string
|
|
33971
|
+
refreshUrl:
|
|
33972
|
+
type: string
|
|
33973
|
+
country:
|
|
33974
|
+
type: string
|
|
33975
|
+
required:
|
|
33976
|
+
- returnUrl
|
|
33977
|
+
- refreshUrl
|
|
33978
|
+
PaymentRecord:
|
|
33979
|
+
type: object
|
|
33980
|
+
properties:
|
|
33981
|
+
id:
|
|
33982
|
+
type: string
|
|
33983
|
+
amount:
|
|
33984
|
+
type: number
|
|
33985
|
+
amountReceived:
|
|
33986
|
+
type: number
|
|
33987
|
+
currency:
|
|
33988
|
+
type: string
|
|
33989
|
+
status:
|
|
33990
|
+
type: string
|
|
33991
|
+
created:
|
|
33992
|
+
type: string
|
|
33993
|
+
email:
|
|
33994
|
+
type: string
|
|
33995
|
+
metadata:
|
|
33996
|
+
type: object
|
|
33997
|
+
additionalProperties:
|
|
33998
|
+
type: string
|
|
33999
|
+
required:
|
|
34000
|
+
- id
|
|
34001
|
+
- amount
|
|
34002
|
+
- amountReceived
|
|
34003
|
+
- currency
|
|
34004
|
+
- status
|
|
34005
|
+
- created
|
|
34006
|
+
- email
|
|
34007
|
+
- metadata
|
|
34008
|
+
PaymentListParams:
|
|
34009
|
+
type: object
|
|
34010
|
+
properties:
|
|
34011
|
+
appId:
|
|
34012
|
+
type: string
|
|
34013
|
+
since:
|
|
34014
|
+
type: string
|
|
34015
|
+
limit:
|
|
34016
|
+
type: number
|
|
34017
|
+
after:
|
|
34018
|
+
type: string
|
|
34019
|
+
PaymentList:
|
|
34020
|
+
type: object
|
|
34021
|
+
properties:
|
|
34022
|
+
data:
|
|
34023
|
+
type: array
|
|
34024
|
+
items:
|
|
34025
|
+
$ref: "#/components/schemas/PaymentRecord"
|
|
34026
|
+
hasMore:
|
|
34027
|
+
type: boolean
|
|
34028
|
+
next:
|
|
34029
|
+
type: string
|
|
34030
|
+
required:
|
|
34031
|
+
- data
|
|
34032
|
+
- hasMore
|
|
34033
|
+
- next
|
|
34034
|
+
PaymentDomainResult:
|
|
34035
|
+
type: object
|
|
34036
|
+
properties:
|
|
34037
|
+
domain:
|
|
34038
|
+
type: string
|
|
34039
|
+
applePay:
|
|
34040
|
+
type: string
|
|
34041
|
+
googlePay:
|
|
34042
|
+
type: string
|
|
34043
|
+
required:
|
|
34044
|
+
- domain
|
|
34045
|
+
- applePay
|
|
34046
|
+
- googlePay
|
|
33624
34047
|
ProductKey:
|
|
33625
34048
|
type: object
|
|
33626
34049
|
properties:
|
|
@@ -28,9 +28,37 @@ export declare function bookingsMemoryImpl(mem: BookingsMemory, caller?: {
|
|
|
28
28
|
};
|
|
29
29
|
}>;
|
|
30
30
|
update(bookingId: string, fields?: any): Promise<any>;
|
|
31
|
-
confirm(bookingId: string): Promise<any>;
|
|
31
|
+
confirm(bookingId: string, opts?: any): Promise<any>;
|
|
32
32
|
cancel(bookingId: string, opts?: any): Promise<any>;
|
|
33
33
|
move(bookingId: string, input?: any): Promise<any>;
|
|
34
|
+
/**
|
|
35
|
+
* Paid bookings, in memory: prices from the slot's `data.prices` (ticket `lines`) or `input.prices`
|
|
36
|
+
* (pass the app's price list for appointments). No Stripe: `checkoutUrl` is pretend; call
|
|
37
|
+
* `payWith(bookingId)` to act as the payment arriving.
|
|
38
|
+
*/
|
|
39
|
+
checkout(input?: any): Promise<{
|
|
40
|
+
booking: any;
|
|
41
|
+
replayed: any;
|
|
42
|
+
checkoutUrl: null;
|
|
43
|
+
expiresAt: null;
|
|
44
|
+
total: number;
|
|
45
|
+
currency: null;
|
|
46
|
+
} | {
|
|
47
|
+
request?: boolean | undefined;
|
|
48
|
+
booking: any;
|
|
49
|
+
replayed: any;
|
|
50
|
+
checkoutUrl: string | null;
|
|
51
|
+
expiresAt: string | null;
|
|
52
|
+
total: number;
|
|
53
|
+
currency: string;
|
|
54
|
+
}>;
|
|
55
|
+
/** In memory only: the payment for a booking arrives (as Stripe's webhook would). */
|
|
56
|
+
payWith(bookingId: string): Promise<any>;
|
|
57
|
+
refund(bookingId: string, opts?: any): Promise<{
|
|
58
|
+
booking: any;
|
|
59
|
+
refunded: number;
|
|
60
|
+
pending: boolean;
|
|
61
|
+
}>;
|
|
34
62
|
extendHold(bookingId: string, holdMinutes: number): Promise<any>;
|
|
35
63
|
/** Counts who would be messaged (no sends in memory); inject `sl.bookings.message` to assert sends. */
|
|
36
64
|
message(input?: any): Promise<{
|
|
@@ -5,6 +5,17 @@
|
|
|
5
5
|
// creates, holds that expire, all-or-nothing writes. Each operation checks and writes without an
|
|
6
6
|
// `await` in between, so concurrent calls in one test behave like the database: of ten requests for
|
|
7
7
|
// the last seat, exactly one wins. Errors carry the platform's `code` / `status` / `details`.
|
|
8
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
9
|
+
var t = {};
|
|
10
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
11
|
+
t[p] = s[p];
|
|
12
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
13
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
14
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
15
|
+
t[p[i]] = s[p[i]];
|
|
16
|
+
}
|
|
17
|
+
return t;
|
|
18
|
+
};
|
|
8
19
|
export function createBookingsMemory() {
|
|
9
20
|
return { slots: [], bookings: [], allocations: [] };
|
|
10
21
|
}
|
|
@@ -193,12 +204,29 @@ export function bookingsMemoryImpl(mem, caller = {}) {
|
|
|
193
204
|
b.updatedAt = iso(now());
|
|
194
205
|
return copy(withAllocations(b));
|
|
195
206
|
},
|
|
196
|
-
async confirm(bookingId) {
|
|
207
|
+
async confirm(bookingId, opts = {}) {
|
|
197
208
|
const b = find(bookingId);
|
|
198
209
|
if (b.status === 'confirmed')
|
|
199
210
|
return copy(withAllocations(b));
|
|
200
211
|
if (!['held', 'pending', 'waitlisted'].includes(b.status))
|
|
201
212
|
fail('INVALID_STATE', `A ${b.status} booking can't be confirmed`, 409, { status: b.status });
|
|
213
|
+
// Paid bookings: confirmed by the payment, or waived. In memory there is no Stripe: a request
|
|
214
|
+
// becomes a hold with a pretend pay link, and `payWith(bookingId)` below stands in for the webhook.
|
|
215
|
+
const pay = b.admin && b.admin.payment;
|
|
216
|
+
if (pay && pay.status === 'awaiting') {
|
|
217
|
+
if (opts.payment === 'waive') {
|
|
218
|
+
pay.status = 'waived';
|
|
219
|
+
}
|
|
220
|
+
else if (b.status === 'pending') {
|
|
221
|
+
b.status = 'held';
|
|
222
|
+
b.holdExpiresAt = iso(now() + 48 * 3600000);
|
|
223
|
+
pay.payBy = b.holdExpiresAt;
|
|
224
|
+
pay.link = `https://pay.test/${b.id}`;
|
|
225
|
+
return copy(withAllocations(b));
|
|
226
|
+
}
|
|
227
|
+
else
|
|
228
|
+
fail('PAYMENT_REQUIRED', 'This booking is confirmed when it is paid for');
|
|
229
|
+
}
|
|
202
230
|
if (holdLapsed(b))
|
|
203
231
|
fail('HOLD_EXPIRED', 'The hold on this booking has run out');
|
|
204
232
|
if (b.status === 'waitlisted') {
|
|
@@ -231,6 +259,11 @@ export function bookingsMemoryImpl(mem, caller = {}) {
|
|
|
231
259
|
b.cancelReason = opts.reason || 'admin';
|
|
232
260
|
b.cancelledAt = iso(now());
|
|
233
261
|
b.holdExpiresAt = null;
|
|
262
|
+
// A paid booking is refunded: 'full' (default) | 'none' | an amount.
|
|
263
|
+
const pay = b.admin && b.admin.payment;
|
|
264
|
+
if (pay && ['paid', 'partially_refunded'].includes(pay.status) && opts.refund !== 'none') {
|
|
265
|
+
await this.refund(bookingId, { amount: opts.refund === 'full' || opts.refund == null ? undefined : Number(opts.refund), reason: 'cancelled' });
|
|
266
|
+
}
|
|
234
267
|
return copy(withAllocations(b));
|
|
235
268
|
},
|
|
236
269
|
async move(bookingId, input = {}) {
|
|
@@ -271,6 +304,61 @@ export function bookingsMemoryImpl(mem, caller = {}) {
|
|
|
271
304
|
}
|
|
272
305
|
return copy(withAllocations(b));
|
|
273
306
|
},
|
|
307
|
+
/**
|
|
308
|
+
* Paid bookings, in memory: prices from the slot's `data.prices` (ticket `lines`) or `input.prices`
|
|
309
|
+
* (pass the app's price list for appointments). No Stripe: `checkoutUrl` is pretend; call
|
|
310
|
+
* `payWith(bookingId)` to act as the payment arriving.
|
|
311
|
+
*/
|
|
312
|
+
async checkout(input = {}) {
|
|
313
|
+
const { lines, priceId, email, successUrl, cancelUrl, prices: priceList } = input, create = __rest(input, ["lines", "priceId", "email", "successUrl", "cancelUrl", "prices"]);
|
|
314
|
+
const slot = create.slotId ? mem.slots.find((x) => x.id === create.slotId) : null;
|
|
315
|
+
const prices = (slot ? (slot.data && slot.data.prices) : priceList) || [];
|
|
316
|
+
const wanted = Array.isArray(lines) && lines.length ? lines : priceId ? [{ priceId, quantity: 1 }] : prices.length === 1 ? [{ priceId: prices[0].id, quantity: create.quantity || 1 }] : [];
|
|
317
|
+
const priced = wanted.map((w) => {
|
|
318
|
+
const p = prices.find((x) => x.id === w.priceId);
|
|
319
|
+
if (!p)
|
|
320
|
+
fail('PRICE_NOT_FOUND', `There is no price "${w.priceId}"`, 400);
|
|
321
|
+
return { priceId: p.id, label: p.label, unitAmount: Number(p.amount), quantity: Number(w.quantity || 1) };
|
|
322
|
+
});
|
|
323
|
+
const total = priced.reduce((a, l) => a + l.unitAmount * l.quantity, 0);
|
|
324
|
+
if (!total) {
|
|
325
|
+
const booking = await this.create(create);
|
|
326
|
+
return { booking, replayed: booking.replayed, checkoutUrl: null, expiresAt: null, total: 0, currency: null };
|
|
327
|
+
}
|
|
328
|
+
const status = create.status === 'pending' ? 'pending' : 'held';
|
|
329
|
+
const quantity = slot ? priced.reduce((a, l) => a + l.quantity, 0) : 1;
|
|
330
|
+
const payment = { status: 'awaiting', total, currency: 'GBP', refunded: 0, lines: priced, email: email || null, refunds: [] };
|
|
331
|
+
const booking = await this.create(Object.assign(Object.assign({}, create), { quantity, status, holdMinutes: 40, admin: Object.assign(Object.assign({}, (create.admin || {})), { payment }) }));
|
|
332
|
+
const checkoutUrl = status === 'held' ? `https://checkout.test/${booking.id}` : null;
|
|
333
|
+
return Object.assign({ booking, replayed: booking.replayed, checkoutUrl, expiresAt: checkoutUrl ? iso(now() + 30 * 60000) : null, total, currency: 'GBP' }, (status === 'pending' ? { request: true } : {}));
|
|
334
|
+
},
|
|
335
|
+
/** In memory only: the payment for a booking arrives (as Stripe's webhook would). */
|
|
336
|
+
async payWith(bookingId) {
|
|
337
|
+
const b = find(bookingId);
|
|
338
|
+
const pay = b.admin && b.admin.payment;
|
|
339
|
+
if (!pay)
|
|
340
|
+
fail('NOT_PAID', 'This booking has no payment');
|
|
341
|
+
pay.status = 'paid';
|
|
342
|
+
pay.paidAt = iso(now());
|
|
343
|
+
b.status = 'confirmed';
|
|
344
|
+
b.holdExpiresAt = null;
|
|
345
|
+
b.updatedAt = iso(now());
|
|
346
|
+
return copy(withAllocations(b));
|
|
347
|
+
},
|
|
348
|
+
async refund(bookingId, opts = {}) {
|
|
349
|
+
const b = find(bookingId);
|
|
350
|
+
const pay = b.admin && b.admin.payment;
|
|
351
|
+
if (!pay || !['paid', 'partially_refunded'].includes(pay.status))
|
|
352
|
+
fail('NOT_PAID', 'This booking has no payment to refund');
|
|
353
|
+
const left = pay.total - (pay.refunded || 0);
|
|
354
|
+
const amount = opts.amount == null ? left : Number(opts.amount);
|
|
355
|
+
if (!Number.isInteger(amount) || amount < 1 || amount > left)
|
|
356
|
+
fail('BAD_REQUEST', `amount must be from 1 to ${left}`, 400);
|
|
357
|
+
pay.refunded = (pay.refunded || 0) + amount;
|
|
358
|
+
pay.refunds = [...(pay.refunds || []), { id: id('re'), amount, reason: opts.reason || 'refund' }];
|
|
359
|
+
pay.status = pay.refunded >= pay.total ? 'refunded' : 'partially_refunded';
|
|
360
|
+
return { booking: copy(withAllocations(b)), refunded: amount, pending: false };
|
|
361
|
+
},
|
|
274
362
|
async extendHold(bookingId, holdMinutes) {
|
|
275
363
|
const b = find(bookingId);
|
|
276
364
|
if (b.status !== 'held')
|
package/dist/testing/index.js
CHANGED
|
@@ -427,9 +427,12 @@ export function createFunctionTestContext(opts) {
|
|
|
427
427
|
const bkFn = (obj, name) => (obj && typeof obj[name] === 'function' ? obj[name].bind(obj) : undefined);
|
|
428
428
|
const BOOKING_READS = new Set(['get', 'query', 'mine', 'freebusy']);
|
|
429
429
|
sl.bookings = {};
|
|
430
|
-
for (const m of ['create', 'get', 'query', 'mine', 'update', 'confirm', 'cancel', 'move', 'extendHold', 'complete', 'noShow', 'freebusy', 'message']) {
|
|
430
|
+
for (const m of ['create', 'get', 'query', 'mine', 'update', 'confirm', 'cancel', 'move', 'extendHold', 'complete', 'noShow', 'freebusy', 'message', 'checkout', 'refund']) {
|
|
431
431
|
sl.bookings[m] = gated('bookings', BOOKING_READS.has(m) ? 'read' : 'write', bkFn(bk, m), `bookings.${m}`);
|
|
432
432
|
}
|
|
433
|
+
// In memory only (no Stripe): the payment for a checkout arrives, as Stripe's webhook would make it.
|
|
434
|
+
if (!impl.bookings)
|
|
435
|
+
sl.bookings.payWith = bkFn(bk, 'payWith');
|
|
433
436
|
sl.bookings.slots = {};
|
|
434
437
|
for (const m of ['create', 'createMany', 'get', 'query', 'update', 'delete']) {
|
|
435
438
|
sl.bookings.slots[m] = gated('bookings', m === 'get' || m === 'query' ? 'read' : 'write', bkFn(bk.slots, m), `bookings.slots.${m}`);
|