Skip to content

Commit f3bac44

Browse files
committed
Merge remote-tracking branch 'origin/master' into connect/workflow-sdk-docs
2 parents 9b798d5 + 23e9ec1 commit f3bac44

File tree

26 files changed

+988
-88
lines changed

26 files changed

+988
-88
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import app from "../../adyen.app.mjs";
2+
3+
export default {
4+
key: "adyen-cancel-payment",
5+
name: "Cancel Payment",
6+
description: "Cancels a payment that has not yet been captured. [See the documentation](https://docs.adyen.com/api-explorer/checkout/71/post/payments/(paymentpspreference)/cancels)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
paymentPspReference: {
12+
propDefinition: [
13+
app,
14+
"paymentPspReference",
15+
],
16+
},
17+
merchantAccount: {
18+
propDefinition: [
19+
app,
20+
"merchantAccount",
21+
],
22+
},
23+
},
24+
methods: {
25+
cancelPayment({
26+
paymentPspReference, data,
27+
} = {}) {
28+
return this.app.getCheckoutAPI()
29+
.ModificationsApi
30+
.cancelAuthorisedPaymentByPspReference(paymentPspReference, data);
31+
},
32+
},
33+
async run({ $ }) {
34+
const {
35+
cancelPayment,
36+
paymentPspReference,
37+
merchantAccount,
38+
} = this;
39+
40+
const response = await cancelPayment({
41+
paymentPspReference,
42+
data: {
43+
merchantAccount,
44+
},
45+
});
46+
$.export("$summary", "Successfully cancelled payment.");
47+
return response;
48+
},
49+
};
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import app from "../../adyen.app.mjs";
2+
3+
export default {
4+
key: "adyen-capture-payment",
5+
name: "Capture Payment",
6+
description: "Captures an authorized payment. This is typically used for delayed capture scenarios, such as when you need to verify the order before capturing the funds.",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
paymentPspReference: {
12+
propDefinition: [
13+
app,
14+
"paymentPspReference",
15+
],
16+
},
17+
merchantAccount: {
18+
propDefinition: [
19+
app,
20+
"merchantAccount",
21+
],
22+
},
23+
amountCurrency: {
24+
propDefinition: [
25+
app,
26+
"amountCurrency",
27+
],
28+
},
29+
amountValue: {
30+
propDefinition: [
31+
app,
32+
"amountValue",
33+
],
34+
},
35+
},
36+
methods: {
37+
capturePayment({
38+
paymentPspReference, data,
39+
} = {}) {
40+
return this.app.getCheckoutAPI()
41+
.ModificationsApi
42+
.captureAuthorisedPayment(paymentPspReference, data);
43+
},
44+
},
45+
async run({ $ }) {
46+
const {
47+
capturePayment,
48+
paymentPspReference,
49+
merchantAccount,
50+
amountCurrency,
51+
amountValue,
52+
} = this;
53+
54+
const response = await capturePayment({
55+
paymentPspReference,
56+
data: {
57+
merchantAccount,
58+
amount: {
59+
currency: amountCurrency,
60+
value: amountValue,
61+
},
62+
},
63+
});
64+
65+
$.export("$summary", "Successfully captured payment.");
66+
return response;
67+
},
68+
};
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
import app from "../../adyen.app.mjs";
2+
3+
export default {
4+
key: "adyen-create-payment",
5+
name: "Create Payment",
6+
description: "Creates a payment for a shopper. [See the documentation](https://docs.adyen.com/api-explorer/Checkout/71/post/payments)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
merchantAccount: {
12+
propDefinition: [
13+
app,
14+
"merchantAccount",
15+
],
16+
},
17+
amountCurrency: {
18+
propDefinition: [
19+
app,
20+
"amountCurrency",
21+
],
22+
},
23+
amountValue: {
24+
propDefinition: [
25+
app,
26+
"amountValue",
27+
],
28+
},
29+
reference: {
30+
type: "string",
31+
label: "Reference",
32+
description: "The reference to uniquely identify a payment. This reference is used in all communication with you about the payment status. We recommend using a unique value per payment; however, it is not a requirement. If you need to provide multiple references for a transaction, separate them with hyphens (`-`). Maximum length: 80 characters.",
33+
},
34+
returnUrl: {
35+
type: "string",
36+
label: "Return URL",
37+
description: "The URL to return to in case of a redirection. The format depends on the channel. For more information refer the [documentation](https://docs.adyen.com/api-explorer/Checkout/71/post/payments#request-returnUrl).",
38+
},
39+
paymentMethodType: {
40+
propDefinition: [
41+
app,
42+
"paymentMethodType",
43+
({ merchantAccount }) => ({
44+
merchantAccount,
45+
}),
46+
],
47+
},
48+
paymentMethodDetails: {
49+
type: "object",
50+
label: "Payment Method Details",
51+
description: "The payment method details object required for submitting additional payment details. Should contain relevant payment details fields. For more information refer the [documentation](https://docs.adyen.com/api-explorer/Checkout/71/post/payments#request-paymentMethod).",
52+
optional: true,
53+
},
54+
},
55+
methods: {
56+
createPayment({ data } = {}) {
57+
return this.app.getCheckoutAPI()
58+
.PaymentsApi
59+
.payments(data);
60+
},
61+
},
62+
async run({ $ }) {
63+
const {
64+
createPayment,
65+
amountCurrency,
66+
amountValue,
67+
merchantAccount,
68+
reference,
69+
returnUrl,
70+
paymentMethodType,
71+
paymentMethodDetails,
72+
} = this;
73+
74+
const response = await createPayment({
75+
data: {
76+
amount: {
77+
currency: amountCurrency,
78+
value: amountValue,
79+
},
80+
merchantAccount,
81+
reference,
82+
returnUrl,
83+
paymentMethod: {
84+
...paymentMethodDetails,
85+
type: paymentMethodType,
86+
},
87+
},
88+
});
89+
$.export("$summary", "Successfully created payment.");
90+
return response;
91+
},
92+
};
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import app from "../../adyen.app.mjs";
2+
3+
export default {
4+
key: "adyen-refund-payment",
5+
name: "Refund Payment",
6+
description: "Refunds a captured payment. [See the documentation](https://docs.adyen.com/api-explorer/checkout/71/post/payments/(paymentpspreference)/refunds)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
paymentPspReference: {
12+
propDefinition: [
13+
app,
14+
"paymentPspReference",
15+
],
16+
},
17+
merchantAccount: {
18+
propDefinition: [
19+
app,
20+
"merchantAccount",
21+
],
22+
},
23+
amountCurrency: {
24+
propDefinition: [
25+
app,
26+
"amountCurrency",
27+
],
28+
},
29+
amountValue: {
30+
propDefinition: [
31+
app,
32+
"amountValue",
33+
],
34+
},
35+
},
36+
methods: {
37+
refundPayment({
38+
paymentPspReference, data,
39+
} = {}) {
40+
return this.app.getCheckoutAPI()
41+
.ModificationsApi
42+
.refundCapturedPayment(paymentPspReference, data);
43+
},
44+
},
45+
async run({ $ }) {
46+
const {
47+
refundPayment,
48+
paymentPspReference,
49+
merchantAccount,
50+
amountCurrency,
51+
amountValue,
52+
} = this;
53+
54+
const response = await refundPayment({
55+
paymentPspReference,
56+
data: {
57+
merchantAccount,
58+
amount: {
59+
currency: amountCurrency,
60+
value: amountValue,
61+
},
62+
},
63+
});
64+
$.export("$summary", `Successfully refunded payment with PSP Reference \`${response.paymentPspReference}\`.`);
65+
return response;
66+
},
67+
};
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import app from "../../adyen.app.mjs";
2+
import utils from "../../common/utils.mjs";
3+
4+
export default {
5+
key: "adyen-submit-details",
6+
name: "Submit Additional Payment Details",
7+
description: "Submits additional details for a payment. [See the documentation](https://docs.adyen.com/api-explorer/Checkout/71/post/payments/details)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
app,
12+
details: {
13+
type: "object",
14+
label: "Details",
15+
description: "Use this collection to submit the details that were returned as a result of the **Create Payment** action call.",
16+
},
17+
authenticationData: {
18+
type: "string",
19+
label: "Authentication Data",
20+
description: "The authentication data that you received from the 3D Secure 2 SDK.",
21+
optional: true,
22+
},
23+
paymentData: {
24+
type: "string",
25+
label: "Payment Data",
26+
description: "The payment data that you received from the **Create Payment** action call. [See the documentation](https://docs.adyen.com/api-explorer/Checkout/71/post/payments/details#request-paymentData).",
27+
optional: true,
28+
},
29+
},
30+
methods: {
31+
submitAdditionalDetails({ data } = {}) {
32+
return this.app.getCheckoutAPI()
33+
.PaymentsApi
34+
.paymentsDetails(data);
35+
},
36+
},
37+
async run({ $ }) {
38+
const {
39+
submitAdditionalDetails,
40+
details,
41+
authenticationData,
42+
paymentData,
43+
} = this;
44+
45+
const response = await submitAdditionalDetails({
46+
data: {
47+
details: utils.parse(details),
48+
authenticationData: utils.parse(authenticationData),
49+
paymentData,
50+
},
51+
});
52+
$.export("$summary", "Successfully submitted additional payment details.");
53+
return response;
54+
},
55+
};

0 commit comments

Comments
 (0)