@drttix/drt-sdk 1.4.0 → 1.4.1
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/cjs/index.d.ts +1 -0
- package/dist/cjs/src/definitions/shopper.d.ts +2 -0
- package/dist/cjs/src/definitions/shopper.js +2 -0
- package/dist/cjs/src/generated/scanner/core/OpenAPI.js +1 -1
- package/dist/cjs/src/generated/shopper/core/OpenAPI.js +1 -1
- package/dist/cjs/src/generated/shopper/index.d.ts +4 -0
- package/dist/cjs/src/generated/shopper/index.js +3 -1
- package/dist/cjs/src/generated/shopper/models/CompletePaymentBody.d.ts +30 -0
- package/dist/cjs/src/generated/shopper/models/CompletePaymentBody.js +2 -0
- package/dist/cjs/src/generated/shopper/models/ConnectedAccountResponse.d.ts +18 -0
- package/dist/cjs/src/generated/shopper/models/ConnectedAccountResponse.js +2 -0
- package/dist/cjs/src/generated/shopper/models/CreatePaymentIntentBody.d.ts +22 -0
- package/dist/cjs/src/generated/shopper/models/CreatePaymentIntentBody.js +2 -0
- package/dist/cjs/src/generated/shopper/models/CreatePaymentIntentResponse.d.ts +47 -0
- package/dist/cjs/src/generated/shopper/models/CreatePaymentIntentResponse.js +2 -0
- package/dist/cjs/src/generated/shopper/services/StripeService.d.ts +28 -0
- package/dist/cjs/src/generated/shopper/services/StripeService.js +54 -0
- package/dist/cjs/src/generated/shopper/types.d.ts +3 -0
- package/dist/cjs/src/scripts/build-all.js +77 -0
- package/dist/cjs/src/staging/index.d.ts +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/src/definitions/shopper.d.ts +2 -0
- package/dist/esm/src/definitions/shopper.js +2 -0
- package/dist/esm/src/generated/scanner/core/OpenAPI.js +1 -1
- package/dist/esm/src/generated/shopper/core/OpenAPI.js +1 -1
- package/dist/esm/src/generated/shopper/index.d.ts +4 -0
- package/dist/esm/src/generated/shopper/index.js +1 -0
- package/dist/esm/src/generated/shopper/models/CompletePaymentBody.d.ts +30 -0
- package/dist/esm/src/generated/shopper/models/CompletePaymentBody.js +1 -0
- package/dist/esm/src/generated/shopper/models/ConnectedAccountResponse.d.ts +18 -0
- package/dist/esm/src/generated/shopper/models/ConnectedAccountResponse.js +1 -0
- package/dist/esm/src/generated/shopper/models/CreatePaymentIntentBody.d.ts +22 -0
- package/dist/esm/src/generated/shopper/models/CreatePaymentIntentBody.js +1 -0
- package/dist/esm/src/generated/shopper/models/CreatePaymentIntentResponse.d.ts +47 -0
- package/dist/esm/src/generated/shopper/models/CreatePaymentIntentResponse.js +1 -0
- package/dist/esm/src/generated/shopper/services/StripeService.d.ts +28 -0
- package/dist/esm/src/generated/shopper/services/StripeService.js +50 -0
- package/dist/esm/src/generated/shopper/types.d.ts +3 -0
- package/dist/esm/src/scripts/build-all.js +77 -0
- package/dist/esm/src/staging/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/definitions/shopper.ts +2 -0
- package/src/generated/scanner/core/OpenAPI.ts +1 -1
- package/src/generated/shopper/core/OpenAPI.ts +1 -1
- package/src/generated/shopper/index.ts +4 -0
- package/src/generated/shopper/models/ConnectedAccountResponse.ts +23 -0
- package/src/generated/shopper/models/CreatePaymentIntentBody.ts +27 -0
- package/src/generated/shopper/models/CreatePaymentIntentResponse.ts +52 -0
- package/src/generated/shopper/services/StripeService.ts +64 -0
- package/src/generated/shopper/types.ts +3 -0
- package/src/scripts/build-all.ts +84 -0
package/dist/cjs/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare const DRT: {
|
|
|
16
16
|
product: typeof import("./src/generated/shopper").ProductService;
|
|
17
17
|
seat: typeof import("./src/generated/shopper").SeatService;
|
|
18
18
|
session: typeof import("./src/generated/shopper").SessionService;
|
|
19
|
+
stripe: typeof import("./src/generated/shopper").StripeService;
|
|
19
20
|
};
|
|
20
21
|
scanner: {
|
|
21
22
|
database: typeof import("./src/generated/scanner").DatabaseService;
|
|
@@ -10,6 +10,7 @@ import { PaymentService } from "../generated/shopper";
|
|
|
10
10
|
import { ProductService } from "../generated/shopper";
|
|
11
11
|
import { SeatService } from "../generated/shopper";
|
|
12
12
|
import { SessionService } from "../generated/shopper";
|
|
13
|
+
import { StripeService } from "../generated/shopper";
|
|
13
14
|
export declare const shopper: {
|
|
14
15
|
account: typeof AccountService;
|
|
15
16
|
cart: typeof CartService;
|
|
@@ -23,5 +24,6 @@ export declare const shopper: {
|
|
|
23
24
|
product: typeof ProductService;
|
|
24
25
|
seat: typeof SeatService;
|
|
25
26
|
session: typeof SessionService;
|
|
27
|
+
stripe: typeof StripeService;
|
|
26
28
|
};
|
|
27
29
|
export * as ShopperTypes from "../generated/shopper/types";
|
|
@@ -47,6 +47,7 @@ const shopper_9 = require("../generated/shopper");
|
|
|
47
47
|
const shopper_10 = require("../generated/shopper");
|
|
48
48
|
const shopper_11 = require("../generated/shopper");
|
|
49
49
|
const shopper_12 = require("../generated/shopper");
|
|
50
|
+
const shopper_13 = require("../generated/shopper");
|
|
50
51
|
exports.shopper = {
|
|
51
52
|
account: shopper_1.AccountService,
|
|
52
53
|
cart: shopper_2.CartService,
|
|
@@ -60,6 +61,7 @@ exports.shopper = {
|
|
|
60
61
|
product: shopper_10.ProductService,
|
|
61
62
|
seat: shopper_11.SeatService,
|
|
62
63
|
session: shopper_12.SessionService,
|
|
64
|
+
stripe: shopper_13.StripeService,
|
|
63
65
|
};
|
|
64
66
|
// Re-export all types as a namespace
|
|
65
67
|
exports.ShopperTypes = __importStar(require("../generated/shopper/types"));
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OpenAPI = void 0;
|
|
4
4
|
exports.OpenAPI = {
|
|
5
5
|
BASE: 'https://api.drttix.com/scanner-v3',
|
|
6
|
-
VERSION: '
|
|
6
|
+
VERSION: '20260713.1',
|
|
7
7
|
WITH_CREDENTIALS: false,
|
|
8
8
|
CREDENTIALS: 'include',
|
|
9
9
|
TOKEN: undefined,
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OpenAPI = void 0;
|
|
4
4
|
exports.OpenAPI = {
|
|
5
5
|
BASE: 'https://api.drttix.com/shopper',
|
|
6
|
-
VERSION: '
|
|
6
|
+
VERSION: '20260715.1',
|
|
7
7
|
WITH_CREDENTIALS: false,
|
|
8
8
|
CREDENTIALS: 'include',
|
|
9
9
|
TOKEN: undefined,
|
|
@@ -34,8 +34,11 @@ export type { CheckoutSubmitBody } from './models/CheckoutSubmitBody';
|
|
|
34
34
|
export type { CheckoutSuccessResponse } from './models/CheckoutSuccessResponse';
|
|
35
35
|
export type { CodeDto } from './models/CodeDto';
|
|
36
36
|
export type { CompleteBody } from './models/CompleteBody';
|
|
37
|
+
export type { ConnectedAccountResponse } from './models/ConnectedAccountResponse';
|
|
37
38
|
export type { CorrelatedCode } from './models/CorrelatedCode';
|
|
38
39
|
export type { CreateCustomerResponse } from './models/CreateCustomerResponse';
|
|
40
|
+
export type { CreatePaymentIntentBody } from './models/CreatePaymentIntentBody';
|
|
41
|
+
export type { CreatePaymentIntentResponse } from './models/CreatePaymentIntentResponse';
|
|
39
42
|
export type { CreateSessionDto } from './models/CreateSessionDto';
|
|
40
43
|
export type { DigitalAsset } from './models/DigitalAsset';
|
|
41
44
|
export type { DonateOrderRequest } from './models/DonateOrderRequest';
|
|
@@ -163,3 +166,4 @@ export { PaymentService } from './services/PaymentService';
|
|
|
163
166
|
export { ProductService } from './services/ProductService';
|
|
164
167
|
export { SeatService } from './services/SeatService';
|
|
165
168
|
export { SessionService } from './services/SessionService';
|
|
169
|
+
export { StripeService } from './services/StripeService';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SessionService = exports.SeatService = exports.ProductService = exports.PaymentService = exports.OrderService = exports.GiftCardService = exports.EventService = exports.DonationService = exports.CodeService = exports.CheckoutService = exports.CartService = exports.AccountService = exports.OpenAPI = exports.CancelError = exports.CancelablePromise = exports.ApiError = void 0;
|
|
3
|
+
exports.StripeService = exports.SessionService = exports.SeatService = exports.ProductService = exports.PaymentService = exports.OrderService = exports.GiftCardService = exports.EventService = exports.DonationService = exports.CodeService = exports.CheckoutService = exports.CartService = exports.AccountService = exports.OpenAPI = exports.CancelError = exports.CancelablePromise = exports.ApiError = void 0;
|
|
4
4
|
/* generated using openapi-typescript-codegen -- do not edit */
|
|
5
5
|
/* istanbul ignore file */
|
|
6
6
|
/* tslint:disable */
|
|
@@ -36,3 +36,5 @@ var SeatService_1 = require("./services/SeatService");
|
|
|
36
36
|
Object.defineProperty(exports, "SeatService", { enumerable: true, get: function () { return SeatService_1.SeatService; } });
|
|
37
37
|
var SessionService_1 = require("./services/SessionService");
|
|
38
38
|
Object.defineProperty(exports, "SessionService", { enumerable: true, get: function () { return SessionService_1.SessionService; } });
|
|
39
|
+
var StripeService_1 = require("./services/StripeService");
|
|
40
|
+
Object.defineProperty(exports, "StripeService", { enumerable: true, get: function () { return StripeService_1.StripeService; } });
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type CompletePaymentBody = {
|
|
2
|
+
/**
|
|
3
|
+
* The Stripe connected account the payment intent is created on.
|
|
4
|
+
*/
|
|
5
|
+
connectedAccountId: string;
|
|
6
|
+
/**
|
|
7
|
+
* Charge amount in the smallest currency unit (cents).
|
|
8
|
+
*/
|
|
9
|
+
amount: number;
|
|
10
|
+
/**
|
|
11
|
+
* Application fee in the smallest currency unit (cents). Stripe rejects the charge if this exceeds amount.
|
|
12
|
+
*/
|
|
13
|
+
applicationFee: number;
|
|
14
|
+
/**
|
|
15
|
+
* The currency of the charge. One of USD or CAD.
|
|
16
|
+
*/
|
|
17
|
+
currency: string;
|
|
18
|
+
/**
|
|
19
|
+
* The Stripe confirmation token used to confirm the payment intent.
|
|
20
|
+
*/
|
|
21
|
+
confirmationToken: string;
|
|
22
|
+
/**
|
|
23
|
+
* The Stripe customer to attach the payment intent to.
|
|
24
|
+
*/
|
|
25
|
+
customerId?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Metadata to attach to the payment intent, e.g. orderId and shopperGuid.
|
|
28
|
+
*/
|
|
29
|
+
metadata?: Record<string, string>;
|
|
30
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type ConnectedAccountResponse = {
|
|
2
|
+
/**
|
|
3
|
+
* The studio's Stripe connected account id (studio_pmt_gateway_assoc.pmt_gateway_acct_id).
|
|
4
|
+
*/
|
|
5
|
+
connectedAccountId: string;
|
|
6
|
+
/**
|
|
7
|
+
* The studio the guid resolved to.
|
|
8
|
+
*/
|
|
9
|
+
studioId: number;
|
|
10
|
+
/**
|
|
11
|
+
* The Stripe pmt_gateway the account belongs to: 5 = Stripe US, 6 = Stripe CA.
|
|
12
|
+
*/
|
|
13
|
+
gatewayId: number;
|
|
14
|
+
/**
|
|
15
|
+
* Stripe onboarding state of the connected account, e.g. Restricted, Complete, Enabled, Pending, Restricted Soon, Rejected.
|
|
16
|
+
*/
|
|
17
|
+
onboardingStatus: string | null;
|
|
18
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type CreatePaymentIntentBody = {
|
|
2
|
+
/**
|
|
3
|
+
* The studio guid (studio_settings.guid) to charge for.
|
|
4
|
+
*/
|
|
5
|
+
studioGuid: string;
|
|
6
|
+
/**
|
|
7
|
+
* Charge amount in the smallest currency unit (cents), before tax.
|
|
8
|
+
*/
|
|
9
|
+
amount: number;
|
|
10
|
+
/**
|
|
11
|
+
* Application fee in the smallest currency unit (cents). Stripe rejects the charge if this exceeds the total amount.
|
|
12
|
+
*/
|
|
13
|
+
applicationFee: number;
|
|
14
|
+
/**
|
|
15
|
+
* When true, sales tax is added to the amount based on the studio's address and local tax rate before the intent is created.
|
|
16
|
+
*/
|
|
17
|
+
addTax?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Metadata to attach to the payment intent, e.g. your own order or transaction id.
|
|
20
|
+
*/
|
|
21
|
+
metadata?: Record<string, string>;
|
|
22
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export type CreatePaymentIntentResponse = {
|
|
2
|
+
/**
|
|
3
|
+
* The Stripe PaymentIntent id.
|
|
4
|
+
*/
|
|
5
|
+
paymentIntentId: string;
|
|
6
|
+
/**
|
|
7
|
+
* The client secret used to mount a Payment Element and confirm the payment client-side.
|
|
8
|
+
*/
|
|
9
|
+
clientSecret: string;
|
|
10
|
+
/**
|
|
11
|
+
* The connected account the intent was created on. Pass as stripeAccount when initializing Stripe.js.
|
|
12
|
+
*/
|
|
13
|
+
connectedAccountId: string;
|
|
14
|
+
studioId: number;
|
|
15
|
+
/**
|
|
16
|
+
* The Stripe pmt_gateway: 5 = Stripe US, 6 = Stripe CA.
|
|
17
|
+
*/
|
|
18
|
+
gatewayId: number;
|
|
19
|
+
/**
|
|
20
|
+
* Charge currency, derived from the gateway.
|
|
21
|
+
*/
|
|
22
|
+
currency: string;
|
|
23
|
+
/**
|
|
24
|
+
* The pre-tax amount from the request, in cents.
|
|
25
|
+
*/
|
|
26
|
+
baseAmount: number;
|
|
27
|
+
/**
|
|
28
|
+
* The sales tax rate applied (as a decimal fraction). 0 when addTax was not requested.
|
|
29
|
+
*/
|
|
30
|
+
taxRate: number;
|
|
31
|
+
/**
|
|
32
|
+
* The sales tax added, in cents. 0 when addTax was not requested.
|
|
33
|
+
*/
|
|
34
|
+
taxAmount: number;
|
|
35
|
+
/**
|
|
36
|
+
* The amount the intent was created for, in cents.
|
|
37
|
+
*/
|
|
38
|
+
totalAmount: number;
|
|
39
|
+
/**
|
|
40
|
+
* The application fee, in cents.
|
|
41
|
+
*/
|
|
42
|
+
applicationFee: number;
|
|
43
|
+
/**
|
|
44
|
+
* The Stripe status of the newly created intent.
|
|
45
|
+
*/
|
|
46
|
+
status: string;
|
|
47
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ConnectedAccountResponse } from '../models/ConnectedAccountResponse';
|
|
2
|
+
import type { CreatePaymentIntentBody } from '../models/CreatePaymentIntentBody';
|
|
3
|
+
import type { CreatePaymentIntentResponse } from '../models/CreatePaymentIntentResponse';
|
|
4
|
+
import type { CancelablePromise } from '../core/CancelablePromise';
|
|
5
|
+
export declare class StripeService {
|
|
6
|
+
/**
|
|
7
|
+
* Get Stripe connected account
|
|
8
|
+
* Returns the Stripe connected account id for the studio identified by studio_settings.guid. Restricted to the integrator holding api_integrator id 6's api key.
|
|
9
|
+
* @param guid The studio guid (studio_settings.guid).
|
|
10
|
+
* @returns ConnectedAccountResponse Returns the studio's Stripe connected account.
|
|
11
|
+
* @throws ApiError
|
|
12
|
+
*/
|
|
13
|
+
static getConnectedAccount(guid: string, context?: {
|
|
14
|
+
shopperGuid?: string;
|
|
15
|
+
accountId?: string;
|
|
16
|
+
}): CancelablePromise<ConnectedAccountResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Create a payment intent for a studio
|
|
19
|
+
* Resolves the studio guid to its Stripe connected account, optionally adds sales tax based on the studio address, and creates an unconfirmed PaymentIntent via the Payment API. Render a Payment Element with the returned clientSecret (initializing Stripe.js with connectedAccountId) and confirm client-side; completion is reported by the Stripe webhook. Restricted to the integrator holding api_integrator id 6’s api key.
|
|
20
|
+
* @param requestBody The studio guid plus the pre-tax amount and application fee in cents.
|
|
21
|
+
* @returns CreatePaymentIntentResponse The created intent with its clientSecret and the amount/tax breakdown.
|
|
22
|
+
* @throws ApiError
|
|
23
|
+
*/
|
|
24
|
+
static createPaymentIntent(requestBody: CreatePaymentIntentBody, context?: {
|
|
25
|
+
shopperGuid?: string;
|
|
26
|
+
accountId?: string;
|
|
27
|
+
}): CancelablePromise<CreatePaymentIntentResponse>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StripeService = void 0;
|
|
4
|
+
const OpenAPI_1 = require("../core/OpenAPI");
|
|
5
|
+
const request_1 = require("../core/request");
|
|
6
|
+
const sdkConfig_1 = require("../../../functions/sdkConfig");
|
|
7
|
+
class StripeService {
|
|
8
|
+
/**
|
|
9
|
+
* Get Stripe connected account
|
|
10
|
+
* Returns the Stripe connected account id for the studio identified by studio_settings.guid. Restricted to the integrator holding api_integrator id 6's api key.
|
|
11
|
+
* @param guid The studio guid (studio_settings.guid).
|
|
12
|
+
* @returns ConnectedAccountResponse Returns the studio's Stripe connected account.
|
|
13
|
+
* @throws ApiError
|
|
14
|
+
*/
|
|
15
|
+
static getConnectedAccount(guid, context) {
|
|
16
|
+
return (0, request_1.request)(OpenAPI_1.OpenAPI, {
|
|
17
|
+
method: 'GET',
|
|
18
|
+
url: '/stripe/connected-account/{guid}',
|
|
19
|
+
path: {
|
|
20
|
+
'guid': guid,
|
|
21
|
+
},
|
|
22
|
+
headers: (0, sdkConfig_1.resolveShopperHeaders)(context),
|
|
23
|
+
errors: {
|
|
24
|
+
400: `Bad Request error with error details.`,
|
|
25
|
+
401: `The apikey header is missing or is not the integrator’s.`,
|
|
26
|
+
404: `Not found error with error details.`,
|
|
27
|
+
500: `Internal Server Error, please contact developers.`,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Create a payment intent for a studio
|
|
33
|
+
* Resolves the studio guid to its Stripe connected account, optionally adds sales tax based on the studio address, and creates an unconfirmed PaymentIntent via the Payment API. Render a Payment Element with the returned clientSecret (initializing Stripe.js with connectedAccountId) and confirm client-side; completion is reported by the Stripe webhook. Restricted to the integrator holding api_integrator id 6’s api key.
|
|
34
|
+
* @param requestBody The studio guid plus the pre-tax amount and application fee in cents.
|
|
35
|
+
* @returns CreatePaymentIntentResponse The created intent with its clientSecret and the amount/tax breakdown.
|
|
36
|
+
* @throws ApiError
|
|
37
|
+
*/
|
|
38
|
+
static createPaymentIntent(requestBody, context) {
|
|
39
|
+
return (0, request_1.request)(OpenAPI_1.OpenAPI, {
|
|
40
|
+
method: 'POST',
|
|
41
|
+
url: '/stripe/payment-intent',
|
|
42
|
+
headers: (0, sdkConfig_1.resolveShopperHeaders)(context),
|
|
43
|
+
body: requestBody,
|
|
44
|
+
mediaType: 'application/json',
|
|
45
|
+
errors: {
|
|
46
|
+
400: `Bad Request error with error details.`,
|
|
47
|
+
401: `The apikey header is missing or is not the integrator’s.`,
|
|
48
|
+
404: `Not found error with error details.`,
|
|
49
|
+
500: `Internal Server Error, please contact developers.`,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.StripeService = StripeService;
|
|
@@ -30,8 +30,11 @@ export type { CheckoutSubmitBody } from './models/CheckoutSubmitBody';
|
|
|
30
30
|
export type { CheckoutSuccessResponse } from './models/CheckoutSuccessResponse';
|
|
31
31
|
export type { CodeDto } from './models/CodeDto';
|
|
32
32
|
export type { CompleteBody } from './models/CompleteBody';
|
|
33
|
+
export type { ConnectedAccountResponse } from './models/ConnectedAccountResponse';
|
|
33
34
|
export type { CorrelatedCode } from './models/CorrelatedCode';
|
|
34
35
|
export type { CreateCustomerResponse } from './models/CreateCustomerResponse';
|
|
36
|
+
export type { CreatePaymentIntentBody } from './models/CreatePaymentIntentBody';
|
|
37
|
+
export type { CreatePaymentIntentResponse } from './models/CreatePaymentIntentResponse';
|
|
35
38
|
export type { CreateSessionDto } from './models/CreateSessionDto';
|
|
36
39
|
export type { DigitalAsset } from './models/DigitalAsset';
|
|
37
40
|
export type { DonateOrderRequest } from './models/DonateOrderRequest';
|
|
@@ -84,6 +84,69 @@ console.log('✅ Replaced scanner/core/request.ts with custom-request.txt');
|
|
|
84
84
|
// shopperScope: 'per-request' }) serve many shoppers/accounts from one SDK
|
|
85
85
|
// instance — see src/functions/sdkConfig.ts.
|
|
86
86
|
console.log('⚙️ Stripping/reworking credential params in generated services...');
|
|
87
|
+
// Finds each `public static <name>(<params>): <returnType> { <body> }` method
|
|
88
|
+
// by tracking paren/brace nesting (a single regex can't express "matching
|
|
89
|
+
// close paren/brace" when the body itself contains nested {}/() such as
|
|
90
|
+
// `headers: {...}` or `path: {...}`). For any method whose body calls
|
|
91
|
+
// resolveShopperHeaders(context) but whose parameter list doesn't already
|
|
92
|
+
// declare a `context` param, appends `context?: { shopperGuid?: string;
|
|
93
|
+
// accountId?: string }` as the last parameter.
|
|
94
|
+
function patchMissingContextParam(src) {
|
|
95
|
+
const methodStart = /public static \w+\(/g;
|
|
96
|
+
let result = '';
|
|
97
|
+
let cursor = 0;
|
|
98
|
+
let match;
|
|
99
|
+
while ((match = methodStart.exec(src))) {
|
|
100
|
+
const parenOpen = match.index + match[0].length - 1;
|
|
101
|
+
// Walk from the opening '(' to its matching ')'.
|
|
102
|
+
let depth = 0;
|
|
103
|
+
let i = parenOpen;
|
|
104
|
+
for (; i < src.length; i++) {
|
|
105
|
+
if (src[i] === '(')
|
|
106
|
+
depth++;
|
|
107
|
+
else if (src[i] === ')') {
|
|
108
|
+
depth--;
|
|
109
|
+
if (depth === 0)
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const parenClose = i;
|
|
114
|
+
// Walk forward to the method's opening '{', then to its matching '}'.
|
|
115
|
+
const braceOpen = src.indexOf('{', parenClose);
|
|
116
|
+
depth = 0;
|
|
117
|
+
let j = braceOpen;
|
|
118
|
+
for (; j < src.length; j++) {
|
|
119
|
+
if (src[j] === '{')
|
|
120
|
+
depth++;
|
|
121
|
+
else if (src[j] === '}') {
|
|
122
|
+
depth--;
|
|
123
|
+
if (depth === 0)
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const braceClose = j;
|
|
128
|
+
const params = src.slice(parenOpen + 1, parenClose);
|
|
129
|
+
const body = src.slice(braceOpen + 1, braceClose);
|
|
130
|
+
if (/resolveShopperHeaders\(context\)/.test(body) && !/context\?:/.test(params)) {
|
|
131
|
+
// Indentation of an existing parameter line (the new param
|
|
132
|
+
// matches it); indentation of the ')' line (preserved as-is).
|
|
133
|
+
const paramIndentMatch = /\r?\n([^\S\r\n]+)\S/.exec(params);
|
|
134
|
+
const paramIndent = paramIndentMatch ? paramIndentMatch[1] : ' ';
|
|
135
|
+
const closeIndentMatch = /\r?\n([^\S\r\n]*)$/.exec(params);
|
|
136
|
+
const closeIndent = closeIndentMatch ? closeIndentMatch[1] : ' ';
|
|
137
|
+
const trimmedParams = params.replace(/[,\s]*$/, '');
|
|
138
|
+
const sep = trimmedParams.trim() ? ',\r\n' : '\r\n';
|
|
139
|
+
const newParams = trimmedParams +
|
|
140
|
+
sep +
|
|
141
|
+
`${paramIndent}context?: { shopperGuid?: string; accountId?: string },\r\n${closeIndent}`;
|
|
142
|
+
result += src.slice(cursor, parenOpen + 1) + newParams;
|
|
143
|
+
cursor = parenClose;
|
|
144
|
+
}
|
|
145
|
+
methodStart.lastIndex = braceClose;
|
|
146
|
+
}
|
|
147
|
+
result += src.slice(cursor);
|
|
148
|
+
return result;
|
|
149
|
+
}
|
|
87
150
|
function walkServices(dir) {
|
|
88
151
|
const results = [];
|
|
89
152
|
for (const entry of fs_1.default.readdirSync(dir, { withFileTypes: true })) {
|
|
@@ -131,6 +194,20 @@ for (const file of serviceFiles) {
|
|
|
131
194
|
// files lose the \n when accountid/apikey lines are stripped) — use
|
|
132
195
|
// [\r\n]+ to match any combination of CR/LF between the two params.
|
|
133
196
|
.replace(/\n([^\S\n]+)context\?:\s*\{\s*shopperGuid\?:\s*string;\s*accountId\?:\s*string\s*\},[\r\n]+[^\S\n]+(requestBody:\s+[^?,\r\n][^,\r\n]*),/g, (_, indent, rbPart) => `\n${indent}${rbPart},\n${indent}context?: { shopperGuid?: string; accountId?: string },`);
|
|
197
|
+
// Some endpoints (e.g. Stripe's integrator-only calls) declare no
|
|
198
|
+
// shopperguid param, so the replace above never injects a `context`
|
|
199
|
+
// parameter into their signature — yet they still call
|
|
200
|
+
// resolveShopperHeaders(context) via the headers: {} replacement,
|
|
201
|
+
// leaving a dangling reference to an undeclared `context`. Add the
|
|
202
|
+
// param to any method signature whose body calls
|
|
203
|
+
// resolveShopperHeaders(context) but doesn't already declare one.
|
|
204
|
+
// Brace/paren nesting inside method bodies (headers: {...}, path:
|
|
205
|
+
// {...}, etc.) makes this unsafe to express as a single regex, so
|
|
206
|
+
// methods are located by tracking paren depth from `public static`
|
|
207
|
+
// through the matching close-paren of the parameter list, then brace
|
|
208
|
+
// depth from the following `{` through the matching method-closing
|
|
209
|
+
// `}`.
|
|
210
|
+
patched = patchMissingContextParam(patched);
|
|
134
211
|
if (patched !== src) {
|
|
135
212
|
patched = patched.replace("import { request as __request } from '../core/request';", "import { request as __request } from '../core/request';\nimport { resolveShopperHeaders } from '../../../functions/sdkConfig';");
|
|
136
213
|
}
|
|
@@ -31,6 +31,7 @@ export declare const DRT: {
|
|
|
31
31
|
product: typeof import("../generated/shopper").ProductService;
|
|
32
32
|
seat: typeof import("../generated/shopper").SeatService;
|
|
33
33
|
session: typeof import("../generated/shopper").SessionService;
|
|
34
|
+
stripe: typeof import("../generated/shopper").StripeService;
|
|
34
35
|
};
|
|
35
36
|
scanner: {
|
|
36
37
|
database: typeof import("../generated/scanner").DatabaseService;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare const DRT: {
|
|
|
16
16
|
product: typeof import("./src/generated/shopper").ProductService;
|
|
17
17
|
seat: typeof import("./src/generated/shopper").SeatService;
|
|
18
18
|
session: typeof import("./src/generated/shopper").SessionService;
|
|
19
|
+
stripe: typeof import("./src/generated/shopper").StripeService;
|
|
19
20
|
};
|
|
20
21
|
scanner: {
|
|
21
22
|
database: typeof import("./src/generated/scanner").DatabaseService;
|
|
@@ -10,6 +10,7 @@ import { PaymentService } from "../generated/shopper";
|
|
|
10
10
|
import { ProductService } from "../generated/shopper";
|
|
11
11
|
import { SeatService } from "../generated/shopper";
|
|
12
12
|
import { SessionService } from "../generated/shopper";
|
|
13
|
+
import { StripeService } from "../generated/shopper";
|
|
13
14
|
export declare const shopper: {
|
|
14
15
|
account: typeof AccountService;
|
|
15
16
|
cart: typeof CartService;
|
|
@@ -23,5 +24,6 @@ export declare const shopper: {
|
|
|
23
24
|
product: typeof ProductService;
|
|
24
25
|
seat: typeof SeatService;
|
|
25
26
|
session: typeof SessionService;
|
|
27
|
+
stripe: typeof StripeService;
|
|
26
28
|
};
|
|
27
29
|
export * as ShopperTypes from "../generated/shopper/types";
|
|
@@ -11,6 +11,7 @@ import { PaymentService } from "../generated/shopper/index.js";
|
|
|
11
11
|
import { ProductService } from "../generated/shopper/index.js";
|
|
12
12
|
import { SeatService } from "../generated/shopper/index.js";
|
|
13
13
|
import { SessionService } from "../generated/shopper/index.js";
|
|
14
|
+
import { StripeService } from "../generated/shopper/index.js";
|
|
14
15
|
export const shopper = {
|
|
15
16
|
account: AccountService,
|
|
16
17
|
cart: CartService,
|
|
@@ -24,6 +25,7 @@ export const shopper = {
|
|
|
24
25
|
product: ProductService,
|
|
25
26
|
seat: SeatService,
|
|
26
27
|
session: SessionService,
|
|
28
|
+
stripe: StripeService,
|
|
27
29
|
};
|
|
28
30
|
// Re-export all types as a namespace
|
|
29
31
|
export * as ShopperTypes from "../generated/shopper/types.js";
|
|
@@ -34,8 +34,11 @@ export type { CheckoutSubmitBody } from './models/CheckoutSubmitBody';
|
|
|
34
34
|
export type { CheckoutSuccessResponse } from './models/CheckoutSuccessResponse';
|
|
35
35
|
export type { CodeDto } from './models/CodeDto';
|
|
36
36
|
export type { CompleteBody } from './models/CompleteBody';
|
|
37
|
+
export type { ConnectedAccountResponse } from './models/ConnectedAccountResponse';
|
|
37
38
|
export type { CorrelatedCode } from './models/CorrelatedCode';
|
|
38
39
|
export type { CreateCustomerResponse } from './models/CreateCustomerResponse';
|
|
40
|
+
export type { CreatePaymentIntentBody } from './models/CreatePaymentIntentBody';
|
|
41
|
+
export type { CreatePaymentIntentResponse } from './models/CreatePaymentIntentResponse';
|
|
39
42
|
export type { CreateSessionDto } from './models/CreateSessionDto';
|
|
40
43
|
export type { DigitalAsset } from './models/DigitalAsset';
|
|
41
44
|
export type { DonateOrderRequest } from './models/DonateOrderRequest';
|
|
@@ -163,3 +166,4 @@ export { PaymentService } from './services/PaymentService';
|
|
|
163
166
|
export { ProductService } from './services/ProductService';
|
|
164
167
|
export { SeatService } from './services/SeatService';
|
|
165
168
|
export { SessionService } from './services/SessionService';
|
|
169
|
+
export { StripeService } from './services/StripeService';
|
|
@@ -17,3 +17,4 @@ export { PaymentService } from './services/PaymentService.js';
|
|
|
17
17
|
export { ProductService } from './services/ProductService.js';
|
|
18
18
|
export { SeatService } from './services/SeatService.js';
|
|
19
19
|
export { SessionService } from './services/SessionService.js';
|
|
20
|
+
export { StripeService } from './services/StripeService.js';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type CompletePaymentBody = {
|
|
2
|
+
/**
|
|
3
|
+
* The Stripe connected account the payment intent is created on.
|
|
4
|
+
*/
|
|
5
|
+
connectedAccountId: string;
|
|
6
|
+
/**
|
|
7
|
+
* Charge amount in the smallest currency unit (cents).
|
|
8
|
+
*/
|
|
9
|
+
amount: number;
|
|
10
|
+
/**
|
|
11
|
+
* Application fee in the smallest currency unit (cents). Stripe rejects the charge if this exceeds amount.
|
|
12
|
+
*/
|
|
13
|
+
applicationFee: number;
|
|
14
|
+
/**
|
|
15
|
+
* The currency of the charge. One of USD or CAD.
|
|
16
|
+
*/
|
|
17
|
+
currency: string;
|
|
18
|
+
/**
|
|
19
|
+
* The Stripe confirmation token used to confirm the payment intent.
|
|
20
|
+
*/
|
|
21
|
+
confirmationToken: string;
|
|
22
|
+
/**
|
|
23
|
+
* The Stripe customer to attach the payment intent to.
|
|
24
|
+
*/
|
|
25
|
+
customerId?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Metadata to attach to the payment intent, e.g. orderId and shopperGuid.
|
|
28
|
+
*/
|
|
29
|
+
metadata?: Record<string, string>;
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type ConnectedAccountResponse = {
|
|
2
|
+
/**
|
|
3
|
+
* The studio's Stripe connected account id (studio_pmt_gateway_assoc.pmt_gateway_acct_id).
|
|
4
|
+
*/
|
|
5
|
+
connectedAccountId: string;
|
|
6
|
+
/**
|
|
7
|
+
* The studio the guid resolved to.
|
|
8
|
+
*/
|
|
9
|
+
studioId: number;
|
|
10
|
+
/**
|
|
11
|
+
* The Stripe pmt_gateway the account belongs to: 5 = Stripe US, 6 = Stripe CA.
|
|
12
|
+
*/
|
|
13
|
+
gatewayId: number;
|
|
14
|
+
/**
|
|
15
|
+
* Stripe onboarding state of the connected account, e.g. Restricted, Complete, Enabled, Pending, Restricted Soon, Rejected.
|
|
16
|
+
*/
|
|
17
|
+
onboardingStatus: string | null;
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type CreatePaymentIntentBody = {
|
|
2
|
+
/**
|
|
3
|
+
* The studio guid (studio_settings.guid) to charge for.
|
|
4
|
+
*/
|
|
5
|
+
studioGuid: string;
|
|
6
|
+
/**
|
|
7
|
+
* Charge amount in the smallest currency unit (cents), before tax.
|
|
8
|
+
*/
|
|
9
|
+
amount: number;
|
|
10
|
+
/**
|
|
11
|
+
* Application fee in the smallest currency unit (cents). Stripe rejects the charge if this exceeds the total amount.
|
|
12
|
+
*/
|
|
13
|
+
applicationFee: number;
|
|
14
|
+
/**
|
|
15
|
+
* When true, sales tax is added to the amount based on the studio's address and local tax rate before the intent is created.
|
|
16
|
+
*/
|
|
17
|
+
addTax?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Metadata to attach to the payment intent, e.g. your own order or transaction id.
|
|
20
|
+
*/
|
|
21
|
+
metadata?: Record<string, string>;
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export type CreatePaymentIntentResponse = {
|
|
2
|
+
/**
|
|
3
|
+
* The Stripe PaymentIntent id.
|
|
4
|
+
*/
|
|
5
|
+
paymentIntentId: string;
|
|
6
|
+
/**
|
|
7
|
+
* The client secret used to mount a Payment Element and confirm the payment client-side.
|
|
8
|
+
*/
|
|
9
|
+
clientSecret: string;
|
|
10
|
+
/**
|
|
11
|
+
* The connected account the intent was created on. Pass as stripeAccount when initializing Stripe.js.
|
|
12
|
+
*/
|
|
13
|
+
connectedAccountId: string;
|
|
14
|
+
studioId: number;
|
|
15
|
+
/**
|
|
16
|
+
* The Stripe pmt_gateway: 5 = Stripe US, 6 = Stripe CA.
|
|
17
|
+
*/
|
|
18
|
+
gatewayId: number;
|
|
19
|
+
/**
|
|
20
|
+
* Charge currency, derived from the gateway.
|
|
21
|
+
*/
|
|
22
|
+
currency: string;
|
|
23
|
+
/**
|
|
24
|
+
* The pre-tax amount from the request, in cents.
|
|
25
|
+
*/
|
|
26
|
+
baseAmount: number;
|
|
27
|
+
/**
|
|
28
|
+
* The sales tax rate applied (as a decimal fraction). 0 when addTax was not requested.
|
|
29
|
+
*/
|
|
30
|
+
taxRate: number;
|
|
31
|
+
/**
|
|
32
|
+
* The sales tax added, in cents. 0 when addTax was not requested.
|
|
33
|
+
*/
|
|
34
|
+
taxAmount: number;
|
|
35
|
+
/**
|
|
36
|
+
* The amount the intent was created for, in cents.
|
|
37
|
+
*/
|
|
38
|
+
totalAmount: number;
|
|
39
|
+
/**
|
|
40
|
+
* The application fee, in cents.
|
|
41
|
+
*/
|
|
42
|
+
applicationFee: number;
|
|
43
|
+
/**
|
|
44
|
+
* The Stripe status of the newly created intent.
|
|
45
|
+
*/
|
|
46
|
+
status: string;
|
|
47
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ConnectedAccountResponse } from '../models/ConnectedAccountResponse';
|
|
2
|
+
import type { CreatePaymentIntentBody } from '../models/CreatePaymentIntentBody';
|
|
3
|
+
import type { CreatePaymentIntentResponse } from '../models/CreatePaymentIntentResponse';
|
|
4
|
+
import type { CancelablePromise } from '../core/CancelablePromise';
|
|
5
|
+
export declare class StripeService {
|
|
6
|
+
/**
|
|
7
|
+
* Get Stripe connected account
|
|
8
|
+
* Returns the Stripe connected account id for the studio identified by studio_settings.guid. Restricted to the integrator holding api_integrator id 6's api key.
|
|
9
|
+
* @param guid The studio guid (studio_settings.guid).
|
|
10
|
+
* @returns ConnectedAccountResponse Returns the studio's Stripe connected account.
|
|
11
|
+
* @throws ApiError
|
|
12
|
+
*/
|
|
13
|
+
static getConnectedAccount(guid: string, context?: {
|
|
14
|
+
shopperGuid?: string;
|
|
15
|
+
accountId?: string;
|
|
16
|
+
}): CancelablePromise<ConnectedAccountResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Create a payment intent for a studio
|
|
19
|
+
* Resolves the studio guid to its Stripe connected account, optionally adds sales tax based on the studio address, and creates an unconfirmed PaymentIntent via the Payment API. Render a Payment Element with the returned clientSecret (initializing Stripe.js with connectedAccountId) and confirm client-side; completion is reported by the Stripe webhook. Restricted to the integrator holding api_integrator id 6’s api key.
|
|
20
|
+
* @param requestBody The studio guid plus the pre-tax amount and application fee in cents.
|
|
21
|
+
* @returns CreatePaymentIntentResponse The created intent with its clientSecret and the amount/tax breakdown.
|
|
22
|
+
* @throws ApiError
|
|
23
|
+
*/
|
|
24
|
+
static createPaymentIntent(requestBody: CreatePaymentIntentBody, context?: {
|
|
25
|
+
shopperGuid?: string;
|
|
26
|
+
accountId?: string;
|
|
27
|
+
}): CancelablePromise<CreatePaymentIntentResponse>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { OpenAPI } from '../core/OpenAPI.js';
|
|
2
|
+
import { request as __request } from '../core/request.js';
|
|
3
|
+
import { resolveShopperHeaders } from '../../../functions/sdkConfig.js';
|
|
4
|
+
export class StripeService {
|
|
5
|
+
/**
|
|
6
|
+
* Get Stripe connected account
|
|
7
|
+
* Returns the Stripe connected account id for the studio identified by studio_settings.guid. Restricted to the integrator holding api_integrator id 6's api key.
|
|
8
|
+
* @param guid The studio guid (studio_settings.guid).
|
|
9
|
+
* @returns ConnectedAccountResponse Returns the studio's Stripe connected account.
|
|
10
|
+
* @throws ApiError
|
|
11
|
+
*/
|
|
12
|
+
static getConnectedAccount(guid, context) {
|
|
13
|
+
return __request(OpenAPI, {
|
|
14
|
+
method: 'GET',
|
|
15
|
+
url: '/stripe/connected-account/{guid}',
|
|
16
|
+
path: {
|
|
17
|
+
'guid': guid,
|
|
18
|
+
},
|
|
19
|
+
headers: resolveShopperHeaders(context),
|
|
20
|
+
errors: {
|
|
21
|
+
400: `Bad Request error with error details.`,
|
|
22
|
+
401: `The apikey header is missing or is not the integrator’s.`,
|
|
23
|
+
404: `Not found error with error details.`,
|
|
24
|
+
500: `Internal Server Error, please contact developers.`,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Create a payment intent for a studio
|
|
30
|
+
* Resolves the studio guid to its Stripe connected account, optionally adds sales tax based on the studio address, and creates an unconfirmed PaymentIntent via the Payment API. Render a Payment Element with the returned clientSecret (initializing Stripe.js with connectedAccountId) and confirm client-side; completion is reported by the Stripe webhook. Restricted to the integrator holding api_integrator id 6’s api key.
|
|
31
|
+
* @param requestBody The studio guid plus the pre-tax amount and application fee in cents.
|
|
32
|
+
* @returns CreatePaymentIntentResponse The created intent with its clientSecret and the amount/tax breakdown.
|
|
33
|
+
* @throws ApiError
|
|
34
|
+
*/
|
|
35
|
+
static createPaymentIntent(requestBody, context) {
|
|
36
|
+
return __request(OpenAPI, {
|
|
37
|
+
method: 'POST',
|
|
38
|
+
url: '/stripe/payment-intent',
|
|
39
|
+
headers: resolveShopperHeaders(context),
|
|
40
|
+
body: requestBody,
|
|
41
|
+
mediaType: 'application/json',
|
|
42
|
+
errors: {
|
|
43
|
+
400: `Bad Request error with error details.`,
|
|
44
|
+
401: `The apikey header is missing or is not the integrator’s.`,
|
|
45
|
+
404: `Not found error with error details.`,
|
|
46
|
+
500: `Internal Server Error, please contact developers.`,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -30,8 +30,11 @@ export type { CheckoutSubmitBody } from './models/CheckoutSubmitBody';
|
|
|
30
30
|
export type { CheckoutSuccessResponse } from './models/CheckoutSuccessResponse';
|
|
31
31
|
export type { CodeDto } from './models/CodeDto';
|
|
32
32
|
export type { CompleteBody } from './models/CompleteBody';
|
|
33
|
+
export type { ConnectedAccountResponse } from './models/ConnectedAccountResponse';
|
|
33
34
|
export type { CorrelatedCode } from './models/CorrelatedCode';
|
|
34
35
|
export type { CreateCustomerResponse } from './models/CreateCustomerResponse';
|
|
36
|
+
export type { CreatePaymentIntentBody } from './models/CreatePaymentIntentBody';
|
|
37
|
+
export type { CreatePaymentIntentResponse } from './models/CreatePaymentIntentResponse';
|
|
35
38
|
export type { CreateSessionDto } from './models/CreateSessionDto';
|
|
36
39
|
export type { DigitalAsset } from './models/DigitalAsset';
|
|
37
40
|
export type { DonateOrderRequest } from './models/DonateOrderRequest';
|
|
@@ -79,6 +79,69 @@ console.log('✅ Replaced scanner/core/request.ts with custom-request.txt');
|
|
|
79
79
|
// shopperScope: 'per-request' }) serve many shoppers/accounts from one SDK
|
|
80
80
|
// instance — see src/functions/sdkConfig.ts.
|
|
81
81
|
console.log('⚙️ Stripping/reworking credential params in generated services...');
|
|
82
|
+
// Finds each `public static <name>(<params>): <returnType> { <body> }` method
|
|
83
|
+
// by tracking paren/brace nesting (a single regex can't express "matching
|
|
84
|
+
// close paren/brace" when the body itself contains nested {}/() such as
|
|
85
|
+
// `headers: {...}` or `path: {...}`). For any method whose body calls
|
|
86
|
+
// resolveShopperHeaders(context) but whose parameter list doesn't already
|
|
87
|
+
// declare a `context` param, appends `context?: { shopperGuid?: string;
|
|
88
|
+
// accountId?: string }` as the last parameter.
|
|
89
|
+
function patchMissingContextParam(src) {
|
|
90
|
+
const methodStart = /public static \w+\(/g;
|
|
91
|
+
let result = '';
|
|
92
|
+
let cursor = 0;
|
|
93
|
+
let match;
|
|
94
|
+
while ((match = methodStart.exec(src))) {
|
|
95
|
+
const parenOpen = match.index + match[0].length - 1;
|
|
96
|
+
// Walk from the opening '(' to its matching ')'.
|
|
97
|
+
let depth = 0;
|
|
98
|
+
let i = parenOpen;
|
|
99
|
+
for (; i < src.length; i++) {
|
|
100
|
+
if (src[i] === '(')
|
|
101
|
+
depth++;
|
|
102
|
+
else if (src[i] === ')') {
|
|
103
|
+
depth--;
|
|
104
|
+
if (depth === 0)
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const parenClose = i;
|
|
109
|
+
// Walk forward to the method's opening '{', then to its matching '}'.
|
|
110
|
+
const braceOpen = src.indexOf('{', parenClose);
|
|
111
|
+
depth = 0;
|
|
112
|
+
let j = braceOpen;
|
|
113
|
+
for (; j < src.length; j++) {
|
|
114
|
+
if (src[j] === '{')
|
|
115
|
+
depth++;
|
|
116
|
+
else if (src[j] === '}') {
|
|
117
|
+
depth--;
|
|
118
|
+
if (depth === 0)
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const braceClose = j;
|
|
123
|
+
const params = src.slice(parenOpen + 1, parenClose);
|
|
124
|
+
const body = src.slice(braceOpen + 1, braceClose);
|
|
125
|
+
if (/resolveShopperHeaders\(context\)/.test(body) && !/context\?:/.test(params)) {
|
|
126
|
+
// Indentation of an existing parameter line (the new param
|
|
127
|
+
// matches it); indentation of the ')' line (preserved as-is).
|
|
128
|
+
const paramIndentMatch = /\r?\n([^\S\r\n]+)\S/.exec(params);
|
|
129
|
+
const paramIndent = paramIndentMatch ? paramIndentMatch[1] : ' ';
|
|
130
|
+
const closeIndentMatch = /\r?\n([^\S\r\n]*)$/.exec(params);
|
|
131
|
+
const closeIndent = closeIndentMatch ? closeIndentMatch[1] : ' ';
|
|
132
|
+
const trimmedParams = params.replace(/[,\s]*$/, '');
|
|
133
|
+
const sep = trimmedParams.trim() ? ',\r\n' : '\r\n';
|
|
134
|
+
const newParams = trimmedParams +
|
|
135
|
+
sep +
|
|
136
|
+
`${paramIndent}context?: { shopperGuid?: string; accountId?: string },\r\n${closeIndent}`;
|
|
137
|
+
result += src.slice(cursor, parenOpen + 1) + newParams;
|
|
138
|
+
cursor = parenClose;
|
|
139
|
+
}
|
|
140
|
+
methodStart.lastIndex = braceClose;
|
|
141
|
+
}
|
|
142
|
+
result += src.slice(cursor);
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
82
145
|
function walkServices(dir) {
|
|
83
146
|
const results = [];
|
|
84
147
|
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
@@ -126,6 +189,20 @@ for (const file of serviceFiles) {
|
|
|
126
189
|
// files lose the \n when accountid/apikey lines are stripped) — use
|
|
127
190
|
// [\r\n]+ to match any combination of CR/LF between the two params.
|
|
128
191
|
.replace(/\n([^\S\n]+)context\?:\s*\{\s*shopperGuid\?:\s*string;\s*accountId\?:\s*string\s*\},[\r\n]+[^\S\n]+(requestBody:\s+[^?,\r\n][^,\r\n]*),/g, (_, indent, rbPart) => `\n${indent}${rbPart},\n${indent}context?: { shopperGuid?: string; accountId?: string },`);
|
|
192
|
+
// Some endpoints (e.g. Stripe's integrator-only calls) declare no
|
|
193
|
+
// shopperguid param, so the replace above never injects a `context`
|
|
194
|
+
// parameter into their signature — yet they still call
|
|
195
|
+
// resolveShopperHeaders(context) via the headers: {} replacement,
|
|
196
|
+
// leaving a dangling reference to an undeclared `context`. Add the
|
|
197
|
+
// param to any method signature whose body calls
|
|
198
|
+
// resolveShopperHeaders(context) but doesn't already declare one.
|
|
199
|
+
// Brace/paren nesting inside method bodies (headers: {...}, path:
|
|
200
|
+
// {...}, etc.) makes this unsafe to express as a single regex, so
|
|
201
|
+
// methods are located by tracking paren depth from `public static`
|
|
202
|
+
// through the matching close-paren of the parameter list, then brace
|
|
203
|
+
// depth from the following `{` through the matching method-closing
|
|
204
|
+
// `}`.
|
|
205
|
+
patched = patchMissingContextParam(patched);
|
|
129
206
|
if (patched !== src) {
|
|
130
207
|
patched = patched.replace("import { request as __request } from '../core/request.js';", "import { request as __request } from '../core/request.js';\nimport { resolveShopperHeaders } from '../../../functions/sdkConfig.js';");
|
|
131
208
|
}
|
|
@@ -31,6 +31,7 @@ export declare const DRT: {
|
|
|
31
31
|
product: typeof import("../generated/shopper").ProductService;
|
|
32
32
|
seat: typeof import("../generated/shopper").SeatService;
|
|
33
33
|
session: typeof import("../generated/shopper").SessionService;
|
|
34
|
+
stripe: typeof import("../generated/shopper").StripeService;
|
|
34
35
|
};
|
|
35
36
|
scanner: {
|
|
36
37
|
database: typeof import("../generated/scanner").DatabaseService;
|
package/package.json
CHANGED
|
@@ -12,6 +12,7 @@ import { PaymentService } from "../generated/shopper";
|
|
|
12
12
|
import { ProductService } from "../generated/shopper";
|
|
13
13
|
import { SeatService } from "../generated/shopper";
|
|
14
14
|
import { SessionService } from "../generated/shopper";
|
|
15
|
+
import { StripeService } from "../generated/shopper";
|
|
15
16
|
|
|
16
17
|
export const shopper = {
|
|
17
18
|
account: AccountService,
|
|
@@ -26,6 +27,7 @@ export const shopper = {
|
|
|
26
27
|
product: ProductService,
|
|
27
28
|
seat: SeatService,
|
|
28
29
|
session: SessionService,
|
|
30
|
+
stripe: StripeService,
|
|
29
31
|
};
|
|
30
32
|
|
|
31
33
|
// Re-export all types as a namespace
|
|
@@ -39,8 +39,11 @@ export type { CheckoutSubmitBody } from './models/CheckoutSubmitBody';
|
|
|
39
39
|
export type { CheckoutSuccessResponse } from './models/CheckoutSuccessResponse';
|
|
40
40
|
export type { CodeDto } from './models/CodeDto';
|
|
41
41
|
export type { CompleteBody } from './models/CompleteBody';
|
|
42
|
+
export type { ConnectedAccountResponse } from './models/ConnectedAccountResponse';
|
|
42
43
|
export type { CorrelatedCode } from './models/CorrelatedCode';
|
|
43
44
|
export type { CreateCustomerResponse } from './models/CreateCustomerResponse';
|
|
45
|
+
export type { CreatePaymentIntentBody } from './models/CreatePaymentIntentBody';
|
|
46
|
+
export type { CreatePaymentIntentResponse } from './models/CreatePaymentIntentResponse';
|
|
44
47
|
export type { CreateSessionDto } from './models/CreateSessionDto';
|
|
45
48
|
export type { DigitalAsset } from './models/DigitalAsset';
|
|
46
49
|
export type { DonateOrderRequest } from './models/DonateOrderRequest';
|
|
@@ -169,3 +172,4 @@ export { PaymentService } from './services/PaymentService';
|
|
|
169
172
|
export { ProductService } from './services/ProductService';
|
|
170
173
|
export { SeatService } from './services/SeatService';
|
|
171
174
|
export { SessionService } from './services/SessionService';
|
|
175
|
+
export { StripeService } from './services/StripeService';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
export type ConnectedAccountResponse = {
|
|
6
|
+
/**
|
|
7
|
+
* The studio's Stripe connected account id (studio_pmt_gateway_assoc.pmt_gateway_acct_id).
|
|
8
|
+
*/
|
|
9
|
+
connectedAccountId: string;
|
|
10
|
+
/**
|
|
11
|
+
* The studio the guid resolved to.
|
|
12
|
+
*/
|
|
13
|
+
studioId: number;
|
|
14
|
+
/**
|
|
15
|
+
* The Stripe pmt_gateway the account belongs to: 5 = Stripe US, 6 = Stripe CA.
|
|
16
|
+
*/
|
|
17
|
+
gatewayId: number;
|
|
18
|
+
/**
|
|
19
|
+
* Stripe onboarding state of the connected account, e.g. Restricted, Complete, Enabled, Pending, Restricted Soon, Rejected.
|
|
20
|
+
*/
|
|
21
|
+
onboardingStatus: string | null;
|
|
22
|
+
};
|
|
23
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
export type CreatePaymentIntentBody = {
|
|
6
|
+
/**
|
|
7
|
+
* The studio guid (studio_settings.guid) to charge for.
|
|
8
|
+
*/
|
|
9
|
+
studioGuid: string;
|
|
10
|
+
/**
|
|
11
|
+
* Charge amount in the smallest currency unit (cents), before tax.
|
|
12
|
+
*/
|
|
13
|
+
amount: number;
|
|
14
|
+
/**
|
|
15
|
+
* Application fee in the smallest currency unit (cents). Stripe rejects the charge if this exceeds the total amount.
|
|
16
|
+
*/
|
|
17
|
+
applicationFee: number;
|
|
18
|
+
/**
|
|
19
|
+
* When true, sales tax is added to the amount based on the studio's address and local tax rate before the intent is created.
|
|
20
|
+
*/
|
|
21
|
+
addTax?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Metadata to attach to the payment intent, e.g. your own order or transaction id.
|
|
24
|
+
*/
|
|
25
|
+
metadata?: Record<string, string>;
|
|
26
|
+
};
|
|
27
|
+
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
export type CreatePaymentIntentResponse = {
|
|
6
|
+
/**
|
|
7
|
+
* The Stripe PaymentIntent id.
|
|
8
|
+
*/
|
|
9
|
+
paymentIntentId: string;
|
|
10
|
+
/**
|
|
11
|
+
* The client secret used to mount a Payment Element and confirm the payment client-side.
|
|
12
|
+
*/
|
|
13
|
+
clientSecret: string;
|
|
14
|
+
/**
|
|
15
|
+
* The connected account the intent was created on. Pass as stripeAccount when initializing Stripe.js.
|
|
16
|
+
*/
|
|
17
|
+
connectedAccountId: string;
|
|
18
|
+
studioId: number;
|
|
19
|
+
/**
|
|
20
|
+
* The Stripe pmt_gateway: 5 = Stripe US, 6 = Stripe CA.
|
|
21
|
+
*/
|
|
22
|
+
gatewayId: number;
|
|
23
|
+
/**
|
|
24
|
+
* Charge currency, derived from the gateway.
|
|
25
|
+
*/
|
|
26
|
+
currency: string;
|
|
27
|
+
/**
|
|
28
|
+
* The pre-tax amount from the request, in cents.
|
|
29
|
+
*/
|
|
30
|
+
baseAmount: number;
|
|
31
|
+
/**
|
|
32
|
+
* The sales tax rate applied (as a decimal fraction). 0 when addTax was not requested.
|
|
33
|
+
*/
|
|
34
|
+
taxRate: number;
|
|
35
|
+
/**
|
|
36
|
+
* The sales tax added, in cents. 0 when addTax was not requested.
|
|
37
|
+
*/
|
|
38
|
+
taxAmount: number;
|
|
39
|
+
/**
|
|
40
|
+
* The amount the intent was created for, in cents.
|
|
41
|
+
*/
|
|
42
|
+
totalAmount: number;
|
|
43
|
+
/**
|
|
44
|
+
* The application fee, in cents.
|
|
45
|
+
*/
|
|
46
|
+
applicationFee: number;
|
|
47
|
+
/**
|
|
48
|
+
* The Stripe status of the newly created intent.
|
|
49
|
+
*/
|
|
50
|
+
status: string;
|
|
51
|
+
};
|
|
52
|
+
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
import type { ConnectedAccountResponse } from '../models/ConnectedAccountResponse';
|
|
6
|
+
import type { CreatePaymentIntentBody } from '../models/CreatePaymentIntentBody';
|
|
7
|
+
import type { CreatePaymentIntentResponse } from '../models/CreatePaymentIntentResponse';
|
|
8
|
+
import type { CancelablePromise } from '../core/CancelablePromise';
|
|
9
|
+
import { OpenAPI } from '../core/OpenAPI';
|
|
10
|
+
import { request as __request } from '../core/request';
|
|
11
|
+
import { resolveShopperHeaders } from '../../../functions/sdkConfig';
|
|
12
|
+
export class StripeService {
|
|
13
|
+
/**
|
|
14
|
+
* Get Stripe connected account
|
|
15
|
+
* Returns the Stripe connected account id for the studio identified by studio_settings.guid. Restricted to the integrator holding api_integrator id 6's api key.
|
|
16
|
+
* @param guid The studio guid (studio_settings.guid).
|
|
17
|
+
* @returns ConnectedAccountResponse Returns the studio's Stripe connected account.
|
|
18
|
+
* @throws ApiError
|
|
19
|
+
*/
|
|
20
|
+
public static getConnectedAccount(
|
|
21
|
+
guid: string,
|
|
22
|
+
context?: { shopperGuid?: string; accountId?: string },
|
|
23
|
+
): CancelablePromise<ConnectedAccountResponse> {
|
|
24
|
+
return __request(OpenAPI, {
|
|
25
|
+
method: 'GET',
|
|
26
|
+
url: '/stripe/connected-account/{guid}',
|
|
27
|
+
path: {
|
|
28
|
+
'guid': guid,
|
|
29
|
+
},
|
|
30
|
+
headers: resolveShopperHeaders(context),
|
|
31
|
+
errors: {
|
|
32
|
+
400: `Bad Request error with error details.`,
|
|
33
|
+
401: `The apikey header is missing or is not the integrator’s.`,
|
|
34
|
+
404: `Not found error with error details.`,
|
|
35
|
+
500: `Internal Server Error, please contact developers.`,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Create a payment intent for a studio
|
|
41
|
+
* Resolves the studio guid to its Stripe connected account, optionally adds sales tax based on the studio address, and creates an unconfirmed PaymentIntent via the Payment API. Render a Payment Element with the returned clientSecret (initializing Stripe.js with connectedAccountId) and confirm client-side; completion is reported by the Stripe webhook. Restricted to the integrator holding api_integrator id 6’s api key.
|
|
42
|
+
* @param requestBody The studio guid plus the pre-tax amount and application fee in cents.
|
|
43
|
+
* @returns CreatePaymentIntentResponse The created intent with its clientSecret and the amount/tax breakdown.
|
|
44
|
+
* @throws ApiError
|
|
45
|
+
*/
|
|
46
|
+
public static createPaymentIntent(
|
|
47
|
+
requestBody: CreatePaymentIntentBody,
|
|
48
|
+
context?: { shopperGuid?: string; accountId?: string },
|
|
49
|
+
): CancelablePromise<CreatePaymentIntentResponse> {
|
|
50
|
+
return __request(OpenAPI, {
|
|
51
|
+
method: 'POST',
|
|
52
|
+
url: '/stripe/payment-intent',
|
|
53
|
+
headers: resolveShopperHeaders(context),
|
|
54
|
+
body: requestBody,
|
|
55
|
+
mediaType: 'application/json',
|
|
56
|
+
errors: {
|
|
57
|
+
400: `Bad Request error with error details.`,
|
|
58
|
+
401: `The apikey header is missing or is not the integrator’s.`,
|
|
59
|
+
404: `Not found error with error details.`,
|
|
60
|
+
500: `Internal Server Error, please contact developers.`,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -33,8 +33,11 @@ export type { CheckoutSubmitBody } from './models/CheckoutSubmitBody';
|
|
|
33
33
|
export type { CheckoutSuccessResponse } from './models/CheckoutSuccessResponse';
|
|
34
34
|
export type { CodeDto } from './models/CodeDto';
|
|
35
35
|
export type { CompleteBody } from './models/CompleteBody';
|
|
36
|
+
export type { ConnectedAccountResponse } from './models/ConnectedAccountResponse';
|
|
36
37
|
export type { CorrelatedCode } from './models/CorrelatedCode';
|
|
37
38
|
export type { CreateCustomerResponse } from './models/CreateCustomerResponse';
|
|
39
|
+
export type { CreatePaymentIntentBody } from './models/CreatePaymentIntentBody';
|
|
40
|
+
export type { CreatePaymentIntentResponse } from './models/CreatePaymentIntentResponse';
|
|
38
41
|
export type { CreateSessionDto } from './models/CreateSessionDto';
|
|
39
42
|
export type { DigitalAsset } from './models/DigitalAsset';
|
|
40
43
|
export type { DonateOrderRequest } from './models/DonateOrderRequest';
|
package/src/scripts/build-all.ts
CHANGED
|
@@ -100,6 +100,76 @@ console.log('✅ Replaced scanner/core/request.ts with custom-request.txt');
|
|
|
100
100
|
// shopperScope: 'per-request' }) serve many shoppers/accounts from one SDK
|
|
101
101
|
// instance — see src/functions/sdkConfig.ts.
|
|
102
102
|
console.log('⚙️ Stripping/reworking credential params in generated services...');
|
|
103
|
+
|
|
104
|
+
// Finds each `public static <name>(<params>): <returnType> { <body> }` method
|
|
105
|
+
// by tracking paren/brace nesting (a single regex can't express "matching
|
|
106
|
+
// close paren/brace" when the body itself contains nested {}/() such as
|
|
107
|
+
// `headers: {...}` or `path: {...}`). For any method whose body calls
|
|
108
|
+
// resolveShopperHeaders(context) but whose parameter list doesn't already
|
|
109
|
+
// declare a `context` param, appends `context?: { shopperGuid?: string;
|
|
110
|
+
// accountId?: string }` as the last parameter.
|
|
111
|
+
function patchMissingContextParam(src: string): string {
|
|
112
|
+
const methodStart = /public static \w+\(/g;
|
|
113
|
+
let result = '';
|
|
114
|
+
let cursor = 0;
|
|
115
|
+
let match: RegExpExecArray | null;
|
|
116
|
+
|
|
117
|
+
while ((match = methodStart.exec(src))) {
|
|
118
|
+
const parenOpen = match.index + match[0].length - 1;
|
|
119
|
+
|
|
120
|
+
// Walk from the opening '(' to its matching ')'.
|
|
121
|
+
let depth = 0;
|
|
122
|
+
let i = parenOpen;
|
|
123
|
+
for (; i < src.length; i++) {
|
|
124
|
+
if (src[i] === '(') depth++;
|
|
125
|
+
else if (src[i] === ')') {
|
|
126
|
+
depth--;
|
|
127
|
+
if (depth === 0) break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const parenClose = i;
|
|
131
|
+
|
|
132
|
+
// Walk forward to the method's opening '{', then to its matching '}'.
|
|
133
|
+
const braceOpen = src.indexOf('{', parenClose);
|
|
134
|
+
depth = 0;
|
|
135
|
+
let j = braceOpen;
|
|
136
|
+
for (; j < src.length; j++) {
|
|
137
|
+
if (src[j] === '{') depth++;
|
|
138
|
+
else if (src[j] === '}') {
|
|
139
|
+
depth--;
|
|
140
|
+
if (depth === 0) break;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const braceClose = j;
|
|
144
|
+
|
|
145
|
+
const params = src.slice(parenOpen + 1, parenClose);
|
|
146
|
+
const body = src.slice(braceOpen + 1, braceClose);
|
|
147
|
+
|
|
148
|
+
if (/resolveShopperHeaders\(context\)/.test(body) && !/context\?:/.test(params)) {
|
|
149
|
+
// Indentation of an existing parameter line (the new param
|
|
150
|
+
// matches it); indentation of the ')' line (preserved as-is).
|
|
151
|
+
const paramIndentMatch = /\r?\n([^\S\r\n]+)\S/.exec(params);
|
|
152
|
+
const paramIndent = paramIndentMatch ? paramIndentMatch[1] : ' ';
|
|
153
|
+
const closeIndentMatch = /\r?\n([^\S\r\n]*)$/.exec(params);
|
|
154
|
+
const closeIndent = closeIndentMatch ? closeIndentMatch[1] : ' ';
|
|
155
|
+
const trimmedParams = params.replace(/[,\s]*$/, '');
|
|
156
|
+
const sep = trimmedParams.trim() ? ',\r\n' : '\r\n';
|
|
157
|
+
const newParams =
|
|
158
|
+
trimmedParams +
|
|
159
|
+
sep +
|
|
160
|
+
`${paramIndent}context?: { shopperGuid?: string; accountId?: string },\r\n${closeIndent}`;
|
|
161
|
+
|
|
162
|
+
result += src.slice(cursor, parenOpen + 1) + newParams;
|
|
163
|
+
cursor = parenClose;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
methodStart.lastIndex = braceClose;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
result += src.slice(cursor);
|
|
170
|
+
return result;
|
|
171
|
+
}
|
|
172
|
+
|
|
103
173
|
function walkServices(dir: string): string[] {
|
|
104
174
|
const results: string[] = [];
|
|
105
175
|
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
@@ -171,6 +241,20 @@ for (const file of serviceFiles) {
|
|
|
171
241
|
(_, indent, rbPart) =>
|
|
172
242
|
`\n${indent}${rbPart},\n${indent}context?: { shopperGuid?: string; accountId?: string },`,
|
|
173
243
|
);
|
|
244
|
+
// Some endpoints (e.g. Stripe's integrator-only calls) declare no
|
|
245
|
+
// shopperguid param, so the replace above never injects a `context`
|
|
246
|
+
// parameter into their signature — yet they still call
|
|
247
|
+
// resolveShopperHeaders(context) via the headers: {} replacement,
|
|
248
|
+
// leaving a dangling reference to an undeclared `context`. Add the
|
|
249
|
+
// param to any method signature whose body calls
|
|
250
|
+
// resolveShopperHeaders(context) but doesn't already declare one.
|
|
251
|
+
// Brace/paren nesting inside method bodies (headers: {...}, path:
|
|
252
|
+
// {...}, etc.) makes this unsafe to express as a single regex, so
|
|
253
|
+
// methods are located by tracking paren depth from `public static`
|
|
254
|
+
// through the matching close-paren of the parameter list, then brace
|
|
255
|
+
// depth from the following `{` through the matching method-closing
|
|
256
|
+
// `}`.
|
|
257
|
+
patched = patchMissingContextParam(patched);
|
|
174
258
|
if (patched !== src) {
|
|
175
259
|
patched = patched.replace(
|
|
176
260
|
"import { request as __request } from '../core/request';",
|