@stacksjs/commerce 0.75.75 → 0.75.77
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/dist/index.js +5 -5
- package/dist/orders/index.d.ts +6 -7
- package/dist/orders/webhook.d.ts +24 -20
- package/package.json +12 -12
package/dist/orders/index.d.ts
CHANGED
|
@@ -59,14 +59,13 @@ export {
|
|
|
59
59
|
updateDeliveryInfo,
|
|
60
60
|
updateStatus,
|
|
61
61
|
} from './update';
|
|
62
|
-
//
|
|
63
|
-
//
|
|
64
|
-
// package's processWebhook() verifies signatures + dispatches.
|
|
62
|
+
// Payment webhook handling (stacksjs/stacks#1879 Co-17, #665): pass each event
|
|
63
|
+
// the payment driver's verifyWebhook() returns to handleCommercePaymentEvent().
|
|
65
64
|
export {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
handleCommercePaymentEvent,
|
|
66
|
+
handlePaymentFailed,
|
|
67
|
+
handlePaymentSucceeded,
|
|
68
|
+
handleRefundSucceeded,
|
|
70
69
|
} from './webhook';
|
|
71
70
|
// Server-side cart-to-order total recompute (stacksjs/stacks#1879 Co-13).
|
|
72
71
|
// Apps pre-flight the cart through this before placeOrder to detect
|
package/dist/orders/webhook.d.ts
CHANGED
|
@@ -1,31 +1,35 @@
|
|
|
1
|
+
import type { PaymentEvent } from '@stacksjs/payments';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* `recordEventOrSkip`.
|
|
3
|
+
* A payment succeeded. Marks the linked payment row and order row in a single
|
|
4
|
+
* transaction. Idempotent via `recordEventOrSkip`.
|
|
5
5
|
*/
|
|
6
|
-
declare function
|
|
6
|
+
declare function handlePaymentSucceeded(event: PaymentEvent): Promise<void>;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* reason on the payment row for ops triage.
|
|
8
|
+
* A payment failed. Marks the payment failed and cancels the linked order,
|
|
9
|
+
* recording the provider's reason on the payment row for ops triage.
|
|
11
10
|
*/
|
|
12
|
-
declare function
|
|
11
|
+
declare function handlePaymentFailed(event: PaymentEvent): Promise<void>;
|
|
13
12
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* A refund succeeded. Adds it to the payment's refunded amount; a refund that
|
|
14
|
+
* covers what is left marks the payment `refunded` and the order REFUNDED,
|
|
15
|
+
* and a smaller one marks the payment `partiallyRefunded` and leaves the order
|
|
16
|
+
* where it is, since REFUNDED is terminal. It used to mark both refunded on any
|
|
17
|
+
* refund at all, and to overwrite the refunded amount rather than add to it.
|
|
18
|
+
*
|
|
19
|
+
* A refund larger than what is left is not recorded and is logged: the
|
|
20
|
+
* provider has refunded more than this database thinks was taken, which a
|
|
21
|
+
* person needs to look at - most likely the same refund recorded by hand in
|
|
22
|
+
* the dashboard as well.
|
|
16
23
|
*/
|
|
17
|
-
declare function
|
|
24
|
+
declare function handleRefundSucceeded(event: PaymentEvent): Promise<void>;
|
|
18
25
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* Returns an unregister callback for tests that want to swap the
|
|
23
|
-
* handler set between cases.
|
|
26
|
+
* Apply a verified payment event to the order it concerns. Answers whether
|
|
27
|
+
* commerce acted on it; events it has no use for are left alone.
|
|
24
28
|
*/
|
|
25
|
-
export declare function
|
|
29
|
+
export declare function handleCommercePaymentEvent(event: PaymentEvent): Promise<boolean>;
|
|
26
30
|
// Export the individual handlers for direct testing.
|
|
27
31
|
export {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
handlePaymentFailed,
|
|
33
|
+
handlePaymentSucceeded,
|
|
34
|
+
handleRefundSucceeded,
|
|
31
35
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/commerce",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.75.
|
|
4
|
+
"version": "0.75.77",
|
|
5
5
|
"description": "Stacks commerce utilities.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"contributors": [
|
|
@@ -57,17 +57,17 @@
|
|
|
57
57
|
"prepublishOnly": "bun run build"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@stacksjs/cache": "0.75.
|
|
61
|
-
"@stacksjs/config": "0.75.
|
|
62
|
-
"@stacksjs/database": "0.75.
|
|
63
|
-
"@stacksjs/env": "0.75.
|
|
64
|
-
"@stacksjs/error-handling": "0.75.
|
|
65
|
-
"@stacksjs/events": "0.75.
|
|
66
|
-
"@stacksjs/logging": "0.75.
|
|
67
|
-
"@stacksjs/orm": "0.75.
|
|
68
|
-
"@stacksjs/payments": "0.75.
|
|
69
|
-
"@stacksjs/realtime": "0.75.
|
|
70
|
-
"@stacksjs/strings": "0.75.
|
|
60
|
+
"@stacksjs/cache": "0.75.77",
|
|
61
|
+
"@stacksjs/config": "0.75.77",
|
|
62
|
+
"@stacksjs/database": "0.75.77",
|
|
63
|
+
"@stacksjs/env": "0.75.77",
|
|
64
|
+
"@stacksjs/error-handling": "0.75.77",
|
|
65
|
+
"@stacksjs/events": "0.75.77",
|
|
66
|
+
"@stacksjs/logging": "0.75.77",
|
|
67
|
+
"@stacksjs/orm": "0.75.77",
|
|
68
|
+
"@stacksjs/payments": "0.75.77",
|
|
69
|
+
"@stacksjs/realtime": "0.75.77",
|
|
70
|
+
"@stacksjs/strings": "0.75.77",
|
|
71
71
|
"ts-spreadsheets": "^0.2.0"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|