@medusajs/medusa 1.6.4 → 1.6.5-alpha.0
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +21 -0
- package/dist/api/index.d.ts +4 -0
- package/dist/api/index.js +4 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/middlewares/error-handler.js.map +1 -1
- package/dist/api/routes/admin/draft-orders/get-draft-order.js +2 -0
- package/dist/api/routes/admin/draft-orders/get-draft-order.js.map +1 -1
- package/dist/api/routes/admin/draft-orders/register-payment.js +1 -10
- package/dist/api/routes/admin/draft-orders/register-payment.js.map +1 -1
- package/dist/api/routes/admin/index.js +6 -0
- package/dist/api/routes/admin/index.js.map +1 -1
- package/dist/api/routes/admin/order-edits/index.d.ts +1 -0
- package/dist/api/routes/admin/order-edits/index.js +3 -1
- package/dist/api/routes/admin/order-edits/index.js.map +1 -1
- package/dist/api/routes/admin/order-edits/list-order-edit.d.ts +2 -2
- package/dist/api/routes/admin/order-edits/list-order-edit.js +2 -2
- package/dist/api/routes/admin/order-edits/request-confirmation.d.ts +3 -0
- package/dist/api/routes/admin/order-edits/request-confirmation.js +67 -5
- package/dist/api/routes/admin/order-edits/request-confirmation.js.map +1 -1
- package/dist/api/routes/admin/orders/get-order.js +1 -1
- package/dist/api/routes/admin/orders/get-order.js.map +1 -1
- package/dist/api/routes/admin/orders/index.js +13 -1
- package/dist/api/routes/admin/orders/index.js.map +1 -1
- package/dist/api/routes/admin/payment-collections/delete-payment-collection.d.ts +54 -0
- package/dist/api/routes/admin/payment-collections/delete-payment-collection.js +106 -0
- package/dist/api/routes/admin/payment-collections/delete-payment-collection.js.map +1 -0
- package/dist/api/routes/admin/payment-collections/get-payment-collection.d.ts +58 -0
- package/dist/api/routes/admin/payment-collections/get-payment-collection.js +133 -0
- package/dist/api/routes/admin/payment-collections/get-payment-collection.js.map +1 -0
- package/dist/api/routes/admin/payment-collections/index.d.ts +16 -0
- package/dist/api/routes/admin/payment-collections/index.js +72 -0
- package/dist/api/routes/admin/payment-collections/index.js.map +1 -0
- package/dist/api/routes/admin/payment-collections/mark-authorized-payment-collection.d.ts +53 -0
- package/dist/api/routes/admin/payment-collections/mark-authorized-payment-collection.js +115 -0
- package/dist/api/routes/admin/payment-collections/mark-authorized-payment-collection.js.map +1 -0
- package/dist/api/routes/admin/payment-collections/update-payment-collection.d.ts +74 -0
- package/dist/api/routes/admin/payment-collections/update-payment-collection.js +160 -0
- package/dist/api/routes/admin/payment-collections/update-payment-collection.js.map +1 -0
- package/dist/api/routes/admin/payments/capture-payment.d.ts +53 -0
- package/dist/api/routes/admin/payments/capture-payment.js +105 -0
- package/dist/api/routes/admin/payments/capture-payment.js.map +1 -0
- package/dist/api/routes/admin/payments/get-payment.d.ts +56 -0
- package/dist/api/routes/admin/payments/get-payment.js +131 -0
- package/dist/api/routes/admin/payments/get-payment.js.map +1 -0
- package/dist/api/routes/admin/payments/index.d.ts +13 -0
- package/dist/api/routes/admin/payments/index.js +67 -0
- package/dist/api/routes/admin/payments/index.js.map +1 -0
- package/dist/api/routes/admin/payments/refund-payment.d.ts +86 -0
- package/dist/api/routes/admin/payments/refund-payment.js +166 -0
- package/dist/api/routes/admin/payments/refund-payment.js.map +1 -0
- package/dist/api/routes/admin/publishable-api-keys/create-publishable-api-key.d.ts +66 -0
- package/dist/api/routes/admin/publishable-api-keys/create-publishable-api-key.js +146 -0
- package/dist/api/routes/admin/publishable-api-keys/create-publishable-api-key.js.map +1 -0
- package/dist/api/routes/admin/publishable-api-keys/delete-publishable-api-key.d.ts +52 -0
- package/dist/api/routes/admin/publishable-api-keys/delete-publishable-api-key.js +120 -0
- package/dist/api/routes/admin/publishable-api-keys/delete-publishable-api-key.js.map +1 -0
- package/dist/api/routes/admin/publishable-api-keys/get-publishable-api-key.d.ts +55 -0
- package/dist/api/routes/admin/publishable-api-keys/get-publishable-api-key.js +105 -0
- package/dist/api/routes/admin/publishable-api-keys/get-publishable-api-key.js.map +1 -0
- package/dist/api/routes/admin/publishable-api-keys/index.d.ts +14 -0
- package/dist/api/routes/admin/publishable-api-keys/index.js +54 -0
- package/dist/api/routes/admin/publishable-api-keys/index.js.map +1 -0
- package/dist/api/routes/admin/publishable-api-keys/list-publishable-api-keys.d.ts +63 -0
- package/dist/api/routes/admin/publishable-api-keys/list-publishable-api-keys.js +174 -0
- package/dist/api/routes/admin/publishable-api-keys/list-publishable-api-keys.js.map +1 -0
- package/dist/api/routes/admin/publishable-api-keys/revoke-publishable-api-key.d.ts +55 -0
- package/dist/api/routes/admin/publishable-api-keys/revoke-publishable-api-key.js +121 -0
- package/dist/api/routes/admin/publishable-api-keys/revoke-publishable-api-key.js.map +1 -0
- package/dist/api/routes/admin/publishable-api-keys/update-publishable-api-key.d.ts +71 -0
- package/dist/api/routes/admin/publishable-api-keys/update-publishable-api-key.js +152 -0
- package/dist/api/routes/admin/publishable-api-keys/update-publishable-api-key.js.map +1 -0
- package/dist/api/routes/admin/store/get-store.js +3 -1
- package/dist/api/routes/admin/store/get-store.js.map +1 -1
- package/dist/api/routes/store/carts/{create-line-item.d.ts → create-line-item/index.d.ts} +0 -0
- package/dist/api/routes/store/carts/{create-line-item.js → create-line-item/index.js} +72 -54
- package/dist/api/routes/store/carts/create-line-item/index.js.map +1 -0
- package/dist/api/routes/store/carts/create-line-item/utils/handler-steps.d.ts +16 -0
- package/dist/api/routes/store/carts/create-line-item/utils/handler-steps.js +125 -0
- package/dist/api/routes/store/carts/create-line-item/utils/handler-steps.js.map +1 -0
- package/dist/api/routes/store/index.js +2 -0
- package/dist/api/routes/store/index.js.map +1 -1
- package/dist/api/routes/store/order-edits/complete-order-edit.js +62 -16
- package/dist/api/routes/store/order-edits/complete-order-edit.js.map +1 -1
- package/dist/api/routes/store/payment-collections/authorize-payment-collection.d.ts +53 -0
- package/dist/api/routes/store/payment-collections/authorize-payment-collection.js +105 -0
- package/dist/api/routes/store/payment-collections/authorize-payment-collection.js.map +1 -0
- package/dist/api/routes/store/payment-collections/get-payment-collection.d.ts +58 -0
- package/dist/api/routes/store/payment-collections/get-payment-collection.js +133 -0
- package/dist/api/routes/store/payment-collections/get-payment-collection.js.map +1 -0
- package/dist/api/routes/store/payment-collections/index.d.ts +15 -0
- package/dist/api/routes/store/payment-collections/index.js +69 -0
- package/dist/api/routes/store/payment-collections/index.js.map +1 -0
- package/dist/api/routes/store/payment-collections/manage-payment-sessions.d.ts +114 -0
- package/dist/api/routes/store/payment-collections/manage-payment-sessions.js +217 -0
- package/dist/api/routes/store/payment-collections/manage-payment-sessions.js.map +1 -0
- package/dist/api/routes/store/payment-collections/refresh-payment-session.d.ts +64 -0
- package/dist/api/routes/store/payment-collections/refresh-payment-session.js +148 -0
- package/dist/api/routes/store/payment-collections/refresh-payment-session.js.map +1 -0
- package/dist/api/routes/store/shipping-options/list-shipping-options.js +1 -7
- package/dist/api/routes/store/shipping-options/list-shipping-options.js.map +1 -1
- package/dist/helpers/test-request.js +4 -2
- package/dist/helpers/test-request.js.map +1 -1
- package/dist/interfaces/payment-service.js +1 -1
- package/dist/interfaces/payment-service.js.map +1 -1
- package/dist/interfaces/transaction-base-service.js +2 -12
- package/dist/interfaces/transaction-base-service.js.map +1 -1
- package/dist/loaders/config.js +9 -5
- package/dist/loaders/config.js.map +1 -1
- package/dist/loaders/feature-flags/index.js +1 -1
- package/dist/loaders/feature-flags/index.js.map +1 -1
- package/dist/loaders/feature-flags/publishable-api-keys.d.ts +3 -0
- package/dist/loaders/feature-flags/publishable-api-keys.js +10 -0
- package/dist/loaders/feature-flags/publishable-api-keys.js.map +1 -0
- package/dist/loaders/index.js +22 -13
- package/dist/loaders/index.js.map +1 -1
- package/dist/loaders/module-definitions/definitions.d.ts +3 -0
- package/dist/loaders/module-definitions/definitions.js +6 -0
- package/dist/loaders/module-definitions/definitions.js.map +1 -0
- package/dist/loaders/module-definitions/index.d.ts +3 -0
- package/dist/loaders/module-definitions/index.js +48 -0
- package/dist/loaders/module-definitions/index.js.map +1 -0
- package/dist/loaders/module.d.ts +10 -0
- package/dist/loaders/module.js +187 -0
- package/dist/loaders/module.js.map +1 -0
- package/dist/loaders/plugins.js +2 -0
- package/dist/loaders/plugins.js.map +1 -1
- package/dist/loaders/services.js +2 -2
- package/dist/loaders/services.js.map +1 -1
- package/dist/migrations/1664880666982-payment-collection.js +2 -2
- package/dist/migrations/1664880666982-payment-collection.js.map +1 -1
- package/dist/migrations/1667815005070-publishable_api_key.d.ts +7 -0
- package/dist/migrations/1667815005070-publishable_api_key.js +82 -0
- package/dist/migrations/1667815005070-publishable_api_key.js.map +1 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +2 -0
- package/dist/models/index.js.map +1 -1
- package/dist/models/payment-collection.d.ts +3 -21
- package/dist/models/payment-collection.js +3 -27
- package/dist/models/payment-collection.js.map +1 -1
- package/dist/models/publishable-api-key-sales-channel.d.ts +19 -0
- package/dist/models/publishable-api-key-sales-channel.js +51 -0
- package/dist/models/publishable-api-key-sales-channel.js.map +1 -0
- package/dist/models/publishable-api-key.d.ts +45 -0
- package/dist/models/publishable-api-key.js +110 -0
- package/dist/models/publishable-api-key.js.map +1 -0
- package/dist/repositories/publishable-api-key.d.ts +6 -0
- package/dist/repositories/publishable-api-key.js +201 -0
- package/dist/repositories/publishable-api-key.js.map +1 -0
- package/dist/services/cart.d.ts +37 -16
- package/dist/services/cart.js +440 -408
- package/dist/services/cart.js.map +1 -1
- package/dist/services/discount.d.ts +4 -2
- package/dist/services/discount.js +29 -19
- package/dist/services/discount.js.map +1 -1
- package/dist/services/draft-order.js +43 -38
- package/dist/services/draft-order.js.map +1 -1
- package/dist/services/fulfillment-provider.js +6 -2
- package/dist/services/fulfillment-provider.js.map +1 -1
- package/dist/services/idempotency-key.d.ts +2 -6
- package/dist/services/idempotency-key.js.map +1 -1
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.js +6 -2
- package/dist/services/index.js.map +1 -1
- package/dist/services/inventory.js +12 -20
- package/dist/services/inventory.js.map +1 -1
- package/dist/services/line-item-adjustment.js +12 -8
- package/dist/services/line-item-adjustment.js.map +1 -1
- package/dist/services/line-item.js +4 -4
- package/dist/services/line-item.js.map +1 -1
- package/dist/services/new-totals.d.ts +192 -0
- package/dist/services/new-totals.js +610 -0
- package/dist/services/new-totals.js.map +1 -0
- package/dist/services/order-edit.js +1 -1
- package/dist/services/order-edit.js.map +1 -1
- package/dist/services/order.d.ts +24 -12
- package/dist/services/order.js +594 -486
- package/dist/services/order.js.map +1 -1
- package/dist/services/payment-collection.d.ts +3 -12
- package/dist/services/payment-collection.js +65 -327
- package/dist/services/payment-collection.js.map +1 -1
- package/dist/services/payment-provider.d.ts +15 -2
- package/dist/services/payment-provider.js +34 -30
- package/dist/services/payment-provider.js.map +1 -1
- package/dist/services/payment.d.ts +43 -0
- package/dist/services/payment.js +299 -0
- package/dist/services/payment.js.map +1 -0
- package/dist/services/pricing.js +36 -32
- package/dist/services/pricing.js.map +1 -1
- package/dist/services/publishable-api-key.d.ts +80 -0
- package/dist/services/publishable-api-key.js +358 -0
- package/dist/services/publishable-api-key.js.map +1 -0
- package/dist/services/shipping-option.d.ts +1 -1
- package/dist/services/shipping-option.js +2 -2
- package/dist/services/shipping-option.js.map +1 -1
- package/dist/services/shipping-profile.js +28 -30
- package/dist/services/shipping-profile.js.map +1 -1
- package/dist/services/store.js +1 -6
- package/dist/services/store.js.map +1 -1
- package/dist/services/swap.js +10 -9
- package/dist/services/swap.js.map +1 -1
- package/dist/services/tax-provider.d.ts +8 -1
- package/dist/services/tax-provider.js +39 -0
- package/dist/services/tax-provider.js.map +1 -1
- package/dist/services/totals.js +11 -16
- package/dist/services/totals.js.map +1 -1
- package/dist/strategies/cart-completion.d.ts +59 -1
- package/dist/strategies/cart-completion.js +209 -209
- package/dist/strategies/cart-completion.js.map +1 -1
- package/dist/types/global.d.ts +14 -0
- package/dist/types/idempotency-key.d.ts +5 -0
- package/dist/types/modules.d.ts +4 -0
- package/dist/types/modules.js +3 -0
- package/dist/types/modules.js.map +1 -0
- package/dist/types/order-edit.js +2 -0
- package/dist/types/order-edit.js.map +1 -1
- package/dist/types/payment-collection.d.ts +1 -3
- package/dist/types/payment-collection.js +0 -1
- package/dist/types/payment-collection.js.map +1 -1
- package/dist/types/publishable-api-key.d.ts +6 -0
- package/dist/types/publishable-api-key.js +3 -0
- package/dist/types/publishable-api-key.js.map +1 -0
- package/dist/types/tax-service.d.ts +9 -0
- package/dist/types/totals.d.ts +1 -1
- package/dist/utils/exception-formatter.d.ts +2 -1
- package/dist/utils/exception-formatter.js +5 -1
- package/dist/utils/exception-formatter.js.map +1 -1
- package/dist/utils/idempotency/index.d.ts +2 -0
- package/dist/utils/idempotency/index.js +19 -0
- package/dist/utils/idempotency/index.js.map +1 -0
- package/dist/utils/idempotency/initialize-idempotency-request.d.ts +3 -0
- package/dist/utils/idempotency/initialize-idempotency-request.js +62 -0
- package/dist/utils/idempotency/initialize-idempotency-request.js.map +1 -0
- package/dist/utils/idempotency/run-idempotency-step.d.ts +14 -0
- package/dist/utils/idempotency/run-idempotency-step.js +79 -0
- package/dist/utils/idempotency/run-idempotency-step.js.map +1 -0
- package/dist/utils/module-helper.d.ts +7 -0
- package/dist/utils/module-helper.js +24 -0
- package/dist/utils/module-helper.js.map +1 -0
- package/package.json +2 -2
- package/dist/api/routes/store/carts/create-line-item.js.map +0 -1
- package/dist/strategies/__fixtures__/order-export-data.d.ts +0 -3
- package/dist/strategies/__fixtures__/order-export-data.js +0 -81
- package/dist/strategies/__fixtures__/order-export-data.js.map +0 -1
- package/dist/strategies/__fixtures__/product-export-data.d.ts +0 -329
- package/dist/strategies/__fixtures__/product-export-data.js +0 -412
- package/dist/strategies/__fixtures__/product-export-data.js.map +0 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
/**
|
|
40
|
+
* @oas [delete] /payment-collections/{id}
|
|
41
|
+
* operationId: "DeletePaymentCollectionsPaymentCollection"
|
|
42
|
+
* summary: "Delete a Payment Collection"
|
|
43
|
+
* description: "Deletes a Payment Collection"
|
|
44
|
+
* x-authenticated: true
|
|
45
|
+
* parameters:
|
|
46
|
+
* - (path) id=* {string} The ID of the Payment Collection to delete.
|
|
47
|
+
* x-codeSamples:
|
|
48
|
+
* - lang: JavaScript
|
|
49
|
+
* label: JS Client
|
|
50
|
+
* source: |
|
|
51
|
+
* import Medusa from "@medusajs/medusa-js"
|
|
52
|
+
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
|
53
|
+
* // must be previously logged in or use api token
|
|
54
|
+
* medusa.admin.paymentCollections.delete(payment_collection_id)
|
|
55
|
+
* .then(({ id, object, deleted }) => {
|
|
56
|
+
* console.log(id)
|
|
57
|
+
* })
|
|
58
|
+
* - lang: Shell
|
|
59
|
+
* label: cURL
|
|
60
|
+
* source: |
|
|
61
|
+
* curl --location --request DELETE 'https://medusa-url.com/admin/payment-collections/{id}' \
|
|
62
|
+
* --header 'Authorization: Bearer {api_token}'
|
|
63
|
+
* security:
|
|
64
|
+
* - api_token: []
|
|
65
|
+
* - cookie_auth: []
|
|
66
|
+
* tags:
|
|
67
|
+
* - PaymentCollection
|
|
68
|
+
* responses:
|
|
69
|
+
* 200:
|
|
70
|
+
* description: OK
|
|
71
|
+
* content:
|
|
72
|
+
* application/json:
|
|
73
|
+
* schema:
|
|
74
|
+
* properties:
|
|
75
|
+
* id:
|
|
76
|
+
* type: string
|
|
77
|
+
* description: The ID of the deleted Payment Collection.
|
|
78
|
+
* object:
|
|
79
|
+
* type: string
|
|
80
|
+
* description: The type of the object that was deleted.
|
|
81
|
+
* format: payment_collection
|
|
82
|
+
* deleted:
|
|
83
|
+
* type: boolean
|
|
84
|
+
* description: Whether or not the Payment Collection was deleted.
|
|
85
|
+
* default: true
|
|
86
|
+
* "400":
|
|
87
|
+
* $ref: "#/components/responses/400_error"
|
|
88
|
+
* "401":
|
|
89
|
+
* $ref: "#/components/responses/unauthorized"
|
|
90
|
+
*/
|
|
91
|
+
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
92
|
+
var id, paymentCollectionService;
|
|
93
|
+
return __generator(this, function (_a) {
|
|
94
|
+
switch (_a.label) {
|
|
95
|
+
case 0:
|
|
96
|
+
id = req.params.id;
|
|
97
|
+
paymentCollectionService = req.scope.resolve("paymentCollectionService");
|
|
98
|
+
return [4 /*yield*/, paymentCollectionService.delete(id)];
|
|
99
|
+
case 1:
|
|
100
|
+
_a.sent();
|
|
101
|
+
res.status(200).json({ id: id, deleted: true, object: "payment_collection" });
|
|
102
|
+
return [2 /*return*/];
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}); });
|
|
106
|
+
//# sourceMappingURL=delete-payment-collection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-payment-collection.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/payment-collections/delete-payment-collection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;;gBACpB,EAAE,GAAK,GAAG,CAAC,MAAM,GAAf,CAAe;gBAEnB,wBAAwB,GAA6B,GAAG,CAAC,KAAK,CAAC,OAAO,CAC1E,0BAA0B,CAC3B,CAAA;gBAED,qBAAM,wBAAwB,CAAC,MAAM,CAAC,EAAE,CAAC,EAAA;;gBAAzC,SAAyC,CAAA;gBAEzC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAA,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC,CAAA;;;;KAC1E,EAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { FindParams } from "../../../../types/common";
|
|
2
|
+
/**
|
|
3
|
+
* @oas [get] /payment-collections/{id}
|
|
4
|
+
* operationId: "GetPaymentCollectonsPaymentCollection"
|
|
5
|
+
* summary: "Retrieve an PaymentCollection"
|
|
6
|
+
* description: "Retrieves a PaymentCollection."
|
|
7
|
+
* x-authenticated: true
|
|
8
|
+
* parameters:
|
|
9
|
+
* - (path) id=* {string} The ID of the PaymentCollection.
|
|
10
|
+
* - (query) expand {string} Comma separated list of relations to include in the results.
|
|
11
|
+
* - (query) fields {string} Comma separated list of fields to include in the results.
|
|
12
|
+
* x-codeSamples:
|
|
13
|
+
* - lang: JavaScript
|
|
14
|
+
* label: JS Client
|
|
15
|
+
* source: |
|
|
16
|
+
* import Medusa from "@medusajs/medusa-js"
|
|
17
|
+
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
|
18
|
+
* // must be previously logged in or use api token
|
|
19
|
+
* medusa.admin.paymentCollections.retrieve(paymentCollectionId)
|
|
20
|
+
* .then(({ payment_collection }) => {
|
|
21
|
+
* console.log(payment_collection.id)
|
|
22
|
+
* })
|
|
23
|
+
* - lang: Shell
|
|
24
|
+
* label: cURL
|
|
25
|
+
* source: |
|
|
26
|
+
* curl --location --request GET 'https://medusa-url.com/admin/payment-collections/{id}' \
|
|
27
|
+
* --header 'Authorization: Bearer {api_token}'
|
|
28
|
+
* security:
|
|
29
|
+
* - api_token: []
|
|
30
|
+
* - cookie_auth: []
|
|
31
|
+
* tags:
|
|
32
|
+
* - PaymentCollection
|
|
33
|
+
* responses:
|
|
34
|
+
* 200:
|
|
35
|
+
* description: OK
|
|
36
|
+
* content:
|
|
37
|
+
* application/json:
|
|
38
|
+
* schema:
|
|
39
|
+
* properties:
|
|
40
|
+
* payment_collection:
|
|
41
|
+
* $ref: "#/components/schemas/payment_collection"
|
|
42
|
+
* "400":
|
|
43
|
+
* $ref: "#/components/responses/400_error"
|
|
44
|
+
* "401":
|
|
45
|
+
* $ref: "#/components/responses/unauthorized"
|
|
46
|
+
* "404":
|
|
47
|
+
* $ref: "#/components/responses/not_found_error"
|
|
48
|
+
* "409":
|
|
49
|
+
* $ref: "#/components/responses/invalid_state_error"
|
|
50
|
+
* "422":
|
|
51
|
+
* $ref: "#/components/responses/invalid_request_error"
|
|
52
|
+
* "500":
|
|
53
|
+
* $ref: "#/components/responses/500_error"
|
|
54
|
+
*/
|
|
55
|
+
declare const _default: (req: any, res: any) => Promise<void>;
|
|
56
|
+
export default _default;
|
|
57
|
+
export declare class GetPaymentCollectionsParams extends FindParams {
|
|
58
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.GetPaymentCollectionsParams = void 0;
|
|
55
|
+
var common_1 = require("../../../../types/common");
|
|
56
|
+
/**
|
|
57
|
+
* @oas [get] /payment-collections/{id}
|
|
58
|
+
* operationId: "GetPaymentCollectonsPaymentCollection"
|
|
59
|
+
* summary: "Retrieve an PaymentCollection"
|
|
60
|
+
* description: "Retrieves a PaymentCollection."
|
|
61
|
+
* x-authenticated: true
|
|
62
|
+
* parameters:
|
|
63
|
+
* - (path) id=* {string} The ID of the PaymentCollection.
|
|
64
|
+
* - (query) expand {string} Comma separated list of relations to include in the results.
|
|
65
|
+
* - (query) fields {string} Comma separated list of fields to include in the results.
|
|
66
|
+
* x-codeSamples:
|
|
67
|
+
* - lang: JavaScript
|
|
68
|
+
* label: JS Client
|
|
69
|
+
* source: |
|
|
70
|
+
* import Medusa from "@medusajs/medusa-js"
|
|
71
|
+
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
|
72
|
+
* // must be previously logged in or use api token
|
|
73
|
+
* medusa.admin.paymentCollections.retrieve(paymentCollectionId)
|
|
74
|
+
* .then(({ payment_collection }) => {
|
|
75
|
+
* console.log(payment_collection.id)
|
|
76
|
+
* })
|
|
77
|
+
* - lang: Shell
|
|
78
|
+
* label: cURL
|
|
79
|
+
* source: |
|
|
80
|
+
* curl --location --request GET 'https://medusa-url.com/admin/payment-collections/{id}' \
|
|
81
|
+
* --header 'Authorization: Bearer {api_token}'
|
|
82
|
+
* security:
|
|
83
|
+
* - api_token: []
|
|
84
|
+
* - cookie_auth: []
|
|
85
|
+
* tags:
|
|
86
|
+
* - PaymentCollection
|
|
87
|
+
* responses:
|
|
88
|
+
* 200:
|
|
89
|
+
* description: OK
|
|
90
|
+
* content:
|
|
91
|
+
* application/json:
|
|
92
|
+
* schema:
|
|
93
|
+
* properties:
|
|
94
|
+
* payment_collection:
|
|
95
|
+
* $ref: "#/components/schemas/payment_collection"
|
|
96
|
+
* "400":
|
|
97
|
+
* $ref: "#/components/responses/400_error"
|
|
98
|
+
* "401":
|
|
99
|
+
* $ref: "#/components/responses/unauthorized"
|
|
100
|
+
* "404":
|
|
101
|
+
* $ref: "#/components/responses/not_found_error"
|
|
102
|
+
* "409":
|
|
103
|
+
* $ref: "#/components/responses/invalid_state_error"
|
|
104
|
+
* "422":
|
|
105
|
+
* $ref: "#/components/responses/invalid_request_error"
|
|
106
|
+
* "500":
|
|
107
|
+
* $ref: "#/components/responses/500_error"
|
|
108
|
+
*/
|
|
109
|
+
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
110
|
+
var id, retrieveConfig, paymentCollectionService, paymentCollection;
|
|
111
|
+
return __generator(this, function (_a) {
|
|
112
|
+
switch (_a.label) {
|
|
113
|
+
case 0:
|
|
114
|
+
id = req.params.id;
|
|
115
|
+
retrieveConfig = req.retrieveConfig;
|
|
116
|
+
paymentCollectionService = req.scope.resolve("paymentCollectionService");
|
|
117
|
+
return [4 /*yield*/, paymentCollectionService.retrieve(id, retrieveConfig)];
|
|
118
|
+
case 1:
|
|
119
|
+
paymentCollection = _a.sent();
|
|
120
|
+
res.status(200).json({ payment_collection: paymentCollection });
|
|
121
|
+
return [2 /*return*/];
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}); });
|
|
125
|
+
var GetPaymentCollectionsParams = /** @class */ (function (_super) {
|
|
126
|
+
__extends(GetPaymentCollectionsParams, _super);
|
|
127
|
+
function GetPaymentCollectionsParams() {
|
|
128
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
129
|
+
}
|
|
130
|
+
return GetPaymentCollectionsParams;
|
|
131
|
+
}(common_1.FindParams));
|
|
132
|
+
exports.GetPaymentCollectionsParams = GetPaymentCollectionsParams;
|
|
133
|
+
//# sourceMappingURL=get-payment-collection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-payment-collection.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/payment-collections/get-payment-collection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,mDAAqD;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;;gBACpB,EAAE,GAAK,GAAG,CAAC,MAAM,GAAf,CAAe;gBACnB,cAAc,GAAG,GAAG,CAAC,cAAc,CAAA;gBAEnC,wBAAwB,GAA6B,GAAG,CAAC,KAAK,CAAC,OAAO,CAC1E,0BAA0B,CAC3B,CAAA;gBAEyB,qBAAM,wBAAwB,CAAC,QAAQ,CAC/D,EAAE,EACF,cAAc,CACf,EAAA;;gBAHK,iBAAiB,GAAG,SAGzB;gBAED,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAC,CAAA;;;;KAChE,EAAA;AAED;IAAiD,+CAAU;IAA3D;;IAA6D,CAAC;IAAD,kCAAC;AAAD,CAAC,AAA9D,CAAiD,mBAAU,GAAG;AAAjD,kEAA2B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import { PaymentCollection } from "../../../../models";
|
|
3
|
+
declare const _default: (app: any, container: any) => any;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const defaultPaymentCollectionFields: string[];
|
|
6
|
+
export declare const defaulPaymentCollectionRelations: string[];
|
|
7
|
+
export declare type AdminPaymentCollectionRes = {
|
|
8
|
+
payment_collection: PaymentCollection;
|
|
9
|
+
};
|
|
10
|
+
export declare type AdminPaymentCollectionDeleteRes = {
|
|
11
|
+
id: string;
|
|
12
|
+
object: "payment_collection";
|
|
13
|
+
deleted: boolean;
|
|
14
|
+
};
|
|
15
|
+
export * from "./get-payment-collection";
|
|
16
|
+
export * from "./update-payment-collection";
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
+
};
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.defaulPaymentCollectionRelations = exports.defaultPaymentCollectionFields = void 0;
|
|
33
|
+
var express_1 = require("express");
|
|
34
|
+
require("reflect-metadata");
|
|
35
|
+
var middlewares_1 = __importStar(require("../../../middlewares"));
|
|
36
|
+
var order_editing_1 = __importDefault(require("../../../../loaders/feature-flags/order-editing"));
|
|
37
|
+
var feature_flag_enabled_1 = require("../../../middlewares/feature-flag-enabled");
|
|
38
|
+
var get_payment_collection_1 = require("./get-payment-collection");
|
|
39
|
+
var update_payment_collection_1 = require("./update-payment-collection");
|
|
40
|
+
var route = (0, express_1.Router)();
|
|
41
|
+
exports.default = (function (app, container) {
|
|
42
|
+
app.use("/payment-collections", (0, feature_flag_enabled_1.isFeatureFlagEnabled)(order_editing_1.default.key), route);
|
|
43
|
+
route.get("/:id", (0, middlewares_1.transformQuery)(get_payment_collection_1.GetPaymentCollectionsParams, {
|
|
44
|
+
defaultFields: exports.defaultPaymentCollectionFields,
|
|
45
|
+
defaultRelations: exports.defaulPaymentCollectionRelations,
|
|
46
|
+
isList: false,
|
|
47
|
+
}), middlewares_1.default.wrap(require("./get-payment-collection").default));
|
|
48
|
+
route.post("/:id", (0, middlewares_1.transformBody)(update_payment_collection_1.AdminUpdatePaymentCollectionRequest), middlewares_1.default.wrap(require("./update-payment-collection").default));
|
|
49
|
+
route.post("/:id/authorize", middlewares_1.default.wrap(require("./mark-authorized-payment-collection").default));
|
|
50
|
+
route.delete("/:id", middlewares_1.default.wrap(require("./delete-payment-collection").default));
|
|
51
|
+
return app;
|
|
52
|
+
});
|
|
53
|
+
exports.defaultPaymentCollectionFields = [
|
|
54
|
+
"id",
|
|
55
|
+
"type",
|
|
56
|
+
"status",
|
|
57
|
+
"description",
|
|
58
|
+
"amount",
|
|
59
|
+
"authorized_amount",
|
|
60
|
+
"region",
|
|
61
|
+
"currency_code",
|
|
62
|
+
"currency",
|
|
63
|
+
"metadata",
|
|
64
|
+
];
|
|
65
|
+
exports.defaulPaymentCollectionRelations = [
|
|
66
|
+
"region",
|
|
67
|
+
"payment_sessions",
|
|
68
|
+
"payments",
|
|
69
|
+
];
|
|
70
|
+
__exportStar(require("./get-payment-collection"), exports);
|
|
71
|
+
__exportStar(require("./update-payment-collection"), exports);
|
|
72
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/payment-collections/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAgC;AAChC,4BAAyB;AACzB,kEAG6B;AAC7B,kGAAqF;AACrF,kFAAgF;AAEhF,mEAAsE;AACtE,yEAAiF;AAGjF,IAAM,KAAK,GAAG,IAAA,gBAAM,GAAE,CAAA;AAEtB,mBAAe,UAAC,GAAG,EAAE,SAAS;IAC5B,GAAG,CAAC,GAAG,CACL,sBAAsB,EACtB,IAAA,2CAAoB,EAAC,uBAAuB,CAAC,GAAG,CAAC,EACjD,KAAK,CACN,CAAA;IAED,KAAK,CAAC,GAAG,CACP,MAAM,EACN,IAAA,4BAAc,EAAC,oDAA2B,EAAE;QAC1C,aAAa,EAAE,sCAA8B;QAC7C,gBAAgB,EAAE,wCAAgC;QAClD,MAAM,EAAE,KAAK;KACd,CAAC,EACF,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,OAAO,CAAC,CAC9D,CAAA;IAED,KAAK,CAAC,IAAI,CACR,MAAM,EACN,IAAA,2BAAa,EAAC,+DAAmC,CAAC,EAClD,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC,OAAO,CAAC,CACjE,CAAA;IAED,KAAK,CAAC,IAAI,CACR,gBAAgB,EAChB,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,sCAAsC,CAAC,CAAC,OAAO,CAAC,CAC1E,CAAA;IAED,KAAK,CAAC,MAAM,CACV,MAAM,EACN,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC,OAAO,CAAC,CACjE,CAAA;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,EAAA;AAEY,QAAA,8BAA8B,GAAG;IAC5C,IAAI;IACJ,MAAM;IACN,QAAQ;IACR,aAAa;IACb,QAAQ;IACR,mBAAmB;IACnB,QAAQ;IACR,eAAe;IACf,UAAU;IACV,UAAU;CACX,CAAA;AAEY,QAAA,gCAAgC,GAAG;IAC9C,QAAQ;IACR,kBAAkB;IAClB,UAAU;CACX,CAAA;AAWD,2DAAwC;AACxC,8DAA2C"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @oas [post] /payment-collections/{id}/authorize
|
|
3
|
+
* operationId: "MarkAuthorizedPaymentCollectionsPaymentCollection"
|
|
4
|
+
* summary: "Set the status of PaymentCollection as Authorized"
|
|
5
|
+
* description: "Sets the status of PaymentCollection as Authorized."
|
|
6
|
+
* x-authenticated: true
|
|
7
|
+
* parameters:
|
|
8
|
+
* - (path) id=* {string} The ID of the PaymentCollection.
|
|
9
|
+
* x-codeSamples:
|
|
10
|
+
* - lang: JavaScript
|
|
11
|
+
* label: JS Client
|
|
12
|
+
* source: |
|
|
13
|
+
* import Medusa from "@medusajs/medusa-js"
|
|
14
|
+
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
|
15
|
+
* // must be previously logged in or use api token
|
|
16
|
+
* medusa.admin.paymentCollections.markAsAuthorized(payment_collection_id)
|
|
17
|
+
* .then(({ payment_collection }) => {
|
|
18
|
+
* console.log(payment_collection.id)
|
|
19
|
+
* })
|
|
20
|
+
* - lang: Shell
|
|
21
|
+
* label: cURL
|
|
22
|
+
* source: |
|
|
23
|
+
* curl --location --request POST 'https://medusa-url.com/admin/payment-collections/{id}/authorize' \
|
|
24
|
+
* --header 'Authorization: Bearer {api_token}'
|
|
25
|
+
* security:
|
|
26
|
+
* - api_token: []
|
|
27
|
+
* - cookie_auth: []
|
|
28
|
+
* tags:
|
|
29
|
+
* - PaymentCollection
|
|
30
|
+
* responses:
|
|
31
|
+
* 200:
|
|
32
|
+
* description: OK
|
|
33
|
+
* content:
|
|
34
|
+
* application/json:
|
|
35
|
+
* schema:
|
|
36
|
+
* properties:
|
|
37
|
+
* payment_collection:
|
|
38
|
+
* $ref: "#/components/schemas/payment_collection"
|
|
39
|
+
* "400":
|
|
40
|
+
* $ref: "#/components/responses/400_error"
|
|
41
|
+
* "401":
|
|
42
|
+
* $ref: "#/components/responses/unauthorized"
|
|
43
|
+
* "404":
|
|
44
|
+
* $ref: "#/components/responses/not_found_error"
|
|
45
|
+
* "409":
|
|
46
|
+
* $ref: "#/components/responses/invalid_state_error"
|
|
47
|
+
* "422":
|
|
48
|
+
* $ref: "#/components/responses/invalid_request_error"
|
|
49
|
+
* "500":
|
|
50
|
+
* $ref: "#/components/responses/500_error"
|
|
51
|
+
*/
|
|
52
|
+
declare const _default: (req: any, res: any) => Promise<void>;
|
|
53
|
+
export default _default;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
/**
|
|
40
|
+
* @oas [post] /payment-collections/{id}/authorize
|
|
41
|
+
* operationId: "MarkAuthorizedPaymentCollectionsPaymentCollection"
|
|
42
|
+
* summary: "Set the status of PaymentCollection as Authorized"
|
|
43
|
+
* description: "Sets the status of PaymentCollection as Authorized."
|
|
44
|
+
* x-authenticated: true
|
|
45
|
+
* parameters:
|
|
46
|
+
* - (path) id=* {string} The ID of the PaymentCollection.
|
|
47
|
+
* x-codeSamples:
|
|
48
|
+
* - lang: JavaScript
|
|
49
|
+
* label: JS Client
|
|
50
|
+
* source: |
|
|
51
|
+
* import Medusa from "@medusajs/medusa-js"
|
|
52
|
+
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
|
53
|
+
* // must be previously logged in or use api token
|
|
54
|
+
* medusa.admin.paymentCollections.markAsAuthorized(payment_collection_id)
|
|
55
|
+
* .then(({ payment_collection }) => {
|
|
56
|
+
* console.log(payment_collection.id)
|
|
57
|
+
* })
|
|
58
|
+
* - lang: Shell
|
|
59
|
+
* label: cURL
|
|
60
|
+
* source: |
|
|
61
|
+
* curl --location --request POST 'https://medusa-url.com/admin/payment-collections/{id}/authorize' \
|
|
62
|
+
* --header 'Authorization: Bearer {api_token}'
|
|
63
|
+
* security:
|
|
64
|
+
* - api_token: []
|
|
65
|
+
* - cookie_auth: []
|
|
66
|
+
* tags:
|
|
67
|
+
* - PaymentCollection
|
|
68
|
+
* responses:
|
|
69
|
+
* 200:
|
|
70
|
+
* description: OK
|
|
71
|
+
* content:
|
|
72
|
+
* application/json:
|
|
73
|
+
* schema:
|
|
74
|
+
* properties:
|
|
75
|
+
* payment_collection:
|
|
76
|
+
* $ref: "#/components/schemas/payment_collection"
|
|
77
|
+
* "400":
|
|
78
|
+
* $ref: "#/components/responses/400_error"
|
|
79
|
+
* "401":
|
|
80
|
+
* $ref: "#/components/responses/unauthorized"
|
|
81
|
+
* "404":
|
|
82
|
+
* $ref: "#/components/responses/not_found_error"
|
|
83
|
+
* "409":
|
|
84
|
+
* $ref: "#/components/responses/invalid_state_error"
|
|
85
|
+
* "422":
|
|
86
|
+
* $ref: "#/components/responses/invalid_request_error"
|
|
87
|
+
* "500":
|
|
88
|
+
* $ref: "#/components/responses/500_error"
|
|
89
|
+
*/
|
|
90
|
+
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
91
|
+
var id, paymentCollectionService, manager, paymentCollection;
|
|
92
|
+
return __generator(this, function (_a) {
|
|
93
|
+
switch (_a.label) {
|
|
94
|
+
case 0:
|
|
95
|
+
id = req.params.id;
|
|
96
|
+
paymentCollectionService = req.scope.resolve("paymentCollectionService");
|
|
97
|
+
manager = req.scope.resolve("manager");
|
|
98
|
+
return [4 /*yield*/, manager.transaction(function (transactionManager) { return __awaiter(void 0, void 0, void 0, function () {
|
|
99
|
+
return __generator(this, function (_a) {
|
|
100
|
+
switch (_a.label) {
|
|
101
|
+
case 0: return [4 /*yield*/, paymentCollectionService
|
|
102
|
+
.withTransaction(transactionManager)
|
|
103
|
+
.markAsAuthorized(id)];
|
|
104
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}); })];
|
|
108
|
+
case 1:
|
|
109
|
+
paymentCollection = _a.sent();
|
|
110
|
+
res.status(200).json({ payment_collection: paymentCollection });
|
|
111
|
+
return [2 /*return*/];
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}); });
|
|
115
|
+
//# sourceMappingURL=mark-authorized-payment-collection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mark-authorized-payment-collection.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/payment-collections/mark-authorized-payment-collection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;;gBACpB,EAAE,GAAK,GAAG,CAAC,MAAM,GAAf,CAAe;gBAEnB,wBAAwB,GAA6B,GAAG,CAAC,KAAK,CAAC,OAAO,CAC1E,0BAA0B,CAC3B,CAAA;gBAEK,OAAO,GAAkB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;gBACjC,qBAAM,OAAO,CAAC,WAAW,CACjD,UAAO,kBAAkB;;;wCAChB,qBAAM,wBAAwB;yCAClC,eAAe,CAAC,kBAAkB,CAAC;yCACnC,gBAAgB,CAAC,EAAE,CAAC,EAAA;wCAFvB,sBAAO,SAEgB,EAAA;;;yBACxB,CACF,EAAA;;gBANK,iBAAiB,GAAG,SAMzB;gBAED,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAC,CAAA;;;;KAChE,EAAA"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @oas [post] /payment-collections/{id}
|
|
3
|
+
* operationId: "PostPaymentCollectionsPaymentCollection"
|
|
4
|
+
* summary: "Updates a PaymentCollection"
|
|
5
|
+
* description: "Updates a PaymentCollection."
|
|
6
|
+
* x-authenticated: true
|
|
7
|
+
* parameters:
|
|
8
|
+
* - (path) id=* {string} The ID of the PaymentCollection.
|
|
9
|
+
* requestBody:
|
|
10
|
+
* content:
|
|
11
|
+
* application/json:
|
|
12
|
+
* schema:
|
|
13
|
+
* properties:
|
|
14
|
+
* description:
|
|
15
|
+
* description: An optional description to create or update the payment collection.
|
|
16
|
+
* type: string
|
|
17
|
+
* metadata:
|
|
18
|
+
* description: An optional set of key-value pairs to hold additional information.
|
|
19
|
+
* type: object
|
|
20
|
+
* x-codeSamples:
|
|
21
|
+
* - lang: JavaScript
|
|
22
|
+
* label: JS Client
|
|
23
|
+
* source: |
|
|
24
|
+
* import Medusa from "@medusajs/medusa-js"
|
|
25
|
+
* const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
|
|
26
|
+
* // must be previously logged in or use api token
|
|
27
|
+
* medusa.admin.paymentCollections.update(payment_collection_id, {
|
|
28
|
+
* description: "Description of payCol"
|
|
29
|
+
* })
|
|
30
|
+
* .then(({ payment_collection }) => {
|
|
31
|
+
* console.log(payment_collection.id)
|
|
32
|
+
* })
|
|
33
|
+
* - lang: Shell
|
|
34
|
+
* label: cURL
|
|
35
|
+
* source: |
|
|
36
|
+
* curl --location --request POST 'https://medusa-url.com/admin/payment-collections/{id}' \
|
|
37
|
+
* --header 'Authorization: Bearer {api_token}' \
|
|
38
|
+
* --header 'Content-Type: application/json' \
|
|
39
|
+
* --data-raw '{
|
|
40
|
+
* "description": "Description of payCol"
|
|
41
|
+
* }'
|
|
42
|
+
* security:
|
|
43
|
+
* - api_token: []
|
|
44
|
+
* - cookie_auth: []
|
|
45
|
+
* tags:
|
|
46
|
+
* - PaymentCollection
|
|
47
|
+
* responses:
|
|
48
|
+
* 200:
|
|
49
|
+
* description: OK
|
|
50
|
+
* content:
|
|
51
|
+
* application/json:
|
|
52
|
+
* schema:
|
|
53
|
+
* properties:
|
|
54
|
+
* payment_collection:
|
|
55
|
+
* $ref: "#/components/schemas/payment_collection"
|
|
56
|
+
* "400":
|
|
57
|
+
* $ref: "#/components/responses/400_error"
|
|
58
|
+
* "401":
|
|
59
|
+
* $ref: "#/components/responses/unauthorized"
|
|
60
|
+
* "404":
|
|
61
|
+
* $ref: "#/components/responses/not_found_error"
|
|
62
|
+
* "409":
|
|
63
|
+
* $ref: "#/components/responses/invalid_state_error"
|
|
64
|
+
* "422":
|
|
65
|
+
* $ref: "#/components/responses/invalid_request_error"
|
|
66
|
+
* "500":
|
|
67
|
+
* $ref: "#/components/responses/500_error"
|
|
68
|
+
*/
|
|
69
|
+
declare const _default: (req: any, res: any) => Promise<void>;
|
|
70
|
+
export default _default;
|
|
71
|
+
export declare class AdminUpdatePaymentCollectionRequest {
|
|
72
|
+
description?: string;
|
|
73
|
+
metadata?: Record<string, unknown>;
|
|
74
|
+
}
|