@activepieces/piece-paywhirl 0.0.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/README.md +7 -0
- package/package.json +28 -0
- package/src/index.d.ts +4 -0
- package/src/index.js +42 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/cancel-subscription.d.ts +7 -0
- package/src/lib/actions/cancel-subscription.js +44 -0
- package/src/lib/actions/cancel-subscription.js.map +1 -0
- package/src/lib/actions/create-customer.d.ts +23 -0
- package/src/lib/actions/create-customer.js +148 -0
- package/src/lib/actions/create-customer.js.map +1 -0
- package/src/lib/actions/get-customer.d.ts +11 -0
- package/src/lib/actions/get-customer.js +75 -0
- package/src/lib/actions/get-customer.js.map +1 -0
- package/src/lib/actions/search-customers-subscription.d.ts +7 -0
- package/src/lib/actions/search-customers-subscription.js +46 -0
- package/src/lib/actions/search-customers-subscription.js.map +1 -0
- package/src/lib/actions/subscribe-customer.d.ts +10 -0
- package/src/lib/actions/subscribe-customer.js +59 -0
- package/src/lib/actions/subscribe-customer.js.map +1 -0
- package/src/lib/common/auth.d.ts +4 -0
- package/src/lib/common/auth.js +45 -0
- package/src/lib/common/auth.js.map +1 -0
- package/src/lib/common/client.d.ts +3 -0
- package/src/lib/common/client.js +28 -0
- package/src/lib/common/client.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-paywhirl",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"types": "./src/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@sinclair/typebox": "0.34.11",
|
|
9
|
+
"ai": "5.0.104",
|
|
10
|
+
"axios": "1.13.1",
|
|
11
|
+
"axios-retry": "4.4.1",
|
|
12
|
+
"deepmerge-ts": "7.1.0",
|
|
13
|
+
"form-data": "4.0.4",
|
|
14
|
+
"i18next": "23.13.0",
|
|
15
|
+
"mime-types": "2.1.35",
|
|
16
|
+
"nanoid": "3.3.8",
|
|
17
|
+
"semver": "7.6.0",
|
|
18
|
+
"socket.io-client": "4.8.1",
|
|
19
|
+
"tslib": "^2.3.0",
|
|
20
|
+
"zod": "4.1.13",
|
|
21
|
+
"@activepieces/pieces-common": "0.11.1",
|
|
22
|
+
"@activepieces/pieces-framework": "0.23.0",
|
|
23
|
+
"@activepieces/shared": "0.32.0"
|
|
24
|
+
},
|
|
25
|
+
"resolutions": {
|
|
26
|
+
"rollup": "npm:@rollup/wasm-node"
|
|
27
|
+
}
|
|
28
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const paywhirl: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
api_key: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
api_secret: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>>;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.paywhirl = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("./lib/common/auth");
|
|
7
|
+
const cancel_subscription_1 = require("./lib/actions/cancel-subscription");
|
|
8
|
+
const create_customer_1 = require("./lib/actions/create-customer");
|
|
9
|
+
const get_customer_1 = require("./lib/actions/get-customer");
|
|
10
|
+
const subscribe_customer_1 = require("./lib/actions/subscribe-customer");
|
|
11
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
12
|
+
const search_customers_subscription_1 = require("./lib/actions/search-customers-subscription");
|
|
13
|
+
const client_1 = require("./lib/common/client");
|
|
14
|
+
const shared_1 = require("@activepieces/shared");
|
|
15
|
+
exports.paywhirl = (0, pieces_framework_1.createPiece)({
|
|
16
|
+
displayName: 'Paywhirl',
|
|
17
|
+
auth: auth_1.paywhirlAuth,
|
|
18
|
+
minimumSupportedRelease: '0.36.1',
|
|
19
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/paywhirl.png',
|
|
20
|
+
description: 'PayWhirls intuitive tools make recurring billing easy. Sell subscriptions, pre-orders, payment plans, or whatever billing arrangements you can dream up.',
|
|
21
|
+
categories: [shared_1.PieceCategory.ACCOUNTING, shared_1.PieceCategory.PAYMENT_PROCESSING],
|
|
22
|
+
authors: ['sanket-a11y'],
|
|
23
|
+
actions: [
|
|
24
|
+
cancel_subscription_1.cancelSubscription,
|
|
25
|
+
create_customer_1.createCustomer,
|
|
26
|
+
get_customer_1.getCustomer,
|
|
27
|
+
search_customers_subscription_1.searchCustomersSubscription,
|
|
28
|
+
subscribe_customer_1.subscribeCustomer,
|
|
29
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
30
|
+
auth: auth_1.paywhirlAuth,
|
|
31
|
+
baseUrl: () => client_1.BASE_URL,
|
|
32
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
return {
|
|
34
|
+
'api-key': auth.props.api_key,
|
|
35
|
+
'api-secret': auth.props.api_secret,
|
|
36
|
+
};
|
|
37
|
+
}),
|
|
38
|
+
}),
|
|
39
|
+
],
|
|
40
|
+
triggers: [],
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/paywhirl/src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,4CAAiD;AACjD,2EAAuE;AACvE,mEAA+D;AAC/D,6DAAyD;AACzD,yEAAqE;AACrE,+DAAwE;AACxE,+FAA0F;AAC1F,gDAA+C;AAC/C,iDAAqD;AAExC,QAAA,QAAQ,GAAG,IAAA,8BAAW,EAAC;IAClC,WAAW,EAAE,UAAU;IACvB,IAAI,EAAE,mBAAY;IAClB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,kDAAkD;IAC3D,WAAW,EACT,0JAA0J;IAC5J,UAAU,EAAE,CAAC,sBAAa,CAAC,UAAU,EAAE,sBAAa,CAAC,kBAAkB,CAAC;IACxE,OAAO,EAAE,CAAC,aAAa,CAAC;IACxB,OAAO,EAAE;QACP,wCAAkB;QAClB,gCAAc;QACd,0BAAW;QACX,2DAA2B;QAC3B,sCAAiB;QACjB,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,mBAAY;YAClB,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAQ;YACvB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,OAAO;oBACL,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO;oBAC7B,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU;iBACpC,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const cancelSubscription: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
api_key: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
api_secret: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
subscription_id: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
6
|
+
customer_id: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cancelSubscription = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const client_1 = require("../common/client");
|
|
8
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
9
|
+
exports.cancelSubscription = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.paywhirlAuth,
|
|
11
|
+
name: 'cancelSubscription',
|
|
12
|
+
displayName: 'Cancel Subscription',
|
|
13
|
+
description: "Cancel a customer's existing subscription. This will prevent the subscription from making any additional charges and unbind the customer from the plan.",
|
|
14
|
+
props: {
|
|
15
|
+
subscription_id: pieces_framework_1.Property.Number({
|
|
16
|
+
displayName: 'Subscription ID',
|
|
17
|
+
description: 'Subscription ID',
|
|
18
|
+
required: false,
|
|
19
|
+
}),
|
|
20
|
+
customer_id: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'Customer ID',
|
|
22
|
+
description: 'Customer ID (can be used instead of subscription_id)',
|
|
23
|
+
required: false,
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
run(context) {
|
|
27
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const { subscription_id, customer_id } = context.propsValue;
|
|
29
|
+
if (!subscription_id && !customer_id) {
|
|
30
|
+
throw new Error('Either subscription_id or customer_id must be provided');
|
|
31
|
+
}
|
|
32
|
+
const body = {};
|
|
33
|
+
if (subscription_id) {
|
|
34
|
+
body.subscription_id = subscription_id;
|
|
35
|
+
}
|
|
36
|
+
if (customer_id) {
|
|
37
|
+
body.customer_id = customer_id;
|
|
38
|
+
}
|
|
39
|
+
const response = yield (0, client_1.makeRequest)(context.auth.props.api_key, context.auth.props.api_secret, pieces_common_1.HttpMethod.POST, '/unsubscribe/customer', body);
|
|
40
|
+
return response;
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=cancel-subscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancel-subscription.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/paywhirl/src/lib/actions/cancel-subscription.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAA8C;AAC9C,6CAA+C;AAC/C,+DAAyD;AAE5C,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC7C,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,qBAAqB;IAClC,WAAW,EACT,yJAAyJ;IAC3J,KAAK,EAAE;QACL,eAAe,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC/B,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EAAE,iBAAiB;YAC9B,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,sDAAsD;YACnE,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE5D,IAAI,CAAC,eAAe,IAAI,CAAC,WAAW,EAAE,CAAC;gBACrC,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;YAC5E,CAAC;YAED,MAAM,IAAI,GAAQ,EAAE,CAAC;YAErB,IAAI,eAAe,EAAE,CAAC;gBACpB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;YACzC,CAAC;YACD,IAAI,WAAW,EAAE,CAAC;gBAChB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;YACjC,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAC1B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAC7B,0BAAU,CAAC,IAAI,EACf,uBAAuB,EACvB,IAAI,CACL,CAAC;YAEF,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const createCustomer: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
api_key: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
api_secret: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
first_name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
last_name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
8
|
+
currency: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
|
+
password: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
phone: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
11
|
+
address: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
12
|
+
city: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
13
|
+
state: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
14
|
+
zip: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
15
|
+
country: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
16
|
+
gateway_id: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
17
|
+
utm_source: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
18
|
+
utm_medium: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
19
|
+
utm_term: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
20
|
+
utm_content: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
21
|
+
utm_campaign: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
22
|
+
utm_group: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
23
|
+
}>;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCustomer = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const client_1 = require("../common/client");
|
|
8
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
9
|
+
exports.createCustomer = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.paywhirlAuth,
|
|
11
|
+
name: 'createCustomer',
|
|
12
|
+
displayName: 'Create Customer',
|
|
13
|
+
description: 'Create a new customer. This is required before binding a customer to a plan via a subscription.',
|
|
14
|
+
props: {
|
|
15
|
+
first_name: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'First Name',
|
|
17
|
+
description: 'First name',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
last_name: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'Last Name',
|
|
22
|
+
description: 'Last name',
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
email: pieces_framework_1.Property.ShortText({
|
|
26
|
+
displayName: 'Email',
|
|
27
|
+
description: 'Email address',
|
|
28
|
+
required: true,
|
|
29
|
+
}),
|
|
30
|
+
currency: pieces_framework_1.Property.ShortText({
|
|
31
|
+
displayName: 'Currency',
|
|
32
|
+
description: 'Currency code (ex. USD, GBP, AUD, CAD, EUR, etc)',
|
|
33
|
+
required: true,
|
|
34
|
+
}),
|
|
35
|
+
password: pieces_framework_1.Property.ShortText({
|
|
36
|
+
displayName: 'Password',
|
|
37
|
+
description: 'Password (leave blank to let customer assign via secure link in welcome email)',
|
|
38
|
+
required: false,
|
|
39
|
+
}),
|
|
40
|
+
phone: pieces_framework_1.Property.Number({
|
|
41
|
+
displayName: 'Phone Number',
|
|
42
|
+
description: 'Phone number',
|
|
43
|
+
required: false,
|
|
44
|
+
}),
|
|
45
|
+
address: pieces_framework_1.Property.LongText({
|
|
46
|
+
displayName: 'Street Address',
|
|
47
|
+
description: 'Street address',
|
|
48
|
+
required: false,
|
|
49
|
+
}),
|
|
50
|
+
city: pieces_framework_1.Property.ShortText({
|
|
51
|
+
displayName: 'City',
|
|
52
|
+
description: 'City',
|
|
53
|
+
required: false,
|
|
54
|
+
}),
|
|
55
|
+
state: pieces_framework_1.Property.ShortText({
|
|
56
|
+
displayName: 'State / Region',
|
|
57
|
+
description: 'State / Region',
|
|
58
|
+
required: false,
|
|
59
|
+
}),
|
|
60
|
+
zip: pieces_framework_1.Property.ShortText({
|
|
61
|
+
displayName: 'Zip / Postal Code',
|
|
62
|
+
description: 'Zip / Postal Code',
|
|
63
|
+
required: false,
|
|
64
|
+
}),
|
|
65
|
+
country: pieces_framework_1.Property.ShortText({
|
|
66
|
+
displayName: 'Country Code',
|
|
67
|
+
description: 'Country Code (ex. US, GB, CA, AU, etc)',
|
|
68
|
+
required: false,
|
|
69
|
+
}),
|
|
70
|
+
gateway_id: pieces_framework_1.Property.ShortText({
|
|
71
|
+
displayName: 'Payment Gateway ID',
|
|
72
|
+
description: 'PayWhirl ID of payment gateway to attach to customer. If left blank, first loaded gateway will be used.',
|
|
73
|
+
required: false,
|
|
74
|
+
}),
|
|
75
|
+
utm_source: pieces_framework_1.Property.ShortText({
|
|
76
|
+
displayName: 'UTM Source',
|
|
77
|
+
description: 'Acquisition source (ex. google, bing, email, fall_campaign, etc)',
|
|
78
|
+
required: false,
|
|
79
|
+
}),
|
|
80
|
+
utm_medium: pieces_framework_1.Property.ShortText({
|
|
81
|
+
displayName: 'UTM Medium',
|
|
82
|
+
description: 'Acquisition medium (ex. CPC, banner, text_ad, etc)',
|
|
83
|
+
required: false,
|
|
84
|
+
}),
|
|
85
|
+
utm_term: pieces_framework_1.Property.ShortText({
|
|
86
|
+
displayName: 'UTM Term',
|
|
87
|
+
description: 'Acquisition keyword',
|
|
88
|
+
required: false,
|
|
89
|
+
}),
|
|
90
|
+
utm_content: pieces_framework_1.Property.ShortText({
|
|
91
|
+
displayName: 'UTM Content',
|
|
92
|
+
description: 'Acquisition Ad Content',
|
|
93
|
+
required: false,
|
|
94
|
+
}),
|
|
95
|
+
utm_campaign: pieces_framework_1.Property.ShortText({
|
|
96
|
+
displayName: 'UTM Campaign',
|
|
97
|
+
description: 'Acquisition Ad Campaign',
|
|
98
|
+
required: false,
|
|
99
|
+
}),
|
|
100
|
+
utm_group: pieces_framework_1.Property.ShortText({
|
|
101
|
+
displayName: 'UTM Group',
|
|
102
|
+
description: 'Acquisition Ad Group',
|
|
103
|
+
required: false,
|
|
104
|
+
}),
|
|
105
|
+
},
|
|
106
|
+
run(context) {
|
|
107
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
const { first_name, last_name, email, currency, password, phone, address, city, state, zip, country, gateway_id, utm_source, utm_medium, utm_term, utm_content, utm_campaign, utm_group, } = context.propsValue;
|
|
109
|
+
const body = {
|
|
110
|
+
first_name,
|
|
111
|
+
last_name,
|
|
112
|
+
email,
|
|
113
|
+
currency,
|
|
114
|
+
};
|
|
115
|
+
if (password)
|
|
116
|
+
body.password = password;
|
|
117
|
+
if (phone)
|
|
118
|
+
body.phone = phone;
|
|
119
|
+
if (address)
|
|
120
|
+
body.address = address;
|
|
121
|
+
if (city)
|
|
122
|
+
body.city = city;
|
|
123
|
+
if (state)
|
|
124
|
+
body.state = state;
|
|
125
|
+
if (zip)
|
|
126
|
+
body.zip = zip;
|
|
127
|
+
if (country)
|
|
128
|
+
body.country = country;
|
|
129
|
+
if (gateway_id)
|
|
130
|
+
body.gateway_id = gateway_id;
|
|
131
|
+
if (utm_source)
|
|
132
|
+
body.utm_source = utm_source;
|
|
133
|
+
if (utm_medium)
|
|
134
|
+
body.utm_medium = utm_medium;
|
|
135
|
+
if (utm_term)
|
|
136
|
+
body.utm_term = utm_term;
|
|
137
|
+
if (utm_content)
|
|
138
|
+
body.utm_content = utm_content;
|
|
139
|
+
if (utm_campaign)
|
|
140
|
+
body.utm_campaign = utm_campaign;
|
|
141
|
+
if (utm_group)
|
|
142
|
+
body.utm_group = utm_group;
|
|
143
|
+
const response = yield (0, client_1.makeRequest)(context.auth.props.api_key, context.auth.props.api_secret, pieces_common_1.HttpMethod.POST, '/create/customer', body);
|
|
144
|
+
return response;
|
|
145
|
+
});
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
//# sourceMappingURL=create-customer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-customer.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/paywhirl/src/lib/actions/create-customer.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAA8C;AAC9C,6CAA+C;AAC/C,+DAAyD;AAE5C,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EACT,iGAAiG;IACnG,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,eAAe;YAC5B,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,kDAAkD;YAC/D,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;Y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AI,CAAC,KAAK,GAAG,KAAK,CAAC;YAC9B,IAAI,GAAG;gBAAE,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;YACxB,IAAI,OAAO;gBAAE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACpC,IAAI,UAAU;gBAAE,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;YAC7C,IAAI,UAAU;gBAAE,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;YAC7C,IAAI,UAAU;gBAAE,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;YAC7C,IAAI,QAAQ;gBAAE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACvC,IAAI,WAAW;gBAAE,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;YAChD,IAAI,YAAY;gBAAE,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;YACnD,IAAI,SAAS;gBAAE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;YAE1C,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAC1B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAC7B,0BAAU,CAAC,IAAI,EACf,kBAAkB,EAClB,IAAI,CACL,CAAC;YAEF,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const getCustomer: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
api_key: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
api_secret: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
limit: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
6
|
+
order_key: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
order_direction: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
8
|
+
before_id: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
9
|
+
after_id: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
10
|
+
keyword: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCustomer = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const client_1 = require("../common/client");
|
|
8
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
9
|
+
exports.getCustomer = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.paywhirlAuth,
|
|
11
|
+
name: 'getCustomer',
|
|
12
|
+
displayName: 'Get Customers',
|
|
13
|
+
description: 'Retrieve a selection of customers. Useful for keeping track of customers in a local database.',
|
|
14
|
+
props: {
|
|
15
|
+
limit: pieces_framework_1.Property.Number({
|
|
16
|
+
displayName: 'Limit',
|
|
17
|
+
description: 'Number of entries to return. Limit 100.',
|
|
18
|
+
required: false,
|
|
19
|
+
}),
|
|
20
|
+
order_key: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'Order Key',
|
|
22
|
+
description: 'Field to sort by. Default: id',
|
|
23
|
+
required: false,
|
|
24
|
+
}),
|
|
25
|
+
order_direction: pieces_framework_1.Property.StaticDropdown({
|
|
26
|
+
displayName: 'Order Direction',
|
|
27
|
+
description: 'Direction to order results',
|
|
28
|
+
options: {
|
|
29
|
+
disabled: false,
|
|
30
|
+
options: [
|
|
31
|
+
{ label: 'Ascending', value: 'asc' },
|
|
32
|
+
{ label: 'Descending', value: 'desc' },
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
required: false,
|
|
36
|
+
}),
|
|
37
|
+
before_id: pieces_framework_1.Property.Number({
|
|
38
|
+
displayName: 'Before ID',
|
|
39
|
+
description: 'All customers returned will have an ID less than this value',
|
|
40
|
+
required: false,
|
|
41
|
+
}),
|
|
42
|
+
after_id: pieces_framework_1.Property.Number({
|
|
43
|
+
displayName: 'After ID',
|
|
44
|
+
description: 'All customers returned will have an ID greater than this value',
|
|
45
|
+
required: false,
|
|
46
|
+
}),
|
|
47
|
+
keyword: pieces_framework_1.Property.ShortText({
|
|
48
|
+
displayName: 'Keyword',
|
|
49
|
+
description: 'Filter by keyword',
|
|
50
|
+
required: false,
|
|
51
|
+
}),
|
|
52
|
+
},
|
|
53
|
+
run(context) {
|
|
54
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
const { limit, order_key, order_direction, before_id, after_id, keyword } = context.propsValue;
|
|
56
|
+
const queryParams = new URLSearchParams();
|
|
57
|
+
if (limit)
|
|
58
|
+
queryParams.append('limit', limit.toString());
|
|
59
|
+
if (order_key)
|
|
60
|
+
queryParams.append('order_key', order_key);
|
|
61
|
+
if (order_direction)
|
|
62
|
+
queryParams.append('order_direction', order_direction);
|
|
63
|
+
if (before_id)
|
|
64
|
+
queryParams.append('before_id', before_id.toString());
|
|
65
|
+
if (after_id)
|
|
66
|
+
queryParams.append('after_id', after_id.toString());
|
|
67
|
+
if (keyword)
|
|
68
|
+
queryParams.append('keyword', keyword);
|
|
69
|
+
const path = `/customers${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
|
|
70
|
+
const response = yield (0, client_1.makeRequest)(context.auth.props.api_key, context.auth.props.api_secret, pieces_common_1.HttpMethod.GET, path);
|
|
71
|
+
return response;
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
//# sourceMappingURL=get-customer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-customer.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/paywhirl/src/lib/actions/get-customer.ts"],"names":[],"mappings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uthProperty<{
|
|
2
|
+
api_key: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
api_secret: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
customer_id: import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
6
|
+
status: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.searchCustomersSubscription = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const client_1 = require("../common/client");
|
|
8
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
9
|
+
exports.searchCustomersSubscription = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.paywhirlAuth,
|
|
11
|
+
name: 'searchCustomersSubscription',
|
|
12
|
+
displayName: 'Get Customer Subscriptions',
|
|
13
|
+
description: 'Get a list of subscriptions associated with a given customer. Useful for determining which services a customer is currently expecting.',
|
|
14
|
+
props: {
|
|
15
|
+
customer_id: pieces_framework_1.Property.Number({
|
|
16
|
+
displayName: 'Customer ID',
|
|
17
|
+
description: 'Customer ID',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
status: pieces_framework_1.Property.StaticDropdown({
|
|
21
|
+
displayName: 'Status',
|
|
22
|
+
description: 'Filter by subscription status. Active (default) excludes canceled; Canceled shows only canceled; All shows all subscriptions.',
|
|
23
|
+
options: {
|
|
24
|
+
disabled: false,
|
|
25
|
+
options: [
|
|
26
|
+
{ label: 'Active', value: 'active' },
|
|
27
|
+
{ label: 'Canceled', value: 'canceled' },
|
|
28
|
+
{ label: 'All', value: 'all' },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
required: false,
|
|
32
|
+
}),
|
|
33
|
+
},
|
|
34
|
+
run(context) {
|
|
35
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const { customer_id, status } = context.propsValue;
|
|
37
|
+
const queryParams = new URLSearchParams();
|
|
38
|
+
if (status)
|
|
39
|
+
queryParams.append('status', status);
|
|
40
|
+
const path = `/subscriptions/${customer_id}${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
|
|
41
|
+
const response = yield (0, client_1.makeRequest)(context.auth.props.api_key, context.auth.props.api_secret, pieces_common_1.HttpMethod.GET, path);
|
|
42
|
+
return response;
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=search-customers-subscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-customers-subscription.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/paywhirl/src/lib/actions/search-customers-subscription.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAA8C;AAC9C,6CAA+C;AAC/C,+DAAyD;AAE5C,QAAA,2BAA2B,GAAG,IAAA,+BAAY,EAAC;IACtD,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,6BAA6B;IACnC,WAAW,EAAE,4BAA4B;IACzC,WAAW,EACT,wIAAwI;IAC1I,KAAK,EAAE;QACL,WAAW,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC3B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC9B,WAAW,EAAE,QAAQ;YACrB,WAAW,EACT,+HAA+H;YACjI,OAAO,EAAE;gBACP,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;oBACpC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;oBACxC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;iBAC/B;aACF;YACD,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEnD,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;YAC1C,IAAI,MAAM;gBAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAEjD,MAAM,IAAI,GAAG,kBAAkB,WAAW,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;YAE1G,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAC1B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAC7B,0BAAU,CAAC,GAAG,EACd,IAAI,CACL,CAAC;YAEF,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const subscribeCustomer: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
api_key: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
api_secret: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
customer_id: import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
6
|
+
plan_id: import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
7
|
+
trial_end: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
8
|
+
promo_id: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
9
|
+
quantity: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.subscribeCustomer = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const client_1 = require("../common/client");
|
|
8
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
9
|
+
exports.subscribeCustomer = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.paywhirlAuth,
|
|
11
|
+
name: 'subscribeCustomer',
|
|
12
|
+
displayName: 'Subscribe Customer',
|
|
13
|
+
description: 'Enroll a customer in an existing plan. The customer must have a valid payment method on file.',
|
|
14
|
+
props: {
|
|
15
|
+
customer_id: pieces_framework_1.Property.Number({
|
|
16
|
+
displayName: 'Customer ID',
|
|
17
|
+
description: 'Customer ID',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
plan_id: pieces_framework_1.Property.Number({
|
|
21
|
+
displayName: 'Plan ID',
|
|
22
|
+
description: 'Plan ID',
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
trial_end: pieces_framework_1.Property.Number({
|
|
26
|
+
displayName: 'Trial End',
|
|
27
|
+
description: 'UNIX timestamp in the future (UTC timezone)',
|
|
28
|
+
required: false,
|
|
29
|
+
}),
|
|
30
|
+
promo_id: pieces_framework_1.Property.Number({
|
|
31
|
+
displayName: 'Promo ID',
|
|
32
|
+
description: 'ID of promo code to apply',
|
|
33
|
+
required: false,
|
|
34
|
+
}),
|
|
35
|
+
quantity: pieces_framework_1.Property.Number({
|
|
36
|
+
displayName: 'Quantity',
|
|
37
|
+
description: 'Quantity (Default: 1)',
|
|
38
|
+
required: false,
|
|
39
|
+
}),
|
|
40
|
+
},
|
|
41
|
+
run(context) {
|
|
42
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const { customer_id, plan_id, trial_end, promo_id, quantity } = context.propsValue;
|
|
44
|
+
const body = {
|
|
45
|
+
customer_id,
|
|
46
|
+
plan_id,
|
|
47
|
+
};
|
|
48
|
+
if (trial_end)
|
|
49
|
+
body.trial_end = trial_end;
|
|
50
|
+
if (promo_id)
|
|
51
|
+
body.promo_id = promo_id;
|
|
52
|
+
if (quantity)
|
|
53
|
+
body.quantity = quantity;
|
|
54
|
+
const response = yield (0, client_1.makeRequest)(context.auth.props.api_key, context.auth.props.api_secret, pieces_common_1.HttpMethod.POST, '/subscribe/customer', body);
|
|
55
|
+
return response;
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=subscribe-customer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribe-customer.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/paywhirl/src/lib/actions/subscribe-customer.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAA8C;AAC9C,6CAA+C;AAC/C,+DAAyD;AAE5C,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,oBAAoB;IACjC,WAAW,EACT,+FAA+F;IACjG,KAAK,EAAE;QACL,WAAW,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC3B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACvB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,SAAS;YACtB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACzB,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACxB,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,2BAA2B;YACxC,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACxB,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAC3D,OAAO,CAAC,UAAU,CAAC;YAErB,MAAM,IAAI,GAAQ;gBAChB,WAAW;gBACX,OAAO;aACR,CAAC;YAEF,IAAI,SAAS;gBAAE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;YAC1C,IAAI,QAAQ;gBAAE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACvC,IAAI,QAAQ;gBAAE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAEvC,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAC1B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAC7B,0BAAU,CAAC,IAAI,EACf,qBAAqB,EACrB,IAAI,CACL,CAAC;YAEF,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.paywhirlAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const client_1 = require("./client");
|
|
7
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
8
|
+
exports.paywhirlAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
9
|
+
displayName: 'API Key',
|
|
10
|
+
description: 'Authenticate with your Paywhirl API Key',
|
|
11
|
+
required: true,
|
|
12
|
+
props: {
|
|
13
|
+
api_key: pieces_framework_1.Property.ShortText({
|
|
14
|
+
displayName: 'API Key',
|
|
15
|
+
description: 'Your Paywhirl API Key',
|
|
16
|
+
required: true,
|
|
17
|
+
}),
|
|
18
|
+
api_secret: pieces_framework_1.Property.ShortText({
|
|
19
|
+
displayName: 'API Secret',
|
|
20
|
+
description: 'Your Paywhirl API Secret',
|
|
21
|
+
required: true,
|
|
22
|
+
}),
|
|
23
|
+
},
|
|
24
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
25
|
+
if (auth) {
|
|
26
|
+
try {
|
|
27
|
+
yield (0, client_1.makeRequest)(auth.api_key, auth.api_secret, pieces_common_1.HttpMethod.GET, '/test');
|
|
28
|
+
return {
|
|
29
|
+
valid: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
return {
|
|
34
|
+
valid: false,
|
|
35
|
+
error: 'Invalid Api Key',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
valid: false,
|
|
41
|
+
error: 'Invalid Api Key',
|
|
42
|
+
};
|
|
43
|
+
}),
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/paywhirl/src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAAqE;AAErE,qCAAuC;AACvC,+DAAyD;AAE5C,QAAA,YAAY,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC/C,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,yCAAyC;IACtD,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,0BAA0B;YACvC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACD,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC;gBACH,MAAM,IAAA,oBAAW,EACf,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,UAAU,EACf,0BAAU,CAAC,GAAG,EACd,OAAO,CACR,CAAC;gBACF,OAAO;oBACL,KAAK,EAAE,IAAI;iBACZ,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO;oBACL,KAAK,EAAE,KAAK;oBACZ,KAAK,EAAE,iBAAiB;iBACzB,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,iBAAiB;SACzB,CAAC;IACJ,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BASE_URL = void 0;
|
|
4
|
+
exports.makeRequest = makeRequest;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
exports.BASE_URL = `https://api.paywhirl.com`;
|
|
8
|
+
function makeRequest(apikey, apisecret, method, path, body) {
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
try {
|
|
11
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
12
|
+
method,
|
|
13
|
+
url: `${exports.BASE_URL}${path}`,
|
|
14
|
+
headers: {
|
|
15
|
+
'api-key': apikey,
|
|
16
|
+
'api-secret': apisecret,
|
|
17
|
+
'Content-Type': 'application/json',
|
|
18
|
+
},
|
|
19
|
+
body,
|
|
20
|
+
});
|
|
21
|
+
return response.body;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
throw new Error(`Unexpected error: ${error.message || String(error)}`);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/paywhirl/src/lib/common/client.ts"],"names":[],"mappings":";;;AAIA,kCAsBC;;AA1BD,+DAAqE;AAExD,QAAA,QAAQ,GAAG,0BAA0B,CAAC;AAEnD,SAAsB,WAAW,CAC/B,MAAc,EACd,SAAiB,EACjB,MAAkB,EAClB,IAAY,EACZ,IAAc;;QAEd,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM;gBACN,GAAG,EAAE,GAAG,gBAAQ,GAAG,IAAI,EAAE;gBACzB,OAAO,EAAE;oBACP,SAAS,EAAE,MAAM;oBACjB,YAAY,EAAE,SAAS;oBACvB,cAAc,EAAE,kBAAkB;iBACnC;gBACD,IAAI;aACL,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,qBAAqB,KAAK,CAAC,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;CAAA"}
|