Skip to content

Commit

Permalink
Merge branch 'master' into issue-14312
Browse files Browse the repository at this point in the history
  • Loading branch information
luancazarine authored Oct 22, 2024
2 parents bd8cb97 + 6da9785 commit d43e26c
Show file tree
Hide file tree
Showing 88 changed files with 2,765 additions and 117 deletions.
49 changes: 49 additions & 0 deletions components/adyen/actions/cancel-payment/cancel-payment.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import app from "../../adyen.app.mjs";

export default {
key: "adyen-cancel-payment",
name: "Cancel Payment",
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)",
version: "0.0.1",
type: "action",
props: {
app,
paymentPspReference: {
propDefinition: [
app,
"paymentPspReference",
],
},
merchantAccount: {
propDefinition: [
app,
"merchantAccount",
],
},
},
methods: {
cancelPayment({
paymentPspReference, data,
} = {}) {
return this.app.getCheckoutAPI()
.ModificationsApi
.cancelAuthorisedPaymentByPspReference(paymentPspReference, data);
},
},
async run({ $ }) {
const {
cancelPayment,
paymentPspReference,
merchantAccount,
} = this;

const response = await cancelPayment({
paymentPspReference,
data: {
merchantAccount,
},
});
$.export("$summary", "Successfully cancelled payment.");
return response;
},
};
68 changes: 68 additions & 0 deletions components/adyen/actions/capture-payment/capture-payment.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import app from "../../adyen.app.mjs";

export default {
key: "adyen-capture-payment",
name: "Capture Payment",
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.",
version: "0.0.1",
type: "action",
props: {
app,
paymentPspReference: {
propDefinition: [
app,
"paymentPspReference",
],
},
merchantAccount: {
propDefinition: [
app,
"merchantAccount",
],
},
amountCurrency: {
propDefinition: [
app,
"amountCurrency",
],
},
amountValue: {
propDefinition: [
app,
"amountValue",
],
},
},
methods: {
capturePayment({
paymentPspReference, data,
} = {}) {
return this.app.getCheckoutAPI()
.ModificationsApi
.captureAuthorisedPayment(paymentPspReference, data);
},
},
async run({ $ }) {
const {
capturePayment,
paymentPspReference,
merchantAccount,
amountCurrency,
amountValue,
} = this;

const response = await capturePayment({
paymentPspReference,
data: {
merchantAccount,
amount: {
currency: amountCurrency,
value: amountValue,
},
},
});

$.export("$summary", "Successfully captured payment.");
return response;
},
};
92 changes: 92 additions & 0 deletions components/adyen/actions/create-payment/create-payment.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import app from "../../adyen.app.mjs";

export default {
key: "adyen-create-payment",
name: "Create Payment",
description: "Creates a payment for a shopper. [See the documentation](https://docs.adyen.com/api-explorer/Checkout/71/post/payments)",
version: "0.0.1",
type: "action",
props: {
app,
merchantAccount: {
propDefinition: [
app,
"merchantAccount",
],
},
amountCurrency: {
propDefinition: [
app,
"amountCurrency",
],
},
amountValue: {
propDefinition: [
app,
"amountValue",
],
},
reference: {
type: "string",
label: "Reference",
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.",
},
returnUrl: {
type: "string",
label: "Return URL",
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).",
},
paymentMethodType: {
propDefinition: [
app,
"paymentMethodType",
({ merchantAccount }) => ({
merchantAccount,
}),
],
},
paymentMethodDetails: {
type: "object",
label: "Payment Method Details",
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).",
optional: true,
},
},
methods: {
createPayment({ data } = {}) {
return this.app.getCheckoutAPI()
.PaymentsApi
.payments(data);
},
},
async run({ $ }) {
const {
createPayment,
amountCurrency,
amountValue,
merchantAccount,
reference,
returnUrl,
paymentMethodType,
paymentMethodDetails,
} = this;

const response = await createPayment({
data: {
amount: {
currency: amountCurrency,
value: amountValue,
},
merchantAccount,
reference,
returnUrl,
paymentMethod: {
...paymentMethodDetails,
type: paymentMethodType,
},
},
});
$.export("$summary", "Successfully created payment.");
return response;
},
};
67 changes: 67 additions & 0 deletions components/adyen/actions/refund-payment/refund-payment.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import app from "../../adyen.app.mjs";

export default {
key: "adyen-refund-payment",
name: "Refund Payment",
description: "Refunds a captured payment. [See the documentation](https://docs.adyen.com/api-explorer/checkout/71/post/payments/(paymentpspreference)/refunds)",
version: "0.0.1",
type: "action",
props: {
app,
paymentPspReference: {
propDefinition: [
app,
"paymentPspReference",
],
},
merchantAccount: {
propDefinition: [
app,
"merchantAccount",
],
},
amountCurrency: {
propDefinition: [
app,
"amountCurrency",
],
},
amountValue: {
propDefinition: [
app,
"amountValue",
],
},
},
methods: {
refundPayment({
paymentPspReference, data,
} = {}) {
return this.app.getCheckoutAPI()
.ModificationsApi
.refundCapturedPayment(paymentPspReference, data);
},
},
async run({ $ }) {
const {
refundPayment,
paymentPspReference,
merchantAccount,
amountCurrency,
amountValue,
} = this;

const response = await refundPayment({
paymentPspReference,
data: {
merchantAccount,
amount: {
currency: amountCurrency,
value: amountValue,
},
},
});
$.export("$summary", `Successfully refunded payment with PSP Reference \`${response.paymentPspReference}\`.`);
return response;
},
};
55 changes: 55 additions & 0 deletions components/adyen/actions/submit-details/submit-details.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import app from "../../adyen.app.mjs";
import utils from "../../common/utils.mjs";

export default {
key: "adyen-submit-details",
name: "Submit Additional Payment Details",
description: "Submits additional details for a payment. [See the documentation](https://docs.adyen.com/api-explorer/Checkout/71/post/payments/details)",
version: "0.0.1",
type: "action",
props: {
app,
details: {
type: "object",
label: "Details",
description: "Use this collection to submit the details that were returned as a result of the **Create Payment** action call.",
},
authenticationData: {
type: "string",
label: "Authentication Data",
description: "The authentication data that you received from the 3D Secure 2 SDK.",
optional: true,
},
paymentData: {
type: "string",
label: "Payment Data",
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).",
optional: true,
},
},
methods: {
submitAdditionalDetails({ data } = {}) {
return this.app.getCheckoutAPI()
.PaymentsApi
.paymentsDetails(data);
},
},
async run({ $ }) {
const {
submitAdditionalDetails,
details,
authenticationData,
paymentData,
} = this;

const response = await submitAdditionalDetails({
data: {
details: utils.parse(details),
authenticationData: utils.parse(authenticationData),
paymentData,
},
});
$.export("$summary", "Successfully submitted additional payment details.");
return response;
},
};
Loading

0 comments on commit d43e26c

Please sign in to comment.