-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[Components] adyen #14308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
[Components] adyen #14308
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
components/adyen/actions/cancel-payment/cancel-payment.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
68
components/adyen/actions/capture-payment/capture-payment.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
], | ||
}, | ||
}, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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
92
components/adyen/actions/create-payment/create-payment.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
}); | ||
$.export("$summary", "Successfully created payment."); | ||
return response; | ||
}, | ||
}; |
67 changes: 67 additions & 0 deletions
67
components/adyen/actions/refund-payment/refund-payment.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)", | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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); | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
refundPayment, | ||
paymentPspReference, | ||
merchantAccount, | ||
amountCurrency, | ||
amountValue, | ||
} = this; | ||
|
||
const response = await refundPayment({ | ||
paymentPspReference, | ||
data: { | ||
merchantAccount, | ||
amount: { | ||
currency: amountCurrency, | ||
value: amountValue, | ||
}, | ||
}, | ||
}); | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
$.export("$summary", `Successfully refunded payment with PSP Reference \`${response.paymentPspReference}\`.`); | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return response; | ||
}, | ||
}; |
55 changes: 55 additions & 0 deletions
55
components/adyen/actions/submit-details/submit-details.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.", | ||
}, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
authenticationData: { | ||
type: "string", | ||
label: "Authentication Data", | ||
description: "The authentication data that you received from the 3D Secure 2 SDK.", | ||
optional: true, | ||
}, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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), | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
paymentData, | ||
}, | ||
}); | ||
$.export("$summary", "Successfully submitted additional payment details."); | ||
return response; | ||
}, | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.