@aglyn/plugins-commerce 1.0.0-beta.285 → 1.0.0-beta.288
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 +1 -1
- package/package.json +13 -13
- package/src/lib/components/cart.js +25 -12
- package/src/lib/components/cart.js.map +1 -1
- package/src/lib/components/commerce-console-page.js +70 -13
- package/src/lib/components/commerce-console-page.js.map +1 -1
- package/src/lib/components/console/order-detail-dialog.component.js +2 -1
- package/src/lib/components/console/order-detail-dialog.component.js.map +1 -1
- package/src/lib/components/console/order-webhooks-card.component.js +1 -1
- package/src/lib/components/console/order-webhooks-card.component.js.map +1 -1
- package/src/lib/components/console/payment-methods-card.component.js +1 -1
- package/src/lib/components/console/payment-methods-card.component.js.map +1 -1
- package/src/lib/components/console/pos/pos-cart-panel.component.d.ts +5 -0
- package/src/lib/components/console/pos/pos-cart-panel.component.js +18 -12
- package/src/lib/components/console/pos/pos-cart-panel.component.js.map +1 -1
- package/src/lib/components/console/pos/pos-hardware-api.d.ts +76 -5
- package/src/lib/components/console/pos/pos-hardware-api.js +53 -11
- package/src/lib/components/console/pos/pos-hardware-api.js.map +1 -1
- package/src/lib/components/console/pos/pos-hardware-buyer.component.d.ts +18 -0
- package/src/lib/components/console/pos/pos-hardware-buyer.component.js +629 -0
- package/src/lib/components/console/pos/pos-hardware-buyer.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-hardware-sale-api.d.ts +162 -0
- package/src/lib/components/console/pos/pos-hardware-sale-api.js +122 -0
- package/src/lib/components/console/pos/pos-hardware-sale-api.js.map +1 -0
- package/src/lib/components/console/pos/pos-hardware-sale-terms.component.d.ts +39 -0
- package/src/lib/components/console/pos/pos-hardware-sale-terms.component.js +251 -0
- package/src/lib/components/console/pos/pos-hardware-sale-terms.component.js.map +1 -0
- package/src/lib/components/console/pos/use-pos-display.js +50 -0
- package/src/lib/components/console/pos/use-pos-display.js.map +1 -1
- package/src/lib/components/console/pos-cellular-control.component.d.ts +41 -0
- package/src/lib/components/console/pos-cellular-control.component.js +211 -0
- package/src/lib/components/console/pos-cellular-control.component.js.map +1 -0
- package/src/lib/components/console/pos-devices-card.component.d.ts +9 -1
- package/src/lib/components/console/pos-devices-card.component.js +47 -15
- package/src/lib/components/console/pos-devices-card.component.js.map +1 -1
- package/src/lib/components/console/pos-display/pos-display-api.d.ts +6 -0
- package/src/lib/components/console/pos-display/pos-display-api.js +8 -1
- package/src/lib/components/console/pos-display/pos-display-api.js.map +1 -1
- package/src/lib/components/console/pos-display-page.component.d.ts +13 -0
- package/src/lib/components/console/pos-display-page.component.js +44 -2
- package/src/lib/components/console/pos-display-page.component.js.map +1 -1
- package/src/lib/components/console/pos-hardware-card.component.d.ts +12 -4
- package/src/lib/components/console/pos-hardware-card.component.js +157 -36
- package/src/lib/components/console/pos-hardware-card.component.js.map +1 -1
- package/src/lib/components/console/pos-hardware-orders-staff-page.component.js +360 -80
- package/src/lib/components/console/pos-hardware-orders-staff-page.component.js.map +1 -1
- package/src/lib/components/console/pos-hardware-terms-page.component.d.ts +34 -0
- package/src/lib/components/console/pos-hardware-terms-page.component.js +257 -0
- package/src/lib/components/console/pos-hardware-terms-page.component.js.map +1 -0
- package/src/lib/components/console/pos-hardware-terms-sign-page.component.d.ts +27 -0
- package/src/lib/components/console/pos-hardware-terms-sign-page.component.js +104 -0
- package/src/lib/components/console/pos-hardware-terms-sign-page.component.js.map +1 -0
- package/src/lib/components/console/pos-hardware-waiting-card.component.d.ts +24 -0
- package/src/lib/components/console/pos-hardware-waiting-card.component.js +205 -0
- package/src/lib/components/console/pos-hardware-waiting-card.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-check-in-dialog.component.js +297 -201
- package/src/lib/components/console/pos-ops/pos-check-in-dialog.component.js.map +1 -1
- package/src/lib/components/console/pos-ops/pos-check-ins-card.component.d.ts +3 -0
- package/src/lib/components/console/pos-ops/pos-check-ins-card.component.js +260 -92
- package/src/lib/components/console/pos-ops/pos-check-ins-card.component.js.map +1 -1
- package/src/lib/components/console/pos-ops/pos-operations-bar.component.d.ts +9 -0
- package/src/lib/components/console/pos-ops/pos-operations-bar.component.js +15 -6
- package/src/lib/components/console/pos-ops/pos-operations-bar.component.js.map +1 -1
- package/src/lib/components/console/pos-ops/pos-rain-check-dialog.component.d.ts +25 -0
- package/src/lib/components/console/pos-ops/pos-rain-check-dialog.component.js +136 -0
- package/src/lib/components/console/pos-ops/pos-rain-check-dialog.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-shift-panel.component.d.ts +6 -0
- package/src/lib/components/console/pos-ops/pos-shift-panel.component.js +48 -31
- package/src/lib/components/console/pos-ops/pos-shift-panel.component.js.map +1 -1
- package/src/lib/components/console/pos-page.component.d.ts +1 -1
- package/src/lib/components/console/pos-page.component.js +63 -12
- package/src/lib/components/console/pos-page.component.js.map +1 -1
- package/src/lib/components/console/pos-reader-splash-setting.component.js +1 -1
- package/src/lib/components/console/pos-reader-splash-setting.component.js.map +1 -1
- package/src/lib/components/console/product-check-in-fields.component.d.ts +4 -2
- package/src/lib/components/console/product-check-in-fields.component.js +60 -14
- package/src/lib/components/console/product-check-in-fields.component.js.map +1 -1
- package/src/lib/components/console/product-editor-dialog.component.js +44 -1
- package/src/lib/components/console/product-editor-dialog.component.js.map +1 -1
- package/src/lib/components/console/product-hardware-sku-field.component.d.ts +19 -0
- package/src/lib/components/console/product-hardware-sku-field.component.js +92 -0
- package/src/lib/components/console/product-hardware-sku-field.component.js.map +1 -0
- package/src/lib/components/console/product-kiosk-offer-field.component.d.ts +22 -0
- package/src/lib/components/console/product-kiosk-offer-field.component.js +94 -0
- package/src/lib/components/console/product-kiosk-offer-field.component.js.map +1 -0
- package/src/lib/components/console/product-register-fields.component.d.ts +4 -0
- package/src/lib/components/console/product-register-fields.component.js +31 -2
- package/src/lib/components/console/product-register-fields.component.js.map +1 -1
- package/src/lib/components/console/products-hub-card.component.js +11 -2
- package/src/lib/components/console/products-hub-card.component.js.map +1 -1
- package/src/lib/components/console/register-hardware-card.component.d.ts +11 -0
- package/src/lib/components/console/register-hardware-card.component.js +56 -27
- package/src/lib/components/console/register-hardware-card.component.js.map +1 -1
- package/src/lib/components/console/reservation-guests-dialog.component.d.ts +28 -0
- package/src/lib/components/console/reservation-guests-dialog.component.js +189 -0
- package/src/lib/components/console/reservation-guests-dialog.component.js.map +1 -0
- package/src/lib/components/console/reservations-card.component.d.ts +9 -0
- package/src/lib/components/console/reservations-card.component.js +158 -23
- package/src/lib/components/console/reservations-card.component.js.map +1 -1
- package/src/lib/components/console/shippingeasy-card.component.js +1 -1
- package/src/lib/components/console/shippingeasy-card.component.js.map +1 -1
- package/src/lib/components/console/shipstation-card.component.d.ts +1 -1
- package/src/lib/components/console/shipstation-card.component.js +3 -3
- package/src/lib/components/console/shipstation-card.component.js.map +1 -1
- package/src/lib/components/product-detail.d.ts +4 -0
- package/src/lib/components/product-detail.js +40 -5
- package/src/lib/components/product-detail.js.map +1 -1
- package/src/lib/components/product-reviews.js +28 -11
- package/src/lib/components/product-reviews.js.map +1 -1
- package/src/lib/components/reservation-widget.js +28 -5
- package/src/lib/components/reservation-widget.js.map +1 -1
- package/src/lib/components/use-day-picker.d.ts +25 -0
- package/src/lib/components/use-day-picker.js +57 -0
- package/src/lib/components/use-day-picker.js.map +1 -0
- package/src/lib/constants/operator-alerts.d.ts +55 -0
- package/src/lib/constants/operator-alerts.js +156 -1
- package/src/lib/constants/operator-alerts.js.map +1 -1
- package/src/lib/declarations.console-server.js +54 -1
- package/src/lib/declarations.console-server.js.map +1 -1
- package/src/lib/declarations.d.ts +4 -2
- package/src/lib/declarations.js +15 -4
- package/src/lib/declarations.js.map +1 -1
- package/src/lib/declarations.server.js +9 -0
- package/src/lib/declarations.server.js.map +1 -1
- package/src/lib/model/commerce-cart.d.ts +9 -1
- package/src/lib/model/commerce-cart.js +4 -3
- package/src/lib/model/commerce-cart.js.map +1 -1
- package/src/lib/model/commerce-check-in-product.d.ts +26 -0
- package/src/lib/model/commerce-check-in-product.js +64 -2
- package/src/lib/model/commerce-check-in-product.js.map +1 -1
- package/src/lib/model/commerce-check-in-record.d.ts +127 -0
- package/src/lib/model/commerce-check-in-record.js +36 -0
- package/src/lib/model/commerce-check-in-record.js.map +1 -0
- package/src/lib/model/commerce-check-in.d.ts +91 -87
- package/src/lib/model/commerce-check-in.js +186 -62
- package/src/lib/model/commerce-check-in.js.map +1 -1
- package/src/lib/model/commerce-kiosk-offer.d.ts +31 -0
- package/src/lib/model/commerce-kiosk-offer.js +35 -0
- package/src/lib/model/commerce-kiosk-offer.js.map +1 -0
- package/src/lib/model/commerce-orders.d.ts +76 -0
- package/src/lib/model/commerce-orders.js +6 -0
- package/src/lib/model/commerce-orders.js.map +1 -1
- package/src/lib/model/commerce-pos-day-report.d.ts +54 -1
- package/src/lib/model/commerce-pos-day-report.js +39 -2
- package/src/lib/model/commerce-pos-day-report.js.map +1 -1
- package/src/lib/model/commerce-pos-offline.d.ts +1 -1
- package/src/lib/model/commerce-pos-offline.js +6 -1
- package/src/lib/model/commerce-pos-offline.js.map +1 -1
- package/src/lib/model/commerce-pos-ops.js +3 -2
- package/src/lib/model/commerce-pos-ops.js.map +1 -1
- package/src/lib/model/commerce-pos.d.ts +36 -3
- package/src/lib/model/commerce-pos.js +14 -6
- package/src/lib/model/commerce-pos.js.map +1 -1
- package/src/lib/model/commerce-receipt.js +3 -2
- package/src/lib/model/commerce-receipt.js.map +1 -1
- package/src/lib/model/commerce-reservations.d.ts +69 -4
- package/src/lib/model/commerce-reservations.js +57 -5
- package/src/lib/model/commerce-reservations.js.map +1 -1
- package/src/lib/model/commerce.d.ts +66 -0
- package/src/lib/model/commerce.js +15 -0
- package/src/lib/model/commerce.js.map +1 -1
- package/src/lib/model/order-list-fields.d.ts +11 -0
- package/src/lib/model/order-list-fields.js +17 -1
- package/src/lib/model/order-list-fields.js.map +1 -1
- package/src/lib/model/own-store-tax-summary.d.ts +152 -0
- package/src/lib/model/own-store-tax-summary.js +288 -0
- package/src/lib/model/own-store-tax-summary.js.map +1 -0
- package/src/lib/model/plugin-permissions.d.ts +74 -0
- package/src/lib/model/plugin-permissions.js +224 -7
- package/src/lib/model/plugin-permissions.js.map +1 -1
- package/src/lib/model/pos-cellular.d.ts +223 -0
- package/src/lib/model/pos-cellular.js +293 -0
- package/src/lib/model/pos-cellular.js.map +1 -0
- package/src/lib/model/pos-hardware-in-person.d.ts +98 -0
- package/src/lib/model/pos-hardware-in-person.js +224 -0
- package/src/lib/model/pos-hardware-in-person.js.map +1 -0
- package/src/lib/model/pos-hardware-tax-summary.d.ts +166 -0
- package/src/lib/model/pos-hardware-tax-summary.js +225 -0
- package/src/lib/model/pos-hardware-tax-summary.js.map +1 -0
- package/src/lib/model/pos-hardware-terms.d.ts +74 -0
- package/src/lib/model/pos-hardware-terms.js +115 -0
- package/src/lib/model/pos-hardware-terms.js.map +1 -0
- package/src/lib/model/pos-hardware.d.ts +349 -7
- package/src/lib/model/pos-hardware.js +291 -20
- package/src/lib/model/pos-hardware.js.map +1 -1
- package/src/lib/model/product-write.d.ts +10 -0
- package/src/lib/model/product-write.js +4 -2
- package/src/lib/model/product-write.js.map +1 -1
- package/src/lib/model/workspace-site-permissions.d.ts +26 -0
- package/src/lib/model/workspace-site-permissions.js +81 -0
- package/src/lib/model/workspace-site-permissions.js.map +1 -0
- package/src/lib/plugin.js +16 -0
- package/src/lib/plugin.js.map +1 -1
- package/src/lib/server/billing-webhook.js +25 -1
- package/src/lib/server/billing-webhook.js.map +1 -1
- package/src/lib/server/cancel-order.js +7 -5
- package/src/lib/server/cancel-order.js.map +1 -1
- package/src/lib/server/cart-checkout.js +20 -8
- package/src/lib/server/cart-checkout.js.map +1 -1
- package/src/lib/server/cart.js +29 -0
- package/src/lib/server/cart.js.map +1 -1
- package/src/lib/server/checkout.js +42 -13
- package/src/lib/server/checkout.js.map +1 -1
- package/src/lib/server/collection-membership.d.ts +4 -0
- package/src/lib/server/collection-membership.js +5 -10
- package/src/lib/server/collection-membership.js.map +1 -1
- package/src/lib/server/commerce-site-keys.d.ts +48 -0
- package/src/lib/server/commerce-site-keys.js +61 -0
- package/src/lib/server/commerce-site-keys.js.map +1 -0
- package/src/lib/server/draft-order.js +8 -5
- package/src/lib/server/draft-order.js.map +1 -1
- package/src/lib/server/fulfill-order.js +7 -5
- package/src/lib/server/fulfill-order.js.map +1 -1
- package/src/lib/server/gift-cards.js +8 -5
- package/src/lib/server/gift-cards.js.map +1 -1
- package/src/lib/server/local-fulfillment-status.js +9 -6
- package/src/lib/server/local-fulfillment-status.js.map +1 -1
- package/src/lib/server/member-post.js +6 -5
- package/src/lib/server/member-post.js.map +1 -1
- package/src/lib/server/membership-admin-password.d.ts +4 -2
- package/src/lib/server/membership-admin-password.js +10 -8
- package/src/lib/server/membership-admin-password.js.map +1 -1
- package/src/lib/server/membership-admin-remove.d.ts +7 -5
- package/src/lib/server/membership-admin-remove.js +9 -9
- package/src/lib/server/membership-admin-remove.js.map +1 -1
- package/src/lib/server/order-notifications.js +5 -2
- package/src/lib/server/order-notifications.js.map +1 -1
- package/src/lib/server/order-print.js +7 -5
- package/src/lib/server/order-print.js.map +1 -1
- package/src/lib/server/order-receipt-send.js +8 -5
- package/src/lib/server/order-receipt-send.js.map +1 -1
- package/src/lib/server/order-webhooks.js +8 -8
- package/src/lib/server/order-webhooks.js.map +1 -1
- package/src/lib/server/orders-shipping-prepare.js +9 -6
- package/src/lib/server/orders-shipping-prepare.js.map +1 -1
- package/src/lib/server/own-store-tax-return-source.d.ts +47 -0
- package/src/lib/server/own-store-tax-return-source.js +312 -0
- package/src/lib/server/own-store-tax-return-source.js.map +1 -0
- package/src/lib/server/payment-methods.js +13 -9
- package/src/lib/server/payment-methods.js.map +1 -1
- package/src/lib/server/pos-auth.d.ts +37 -6
- package/src/lib/server/pos-auth.js +40 -15
- package/src/lib/server/pos-auth.js.map +1 -1
- package/src/lib/server/pos-cellular-billing.d.ts +81 -0
- package/src/lib/server/pos-cellular-billing.js +711 -0
- package/src/lib/server/pos-cellular-billing.js.map +1 -0
- package/src/lib/server/pos-cellular-notify.d.ts +47 -0
- package/src/lib/server/pos-cellular-notify.js +150 -0
- package/src/lib/server/pos-cellular-notify.js.map +1 -0
- package/src/lib/server/pos-cellular.d.ts +88 -0
- package/src/lib/server/pos-cellular.js +339 -0
- package/src/lib/server/pos-cellular.js.map +1 -0
- package/src/lib/server/pos-check-in.d.ts +5 -1
- package/src/lib/server/pos-check-in.js +296 -28
- package/src/lib/server/pos-check-in.js.map +1 -1
- package/src/lib/server/pos-day-report.js +29 -3
- package/src/lib/server/pos-day-report.js.map +1 -1
- package/src/lib/server/pos-display.d.ts +16 -0
- package/src/lib/server/pos-display.js +129 -2
- package/src/lib/server/pos-display.js.map +1 -1
- package/src/lib/server/pos-hardware-admin.d.ts +10 -1
- package/src/lib/server/pos-hardware-admin.js +250 -84
- package/src/lib/server/pos-hardware-admin.js.map +1 -1
- package/src/lib/server/pos-hardware-attach.d.ts +105 -0
- package/src/lib/server/pos-hardware-attach.js +443 -0
- package/src/lib/server/pos-hardware-attach.js.map +1 -0
- package/src/lib/server/pos-hardware-buyer-lookup.d.ts +58 -0
- package/src/lib/server/pos-hardware-buyer-lookup.js +180 -0
- package/src/lib/server/pos-hardware-buyer-lookup.js.map +1 -0
- package/src/lib/server/pos-hardware-buyer-record.d.ts +29 -0
- package/src/lib/server/pos-hardware-buyer-record.js +86 -0
- package/src/lib/server/pos-hardware-buyer-record.js.map +1 -0
- package/src/lib/server/pos-hardware-cancel.d.ts +58 -0
- package/src/lib/server/pos-hardware-cancel.js +147 -0
- package/src/lib/server/pos-hardware-cancel.js.map +1 -0
- package/src/lib/server/pos-hardware-closure-notices.d.ts +27 -0
- package/src/lib/server/pos-hardware-closure-notices.js +85 -0
- package/src/lib/server/pos-hardware-closure-notices.js.map +1 -0
- package/src/lib/server/pos-hardware-closure.d.ts +60 -0
- package/src/lib/server/pos-hardware-closure.js +153 -0
- package/src/lib/server/pos-hardware-closure.js.map +1 -0
- package/src/lib/server/pos-hardware-in-person.d.ts +61 -0
- package/src/lib/server/pos-hardware-in-person.js +236 -0
- package/src/lib/server/pos-hardware-in-person.js.map +1 -0
- package/src/lib/server/pos-hardware-notify.d.ts +40 -2
- package/src/lib/server/pos-hardware-notify.js +195 -14
- package/src/lib/server/pos-hardware-notify.js.map +1 -1
- package/src/lib/server/pos-hardware-readers.d.ts +115 -0
- package/src/lib/server/pos-hardware-readers.js +430 -0
- package/src/lib/server/pos-hardware-readers.js.map +1 -0
- package/src/lib/server/pos-hardware-returns.d.ts +116 -0
- package/src/lib/server/pos-hardware-returns.js +502 -0
- package/src/lib/server/pos-hardware-returns.js.map +1 -0
- package/src/lib/server/pos-hardware-sale-fields.d.ts +28 -0
- package/src/lib/server/pos-hardware-sale-fields.js +44 -0
- package/src/lib/server/pos-hardware-sale-fields.js.map +1 -0
- package/src/lib/server/pos-hardware-sale.d.ts +54 -0
- package/src/lib/server/pos-hardware-sale.js +369 -0
- package/src/lib/server/pos-hardware-sale.js.map +1 -0
- package/src/lib/server/pos-hardware-tax-return-source.d.ts +99 -0
- package/src/lib/server/pos-hardware-tax-return-source.js +462 -0
- package/src/lib/server/pos-hardware-tax-return-source.js.map +1 -0
- package/src/lib/server/pos-hardware-terms.d.ts +64 -0
- package/src/lib/server/pos-hardware-terms.js +154 -0
- package/src/lib/server/pos-hardware-terms.js.map +1 -0
- package/src/lib/server/pos-hardware-user-eraser.d.ts +3 -0
- package/src/lib/server/pos-hardware-user-eraser.js +31 -7
- package/src/lib/server/pos-hardware-user-eraser.js.map +1 -1
- package/src/lib/server/pos-hardware-webhook.d.ts +5 -0
- package/src/lib/server/pos-hardware-webhook.js +51 -6
- package/src/lib/server/pos-hardware-webhook.js.map +1 -1
- package/src/lib/server/pos-hardware.d.ts +74 -1
- package/src/lib/server/pos-hardware.js +175 -10
- package/src/lib/server/pos-hardware.js.map +1 -1
- package/src/lib/server/pos-kiosk.d.ts +2 -0
- package/src/lib/server/pos-kiosk.js +17 -12
- package/src/lib/server/pos-kiosk.js.map +1 -1
- package/src/lib/server/pos-offline-card-order.d.ts +64 -0
- package/src/lib/server/pos-offline-card-order.js +102 -0
- package/src/lib/server/pos-offline-card-order.js.map +1 -0
- package/src/lib/server/pos-offline-card-reconcile.d.ts +67 -1
- package/src/lib/server/pos-offline-card-reconcile.js +215 -18
- package/src/lib/server/pos-offline-card-reconcile.js.map +1 -1
- package/src/lib/server/pos-offline-sync.d.ts +39 -0
- package/src/lib/server/pos-offline-sync.js +190 -55
- package/src/lib/server/pos-offline-sync.js.map +1 -1
- package/src/lib/server/pos-ops-gate.d.ts +28 -9
- package/src/lib/server/pos-ops-gate.js +50 -19
- package/src/lib/server/pos-ops-gate.js.map +1 -1
- package/src/lib/server/pos-ops-routes.js +24 -0
- package/src/lib/server/pos-ops-routes.js.map +1 -1
- package/src/lib/server/pos-order-refund-ids.d.ts +28 -0
- package/src/lib/server/pos-order-refund-ids.js +31 -0
- package/src/lib/server/pos-order-refund-ids.js.map +1 -0
- package/src/lib/server/pos-order.js +52 -49
- package/src/lib/server/pos-order.js.map +1 -1
- package/src/lib/server/pos-payment.js +1 -1
- package/src/lib/server/pos-payment.js.map +1 -1
- package/src/lib/server/pos-reader-splash-admin.js +30 -32
- package/src/lib/server/pos-reader-splash-admin.js.map +1 -1
- package/src/lib/server/pos-reader-splash-images-route.d.ts +17 -0
- package/src/lib/server/pos-reader-splash-images-route.js +113 -0
- package/src/lib/server/pos-reader-splash-images-route.js.map +1 -0
- package/src/lib/server/pos-reader-splash-images.d.ts +51 -0
- package/src/lib/server/pos-reader-splash-images.js +123 -0
- package/src/lib/server/pos-reader-splash-images.js.map +1 -0
- package/src/lib/server/pos-reader-splash.d.ts +68 -1
- package/src/lib/server/pos-reader-splash.js +182 -11
- package/src/lib/server/pos-reader-splash.js.map +1 -1
- package/src/lib/server/pos-readers.d.ts +29 -0
- package/src/lib/server/pos-readers.js +134 -35
- package/src/lib/server/pos-readers.js.map +1 -1
- package/src/lib/server/pos-refund-authority.d.ts +3 -1
- package/src/lib/server/pos-refund-authority.js +3 -2
- package/src/lib/server/pos-refund-authority.js.map +1 -1
- package/src/lib/server/pos-return.d.ts +10 -0
- package/src/lib/server/pos-return.js +29 -7
- package/src/lib/server/pos-return.js.map +1 -1
- package/src/lib/server/pos-sale.js +6 -1
- package/src/lib/server/pos-sale.js.map +1 -1
- package/src/lib/server/pos-shift.js +11 -0
- package/src/lib/server/pos-shift.js.map +1 -1
- package/src/lib/server/pos-staff-pin.js +29 -24
- package/src/lib/server/pos-staff-pin.js.map +1 -1
- package/src/lib/server/pos-terminal.d.ts +14 -4
- package/src/lib/server/pos-terminal.js +34 -38
- package/src/lib/server/pos-terminal.js.map +1 -1
- package/src/lib/server/printers.d.ts +7 -3
- package/src/lib/server/printers.js +18 -12
- package/src/lib/server/printers.js.map +1 -1
- package/src/lib/server/product-drafts.d.ts +11 -1
- package/src/lib/server/product-drafts.js +12 -8
- package/src/lib/server/product-drafts.js.map +1 -1
- package/src/lib/server/product.d.ts +15 -1
- package/src/lib/server/product.js +16 -3
- package/src/lib/server/product.js.map +1 -1
- package/src/lib/server/products-write.d.ts +26 -2
- package/src/lib/server/products-write.js +19 -7
- package/src/lib/server/products-write.js.map +1 -1
- package/src/lib/server/refund.js +55 -42
- package/src/lib/server/refund.js.map +1 -1
- package/src/lib/server/reservation-availability-query.d.ts +8 -0
- package/src/lib/server/reservation-availability-query.js +11 -1
- package/src/lib/server/reservation-availability-query.js.map +1 -1
- package/src/lib/server/reservation-availability.d.ts +1 -1
- package/src/lib/server/reservation-availability.js +7 -2
- package/src/lib/server/reservation-availability.js.map +1 -1
- package/src/lib/server/reservation-guests.d.ts +32 -0
- package/src/lib/server/reservation-guests.js +285 -0
- package/src/lib/server/reservation-guests.js.map +1 -0
- package/src/lib/server/reservation-walk-in.d.ts +11 -1
- package/src/lib/server/reservation-walk-in.js +56 -12
- package/src/lib/server/reservation-walk-in.js.map +1 -1
- package/src/lib/server/reserve.js +18 -5
- package/src/lib/server/reserve.js.map +1 -1
- package/src/lib/server/returns.js +9 -6
- package/src/lib/server/returns.js.map +1 -1
- package/src/lib/server/reviews.d.ts +22 -2
- package/src/lib/server/reviews.js +88 -20
- package/src/lib/server/reviews.js.map +1 -1
- package/src/lib/server/shipping-connectors.js +10 -11
- package/src/lib/server/shipping-connectors.js.map +1 -1
- package/src/lib/server/site-page-resolver.js +20 -3
- package/src/lib/server/site-page-resolver.js.map +1 -1
- package/src/lib/server/store-day.d.ts +33 -0
- package/src/lib/server/store-day.js +46 -0
- package/src/lib/server/store-day.js.map +1 -0
- package/src/lib/server/store-setup-ai-writer.d.ts +2 -1
- package/src/lib/server/store-setup-ai-writer.js +5 -6
- package/src/lib/server/store-setup-ai-writer.js.map +1 -1
- package/src/lib/server/storefront-tax.d.ts +13 -0
- package/src/lib/server/storefront-tax.js +8 -1
- package/src/lib/server/storefront-tax.js.map +1 -1
- package/src/lib/server/tax-return-source.d.ts +32 -3
- package/src/lib/server/tax-return-source.js +99 -20
- package/src/lib/server/tax-return-source.js.map +1 -1
- package/src/lib/server.js +100 -2
- package/src/lib/server.js.map +1 -1
- package/src/lib/testing/fake-firestore.js +58 -16
- package/src/lib/testing/fake-firestore.js.map +1 -1
- package/src/lib/testing/pos-ops-memory-firestore.js +18 -4
- package/src/lib/testing/pos-ops-memory-firestore.js.map +1 -1
- package/src/lib/testing/site-register-permissions.d.ts +29 -0
- package/src/lib/testing/site-register-permissions.js +38 -0
- package/src/lib/testing/site-register-permissions.js.map +1 -0
- package/src/lib/transfer/tracking.server.js +8 -5
- package/src/lib/transfer/tracking.server.js.map +1 -1
- package/src/lib/utils/add-to-cart.d.ts +2 -0
- package/src/lib/utils/add-to-cart.js +6 -3
- package/src/lib/utils/add-to-cart.js.map +1 -1
|
@@ -0,0 +1,711 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2026 Aglyn LLC
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/ import { normalizeOrgLockdown } from "@aglyn/aglyn/app-utils/lockdown";
|
|
18
|
+
import { formatOperatorAlertAmount } from "@aglyn/aglyn/app-utils/operator-alerts";
|
|
19
|
+
import { firebaseAdmin, raiseOperatorAlert, readOrgBilling } from "@aglyn/tenant-data-admin";
|
|
20
|
+
import { chargeOrgUsageInvoice, USAGE_INVOICE_MIN_CHARGE_CENTS } from "@aglyn/tenant-data-admin/server/usage-invoice";
|
|
21
|
+
import { BUNDLE_ID } from "../constants/bundle-common.js";
|
|
22
|
+
import { COMMERCE_POS_CELLULAR_CHARGE_FAILED, COMMERCE_POS_CELLULAR_TURN_OFF_FAILED, COMMERCE_POS_CELLULAR_TURNED_OFF_UNPAID } from "../constants/operator-alerts.js";
|
|
23
|
+
import { closePosCellularPeriod, parsePosCellularConfig, posCellularChargeCents, posCellularGraceEndsAtMs, posCellularMonthBounds, posCellularMonthKey, posCellularMonthLabel, posCellularOverdue, posCellularPreviousMonthKey, posCellularReadersByWorkspace, posCellularWarningDue, POS_CELLULAR_CHARGE_KIND, POS_CELLULAR_CHARGES_COLLECTION, POS_CELLULAR_READERS_COLLECTION, POS_CELLULAR_SETTLED_STATES } from "../model/pos-cellular.js";
|
|
24
|
+
import { posCellularInvoiceStatus, settleSuspendedPosCellularCharge, turnOffPosCellularConfiguration } from "./pos-cellular.js";
|
|
25
|
+
/*==========================================
|
|
26
|
+
* THE MONTHLY 4G CHARGE (AGL-4038).
|
|
27
|
+
*
|
|
28
|
+
* Once a day, for the calendar month that has just ended, each workspace
|
|
29
|
+
* whose Stripe Reader S710s had 4G at any time in it is charged once: Stripe's
|
|
30
|
+
* price per reader, plus what collecting it costs (`posCellularChargeCents`),
|
|
31
|
+
* on a one-off invoice to its card through core's usage-invoice charge, the
|
|
32
|
+
* path domains and AI overages take. That is the month Stripe bills the
|
|
33
|
+
* platform for, in arrears, so a reader turned off on the 3rd is charged for
|
|
34
|
+
* that month and not the next.
|
|
35
|
+
*
|
|
36
|
+
* Once per workspace per month: `posCellularCharges/{orgId}_{month}` is
|
|
37
|
+
* claimed in a transaction before Stripe is called, and the invoice's
|
|
38
|
+
* idempotency key is the same pair, so a run that died mid-charge and the
|
|
39
|
+
* next day's run land on the same invoice. A charge that did not collect is
|
|
40
|
+
* left open on the workspace's Billing page (nothing retries it) and staff
|
|
41
|
+
* are alerted; a workspace with no one to bill is recorded and alerted, and
|
|
42
|
+
* never charged later for that month.
|
|
43
|
+
*
|
|
44
|
+
* Daily rather than monthly: a month whose charge failed to START (Stripe
|
|
45
|
+
* unreachable) is retried the next day; one that settled costs a read.
|
|
46
|
+
*
|
|
47
|
+
* A STORE THAT IS GONE stops costing the platform: a reader record whose
|
|
48
|
+
* store no longer exists has its period closed and the store's Configuration
|
|
49
|
+
* told to turn cellular off; a workspace being erased does the same for all
|
|
50
|
+
* of its stores first ({@link posCellularOrgEraser}).
|
|
51
|
+
*
|
|
52
|
+
* WARN, THEN TURN OFF. A charge left open is asked about each day: paid
|
|
53
|
+
* since, it is settled as paid; voided by staff, as voided. The first time
|
|
54
|
+
* Stripe says it is still unpaid (the same run that left it open, unless
|
|
55
|
+
* Stripe could not be asked), the members who manage the workspace's billing
|
|
56
|
+
* are warned, once (`warnedAtMs`), of the amount and of the day 4G turns off
|
|
57
|
+
* unless it is paid; paid before then, nothing else is sent. Still unpaid
|
|
58
|
+
* once the grace period (`POS_CELLULAR_GRACE_DAYS`, 14 by default) has run
|
|
59
|
+
* from the day it was left open, 4G is turned off at Stripe for every store
|
|
60
|
+
* of the workspace, the members who manage its billing are emailed and
|
|
61
|
+
* notified again, and staff are alerted. Stripe that cannot be asked is never
|
|
62
|
+
* read as unpaid.
|
|
63
|
+
* Paying does not turn 4G back on: the merchant does, once it is paid
|
|
64
|
+
* (`pos-cellular.ts` refuses it until then). Each step is idempotent, so a run
|
|
65
|
+
* that dies half-way is finished by the next.
|
|
66
|
+
*
|
|
67
|
+
* A WORKSPACE DELETED MID-MONTH is charged for that final month as it is
|
|
68
|
+
* erased, before its data goes, through the same claim as the monthly run
|
|
69
|
+
* (and last month too, if the run had not charged it yet), so the two never
|
|
70
|
+
* charge one month twice. A failure there alerts staff and never holds the
|
|
71
|
+
* erasure.
|
|
72
|
+
*=========================================*/ const LABEL = '[pos-cellular] billing';
|
|
73
|
+
/** A charge claimed this long ago and not settled was abandoned by its run. */ const CLAIM_STALE_MS = 30 * 60 * 1000;
|
|
74
|
+
/** How many times a charge that never reached Stripe is tried before staff hear of it. */ const ALERT_AFTER_ATTEMPTS = 3;
|
|
75
|
+
function firestore() {
|
|
76
|
+
return firebaseAdmin.app().firestore();
|
|
77
|
+
}
|
|
78
|
+
function recordsRef() {
|
|
79
|
+
return firestore().collection(POS_CELLULAR_READERS_COLLECTION);
|
|
80
|
+
}
|
|
81
|
+
function chargesRef() {
|
|
82
|
+
return firestore().collection(POS_CELLULAR_CHARGES_COLLECTION);
|
|
83
|
+
}
|
|
84
|
+
/** A workspace's charge for one month, `{orgId}_{month}`: one per pair, so a rerun finds it. */ function posCellularChargeId(orgId, month) {
|
|
85
|
+
return `${orgId}_${month}`;
|
|
86
|
+
}
|
|
87
|
+
/** The reader records that may count for a month: on now, or turned off since it began. */ async function recordsForMonth(startMs) {
|
|
88
|
+
const [on, off] = await Promise.all([
|
|
89
|
+
recordsRef().where('enabled', '==', true).limit(1000).get(),
|
|
90
|
+
recordsRef().where('disabledAtMs', '>=', startMs).limit(1000).get()
|
|
91
|
+
]);
|
|
92
|
+
const byId = new Map();
|
|
93
|
+
for (const doc of [
|
|
94
|
+
...on.docs,
|
|
95
|
+
...off.docs
|
|
96
|
+
]){
|
|
97
|
+
byId.set(String(doc.id), doc.data());
|
|
98
|
+
}
|
|
99
|
+
return [
|
|
100
|
+
...byId
|
|
101
|
+
].map(([id, record])=>({
|
|
102
|
+
id,
|
|
103
|
+
record
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Closes the records of stores that no longer exist and turns cellular off
|
|
108
|
+
* on their Configuration, alerting staff when Stripe refuses. Returns how
|
|
109
|
+
* many stores it found gone.
|
|
110
|
+
*/ async function closeGoneStores(records, deps, now) {
|
|
111
|
+
const open = records.filter(({ record })=>record.enabled);
|
|
112
|
+
const hostIds = [
|
|
113
|
+
...new Set(open.map(({ record })=>record.hostId))
|
|
114
|
+
];
|
|
115
|
+
let gone = 0;
|
|
116
|
+
for (const hostId of hostIds){
|
|
117
|
+
const host = await firestore().collection('hosts').doc(hostId).get();
|
|
118
|
+
if (host.exists) continue;
|
|
119
|
+
gone += 1;
|
|
120
|
+
const mine = open.filter(({ record })=>record.hostId === hostId);
|
|
121
|
+
await turnOffConfigurations(mine.map(({ record })=>record), deps);
|
|
122
|
+
for (const { id, record } of mine)await recordsRef().doc(id).set(closePosCellularPeriod(record, now));
|
|
123
|
+
}
|
|
124
|
+
return gone;
|
|
125
|
+
}
|
|
126
|
+
/** Turns cellular off on each distinct Configuration the records name, alerting a refusal. */ async function turnOffConfigurations(records, deps) {
|
|
127
|
+
const configurations = new Map();
|
|
128
|
+
for (const record of records){
|
|
129
|
+
if (record.stripeConfigurationId) configurations.set(record.stripeConfigurationId, record);
|
|
130
|
+
}
|
|
131
|
+
let off = 0;
|
|
132
|
+
let failed = 0;
|
|
133
|
+
for (const [configurationId, record] of configurations){
|
|
134
|
+
const done = await deps.turnOff(configurationId).catch(()=>false);
|
|
135
|
+
if (done) {
|
|
136
|
+
off += 1;
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
failed += 1;
|
|
140
|
+
await deps.alert(COMMERCE_POS_CELLULAR_TURN_OFF_FAILED, {
|
|
141
|
+
dedupeKey: configurationId,
|
|
142
|
+
orgId: record.orgId,
|
|
143
|
+
hostId: record.hostId,
|
|
144
|
+
context: {
|
|
145
|
+
configurationId,
|
|
146
|
+
hostId: record.hostId,
|
|
147
|
+
orgId: record.orgId
|
|
148
|
+
}
|
|
149
|
+
}).catch((error)=>console.error(`${LABEL}: the turn-off alert was not raised`, configurationId, error));
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
off,
|
|
153
|
+
failed
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Claims a workspace's month for this run, or says it is not this run's:
|
|
158
|
+
* settled already, or claimed by a run still within its window. The claim
|
|
159
|
+
* counts the attempt.
|
|
160
|
+
*/ async function claimMonth(orgId, month, readers, amountCents, now) {
|
|
161
|
+
const ref = chargesRef().doc(posCellularChargeId(orgId, month));
|
|
162
|
+
return firestore().runTransaction(async (transaction)=>{
|
|
163
|
+
var _ref, _ref1, _ref2, _ref3, _ref4;
|
|
164
|
+
const snapshot = await transaction.get(ref);
|
|
165
|
+
const existing = snapshot.exists ? snapshot.data() : null;
|
|
166
|
+
if (existing && POS_CELLULAR_SETTLED_STATES.includes(existing.state)) return null;
|
|
167
|
+
if ((existing == null ? void 0 : existing.state) === 'charging' && now - existing.updatedAtMs < CLAIM_STALE_MS) return null;
|
|
168
|
+
const attempts = ((_ref = existing == null ? void 0 : existing.attempts) != null ? _ref : 0) + 1;
|
|
169
|
+
const claim = {
|
|
170
|
+
orgId,
|
|
171
|
+
month,
|
|
172
|
+
// The figures of the FIRST attempt stand: the invoice's key is the
|
|
173
|
+
// month's, and Stripe refuses a key reused with other parameters.
|
|
174
|
+
readers: (_ref1 = existing == null ? void 0 : existing.readers) != null ? _ref1 : readers,
|
|
175
|
+
amountCents: (_ref2 = existing == null ? void 0 : existing.amountCents) != null ? _ref2 : amountCents,
|
|
176
|
+
state: 'charging',
|
|
177
|
+
invoiceId: (_ref3 = existing == null ? void 0 : existing.invoiceId) != null ? _ref3 : null,
|
|
178
|
+
paidCents: 0,
|
|
179
|
+
attempts,
|
|
180
|
+
createdAtMs: (_ref4 = existing == null ? void 0 : existing.createdAtMs) != null ? _ref4 : now,
|
|
181
|
+
updatedAtMs: now
|
|
182
|
+
};
|
|
183
|
+
transaction.set(ref, claim);
|
|
184
|
+
return {
|
|
185
|
+
attempts
|
|
186
|
+
};
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
async function settleMonth(orgId, month, patch, now) {
|
|
190
|
+
await chargesRef().doc(posCellularChargeId(orgId, month)).set(_extends({}, patch, {
|
|
191
|
+
updatedAtMs: now
|
|
192
|
+
}), {
|
|
193
|
+
merge: true
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Charges one workspace's month once: claimed in a transaction first, so the
|
|
198
|
+
* monthly run and a workspace erasure never both charge it, and keyed by the
|
|
199
|
+
* month so a retried run lands on the same invoice. `final` marks the charge
|
|
200
|
+
* an erasure made, which alerts staff at once on a failure, since nothing
|
|
201
|
+
* retries it.
|
|
202
|
+
*/ async function chargeWorkspaceMonth(input, context) {
|
|
203
|
+
var _billing_stripeCustomerId;
|
|
204
|
+
const { orgId, month, readers } = input;
|
|
205
|
+
const { config, now, alert } = context;
|
|
206
|
+
const amountCents = posCellularChargeCents(readers, config);
|
|
207
|
+
const claim = await claimMonth(orgId, month, readers, amountCents, now);
|
|
208
|
+
if (!claim) return 'settled';
|
|
209
|
+
const stored = (await chargesRef().doc(posCellularChargeId(orgId, month)).get()).data();
|
|
210
|
+
const final = input.final ? {
|
|
211
|
+
final: true
|
|
212
|
+
} : {};
|
|
213
|
+
const raise = (reason)=>alert(COMMERCE_POS_CELLULAR_CHARGE_FAILED, {
|
|
214
|
+
dedupeKey: posCellularChargeId(orgId, month),
|
|
215
|
+
orgId,
|
|
216
|
+
context: {
|
|
217
|
+
orgId,
|
|
218
|
+
month: posCellularMonthLabel(month),
|
|
219
|
+
readers: String(stored.readers),
|
|
220
|
+
amount: formatOperatorAlertAmount(stored.amountCents),
|
|
221
|
+
reason: input.final ? `${reason} (charged as the workspace was deleted)` : reason
|
|
222
|
+
}
|
|
223
|
+
}).catch((error)=>console.error(`${LABEL}: the alert was not raised`, orgId, error));
|
|
224
|
+
const org = await firestore().collection('orgs').doc(orgId).get();
|
|
225
|
+
if (!org.exists) {
|
|
226
|
+
await settleMonth(orgId, month, _extends({
|
|
227
|
+
state: 'no-workspace'
|
|
228
|
+
}, final), now);
|
|
229
|
+
if (input.final) await raise('the workspace was already gone');
|
|
230
|
+
return 'unbillable';
|
|
231
|
+
}
|
|
232
|
+
if (stored.amountCents < USAGE_INVOICE_MIN_CHARGE_CENTS) {
|
|
233
|
+
await settleMonth(orgId, month, _extends({
|
|
234
|
+
state: 'below-minimum'
|
|
235
|
+
}, final), now);
|
|
236
|
+
return 'unbillable';
|
|
237
|
+
}
|
|
238
|
+
const billing = await context.readBilling(orgId).catch(()=>({}));
|
|
239
|
+
const stripeCustomerId = String((_billing_stripeCustomerId = billing.stripeCustomerId) != null ? _billing_stripeCustomerId : '');
|
|
240
|
+
if (!stripeCustomerId) {
|
|
241
|
+
await settleMonth(orgId, month, _extends({
|
|
242
|
+
state: 'no-customer'
|
|
243
|
+
}, final), now);
|
|
244
|
+
await raise('the workspace has no payment method on file');
|
|
245
|
+
return 'unbillable';
|
|
246
|
+
}
|
|
247
|
+
const label = posCellularMonthLabel(month);
|
|
248
|
+
const result = await context.charge({
|
|
249
|
+
orgId,
|
|
250
|
+
stripeCustomerId,
|
|
251
|
+
productId: config.productId,
|
|
252
|
+
amountCents: stored.amountCents,
|
|
253
|
+
currency: 'usd',
|
|
254
|
+
description: `4G for ${stored.readers} Stripe Reader S710 card reader${stored.readers === 1 ? '' : 's'}, ${label}`,
|
|
255
|
+
metadata: {
|
|
256
|
+
orgId,
|
|
257
|
+
pluginId: BUNDLE_ID,
|
|
258
|
+
kind: POS_CELLULAR_CHARGE_KIND,
|
|
259
|
+
month,
|
|
260
|
+
readers: String(stored.readers)
|
|
261
|
+
},
|
|
262
|
+
idempotencyKey: `pos-cellular-${orgId}-${month}`
|
|
263
|
+
}).catch((error)=>({
|
|
264
|
+
ok: false,
|
|
265
|
+
invoiceId: null,
|
|
266
|
+
status: null,
|
|
267
|
+
totalCents: 0,
|
|
268
|
+
amountPaidCents: 0,
|
|
269
|
+
requiresAction: false,
|
|
270
|
+
error: error instanceof Error ? error.message : 'the charge threw'
|
|
271
|
+
}));
|
|
272
|
+
if (result.ok) {
|
|
273
|
+
await settleMonth(orgId, month, _extends({
|
|
274
|
+
state: 'paid',
|
|
275
|
+
invoiceId: result.invoiceId,
|
|
276
|
+
paidCents: result.amountPaidCents
|
|
277
|
+
}, final), now);
|
|
278
|
+
return 'paid';
|
|
279
|
+
}
|
|
280
|
+
if (result.invoiceId) {
|
|
281
|
+
// The invoice stays open on their Billing page, where they can pay it;
|
|
282
|
+
// the grace period runs from today.
|
|
283
|
+
await settleMonth(orgId, month, _extends({
|
|
284
|
+
state: 'open',
|
|
285
|
+
invoiceId: result.invoiceId,
|
|
286
|
+
openedAtMs: now
|
|
287
|
+
}, final), now);
|
|
288
|
+
await raise(result.requiresAction ? 'the card needs the cardholder to authenticate' : result.error || 'the card was declined');
|
|
289
|
+
return 'open';
|
|
290
|
+
}
|
|
291
|
+
await settleMonth(orgId, month, _extends({
|
|
292
|
+
state: 'failed'
|
|
293
|
+
}, final), now);
|
|
294
|
+
console.error(`${LABEL}: the charge did not reach Stripe`, orgId, month, result.error);
|
|
295
|
+
// Nothing retries a charge made at erasure: staff hear of it now.
|
|
296
|
+
if (input.final || claim.attempts >= ALERT_AFTER_ATTEMPTS) await raise(result.error || 'Stripe did not answer');
|
|
297
|
+
return 'failed';
|
|
298
|
+
}
|
|
299
|
+
/** The charge of every workspace whose readers had 4G last month, once each. */ export async function runPosCellularBilling(gate, deps = {}) {
|
|
300
|
+
var _deps_now, _deps_charge, _deps_readBilling, _deps_alert, _deps_turnOff, _deps_invoiceStatus, _deps_notify, _deps_warn;
|
|
301
|
+
const config = deps.config === undefined ? parsePosCellularConfig(process.env) : deps.config;
|
|
302
|
+
const now = ((_deps_now = deps.now) != null ? _deps_now : Date.now)();
|
|
303
|
+
const report = {
|
|
304
|
+
month: null,
|
|
305
|
+
workspaces: 0,
|
|
306
|
+
paid: 0,
|
|
307
|
+
open: 0,
|
|
308
|
+
failed: 0,
|
|
309
|
+
unbillable: 0,
|
|
310
|
+
deferred: 0,
|
|
311
|
+
storesGone: 0,
|
|
312
|
+
paidLate: 0,
|
|
313
|
+
warned: 0,
|
|
314
|
+
turnedOff: 0
|
|
315
|
+
};
|
|
316
|
+
if (!config) return report;
|
|
317
|
+
const charge = (_deps_charge = deps.charge) != null ? _deps_charge : (request)=>chargeOrgUsageInvoice(request);
|
|
318
|
+
const readBilling = (_deps_readBilling = deps.readBilling) != null ? _deps_readBilling : (orgId)=>readOrgBilling(orgId);
|
|
319
|
+
const alert = (_deps_alert = deps.alert) != null ? _deps_alert : raiseOperatorAlert;
|
|
320
|
+
const turnOff = (_deps_turnOff = deps.turnOff) != null ? _deps_turnOff : turnOffPosCellularConfiguration;
|
|
321
|
+
const month = posCellularPreviousMonthKey(now);
|
|
322
|
+
report.month = month;
|
|
323
|
+
const bounds = posCellularMonthBounds(month);
|
|
324
|
+
const records = await recordsForMonth(bounds.startMs);
|
|
325
|
+
report.storesGone = await closeGoneStores(records, {
|
|
326
|
+
turnOff,
|
|
327
|
+
alert
|
|
328
|
+
}, now);
|
|
329
|
+
const byOrg = posCellularReadersByWorkspace(records.map(({ record })=>record), month);
|
|
330
|
+
report.workspaces = byOrg.size;
|
|
331
|
+
for (const [orgId, { readers, hostIds }] of byOrg){
|
|
332
|
+
// A store locked for security or abuse is charged nothing while it is:
|
|
333
|
+
// its card may be the stolen one the lock is about. Tried again daily.
|
|
334
|
+
const locked = await Promise.all(hostIds.map((hostId)=>gate.isLocked(hostId).catch(()=>true)));
|
|
335
|
+
if (locked.some(Boolean)) {
|
|
336
|
+
report.deferred += 1;
|
|
337
|
+
continue;
|
|
338
|
+
}
|
|
339
|
+
const outcome = await chargeWorkspaceMonth({
|
|
340
|
+
orgId,
|
|
341
|
+
month,
|
|
342
|
+
readers
|
|
343
|
+
}, {
|
|
344
|
+
config,
|
|
345
|
+
now,
|
|
346
|
+
charge,
|
|
347
|
+
readBilling,
|
|
348
|
+
alert
|
|
349
|
+
});
|
|
350
|
+
if (outcome === 'paid') report.paid += 1;
|
|
351
|
+
else if (outcome === 'open') report.open += 1;
|
|
352
|
+
else if (outcome === 'failed') report.failed += 1;
|
|
353
|
+
else if (outcome === 'unbillable') report.unbillable += 1;
|
|
354
|
+
}
|
|
355
|
+
const grace = await enforcePosCellularGrace({
|
|
356
|
+
config,
|
|
357
|
+
now,
|
|
358
|
+
alert,
|
|
359
|
+
turnOff,
|
|
360
|
+
invoiceStatus: (_deps_invoiceStatus = deps.invoiceStatus) != null ? _deps_invoiceStatus : posCellularInvoiceStatus,
|
|
361
|
+
notify: (_deps_notify = deps.notify) != null ? _deps_notify : async (notice)=>(await import("./pos-cellular-notify.js")).sendPosCellularTurnedOffNotice(notice),
|
|
362
|
+
warn: (_deps_warn = deps.warn) != null ? _deps_warn : async (notice)=>(await import("./pos-cellular-notify.js")).sendPosCellularPaymentDueNotice(notice)
|
|
363
|
+
});
|
|
364
|
+
report.paidLate = grace.paidLate;
|
|
365
|
+
report.warned = grace.warned;
|
|
366
|
+
report.turnedOff = grace.turnedOff;
|
|
367
|
+
return report;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* WARN, THEN TURN OFF (AGL-4038): every charge left open is asked about at
|
|
371
|
+
* Stripe; paid or voided since, it is settled so; still unpaid within its
|
|
372
|
+
* grace, the workspace is warned once of the day 4G turns off; still unpaid
|
|
373
|
+
* past it, 4G goes off for the workspace. A charge already suspended is
|
|
374
|
+
* finished if a run died half-way (a store still on, nobody told yet) and
|
|
375
|
+
* settled once paid.
|
|
376
|
+
*/ async function enforcePosCellularGrace(context) {
|
|
377
|
+
const { config, now } = context;
|
|
378
|
+
let paidLate = 0;
|
|
379
|
+
let warned = 0;
|
|
380
|
+
let turnedOff = 0;
|
|
381
|
+
for (const state of [
|
|
382
|
+
'open',
|
|
383
|
+
'suspended'
|
|
384
|
+
]){
|
|
385
|
+
const snapshot = await chargesRef().where('state', '==', state).limit(200).get();
|
|
386
|
+
for (const doc of snapshot.docs){
|
|
387
|
+
var _stored_suspendedAtMs;
|
|
388
|
+
const id = String(doc.id);
|
|
389
|
+
const stored = doc.data();
|
|
390
|
+
const invoice = stored.invoiceId ? await context.invoiceStatus(stored.invoiceId).catch(()=>null) : null;
|
|
391
|
+
if ((invoice == null ? void 0 : invoice.status) === 'paid' || (invoice == null ? void 0 : invoice.status) === 'void') {
|
|
392
|
+
const settled = invoice.status === 'paid' ? 'paid' : 'voided';
|
|
393
|
+
if (state === 'suspended') {
|
|
394
|
+
await settleSuspendedPosCellularCharge(id, stored, settled, invoice.amountPaidCents, now);
|
|
395
|
+
} else {
|
|
396
|
+
await settleMonth(stored.orgId, stored.month, _extends({
|
|
397
|
+
state: settled
|
|
398
|
+
}, settled === 'paid' ? {
|
|
399
|
+
paidCents: invoice.amountPaidCents
|
|
400
|
+
} : {}), now);
|
|
401
|
+
}
|
|
402
|
+
if (settled === 'paid') paidLate += 1;
|
|
403
|
+
continue;
|
|
404
|
+
}
|
|
405
|
+
// Stripe could not be asked: never read as unpaid.
|
|
406
|
+
if (!invoice) continue;
|
|
407
|
+
if (state === 'open') {
|
|
408
|
+
if (!posCellularOverdue(stored, config.graceDays, now)) {
|
|
409
|
+
if (posCellularWarningDue(stored) && await warnPaymentDue(id, context)) warned += 1;
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
412
|
+
const claimed = await claimSuspension(id, now);
|
|
413
|
+
if (!claimed) continue;
|
|
414
|
+
turnedOff += 1;
|
|
415
|
+
await context.alert(COMMERCE_POS_CELLULAR_TURNED_OFF_UNPAID, {
|
|
416
|
+
dedupeKey: id,
|
|
417
|
+
orgId: stored.orgId,
|
|
418
|
+
context: {
|
|
419
|
+
orgId: stored.orgId,
|
|
420
|
+
month: posCellularMonthLabel(stored.month),
|
|
421
|
+
amount: formatOperatorAlertAmount(stored.amountCents),
|
|
422
|
+
graceDays: String(config.graceDays)
|
|
423
|
+
}
|
|
424
|
+
}).catch((error)=>console.error(`${LABEL}: the turned-off alert was not raised`, id, error));
|
|
425
|
+
}
|
|
426
|
+
await finishSuspension(id, _extends({}, stored, {
|
|
427
|
+
state: 'suspended',
|
|
428
|
+
suspendedAtMs: (_stored_suspendedAtMs = stored.suspendedAtMs) != null ? _stored_suspendedAtMs : now
|
|
429
|
+
}), context);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
return {
|
|
433
|
+
paidLate,
|
|
434
|
+
warned,
|
|
435
|
+
turnedOff
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Claims the warning of an open charge, once: the charge as it stood, or null
|
|
440
|
+
* when a run already warned of it or it is no longer open. The day its grace
|
|
441
|
+
* counts from is pinned with the claim, so the day the warning states is the
|
|
442
|
+
* day the turn-off keeps, even for a charge from before that day was stored.
|
|
443
|
+
*/ async function claimWarning(id, now) {
|
|
444
|
+
const ref = chargesRef().doc(id);
|
|
445
|
+
return firestore().runTransaction(async (transaction)=>{
|
|
446
|
+
var _charge_openedAtMs;
|
|
447
|
+
const snapshot = await transaction.get(ref);
|
|
448
|
+
const charge = snapshot.exists ? snapshot.data() : null;
|
|
449
|
+
if (!charge || !posCellularWarningDue(charge)) return null;
|
|
450
|
+
const openedAtMs = Number((_charge_openedAtMs = charge.openedAtMs) != null ? _charge_openedAtMs : charge.updatedAtMs);
|
|
451
|
+
transaction.set(ref, {
|
|
452
|
+
warnedAtMs: now,
|
|
453
|
+
openedAtMs,
|
|
454
|
+
updatedAtMs: now
|
|
455
|
+
}, {
|
|
456
|
+
merge: true
|
|
457
|
+
});
|
|
458
|
+
return _extends({}, charge, {
|
|
459
|
+
openedAtMs
|
|
460
|
+
});
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* WARN AT THE START (AGL-4038): the members who manage the workspace's
|
|
465
|
+
* billing are told the charge is due and the day 4G turns off for its stores
|
|
466
|
+
* unless it is paid. Claimed before it is sent, so two runs never both send
|
|
467
|
+
* it; a warning nobody could be sent is released for the next run to try.
|
|
468
|
+
*/ async function warnPaymentDue(id, context) {
|
|
469
|
+
const { config, now } = context;
|
|
470
|
+
const charge = await claimWarning(id, now);
|
|
471
|
+
if (!charge) return false;
|
|
472
|
+
const told = await (async ()=>{
|
|
473
|
+
// The stores that have 4G now, which lose it on that day.
|
|
474
|
+
const snapshot = await recordsRef().where('orgId', '==', charge.orgId).where('enabled', '==', true).limit(500).get();
|
|
475
|
+
const hostIds = [
|
|
476
|
+
...new Set(snapshot.docs.map((doc)=>doc.data().hostId))
|
|
477
|
+
];
|
|
478
|
+
return context.warn({
|
|
479
|
+
orgId: charge.orgId,
|
|
480
|
+
month: charge.month,
|
|
481
|
+
amount: formatOperatorAlertAmount(charge.amountCents),
|
|
482
|
+
readers: charge.readers,
|
|
483
|
+
openedAtMs: Number(charge.openedAtMs),
|
|
484
|
+
turnsOffAtMs: posCellularGraceEndsAtMs(charge, config.graceDays),
|
|
485
|
+
hostIds
|
|
486
|
+
});
|
|
487
|
+
})().catch((error)=>{
|
|
488
|
+
console.error(`${LABEL}: the payment-due warning was not sent`, id, error);
|
|
489
|
+
return false;
|
|
490
|
+
});
|
|
491
|
+
if (!told) await chargesRef().doc(id).set({
|
|
492
|
+
warnedAtMs: null,
|
|
493
|
+
updatedAtMs: now
|
|
494
|
+
}, {
|
|
495
|
+
merge: true
|
|
496
|
+
});
|
|
497
|
+
return told;
|
|
498
|
+
}
|
|
499
|
+
/** Moves an open charge to `suspended`, once: false when a run already did, or it is no longer open. */ async function claimSuspension(id, now) {
|
|
500
|
+
const ref = chargesRef().doc(id);
|
|
501
|
+
return firestore().runTransaction(async (transaction)=>{
|
|
502
|
+
const snapshot = await transaction.get(ref);
|
|
503
|
+
if (!snapshot.exists || snapshot.data().state !== 'open') return false;
|
|
504
|
+
transaction.set(ref, {
|
|
505
|
+
state: 'suspended',
|
|
506
|
+
suspendedAtMs: now,
|
|
507
|
+
updatedAtMs: now
|
|
508
|
+
}, {
|
|
509
|
+
merge: true
|
|
510
|
+
});
|
|
511
|
+
return true;
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* 4G off at Stripe for every store of the workspace that still has it, each
|
|
516
|
+
* store's settings saying why, its readers' periods closed, and the workspace
|
|
517
|
+
* told once. Safe to run again: a store already off and a notice already
|
|
518
|
+
* sent are left alone.
|
|
519
|
+
*/ async function finishSuspension(id, charge, context) {
|
|
520
|
+
var _charge_suspendedHostIds, _charge_suspendedHostIds1;
|
|
521
|
+
const { now } = context;
|
|
522
|
+
const snapshot = await recordsRef().where('orgId', '==', charge.orgId).where('enabled', '==', true).limit(500).get();
|
|
523
|
+
const records = snapshot.docs.map((doc)=>({
|
|
524
|
+
id: String(doc.id),
|
|
525
|
+
record: doc.data()
|
|
526
|
+
}));
|
|
527
|
+
const hostIds = new Set((_charge_suspendedHostIds = charge.suspendedHostIds) != null ? _charge_suspendedHostIds : []);
|
|
528
|
+
if (records.length) {
|
|
529
|
+
await turnOffConfigurations(records.map(({ record })=>record), {
|
|
530
|
+
turnOff: context.turnOff,
|
|
531
|
+
alert: context.alert
|
|
532
|
+
});
|
|
533
|
+
const suspension = {
|
|
534
|
+
month: charge.month,
|
|
535
|
+
invoiceId: charge.invoiceId,
|
|
536
|
+
atMs: now
|
|
537
|
+
};
|
|
538
|
+
for (const hostId of new Set(records.map(({ record })=>record.hostId))){
|
|
539
|
+
hostIds.add(hostId);
|
|
540
|
+
const terminal = firestore().collection('hosts').doc(hostId).collection('terminal').doc('config');
|
|
541
|
+
if (!(await terminal.get()).exists) continue;
|
|
542
|
+
await terminal.set({
|
|
543
|
+
cellularEnabled: false,
|
|
544
|
+
cellularChangedAtMs: now,
|
|
545
|
+
cellularChangedBy: 'unpaid',
|
|
546
|
+
cellularSuspended: suspension
|
|
547
|
+
}, {
|
|
548
|
+
merge: true
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
for (const { id: recordId, record } of records)await recordsRef().doc(recordId).set(closePosCellularPeriod(record, now));
|
|
552
|
+
}
|
|
553
|
+
const patch = {};
|
|
554
|
+
if (records.length || hostIds.size !== ((_charge_suspendedHostIds1 = charge.suspendedHostIds) != null ? _charge_suspendedHostIds1 : []).length) patch.suspendedHostIds = [
|
|
555
|
+
...hostIds
|
|
556
|
+
];
|
|
557
|
+
if (!charge.noticeSentAtMs) {
|
|
558
|
+
var _charge_openedAtMs, _charge_suspendedAtMs;
|
|
559
|
+
const told = await context.notify({
|
|
560
|
+
orgId: charge.orgId,
|
|
561
|
+
month: charge.month,
|
|
562
|
+
amount: formatOperatorAlertAmount(charge.amountCents),
|
|
563
|
+
readers: charge.readers,
|
|
564
|
+
openedAtMs: Number((_charge_openedAtMs = charge.openedAtMs) != null ? _charge_openedAtMs : charge.updatedAtMs),
|
|
565
|
+
turnedOffAtMs: Number((_charge_suspendedAtMs = charge.suspendedAtMs) != null ? _charge_suspendedAtMs : now),
|
|
566
|
+
hostIds: [
|
|
567
|
+
...hostIds
|
|
568
|
+
]
|
|
569
|
+
});
|
|
570
|
+
if (told) patch.noticeSentAtMs = now;
|
|
571
|
+
}
|
|
572
|
+
// A suspension already finished, and still unpaid, writes nothing.
|
|
573
|
+
if (Object.keys(patch).length) await chargesRef().doc(id).set(_extends({}, patch, {
|
|
574
|
+
updatedAtMs: now
|
|
575
|
+
}), {
|
|
576
|
+
merge: true
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Commerce's 4G share of a WORKSPACE erasure (AGL-4038), before its data
|
|
581
|
+
* goes:
|
|
582
|
+
*
|
|
583
|
+
* 1. CHARGE IT. The month the workspace is deleted in is charged now, for
|
|
584
|
+
* each S710 that had 4G in it, as the monthly run would have charged it a
|
|
585
|
+
* month later; and last month too, if the run had not charged it yet.
|
|
586
|
+
* Through the run's own claim and key, so the two never charge one month
|
|
587
|
+
* twice. A workspace that is locked is not charged (its card may be the
|
|
588
|
+
* stolen one the lock is about): staff are alerted instead. Any failure
|
|
589
|
+
* alerts staff and goes on.
|
|
590
|
+
* 2. TURN IT OFF. Every store of the workspace with 4G on has cellular turned
|
|
591
|
+
* off at Stripe, so the platform stops paying for readers nobody will be
|
|
592
|
+
* charged for, and their periods are closed.
|
|
593
|
+
*
|
|
594
|
+
* Never fails the erasure: a refusal is a must alert. A dry run only counts.
|
|
595
|
+
*/ export function createPosCellularOrgEraser(deps = {}) {
|
|
596
|
+
return async ({ orgId, dryRun })=>{
|
|
597
|
+
var _deps_now, _deps_alert, _deps_turnOff;
|
|
598
|
+
const empty = {
|
|
599
|
+
cellularStoresTurnedOff: 0,
|
|
600
|
+
cellularTurnOffFailed: 0,
|
|
601
|
+
cellularFinalMonthsCharged: 0,
|
|
602
|
+
cellularFinalChargeFailed: 0
|
|
603
|
+
};
|
|
604
|
+
if (!orgId) return empty;
|
|
605
|
+
const now = ((_deps_now = deps.now) != null ? _deps_now : Date.now)();
|
|
606
|
+
const alert = (_deps_alert = deps.alert) != null ? _deps_alert : raiseOperatorAlert;
|
|
607
|
+
const snapshot = await recordsRef().where('orgId', '==', orgId).limit(500).get();
|
|
608
|
+
const all = snapshot.docs.map((doc)=>({
|
|
609
|
+
id: String(doc.id),
|
|
610
|
+
record: doc.data()
|
|
611
|
+
}));
|
|
612
|
+
const records = all.filter(({ record })=>record.enabled);
|
|
613
|
+
const stores = new Set(records.map(({ record })=>record.stripeConfigurationId).filter(Boolean)).size;
|
|
614
|
+
// 1. The final month (and last month, if it is still owed).
|
|
615
|
+
const config = deps.config === undefined ? parsePosCellularConfig(process.env) : deps.config;
|
|
616
|
+
// The months with readers that no run has settled yet.
|
|
617
|
+
const months = [];
|
|
618
|
+
for (const month of config ? [
|
|
619
|
+
posCellularPreviousMonthKey(now),
|
|
620
|
+
posCellularMonthKey(now)
|
|
621
|
+
] : []){
|
|
622
|
+
var _ref;
|
|
623
|
+
var _posCellularReadersByWorkspace_get;
|
|
624
|
+
const readers = (_ref = (_posCellularReadersByWorkspace_get = posCellularReadersByWorkspace(all.map(({ record })=>record), month).get(orgId)) == null ? void 0 : _posCellularReadersByWorkspace_get.readers) != null ? _ref : 0;
|
|
625
|
+
if (!readers) continue;
|
|
626
|
+
const existing = await chargesRef().doc(posCellularChargeId(orgId, month)).get();
|
|
627
|
+
const state = existing.exists ? existing.data().state : null;
|
|
628
|
+
if (!state || !POS_CELLULAR_SETTLED_STATES.includes(state)) months.push({
|
|
629
|
+
month,
|
|
630
|
+
readers
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
let charged = 0;
|
|
634
|
+
let chargeFailed = 0;
|
|
635
|
+
if (dryRun) return _extends({}, empty, {
|
|
636
|
+
cellularStoresTurnedOff: stores,
|
|
637
|
+
cellularFinalMonthsCharged: months.length
|
|
638
|
+
});
|
|
639
|
+
if (config && months.length) {
|
|
640
|
+
const org = await firestore().collection('orgs').doc(orgId).get().catch(()=>null);
|
|
641
|
+
const locked = (org == null ? void 0 : org.exists) ? normalizeOrgLockdown(org.data()) !== null : false;
|
|
642
|
+
for (const { month, readers } of months){
|
|
643
|
+
try {
|
|
644
|
+
var _deps_charge, _deps_readBilling;
|
|
645
|
+
if (locked) {
|
|
646
|
+
chargeFailed += 1;
|
|
647
|
+
await alert(COMMERCE_POS_CELLULAR_CHARGE_FAILED, {
|
|
648
|
+
dedupeKey: posCellularChargeId(orgId, month),
|
|
649
|
+
orgId,
|
|
650
|
+
context: {
|
|
651
|
+
orgId,
|
|
652
|
+
month: posCellularMonthLabel(month),
|
|
653
|
+
readers: String(readers),
|
|
654
|
+
amount: formatOperatorAlertAmount(posCellularChargeCents(readers, config)),
|
|
655
|
+
reason: 'the workspace is locked, so it was not charged as it was deleted'
|
|
656
|
+
}
|
|
657
|
+
});
|
|
658
|
+
continue;
|
|
659
|
+
}
|
|
660
|
+
const outcome = await chargeWorkspaceMonth({
|
|
661
|
+
orgId,
|
|
662
|
+
month,
|
|
663
|
+
readers,
|
|
664
|
+
final: true
|
|
665
|
+
}, {
|
|
666
|
+
config,
|
|
667
|
+
now,
|
|
668
|
+
charge: (_deps_charge = deps.charge) != null ? _deps_charge : (request)=>chargeOrgUsageInvoice(request),
|
|
669
|
+
readBilling: (_deps_readBilling = deps.readBilling) != null ? _deps_readBilling : (id)=>readOrgBilling(id),
|
|
670
|
+
alert
|
|
671
|
+
});
|
|
672
|
+
if (outcome === 'paid') charged += 1;
|
|
673
|
+
else if (outcome !== 'settled') chargeFailed += 1;
|
|
674
|
+
} catch (error) {
|
|
675
|
+
chargeFailed += 1;
|
|
676
|
+
console.error(`${LABEL}: the final month was not charged`, orgId, month, error);
|
|
677
|
+
await alert(COMMERCE_POS_CELLULAR_CHARGE_FAILED, {
|
|
678
|
+
dedupeKey: posCellularChargeId(orgId, month),
|
|
679
|
+
orgId,
|
|
680
|
+
context: {
|
|
681
|
+
orgId,
|
|
682
|
+
month: posCellularMonthLabel(month),
|
|
683
|
+
readers: String(readers),
|
|
684
|
+
amount: formatOperatorAlertAmount(posCellularChargeCents(readers, config)),
|
|
685
|
+
reason: 'the charge failed as the workspace was deleted'
|
|
686
|
+
}
|
|
687
|
+
}).catch(()=>undefined);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
// 2. Off at Stripe, so the platform stops paying for it.
|
|
692
|
+
if (!records.length) return _extends({}, empty, {
|
|
693
|
+
cellularFinalMonthsCharged: charged,
|
|
694
|
+
cellularFinalChargeFailed: chargeFailed
|
|
695
|
+
});
|
|
696
|
+
const { off, failed } = await turnOffConfigurations(records.map(({ record })=>record), {
|
|
697
|
+
turnOff: (_deps_turnOff = deps.turnOff) != null ? _deps_turnOff : turnOffPosCellularConfiguration,
|
|
698
|
+
alert
|
|
699
|
+
});
|
|
700
|
+
for (const { id, record } of records)await recordsRef().doc(id).set(closePosCellularPeriod(record, now));
|
|
701
|
+
return {
|
|
702
|
+
cellularStoresTurnedOff: off,
|
|
703
|
+
cellularTurnOffFailed: failed,
|
|
704
|
+
cellularFinalMonthsCharged: charged,
|
|
705
|
+
cellularFinalChargeFailed: chargeFailed
|
|
706
|
+
};
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
/** The eraser over the platform's own Firestore and Stripe, as the declarations register it. */ export const posCellularOrgEraser = (request)=>createPosCellularOrgEraser()(request);
|
|
710
|
+
|
|
711
|
+
//# sourceMappingURL=pos-cellular-billing.js.map
|