@devvit/payments 0.12.5-next-2025-11-26-16-05-45-1a72ba60f.0 → 0.12.5
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/meta.min.json +2 -2
- package/package.json +8 -8
- package/payments.min.js.map +1 -1
- package/server/PaymentsClient.d.ts +5 -8
- package/server/PaymentsClient.d.ts.map +1 -1
- package/server/PaymentsClient.js +14 -21
- package/server/index.d.ts +6 -1
- package/server/index.d.ts.map +1 -1
- package/server/index.js +6 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AcknowledgeOrderDeliveryResponse, GetOrdersRequest, GetOrdersResponse, GetProductsRequest, GetProductsResponse } from '@devvit/protos/json/devvit/plugin/payments/v1alpha/payments.js';
|
|
2
|
+
import type { Prettify } from '@devvit/shared-types/Prettify.js';
|
|
2
3
|
type RequiredGetOrderFields = 'limit';
|
|
3
|
-
export type GetOrdersFilters = Partial<Omit<GetOrdersRequest, RequiredGetOrderFields>> & Pick<GetOrdersRequest, RequiredGetOrderFields
|
|
4
|
+
export type GetOrdersFilters = Prettify<Partial<Omit<GetOrdersRequest, RequiredGetOrderFields>> & Pick<GetOrdersRequest, RequiredGetOrderFields>>;
|
|
4
5
|
/**
|
|
5
6
|
* @experimental - This is not finalized yet, may not work, and may change.
|
|
6
7
|
*/
|
|
@@ -10,21 +11,17 @@ export declare class PaymentsClient {
|
|
|
10
11
|
* @param filters - Filters to apply to the products query.
|
|
11
12
|
* @experimental - This is not finalized yet, may not work, and may change.
|
|
12
13
|
*/
|
|
13
|
-
getProducts(filters?: Partial<GetProductsRequest
|
|
14
|
+
getProducts(filters?: Readonly<Partial<GetProductsRequest>>): Promise<GetProductsResponse>;
|
|
14
15
|
/**
|
|
15
16
|
* @param filters - Filters to apply to the orders query.
|
|
16
17
|
* @experimental - This is not finalized yet, may not work, and may change.
|
|
17
18
|
*/
|
|
18
|
-
getOrders(filters: GetOrdersFilters): Promise<GetOrdersResponse>;
|
|
19
|
+
getOrders(filters: Readonly<GetOrdersFilters>): Promise<GetOrdersResponse>;
|
|
19
20
|
/**
|
|
20
21
|
* @param orderId - The ID of the order to acknowledge delivery for.
|
|
21
22
|
* @experimental - This is not finalized yet, may not work, and may change.
|
|
22
23
|
*/
|
|
23
24
|
acknowledgeOrderDelivery(orderId: string): Promise<AcknowledgeOrderDeliveryResponse>;
|
|
24
25
|
}
|
|
25
|
-
/**
|
|
26
|
-
* @experimental - This is not finalized yet, may not work, and may change.
|
|
27
|
-
*/
|
|
28
|
-
export declare const payments: PaymentsClient;
|
|
29
26
|
export {};
|
|
30
27
|
//# sourceMappingURL=PaymentsClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaymentsClient.d.ts","sourceRoot":"","sources":["../../src/server/PaymentsClient.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"PaymentsClient.d.ts","sourceRoot":"","sources":["../../src/server/PaymentsClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gCAAgC,EAChC,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,gEAAgE,CAAC;AAMxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAGjE,KAAK,sBAAsB,GAAG,OAAO,CAAC;AACtC,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CACrC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,CAAC,GACrD,IAAI,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,CACjD,CAAC;AAEF;;GAEG;AACH,qBAAa,cAAc;;IAGzB;;;OAGG;IACH,WAAW,CAAC,OAAO,GAAE,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAO9F;;;OAGG;IACG,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAmBhF;;;OAGG;IACH,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,gCAAgC,CAAC;CAOrF"}
|
package/server/PaymentsClient.js
CHANGED
|
@@ -27,29 +27,26 @@ export class PaymentsClient {
|
|
|
27
27
|
* @experimental - This is not finalized yet, may not work, and may change.
|
|
28
28
|
*/
|
|
29
29
|
getProducts(filters = {}) {
|
|
30
|
-
return __classPrivateFieldGet(this, _PaymentsClient_instances, "a", _PaymentsClient_plugin_get).GetProducts({
|
|
31
|
-
// Defaults
|
|
32
|
-
skus: [],
|
|
33
|
-
metadata: {},
|
|
34
|
-
// User provided second, overwrites above
|
|
35
|
-
...filters,
|
|
36
|
-
}, context.metadata);
|
|
30
|
+
return __classPrivateFieldGet(this, _PaymentsClient_instances, "a", _PaymentsClient_plugin_get).GetProducts({ metadata: filters.metadata ?? {}, skus: filters.skus ?? [] }, context.metadata);
|
|
37
31
|
}
|
|
38
32
|
/**
|
|
39
33
|
* @param filters - Filters to apply to the orders query.
|
|
40
34
|
* @experimental - This is not finalized yet, may not work, and may change.
|
|
41
35
|
*/
|
|
42
|
-
getOrders(filters) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
36
|
+
async getOrders(filters) {
|
|
37
|
+
const orders = await __classPrivateFieldGet(this, _PaymentsClient_instances, "a", _PaymentsClient_plugin_get).GetOrders({
|
|
38
|
+
metadata: filters.metadata ?? {},
|
|
39
|
+
start: filters.start ? new Date(filters.start) : undefined,
|
|
40
|
+
end: filters.end ? new Date(filters.end) : undefined,
|
|
41
|
+
sku: filters.sku ?? '',
|
|
42
|
+
buyer: filters.buyer ?? '',
|
|
43
|
+
status: filters.status ?? OrderStatus.ORDER_STATUS_UNSPECIFIED,
|
|
44
|
+
cursor: filters.cursor ?? '',
|
|
45
|
+
limit: filters.limit,
|
|
52
46
|
}, context.metadata);
|
|
47
|
+
// Convert the hydrated old Protobuf to JSON. Don't use
|
|
48
|
+
// Protobuf.toJSON() which would omit default values.
|
|
49
|
+
return JSON.parse(JSON.stringify(orders));
|
|
53
50
|
}
|
|
54
51
|
/**
|
|
55
52
|
* @param orderId - The ID of the order to acknowledge delivery for.
|
|
@@ -62,7 +59,3 @@ export class PaymentsClient {
|
|
|
62
59
|
_PaymentsClient_pluginCache = new WeakMap(), _PaymentsClient_instances = new WeakSet(), _PaymentsClient_plugin_get = function _PaymentsClient_plugin_get() {
|
|
63
60
|
return (__classPrivateFieldSet(this, _PaymentsClient_pluginCache, __classPrivateFieldGet(this, _PaymentsClient_pluginCache, "f") ?? getDevvitConfig().use(PaymentsServiceDefinition), "f"));
|
|
64
61
|
};
|
|
65
|
-
/**
|
|
66
|
-
* @experimental - This is not finalized yet, may not work, and may change.
|
|
67
|
-
*/
|
|
68
|
-
export const payments = new PaymentsClient();
|
package/server/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { PaymentsClient } from './PaymentsClient.js';
|
|
1
2
|
export type { PaymentHandlerResponse } from '../paymentHandler.js';
|
|
2
|
-
export {
|
|
3
|
+
export { type PaymentsClient };
|
|
4
|
+
/**
|
|
5
|
+
* @experimental - This is not finalized yet, may not work, and may change.
|
|
6
|
+
*/
|
|
7
|
+
export declare const payments: PaymentsClient;
|
|
3
8
|
//# sourceMappingURL=index.d.ts.map
|
package/server/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,YAAY,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,KAAK,cAAc,EAAE,CAAC;AAE/B;;GAEG;AACH,eAAO,MAAM,QAAQ,gBAAuB,CAAC"}
|
package/server/index.js
CHANGED