Skip to content

Commit 17c06e8

Browse files
authored
[FEATURE] Upgrade Pipedream Stripe App to Latest Stable API Version (#16463)
* [FEATURE] Upgrade Pipedream Stripe App to Latest Stable API Version * [Usability Audit] Stripe
1 parent 24e14b4 commit 17c06e8

File tree

63 files changed

+2433
-1079
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2433
-1079
lines changed

components/stripe/actions/cancel-or-reverse-payout/cancel-or-reverse-payout.mjs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@ import app from "../../stripe.app.mjs";
22

33
export default {
44
key: "stripe-cancel-or-reverse-payout",
5-
name: "Cancel Or Reverse a Payout",
5+
name: "Cancel Or Reverse A Payout",
66
type: "action",
7-
version: "0.1.1",
8-
description: "Cancel or reverse a [payout](https://stripe.com/docs/payouts). " +
9-
"A payout can be canceled only if it has not yet been paid out. A payout can be reversed " +
10-
"only if it has already been paid out. Funds will be refunded to your available balance. [See" +
11-
" the docs](https://stripe.com/docs/api/payouts/cancel) for more information",
7+
version: "0.1.2",
8+
description: "Cancel a pending payout or reverse a paid payout. [See the documentation here](https://docs.stripe.com/api/payouts/cancel) and [here](https://docs.stripe.com/api/payouts/reverse)",
129
props: {
1310
app,
11+
// eslint-disable-next-line pipedream/props-label, pipedream/props-description
12+
alert: {
13+
type: "alert",
14+
alertType: "info",
15+
content: "A payout can be canceled only if it has not yet been paid out. A payout can be reversed only if it has already been paid out. Funds will be refunded to your available balance. [See the documentation](https://stripe.com/docs/api/payouts/cancel).",
16+
},
1417
id: {
1518
propDefinition: [
1619
app,

components/stripe/actions/cancel-payment-intent/cancel-payment-intent.mjs

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,43 @@
1-
import pick from "lodash.pick";
21
import app from "../../stripe.app.mjs";
32

43
export default {
54
key: "stripe-cancel-payment-intent",
6-
name: "Cancel a Payment Intent",
5+
name: "Cancel A Payment Intent",
76
type: "action",
8-
version: "0.1.1",
9-
description: "Cancel a [payment intent](https://stripe.com/docs/payments/payment-intents). " +
10-
"Once canceled, no additional charges will be made by the payment intent and any operations " +
11-
"on the payment intent will fail with an error. For payment intents with status=" +
12-
"`requires_capture`, the remaining amount_capturable will automatically be refunded. [See the" +
13-
" docs](https://stripe.com/docs/api/payment_intents/cancel) for more information",
7+
version: "0.1.2",
8+
description: "Cancel a PaymentIntent. [See the documentation](https://stripe.com/docs/payments/payment-intents).",
149
props: {
1510
app,
11+
// eslint-disable-next-line pipedream/props-label, pipedream/props-description
12+
alert: {
13+
type: "alert",
14+
alertType: "info",
15+
content: "Once canceled, no additional charges will be made by the payment intent and any operations on the payment intent will fail with an error. For payment intents with `status=requires_capture`, the remaining amount_capturable will automatically be refunded. [See the documentation](https://stripe.com/docs/api/payment_intents/cancel).",
16+
},
1617
id: {
1718
propDefinition: [
1819
app,
19-
"payment_intent",
20+
"paymentIntent",
2021
],
2122
optional: false,
2223
},
23-
cancellation_reason: {
24+
cancellationReason: {
2425
propDefinition: [
2526
app,
26-
"payment_intent_cancellation_reason",
27+
"paymentIntentCancellationReason",
2728
],
2829
},
2930
},
3031
async run({ $ }) {
31-
const params = pick(this, [
32-
"cancellation_reason",
33-
]);
34-
const resp = await this.app.sdk().paymentIntents.cancel(this.id, params);
32+
const {
33+
app,
34+
id,
35+
cancellationReason,
36+
} = this;
37+
38+
const resp = await app.sdk().paymentIntents.cancel(id, {
39+
cancellation_reason: cancellationReason,
40+
});
3541
$.export("$summary", "Successfully cancelled payment intent");
3642
return resp;
3743
},

components/stripe/actions/capture-payment-intent/capture-payment-intent.mjs

Lines changed: 67 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,97 @@
1-
import pick from "lodash.pick";
21
import app from "../../stripe.app.mjs";
32

43
export default {
54
key: "stripe-capture-payment-intent",
65
name: "Capture a Payment Intent",
76
type: "action",
8-
version: "0.1.1",
9-
description: "Capture the funds of an existing uncaptured payment intent. [See the " +
10-
"docs](https://stripe.com/docs/api/payment_intents/capture) for more information",
7+
version: "0.1.2",
8+
description: "Capture the funds of an existing uncaptured payment intent. [See the documentation](https://stripe.com/docs/api/payment_intents/capture).",
119
props: {
1210
app,
11+
// eslint-disable-next-line pipedream/props-label, pipedream/props-description
12+
alert: {
13+
type: "alert",
14+
alertType: "info",
15+
content: "Use this Pipedream component to capture funds from an existing PaymentIntent if its status is `requires_capture`. Be aware that uncaptured PaymentIntents will automatically cancel after a certain period (typically 7 days), so ensure timely capture. This process is part of a separate authorization and capture flow for payments. [See the documentation](https://stripe.com/docs/api/payment_intents/capture).",
16+
},
1317
id: {
1418
propDefinition: [
1519
app,
16-
"payment_intent",
20+
"paymentIntent",
1721
],
1822
optional: false,
1923
},
20-
amount_to_capture: {
24+
amountToCapture: {
25+
description: "The amount to capture from the PaymentIntent, which must be less than or equal to the original amount. Defaults to the full `amount_capturable` if it's not provided.",
2126
propDefinition: [
2227
app,
2328
"amount",
2429
],
25-
description: "The amount to capture, which must be less than or equal to the original " +
26-
"amount. Any additional amount will be automatically refunded. Defaults to the full " +
27-
"`amount_capturable` if not provided.",
2830
},
29-
advanced: {
31+
metadata: {
3032
propDefinition: [
3133
app,
3234
"metadata",
3335
],
34-
label: "Advanced Options",
35-
description: "Specify less-common options that you require. See [Capture a PaymentIntent]" +
36-
"(https://stripe.com/docs/api/payment_intents/capture) for a list of supported options.",
36+
},
37+
applicationFeeAmount: {
38+
type: "integer",
39+
label: "Application Fee Amount",
40+
description: "The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner’s Stripe account. The amount of the application fee collected will be capped at the total amount captured. For more information, see the PaymentIntents use case for connected accounts.",
41+
optional: true,
42+
},
43+
finalCapture: {
44+
type: "boolean",
45+
label: "Final Capture",
46+
description: "When capturing a PaymentIntent, setting final_capture to false notifies Stripe to not release the remaining uncaptured funds to make sure that they're captured in future requests. You can only use this setting when multicapture is available for PaymentIntents.",
47+
optional: true,
48+
},
49+
statementDescriptor: {
50+
propDefinition: [
51+
app,
52+
"statementDescriptor",
53+
],
54+
},
55+
statementDescriptorSuffix: {
56+
type: "string",
57+
label: "Statement Descriptor Suffix",
58+
description: "Provides information about a card charge. Concatenated to the account’s statement descriptor prefix to form the complete statement descriptor that appears on the customer’s statement.",
59+
optional: true,
60+
},
61+
transferDataAmount: {
62+
type: "integer",
63+
label: "Transfer Data Amount",
64+
description: "The amount that will be transferred automatically when a charge succeeds.",
65+
optional: true,
3766
},
3867
},
3968
async run({ $ }) {
40-
const params = pick(this, [
41-
"amount_to_capture",
42-
]);
43-
const resp = await this.app.sdk().paymentIntents.capture(this.id, {
44-
...params,
45-
...this.advanced,
69+
const {
70+
id,
71+
amountToCapture,
72+
metadata,
73+
applicationFeeAmount,
74+
finalCapture,
75+
statementDescriptor,
76+
statementDescriptorSuffix,
77+
transferDataAmount,
78+
} = this;
79+
80+
const resp = await this.app.sdk().paymentIntents.capture(id, {
81+
amount_to_capture: amountToCapture,
82+
metadata,
83+
application_fee_amount: applicationFeeAmount,
84+
final_capture: finalCapture,
85+
statement_descriptor: statementDescriptor,
86+
statement_descriptor_suffix: statementDescriptorSuffix,
87+
...(transferDataAmount && {
88+
transfer_data: {
89+
amount: transferDataAmount,
90+
},
91+
}),
4692
});
47-
$.export("$summary", `Successfully captured ${params.amount_to_capture
48-
? params.amount_to_capture
93+
$.export("$summary", `Successfully captured ${amountToCapture
94+
? amountToCapture
4995
: `the full ${resp.amount_capturable}`} from the payment intent`);
5096
return resp;
5197
},

0 commit comments

Comments
 (0)