@activepieces/piece-stripe 0.5.13 → 0.5.15
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/package.json +3 -4
- package/src/i18n/translation.json +0 -1
- package/src/index.js +55 -1
- package/src/index.js.map +1 -1
- package/src/lib/actions/cancel-subscription.d.ts +4 -0
- package/src/lib/actions/cancel-subscription.js +37 -0
- package/src/lib/actions/cancel-subscription.js.map +1 -0
- package/src/lib/actions/create-payment-intent.d.ts +10 -0
- package/src/lib/actions/create-payment-intent.js +108 -0
- package/src/lib/actions/create-payment-intent.js.map +1 -0
- package/src/lib/actions/create-payment-link.d.ts +8 -0
- package/src/lib/actions/create-payment-link.js +92 -0
- package/src/lib/actions/create-payment-link.js.map +1 -0
- package/src/lib/actions/create-price.d.ts +7 -0
- package/src/lib/actions/create-price.js +92 -0
- package/src/lib/actions/create-price.js.map +1 -0
- package/src/lib/actions/create-product.d.ts +8 -0
- package/src/lib/actions/create-product.js +84 -0
- package/src/lib/actions/create-product.js.map +1 -0
- package/src/lib/actions/create-refund.d.ts +6 -0
- package/src/lib/actions/create-refund.js +72 -0
- package/src/lib/actions/create-refund.js.map +1 -0
- package/src/lib/actions/create-subscription.d.ts +9 -0
- package/src/lib/actions/create-subscription.js +105 -0
- package/src/lib/actions/create-subscription.js.map +1 -0
- package/src/lib/actions/deactivate-payment-link.d.ts +3 -0
- package/src/lib/actions/deactivate-payment-link.js +26 -0
- package/src/lib/actions/deactivate-payment-link.js.map +1 -0
- package/src/lib/actions/find-invoice.d.ts +3 -0
- package/src/lib/actions/find-invoice.js +32 -0
- package/src/lib/actions/find-invoice.js.map +1 -0
- package/src/lib/actions/retrieve-invoice.d.ts +3 -0
- package/src/lib/actions/retrieve-invoice.js +32 -0
- package/src/lib/actions/retrieve-invoice.js.map +1 -0
- package/src/lib/actions/retrieve-payment-intent.d.ts +3 -0
- package/src/lib/actions/retrieve-payment-intent.js +32 -0
- package/src/lib/actions/retrieve-payment-intent.js.map +1 -0
- package/src/lib/actions/retrieve-payout.d.ts +3 -0
- package/src/lib/actions/retrieve-payout.js +32 -0
- package/src/lib/actions/retrieve-payout.js.map +1 -0
- package/src/lib/actions/update-customer.d.ts +12 -0
- package/src/lib/actions/update-customer.js +95 -0
- package/src/lib/actions/update-customer.js.map +1 -0
- package/src/lib/common/index.d.ts +10 -0
- package/src/lib/common/index.js +360 -7
- package/src/lib/common/index.js.map +1 -1
- package/src/lib/common/types.d.ts +58 -0
- package/src/lib/common/types.js +3 -0
- package/src/lib/common/types.js.map +1 -0
- package/src/lib/trigger/canceled-subscription.d.ts +8 -0
- package/src/lib/trigger/canceled-subscription.js +113 -0
- package/src/lib/trigger/canceled-subscription.js.map +1 -0
- package/src/lib/trigger/checkout-session-completed.d.ts +8 -0
- package/src/lib/trigger/checkout-session-completed.js +91 -0
- package/src/lib/trigger/checkout-session-completed.js.map +1 -0
- package/src/lib/trigger/invoice-payment-failed.d.ts +8 -0
- package/src/lib/trigger/invoice-payment-failed.js +101 -0
- package/src/lib/trigger/invoice-payment-failed.js.map +1 -0
- package/src/lib/trigger/new-charge.d.ts +2 -0
- package/src/lib/trigger/new-charge.js +94 -0
- package/src/lib/trigger/new-charge.js.map +1 -0
- package/src/lib/trigger/new-customer.js +20 -0
- package/src/lib/trigger/new-customer.js.map +1 -1
- package/src/lib/trigger/new-dispute.d.ts +11 -0
- package/src/lib/trigger/new-dispute.js +98 -0
- package/src/lib/trigger/new-dispute.js.map +1 -0
- package/src/lib/trigger/new-invoice.d.ts +14 -0
- package/src/lib/trigger/new-invoice.js +114 -0
- package/src/lib/trigger/new-invoice.js.map +1 -0
- package/src/lib/trigger/new-payment-link.d.ts +2 -0
- package/src/lib/trigger/new-payment-link.js +76 -0
- package/src/lib/trigger/new-payment-link.js.map +1 -0
- package/src/lib/trigger/new-payment.js +21 -0
- package/src/lib/trigger/new-payment.js.map +1 -1
- package/src/lib/trigger/new-refund.d.ts +11 -0
- package/src/lib/trigger/new-refund.js +91 -0
- package/src/lib/trigger/new-refund.js.map +1 -0
- package/src/lib/trigger/new-subscription.js +20 -0
- package/src/lib/trigger/new-subscription.js.map +1 -1
- package/src/lib/trigger/payment-failed.js +21 -0
- package/src/lib/trigger/payment-failed.js.map +1 -1
- package/src/lib/trigger/updated-subscription.d.ts +11 -0
- package/src/lib/trigger/updated-subscription.js +127 -0
- package/src/lib/trigger/updated-subscription.js.map +1 -0
package/package.json
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-stripe",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.15",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@sinclair/typebox": "0.34.11",
|
|
6
6
|
"axios": "1.8.3",
|
|
7
7
|
"axios-retry": "4.4.1",
|
|
8
8
|
"deepmerge-ts": "7.1.0",
|
|
9
|
-
"fast-glob": "3.3.3",
|
|
10
9
|
"mime-types": "2.1.35",
|
|
11
10
|
"nanoid": "3.3.8",
|
|
12
11
|
"semver": "7.6.0",
|
|
13
12
|
"stripe": "18.2.1",
|
|
14
13
|
"zod": "3.25.76",
|
|
15
14
|
"@activepieces/pieces-common": "0.7.0",
|
|
16
|
-
"@activepieces/pieces-framework": "0.
|
|
17
|
-
"@activepieces/shared": "0.
|
|
15
|
+
"@activepieces/pieces-framework": "0.20.1",
|
|
16
|
+
"@activepieces/shared": "0.22.0",
|
|
18
17
|
"tslib": "2.8.1"
|
|
19
18
|
},
|
|
20
19
|
"overrides": {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"Stripe": "Stripe",
|
|
3
2
|
"Online payment processing for internet businesses": "Online payment processing for internet businesses",
|
|
4
3
|
"Secret key acquired from your Stripe dashboard": "Secret key acquired from your Stripe dashboard",
|
|
5
4
|
"Create Customer": "Create Customer",
|
package/src/index.js
CHANGED
|
@@ -14,6 +14,28 @@ const new_payment_1 = require("./lib/trigger/new-payment");
|
|
|
14
14
|
const new_subscription_1 = require("./lib/trigger/new-subscription");
|
|
15
15
|
const payment_failed_1 = require("./lib/trigger/payment-failed");
|
|
16
16
|
const search_subscriptions_1 = require("./lib/actions/search-subscriptions");
|
|
17
|
+
const new_charge_1 = require("./lib/trigger/new-charge");
|
|
18
|
+
const new_invoice_1 = require("./lib/trigger/new-invoice");
|
|
19
|
+
const invoice_payment_failed_1 = require("./lib/trigger/invoice-payment-failed");
|
|
20
|
+
const canceled_subscription_1 = require("./lib/trigger/canceled-subscription");
|
|
21
|
+
const new_refund_1 = require("./lib/trigger/new-refund");
|
|
22
|
+
const new_dispute_1 = require("./lib/trigger/new-dispute");
|
|
23
|
+
const new_payment_link_1 = require("./lib/trigger/new-payment-link");
|
|
24
|
+
const updated_subscription_1 = require("./lib/trigger/updated-subscription");
|
|
25
|
+
const checkout_session_completed_1 = require("./lib/trigger/checkout-session-completed");
|
|
26
|
+
const update_customer_1 = require("./lib/actions/update-customer");
|
|
27
|
+
const create_payment_intent_1 = require("./lib/actions/create-payment-intent");
|
|
28
|
+
const create_product_1 = require("./lib/actions/create-product");
|
|
29
|
+
const create_price_1 = require("./lib/actions/create-price");
|
|
30
|
+
const create_subscription_1 = require("./lib/actions/create-subscription");
|
|
31
|
+
const cancel_subscription_1 = require("./lib/actions/cancel-subscription");
|
|
32
|
+
const retrieve_invoice_1 = require("./lib/actions/retrieve-invoice");
|
|
33
|
+
const retrieve_payout_1 = require("./lib/actions/retrieve-payout");
|
|
34
|
+
const create_refund_1 = require("./lib/actions/create-refund");
|
|
35
|
+
const create_payment_link_1 = require("./lib/actions/create-payment-link");
|
|
36
|
+
const deactivate_payment_link_1 = require("./lib/actions/deactivate-payment-link");
|
|
37
|
+
const retrieve_payment_intent_1 = require("./lib/actions/retrieve-payment-intent");
|
|
38
|
+
const find_invoice_1 = require("./lib/actions/find-invoice");
|
|
17
39
|
exports.stripeAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
18
40
|
displayName: 'Secret API Key',
|
|
19
41
|
required: true,
|
|
@@ -24,7 +46,17 @@ exports.stripe = (0, pieces_framework_1.createPiece)({
|
|
|
24
46
|
description: 'Online payment processing for internet businesses',
|
|
25
47
|
minimumSupportedRelease: '0.30.0',
|
|
26
48
|
logoUrl: 'https://cdn.activepieces.com/pieces/stripe.png',
|
|
27
|
-
authors: [
|
|
49
|
+
authors: [
|
|
50
|
+
'lldiegon',
|
|
51
|
+
'doskyft',
|
|
52
|
+
'kishanprmr',
|
|
53
|
+
'MoShizzle',
|
|
54
|
+
'AbdulTheActivePiecer',
|
|
55
|
+
'khaledmashaly',
|
|
56
|
+
'abuaboud',
|
|
57
|
+
'Prabhukiran161',
|
|
58
|
+
'sanket-a11y'
|
|
59
|
+
],
|
|
28
60
|
categories: [shared_1.PieceCategory.COMMERCE, shared_1.PieceCategory.PAYMENT_PROCESSING],
|
|
29
61
|
auth: exports.stripeAuth,
|
|
30
62
|
actions: [
|
|
@@ -33,6 +65,19 @@ exports.stripe = (0, pieces_framework_1.createPiece)({
|
|
|
33
65
|
search_customer_1.stripeSearchCustomer,
|
|
34
66
|
search_subscriptions_1.stripeSearchSubscriptions,
|
|
35
67
|
retrieve_customer_1.stripeRetrieveCustomer,
|
|
68
|
+
update_customer_1.stripeUpdateCustomer,
|
|
69
|
+
create_payment_intent_1.stripeCreatePaymentIntent,
|
|
70
|
+
create_product_1.stripeCreateProduct,
|
|
71
|
+
create_price_1.stripeCreatePrice,
|
|
72
|
+
create_subscription_1.stripeCreateSubscription,
|
|
73
|
+
cancel_subscription_1.stripeCancelSubscription,
|
|
74
|
+
retrieve_invoice_1.stripeRetrieveInvoice,
|
|
75
|
+
retrieve_payout_1.stripeRetrievePayout,
|
|
76
|
+
create_refund_1.stripeCreateRefund,
|
|
77
|
+
create_payment_link_1.stripeCreatePaymentLink,
|
|
78
|
+
deactivate_payment_link_1.stripeDeactivatePaymentLink,
|
|
79
|
+
retrieve_payment_intent_1.stripeRetrievePaymentIntent,
|
|
80
|
+
find_invoice_1.stripeFindInvoice,
|
|
36
81
|
(0, pieces_common_1.createCustomApiCallAction)({
|
|
37
82
|
baseUrl: () => 'https://api.stripe.com/v1',
|
|
38
83
|
auth: exports.stripeAuth,
|
|
@@ -48,6 +93,15 @@ exports.stripe = (0, pieces_framework_1.createPiece)({
|
|
|
48
93
|
new_customer_1.stripeNewCustomer,
|
|
49
94
|
payment_failed_1.stripePaymentFailed,
|
|
50
95
|
new_subscription_1.stripeNewSubscription,
|
|
96
|
+
new_charge_1.stripeNewCharge,
|
|
97
|
+
new_invoice_1.stripeNewInvoice,
|
|
98
|
+
invoice_payment_failed_1.stripeInvoicePaymentFailed,
|
|
99
|
+
canceled_subscription_1.stripeCanceledSubscription,
|
|
100
|
+
new_refund_1.stripeNewRefund,
|
|
101
|
+
new_dispute_1.stripeNewDispute,
|
|
102
|
+
new_payment_link_1.stripeNewPaymentLink,
|
|
103
|
+
updated_subscription_1.stripeUpdatedSubscription,
|
|
104
|
+
checkout_session_completed_1.stripeCheckoutSessionCompleted,
|
|
51
105
|
],
|
|
52
106
|
});
|
|
53
107
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/stripe/src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,qEAAwE;AACxE,iDAAqD;AACrD,mEAAqE;AACrE,iEAAmE;AACnE,uEAAyE;AACzE,mEAAqE;AACrE,6DAA+D;AAC/D,2DAA6D;AAC7D,qEAAuE;AACvE,iEAAmE;AACnE,6EAA+E;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/stripe/src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,qEAAwE;AACxE,iDAAqD;AACrD,mEAAqE;AACrE,iEAAmE;AACnE,uEAAyE;AACzE,mEAAqE;AACrE,6DAA+D;AAC/D,2DAA6D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AG,EAAE,CAAC,2BAA2B;YAC1C,IAAI,EAAE,kBAAU;YAChB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC5B,aAAa,EAAE,UAAU,IAAI,EAAE;iBAChC,CAAC,CAAA;cAAA;SACH,CAAC;KACH;IACD,QAAQ,EAAE;QACR,8BAAgB;QAChB,gCAAiB;QACjB,oCAAmB;QACnB,wCAAqB;QACrB,4BAAe;QACf,8BAAgB;QAChB,mDAA0B;QAC1B,kDAA0B;QAC1B,4BAAe;QACf,8BAAgB;QAChB,uCAAoB;QACpB,gDAAyB;QACzB,2DAA8B;KAC/B;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const stripeCancelSubscription: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
subscription: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
cancel_at_period_end: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stripeCancelSubscription = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const __1 = require("../..");
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.stripeCancelSubscription = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'cancel_subscription',
|
|
10
|
+
auth: __1.stripeAuth,
|
|
11
|
+
displayName: 'Cancel Subscription',
|
|
12
|
+
description: 'Cancel an existing subscription, either immediately or at the end of the current billing period.',
|
|
13
|
+
props: {
|
|
14
|
+
subscription: common_1.stripeCommon.subscription,
|
|
15
|
+
cancel_at_period_end: pieces_framework_1.Property.Checkbox({
|
|
16
|
+
displayName: 'Cancel at Period End',
|
|
17
|
+
description: 'If true, the subscription remains active until the end of the current billing period. If false, it cancels immediately.',
|
|
18
|
+
required: false,
|
|
19
|
+
defaultValue: false,
|
|
20
|
+
}),
|
|
21
|
+
},
|
|
22
|
+
run(context) {
|
|
23
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const { subscription, cancel_at_period_end } = context.propsValue;
|
|
25
|
+
const client = (0, common_1.getClient)(context.auth);
|
|
26
|
+
if (cancel_at_period_end) {
|
|
27
|
+
return yield client.subscriptions.update(subscription, {
|
|
28
|
+
cancel_at_period_end: true,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return yield client.subscriptions.cancel(subscription);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=cancel-subscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancel-subscription.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/stripe/src/lib/actions/cancel-subscription.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,6BAAmC;AACnC,sCAAoD;AAEvC,QAAA,wBAAwB,GAAG,IAAA,+BAAY,EAAC;IACnD,IAAI,EAAE,qBAAqB;IAC3B,IAAI,EAAE,cAAU;IAChB,WAAW,EAAE,qBAAqB;IAClC,WAAW,EACT,kGAAkG;IACpG,KAAK,EAAE;QACL,YAAY,EAAE,qBAAY,CAAC,YAAY;QACvC,oBAAoB,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACtC,WAAW,EAAE,sBAAsB;YACnC,WAAW,EACT,yHAAyH;YAC3H,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;SACpB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,YAAY,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAElE,MAAM,MAAM,GAAG,IAAA,kBAAS,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAEvC,IAAI,oBAAoB,EAAE,CAAC;gBACzB,OAAO,MAAM,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,YAAY,EAAE;oBACrD,oBAAoB,EAAE,IAAI;iBAC3B,CAAC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACN,OAAO,MAAM,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACzD,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const stripeCreatePaymentIntent: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
amount: import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
3
|
+
currency: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
4
|
+
customer: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
5
|
+
payment_method: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
confirm: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
7
|
+
return_url: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
description: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
9
|
+
receipt_email: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stripeCreatePaymentIntent = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const __1 = require("../..");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.stripeCreatePaymentIntent = (0, pieces_framework_1.createAction)({
|
|
10
|
+
name: 'create_payment_intent',
|
|
11
|
+
auth: __1.stripeAuth,
|
|
12
|
+
displayName: 'Create Payment (Payment Intent)',
|
|
13
|
+
description: 'Creates a new payment intent to start a payment flow.',
|
|
14
|
+
props: {
|
|
15
|
+
amount: pieces_framework_1.Property.Number({
|
|
16
|
+
displayName: 'Amount',
|
|
17
|
+
description: 'The amount to charge, in a decimal format (e.g., 10.50 for $10.50).',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
currency: pieces_framework_1.Property.StaticDropdown({
|
|
21
|
+
displayName: 'Currency',
|
|
22
|
+
description: 'The three-letter ISO code for the currency.',
|
|
23
|
+
required: true,
|
|
24
|
+
options: {
|
|
25
|
+
options: [
|
|
26
|
+
{ label: 'US Dollar', value: 'usd' },
|
|
27
|
+
{ label: 'Euro', value: 'eur' },
|
|
28
|
+
{ label: 'Pound Sterling', value: 'gbp' },
|
|
29
|
+
{ label: 'Australian Dollar', value: 'aud' },
|
|
30
|
+
{ label: 'Canadian Dollar', value: 'cad' },
|
|
31
|
+
{ label: 'Swiss Franc', value: 'chf' },
|
|
32
|
+
{ label: 'Chinese Yuan', value: 'cny' },
|
|
33
|
+
{ label: 'Japanese Yen', value: 'jpy' },
|
|
34
|
+
{ label: 'Indian Rupee', value: 'inr' },
|
|
35
|
+
{ label: 'Singapore Dollar', value: 'sgd' },
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
customer: common_1.stripeCommon.customer,
|
|
40
|
+
payment_method: pieces_framework_1.Property.ShortText({
|
|
41
|
+
displayName: 'Payment Method ID',
|
|
42
|
+
description: 'The ID of the Payment Method to attach (e.g., `pm_...`). Required if you want to confirm the payment immediately.',
|
|
43
|
+
required: false,
|
|
44
|
+
}),
|
|
45
|
+
confirm: pieces_framework_1.Property.Checkbox({
|
|
46
|
+
displayName: 'Confirm Payment Immediately',
|
|
47
|
+
description: 'If true, Stripe will attempt to charge the provided payment method. A `Payment Method ID` is required.',
|
|
48
|
+
required: false,
|
|
49
|
+
defaultValue: false,
|
|
50
|
+
}),
|
|
51
|
+
return_url: pieces_framework_1.Property.ShortText({
|
|
52
|
+
displayName: 'Return URL',
|
|
53
|
+
description: 'The URL to redirect your customer back to after they authenticate their payment. Required when confirming the payment.',
|
|
54
|
+
required: false,
|
|
55
|
+
}),
|
|
56
|
+
description: pieces_framework_1.Property.LongText({
|
|
57
|
+
displayName: 'Description',
|
|
58
|
+
required: false,
|
|
59
|
+
}),
|
|
60
|
+
receipt_email: pieces_framework_1.Property.ShortText({
|
|
61
|
+
displayName: 'Receipt Email',
|
|
62
|
+
description: "The email address to send a receipt to. This will override the customer's email address.",
|
|
63
|
+
required: false,
|
|
64
|
+
}),
|
|
65
|
+
},
|
|
66
|
+
run(context) {
|
|
67
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
const { amount, currency, customer, payment_method, confirm, return_url, description, receipt_email, } = context.propsValue;
|
|
69
|
+
if (confirm && !payment_method) {
|
|
70
|
+
throw new Error("A Payment Method ID is required when 'Confirm Payment' is set to true.");
|
|
71
|
+
}
|
|
72
|
+
if (confirm && !return_url) {
|
|
73
|
+
throw new Error("A Return URL is required when 'Confirm Payment' is set to true.");
|
|
74
|
+
}
|
|
75
|
+
const amountInCents = Math.round(amount * 100);
|
|
76
|
+
const body = {
|
|
77
|
+
amount: amountInCents,
|
|
78
|
+
currency: currency,
|
|
79
|
+
};
|
|
80
|
+
if (customer)
|
|
81
|
+
body.customer = customer;
|
|
82
|
+
if (payment_method)
|
|
83
|
+
body.payment_method = payment_method;
|
|
84
|
+
if (confirm)
|
|
85
|
+
body.confirm = confirm;
|
|
86
|
+
if (return_url)
|
|
87
|
+
body.return_url = return_url;
|
|
88
|
+
if (description)
|
|
89
|
+
body.description = description;
|
|
90
|
+
if (receipt_email)
|
|
91
|
+
body.receipt_email = receipt_email;
|
|
92
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
93
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
94
|
+
url: `${common_1.stripeCommon.baseUrl}/payment_intents`,
|
|
95
|
+
authentication: {
|
|
96
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
97
|
+
token: context.auth,
|
|
98
|
+
},
|
|
99
|
+
headers: {
|
|
100
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
101
|
+
},
|
|
102
|
+
body: body,
|
|
103
|
+
});
|
|
104
|
+
return response.body;
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
//# sourceMappingURL=create-payment-intent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-payment-intent.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/stripe/src/lib/actions/create-payment-intent.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAIqC;AACrC,6BAAmC;AACnC,sCAAyC;AAE5B,QAAA,yBAAyB,GAAG,IAAA,+BAAY,EAAC;IACpD,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,cAAU;IAChB,WAAW,EAAE,iCAAiC;IAC9C,WAAW,EAAE,uDAAuD;IACpE,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACtB,WAAW,EAAE,QAAQ;YACrB,WAAW,EACT,qEAAqE;YACvE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAChC,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE;oBACpC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE;oBAC/B,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE;oBACzC,EAAE,KAAK,EAAE,mBAA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KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const stripeCreatePaymentLink: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
line_items: import("@activepieces/pieces-framework").ArrayProperty<true>;
|
|
3
|
+
after_completion_type: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
4
|
+
after_completion_redirect_url: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
allow_promotion_codes: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
6
|
+
billing_address_collection: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
7
|
+
metadata: import("@activepieces/pieces-framework").JsonProperty<false>;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stripeCreatePaymentLink = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const __1 = require("../..");
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.stripeCreatePaymentLink = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'create_payment_link',
|
|
10
|
+
auth: __1.stripeAuth,
|
|
11
|
+
displayName: 'Create Payment Link',
|
|
12
|
+
description: 'Creates a shareable, Stripe-hosted payment link for one-time purchases or subscriptions.',
|
|
13
|
+
props: {
|
|
14
|
+
line_items: pieces_framework_1.Property.Array({
|
|
15
|
+
displayName: 'Line Items',
|
|
16
|
+
description: 'The products and quantities to include in the payment link.',
|
|
17
|
+
required: true,
|
|
18
|
+
properties: {
|
|
19
|
+
price: pieces_framework_1.Property.ShortText({
|
|
20
|
+
displayName: 'Price ID',
|
|
21
|
+
description: 'The ID of the price object (e.g., price_1J2X3Y4Z...). Find this in your Stripe Dashboard under Products.',
|
|
22
|
+
required: true,
|
|
23
|
+
}),
|
|
24
|
+
quantity: pieces_framework_1.Property.Number({
|
|
25
|
+
displayName: 'Quantity',
|
|
26
|
+
required: true,
|
|
27
|
+
}),
|
|
28
|
+
},
|
|
29
|
+
}),
|
|
30
|
+
after_completion_type: pieces_framework_1.Property.StaticDropdown({
|
|
31
|
+
displayName: 'After Completion Behavior',
|
|
32
|
+
description: "Controls the behavior after the purchase is complete. Defaults to showing Stripe's hosted confirmation page.",
|
|
33
|
+
required: false,
|
|
34
|
+
options: {
|
|
35
|
+
options: [
|
|
36
|
+
{ label: 'Show Confirmation Page', value: 'hosted_confirmation' },
|
|
37
|
+
{ label: 'Redirect to URL', value: 'redirect' },
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
after_completion_redirect_url: pieces_framework_1.Property.ShortText({
|
|
42
|
+
displayName: 'Redirect URL',
|
|
43
|
+
description: 'The URL to redirect the customer to after a successful purchase. Only used if the behavior is set to "Redirect to URL".',
|
|
44
|
+
required: false,
|
|
45
|
+
}),
|
|
46
|
+
allow_promotion_codes: pieces_framework_1.Property.Checkbox({
|
|
47
|
+
displayName: 'Allow Promotion Codes',
|
|
48
|
+
description: 'Enables the user to enter a promotion code on the Payment Link page.',
|
|
49
|
+
required: false,
|
|
50
|
+
}),
|
|
51
|
+
billing_address_collection: pieces_framework_1.Property.StaticDropdown({
|
|
52
|
+
displayName: 'Billing Address Collection',
|
|
53
|
+
description: 'Describes whether Checkout should collect the customer’s billing address.',
|
|
54
|
+
required: false,
|
|
55
|
+
options: {
|
|
56
|
+
options: [
|
|
57
|
+
{ label: 'Auto', value: 'auto' },
|
|
58
|
+
{ label: 'Required', value: 'required' },
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
}),
|
|
62
|
+
metadata: pieces_framework_1.Property.Json({
|
|
63
|
+
displayName: 'Metadata',
|
|
64
|
+
required: false,
|
|
65
|
+
}),
|
|
66
|
+
},
|
|
67
|
+
run(context) {
|
|
68
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
const client = (0, common_1.getClient)(context.auth);
|
|
70
|
+
const props = context.propsValue;
|
|
71
|
+
const params = {
|
|
72
|
+
line_items: props.line_items,
|
|
73
|
+
allow_promotion_codes: props.allow_promotion_codes,
|
|
74
|
+
billing_address_collection: props.billing_address_collection,
|
|
75
|
+
metadata: props.metadata,
|
|
76
|
+
};
|
|
77
|
+
if (props.after_completion_type) {
|
|
78
|
+
params.after_completion = {
|
|
79
|
+
type: props.after_completion_type,
|
|
80
|
+
};
|
|
81
|
+
if (props.after_completion_type === 'redirect' &&
|
|
82
|
+
props.after_completion_redirect_url) {
|
|
83
|
+
params.after_completion.redirect = {
|
|
84
|
+
url: props.after_completion_redirect_url,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return yield client.paymentLinks.create(params);
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
//# sourceMappingURL=create-payment-link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-payment-link.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/stripe/src/lib/actions/create-payment-link.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,6BAAmC;AACnC,sCAAsC;AAGzB,QAAA,uBAAuB,GAAG,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,qBAAqB;IAC3B,IAAI,EAAE,cAAU;IAChB,WAAW,EAAE,qBAAqB;IAClC,WAAW,EACT,0FAA0F;IAC5F,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACzB,WAAW,EAAE,YAAY;YACzB,WAAW,EACT,6DAA6D;YAC/D,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE;gBACV,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;oBACxB,WAAW,EAAE,UAAU;oBACvB,WAAW,EACT,0GAA0G;oBAC5G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AAI,CAAC,CAAC;YACvC,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC;YAEjC,MAAM,MAAM,GAAmC;gBAC7C,UAAU,EAAE,KAAK,CAAC,UAAmD;gBACrE,qBAAqB,EAAE,KAAK,CAAC,qBAAqB;gBAClD,0BAA0B,EAAE,KAAK,CAAC,0BAGrB;gBACb,QAAQ,EAAE,KAAK,CAAC,QAA8C;aAC/D,CAAC;YAEF,IAAI,KAAK,CAAC,qBAAqB,EAAE,CAAC;gBAChC,MAAM,CAAC,gBAAgB,GAAG;oBACxB,IAAI,EAAE,KAAK,CAAC,qBAA2D;iBACxE,CAAC;gBACF,IACE,KAAK,CAAC,qBAAqB,KAAK,UAAU;oBAC1C,KAAK,CAAC,6BAA6B,EACnC,CAAC;oBACD,MAAM,CAAC,gBAAgB,CAAC,QAAQ,GAAG;wBACjC,GAAG,EAAE,KAAK,CAAC,6BAA6B;qBACzC,CAAC;gBACJ,CAAC;YACH,CAAC;YAED,OAAO,MAAM,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAClD,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const stripeCreatePrice: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
product: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
unit_amount: import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
4
|
+
currency: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
5
|
+
recurring_interval: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
6
|
+
recurring_interval_count: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stripeCreatePrice = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const __1 = require("../..");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.stripeCreatePrice = (0, pieces_framework_1.createAction)({
|
|
10
|
+
name: 'create_price',
|
|
11
|
+
auth: __1.stripeAuth,
|
|
12
|
+
displayName: 'Create Price',
|
|
13
|
+
description: 'Create a price (one-time or recurring), associated with a product.',
|
|
14
|
+
props: {
|
|
15
|
+
product: common_1.stripeCommon.product,
|
|
16
|
+
unit_amount: pieces_framework_1.Property.Number({
|
|
17
|
+
displayName: 'Unit Amount',
|
|
18
|
+
description: 'The price amount as a decimal, for example, 25.50 for $25.50.',
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
currency: pieces_framework_1.Property.StaticDropdown({
|
|
22
|
+
displayName: 'Currency',
|
|
23
|
+
description: 'The three-letter ISO code for the currency.',
|
|
24
|
+
required: true,
|
|
25
|
+
options: {
|
|
26
|
+
options: [
|
|
27
|
+
{ label: 'US Dollar', value: 'usd' },
|
|
28
|
+
{ label: 'Euro', value: 'eur' },
|
|
29
|
+
{ label: 'Pound Sterling', value: 'gbp' },
|
|
30
|
+
{ label: 'Indian Rupee', value: 'inr' },
|
|
31
|
+
{ label: 'Australian Dollar', value: 'aud' },
|
|
32
|
+
{ label: 'Canadian Dollar', value: 'cad' },
|
|
33
|
+
{ label: 'Swiss Franc', value: 'chf' },
|
|
34
|
+
{ label: 'Chinese Yuan', value: 'cny' },
|
|
35
|
+
{ label: 'Japanese Yen', value: 'jpy' },
|
|
36
|
+
{ label: 'Singapore Dollar', value: 'sgd' },
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
}),
|
|
40
|
+
recurring_interval: pieces_framework_1.Property.StaticDropdown({
|
|
41
|
+
displayName: 'Billing Interval',
|
|
42
|
+
description: "Specify the billing frequency. Select 'One-Time' for a single, non-recurring payment.",
|
|
43
|
+
required: true,
|
|
44
|
+
defaultValue: 'one_time',
|
|
45
|
+
options: {
|
|
46
|
+
options: [
|
|
47
|
+
{ label: 'One-Time', value: 'one_time' },
|
|
48
|
+
{ label: 'Daily', value: 'day' },
|
|
49
|
+
{ label: 'Weekly', value: 'week' },
|
|
50
|
+
{ label: 'Monthly', value: 'month' },
|
|
51
|
+
{ label: 'Yearly', value: 'year' },
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
}),
|
|
55
|
+
recurring_interval_count: pieces_framework_1.Property.Number({
|
|
56
|
+
displayName: 'Interval Count',
|
|
57
|
+
description: 'The number of intervals between subscription billings (e.g., for billing every 3 months, set Interval to Monthly and Interval Count to 3). Only used for recurring prices.',
|
|
58
|
+
required: false,
|
|
59
|
+
}),
|
|
60
|
+
},
|
|
61
|
+
run(context) {
|
|
62
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
const { product, unit_amount, currency, recurring_interval, recurring_interval_count, } = context.propsValue;
|
|
64
|
+
const unitAmountInCents = Math.round(unit_amount * 100);
|
|
65
|
+
const body = {
|
|
66
|
+
product: product,
|
|
67
|
+
unit_amount: unitAmountInCents,
|
|
68
|
+
currency: currency,
|
|
69
|
+
};
|
|
70
|
+
if (recurring_interval !== 'one_time') {
|
|
71
|
+
body['recurring[interval]'] = recurring_interval;
|
|
72
|
+
if (recurring_interval_count) {
|
|
73
|
+
body['recurring[interval_count]'] = recurring_interval_count;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
77
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
78
|
+
url: `${common_1.stripeCommon.baseUrl}/prices`,
|
|
79
|
+
authentication: {
|
|
80
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
81
|
+
token: context.auth,
|
|
82
|
+
},
|
|
83
|
+
headers: {
|
|
84
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
85
|
+
},
|
|
86
|
+
body: body,
|
|
87
|
+
});
|
|
88
|
+
return response.body;
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
//# sourceMappingURL=create-price.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-price.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/stripe/src/lib/actions/create-price.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAIqC;AACrC,6BAAmC;AACnC,sCAAyC;AAE5B,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,cAAU;IAChB,WAAW,EAAE,cAAc;IAC3B,WAAW,EACT,oEAAoE;IACtE,KAAK,EAAE;QACL,OAAO,EAAE,qBAAY,CAAC,OAAO;QAC7B,WAAW,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC3B,WAAW,EAAE,aAAa;YAC1B,WAAW,EACT,+DAA+D;YACjE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAChC,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE;oBACpC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE;oBAC/B,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE;oBACzC,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE;oBACvC,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,KAAK,EAAE;oBAC5C,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,KAAK,EAAE;oBAC1C,E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AE,QAAQ;aACnB,CAAC;YAEF,IAAI,kBAAkB,KAAK,UAAU,EAAE,CAAC;gBACtC,IAAI,CAAC,qBAAqB,CAAC,GAAG,kBAAkB,CAAC;gBACjD,IAAI,wBAAwB,EAAE,CAAC;oBAC7B,IAAI,CAAC,2BAA2B,CAAC,GAAG,wBAAwB,CAAC;gBAC/D,CAAC;YACH,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,GAAG,qBAAY,CAAC,OAAO,SAAS;gBACrC,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,OAAO,CAAC,IAAI;iBACpB;gBACD,OAAO,EAAE;oBACP,cAAc,EAAE,mCAAmC;iBACpD;gBACD,IAAI,EAAE,IAAI;aACX,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const stripeCreateProduct: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
description: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
4
|
+
active: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
5
|
+
images: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
6
|
+
url: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
metadata: import("@activepieces/pieces-framework").JsonProperty<false>;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stripeCreateProduct = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const __1 = require("../..");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.stripeCreateProduct = (0, pieces_framework_1.createAction)({
|
|
10
|
+
name: 'create_product',
|
|
11
|
+
auth: __1.stripeAuth,
|
|
12
|
+
displayName: 'Create Product',
|
|
13
|
+
description: 'Create a new product object in Stripe.',
|
|
14
|
+
props: {
|
|
15
|
+
name: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Product Name',
|
|
17
|
+
description: 'The product’s name, meant to be displayable to the customer.',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
description: pieces_framework_1.Property.LongText({
|
|
21
|
+
displayName: 'Description',
|
|
22
|
+
description: 'The product’s description, meant to be displayable to the customer.',
|
|
23
|
+
required: false,
|
|
24
|
+
}),
|
|
25
|
+
active: pieces_framework_1.Property.Checkbox({
|
|
26
|
+
displayName: 'Active',
|
|
27
|
+
description: 'Whether the product is currently available for purchase. Defaults to true.',
|
|
28
|
+
required: false,
|
|
29
|
+
}),
|
|
30
|
+
images: pieces_framework_1.Property.Array({
|
|
31
|
+
displayName: 'Image URLs',
|
|
32
|
+
description: 'A list of up to 8 URLs of images for this product.',
|
|
33
|
+
required: false,
|
|
34
|
+
}),
|
|
35
|
+
url: pieces_framework_1.Property.ShortText({
|
|
36
|
+
displayName: 'Product URL',
|
|
37
|
+
description: 'A publicly-accessible online page for this product.',
|
|
38
|
+
required: false,
|
|
39
|
+
}),
|
|
40
|
+
metadata: pieces_framework_1.Property.Json({
|
|
41
|
+
displayName: 'Metadata',
|
|
42
|
+
description: 'A set of key-value pairs to store additional information about the product.',
|
|
43
|
+
required: false,
|
|
44
|
+
}),
|
|
45
|
+
},
|
|
46
|
+
run(context) {
|
|
47
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const { name, description, active, images, url, metadata } = context.propsValue;
|
|
49
|
+
const body = {
|
|
50
|
+
name: name,
|
|
51
|
+
};
|
|
52
|
+
if (description)
|
|
53
|
+
body.description = description;
|
|
54
|
+
if (active !== undefined)
|
|
55
|
+
body.active = active;
|
|
56
|
+
if (url)
|
|
57
|
+
body.url = url;
|
|
58
|
+
if (images && Array.isArray(images)) {
|
|
59
|
+
images.forEach((image, index) => {
|
|
60
|
+
body[`images[${index}]`] = image;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (metadata && typeof metadata === 'object') {
|
|
64
|
+
Object.keys(metadata).forEach((key) => {
|
|
65
|
+
body[`metadata[${key}]`] = metadata[key];
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
69
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
70
|
+
url: `${common_1.stripeCommon.baseUrl}/products`,
|
|
71
|
+
authentication: {
|
|
72
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
73
|
+
token: context.auth,
|
|
74
|
+
},
|
|
75
|
+
headers: {
|
|
76
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
77
|
+
},
|
|
78
|
+
body: body,
|
|
79
|
+
});
|
|
80
|
+
return response.body;
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=create-product.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-product.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/stripe/src/lib/actions/create-product.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAIqC;AACrC,6BAAmC;AACnC,sCAAyC;AAE5B,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE,cAAU;IAChB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,wCAAwC;IACrD,KAAK,EAAE;QACL,IAAI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,CAAC,MAAM,CAAC,EAAE,CAAC;gBACpC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;oBAC9B,IAAI,CAAC,UAAU,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC;gBACnC,CAAC,CAAC,CAAC;YACL,CAAC;YACD,IAAI,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;gBAC7C,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;oBACpC,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC,GAAI,QAAmC,CAAC,GAAG,CAAC,CAAC;gBACvE,CAAC,CAAC,CAAC;YACL,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,GAAG,qBAAY,CAAC,OAAO,WAAW;gBACvC,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,OAAO,CAAC,IAAI;iBACpB;gBACD,OAAO,EAAE;oBACP,cAAc,EAAE,mCAAmC;iBACpD;gBACD,IAAI,EAAE,IAAI;aACX,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const stripeCreateRefund: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
payment_intent: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
amount: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
4
|
+
reason: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
5
|
+
metadata: import("@activepieces/pieces-framework").JsonProperty<false>;
|
|
6
|
+
}>;
|