-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[Components] xendit #16278 #16385
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] xendit #16278 #16385
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d78460b
Adding redirects for /components child pages (#16381)
dannyroosevelt 7842943
[Components] xendit #16278
luancazarine 89fd64e
pnpm update
luancazarine 2fc8618
some adjusts
luancazarine 40182e8
some adjusts
luancazarine 2c7b260
pnpm update
luancazarine 533ec93
some adjusts
luancazarine 21ceb70
Merge branch 'master' into issue-16278
luancazarine 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
This file was deleted.
Oops, something went wrong.
174 changes: 174 additions & 0 deletions
174
components/xendit/actions/create-invoice/create-invoice.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,174 @@ | ||
| import { | ||
| INVOICE_NOTIFICATION_OPTIONS, | ||
| LOCALE_OPTIONS, | ||
| } from "../../common/constants.mjs"; | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
| import xendit from "../../xendit.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "xendit-create-invoice", | ||
| name: "Create Invoice", | ||
| version: "0.0.1", | ||
| description: "Create a new invoice on Xendit platform [See the documentation](https://developers.xendit.co/api-reference/#create-invoice)", | ||
| type: "action", | ||
| props: { | ||
| xendit, | ||
| externalId: { | ||
| type: "string", | ||
| label: "External ID", | ||
| description: "ID of your choice (typically the unique identifier of an invoice in your system).", | ||
| }, | ||
| amount: { | ||
| type: "string", | ||
| label: "Amount", | ||
| description: "Amount on the invoice. Min and max amounts are stated [here](https://docs.xendit.co/xeninvoice/payment-channels). The amount should be inclusive of any fees and or items that you may choose to include. If there is a difference between this amount and the sum of the price in the `items` parameters and or `fees` parameter, Xendit will refer to this amount parameter to create invoice. Do take note: if the currency or default currency is IDR and the amount includes decimals (e.g IDR 4550.50), the amount will be truncated to IDR 4550.", | ||
| }, | ||
| description: { | ||
| type: "string", | ||
| label: "Description", | ||
| description: "Description of invoice - you can use this field to list what items are being paid for, or anything else of your choice that describes the function of the invoice.", | ||
| optional: true, | ||
| }, | ||
| givenNames: { | ||
| type: "string", | ||
| label: "Given Names", | ||
| description: "Given name of the customer", | ||
| optional: true, | ||
| }, | ||
| surname: { | ||
| type: "string", | ||
| label: "Surname", | ||
| description: "Surname of the customer", | ||
| optional: true, | ||
| }, | ||
| email: { | ||
| type: "string", | ||
| label: "Email", | ||
| description: "Email address of the customer", | ||
| optional: true, | ||
| }, | ||
| mobileNumber: { | ||
| type: "string", | ||
| label: "Mobile Number", | ||
| description: "Mobile phone number of the customer in E164 format", | ||
| optional: true, | ||
| }, | ||
| addresses: { | ||
| type: "string[]", | ||
| label: "Addresses", | ||
| description: "A list of objects of customer's addresses", | ||
| optional: true, | ||
| }, | ||
| invoiceCreatedNotification: { | ||
| type: "string[]", | ||
| label: "Invoice Created Notification", | ||
| description: "Specify which channel you want to notify your end customer through when you create a payment/invoice. If you do not specify values for this object, your end user will not be notified for this notification type.", | ||
| options: INVOICE_NOTIFICATION_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| invoiceReminderNotification: { | ||
| type: "string[]", | ||
| label: "Invoice Reminder Notification", | ||
| description: "Specify which channel you want to notify your end customer through when you want to remind your customer to complete their payment. If you do not specify values for this object, your end user will not be notified for this notification type.", | ||
| options: INVOICE_NOTIFICATION_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| invoicePaidNotification: { | ||
| type: "string[]", | ||
| label: "Invoice Paid Notification", | ||
| description: "Specify which channel you want to notify your end customer through when they have successfully completed payment. If you do not specify values for this object, your end user will not be notified for this notification type.", | ||
| options: INVOICE_NOTIFICATION_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| invoiceDuration: { | ||
| type: "integer", | ||
| label: "Invoice Duration", | ||
| description: "Duration of time that the end customer is given to pay the invoice before expiration (in seconds, since creation). Default is 24 hours (86,400 seconds).", | ||
| optional: true, | ||
| }, | ||
| successRedirectUrl: { | ||
| type: "string", | ||
| label: "Success Redirect URL", | ||
| description: "URL to redirect the customer to after successful payment.", | ||
| optional: true, | ||
| }, | ||
| failureRedirectUrl: { | ||
| type: "string", | ||
| label: "Failure Redirect URL", | ||
| description: "URL to redirect the customer to after failed payment.", | ||
| optional: true, | ||
| }, | ||
| paymentMethods: { | ||
| propDefinition: [ | ||
| xendit, | ||
| "paymentMethods", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| currency: { | ||
| type: "string", | ||
| label: "Currency", | ||
| description: "Currency of the amount that you created.", | ||
| optional: true, | ||
| }, | ||
| locale: { | ||
| type: "string", | ||
| label: "Locale", | ||
| description: "The default language to display", | ||
| options: LOCALE_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| items: { | ||
| type: "string[]", | ||
| label: "Items", | ||
| description: "Array of items JSON objects describing the item(s) purchased. Max array size: 75. Mandatory for PayLater payment method. [See the documentation](https://developers.xendit.co/api-reference/#create-invoice) for further details.", | ||
| optional: true, | ||
| }, | ||
| fees: { | ||
| type: "string[]", | ||
| label: "Fees", | ||
| description: "Array of items JSON objects describing the fee(s) that you charge to your end customer. This can be an admin fee, logistics fee, etc. This amount will be included in the total invoice amount and will be transferred to your balance when the transaction settles. Max array size: 10. [See the documentation](https://developers.xendit.co/api-reference/#create-invoice) for further details.", | ||
| optional: true, | ||
| }, | ||
| metadata: { | ||
| type: "object", | ||
| label: "Metadata", | ||
| description: "An object containing any additional information you want to include with the invoice. This will be returned in the response and can be used for tracking or reporting purposes.", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.xendit.createInvoice({ | ||
| $, | ||
| data: { | ||
| external_id: this.externalId, | ||
| amount: this.amount, | ||
| description: this.description, | ||
| customer: { | ||
| given_names: this.givenNames, | ||
| surname: this.surname, | ||
| email: this.email, | ||
| mobile_number: this.mobileNumber, | ||
| addresses: parseObject(this.addresses), | ||
| }, | ||
| customer_notification_preference: { | ||
| invoice_created: parseObject(this.invoiceCreatedNotification), | ||
| invoice_reminder: parseObject(this.invoiceReminderNotification), | ||
| invoice_paid: parseObject(this.invoicePaidNotification), | ||
| }, | ||
| invoice_duration: this.invoiceDuration, | ||
| success_redirect_url: this.successRedirectUrl, | ||
| failure_redirect_url: this.failureRedirectUrl, | ||
| payment_methods: parseObject(this.paymentMethods), | ||
| locale: this.locale, | ||
| items: parseObject(this.items), | ||
| fees: parseObject(this.fees), | ||
| currency: this.currency, | ||
| metadata: this.metadata, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `A new invoice with ID: ${response.id} was successfully created!`); | ||
| return response; | ||
| }, | ||
| }; |
105 changes: 105 additions & 0 deletions
105
components/xendit/actions/create-payout/create-payout.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,105 @@ | ||
| import xendit from "../../xendit.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "xendit-create-payout", | ||
| name: "Create Payout", | ||
| version: "0.0.1", | ||
| description: "Create a new payout on Xendit platform [See the documentation](https://developers.xendit.co/api-reference/#create-payout)", | ||
| type: "action", | ||
| props: { | ||
| xendit, | ||
| referenceId: { | ||
| type: "string", | ||
| label: "Reference ID", | ||
| description: "A client defined payout identifier. This is the ID assigned to the payout on your system, such as a transaction or order ID. Does not need to be unique.", | ||
| }, | ||
| channelCode: { | ||
| type: "string", | ||
| label: "Channel Code", | ||
| description: "Channel code of destination bank, e-wallet or OTC channel. List of supported channels can be found [here](https://docs.xendit.co/xendisburse/channel-codes)", | ||
| }, | ||
| accountHolderName: { | ||
| type: "string", | ||
| label: "Account Holder Name", | ||
| description: "Name of account holder as per the bank or e-wallet's records. Needs to match the registered account name exactly.", | ||
| }, | ||
| accountNumber: { | ||
| type: "string", | ||
| label: "Account Number", | ||
| description: "Account number of destination. Mobile numbers for e-wallet accounts.", | ||
| }, | ||
| accountType: { | ||
| type: "string", | ||
| label: "Account Type", | ||
| description: "Account type of the destination for currencies and channels that supports proxy transfers (ie: Using mobile number as account number)", | ||
| optional: true, | ||
| }, | ||
| amount: { | ||
| type: "string", | ||
| label: "Amount", | ||
| description: "Amount to be sent to the destination account. Should be a multiple of the minimum increment for the selected channel.", | ||
| }, | ||
| description: { | ||
| type: "string", | ||
| label: "Description", | ||
| description: "Description to send with the payout. The recipient may see this e.g., in their bank statement (if supported) or in email receipts we send on your behalf.", | ||
| optional: true, | ||
| }, | ||
| currency: { | ||
| type: "string", | ||
| label: "Currency", | ||
| description: "ISO 4217 Currency Code.", | ||
| optional: true, | ||
| }, | ||
| emailTo: { | ||
| type: "string[]", | ||
| label: "Email To", | ||
| description: "A list of email addresses to receive the payout details upon successful payout. **Maximum of three email addresses**.", | ||
| optional: true, | ||
| }, | ||
| emailCc: { | ||
| type: "string[]", | ||
| label: "Email Cc", | ||
| description: "A list of email addresses to receive the payout details upon successful payout. **Maximum of three email addresses**.", | ||
| optional: true, | ||
| }, | ||
| emailBcc: { | ||
| type: "string[]", | ||
| label: "Email Bcc", | ||
| description: "A list of email addresses to receive a hidden copy of the payout details upon successful payout. **Maximum of three email addresses**.", | ||
| optional: true, | ||
| }, | ||
| metadata: { | ||
| type: "string", | ||
| label: "Metadata", | ||
| description: "A list of objects of metadata key-value pairs. The key must be a string and the value can be a string or number.", | ||
| optional: true, | ||
| }, | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.xendit.createPayout({ | ||
| $, | ||
| data: { | ||
| reference_id: this.referenceId, | ||
| channel_code: this.channelCode, | ||
| channel_properties: { | ||
| account_holder_name: this.accountHolderName, | ||
| account_number: this.accountNumber, | ||
| account_type: this.accountType, | ||
| }, | ||
| amount: this.amount, | ||
| description: this.description, | ||
| currency: this.currency, | ||
| receipt_notification: { | ||
| email_to: this.emailTo, | ||
| email_cc: this.emailCc, | ||
| email_bcc: this.emailBcc, | ||
| }, | ||
| metadata: this.metadata, | ||
| }, | ||
| }); | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| $.export("$summary", `A new payout with ID: ${response.id} was successfully created!`); | ||
| return response; | ||
| }, | ||
| }; | ||
27 changes: 27 additions & 0 deletions
27
components/xendit/actions/get-payment-status/get-payment-status.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,27 @@ | ||
| import xendit from "../../xendit.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "xendit-get-payment-status", | ||
| name: "Get Payment Status", | ||
| description: "Get the status of a payment request. [See the documentation](https://developers.xendit.co/api-reference/payments-api/#get-payment-request-by-id)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| xendit, | ||
| paymentRequestId: { | ||
| propDefinition: [ | ||
| xendit, | ||
| "paymentRequestId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.xendit.getPaymentRequest({ | ||
| $, | ||
| paymentRequestId: this.paymentRequestId, | ||
| }); | ||
|
|
||
| $.export("$summary", `Payment status: ${response.status}`); | ||
| return response; | ||
| }, | ||
| }; |
This file was deleted.
Oops, something went wrong.
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.