{"id":22356793,"url":"https://github.com/ainsleydev/mondu-trade-woocommerce","last_synced_at":"2026-05-14T23:14:44.528Z","repository":{"id":264174581,"uuid":"888946325","full_name":"ainsleydev/mondu-trade-woocommerce","owner":"ainsleydev","description":"Wordpress Plugin for integrating Digital Trade Accounts into WooCommerce via the Mondu API","archived":false,"fork":false,"pushed_at":"2025-01-04T15:13:59.000Z","size":1128,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-31T14:41:35.906Z","etag":null,"topics":["ecommerce","mondu","php","woocommerce","wordpress"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ainsleydev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-15T10:04:01.000Z","updated_at":"2025-01-04T15:13:57.000Z","dependencies_parsed_at":"2024-12-18T10:20:34.662Z","dependency_job_id":"1b66c001-7b03-4df9-b3d4-07b9526289fe","html_url":"https://github.com/ainsleydev/mondu-trade-woocommerce","commit_stats":null,"previous_names":["ainsleydev/mondu-trade-woocommerce"],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ainsleydev%2Fmondu-trade-woocommerce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ainsleydev%2Fmondu-trade-woocommerce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ainsleydev%2Fmondu-trade-woocommerce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ainsleydev%2Fmondu-trade-woocommerce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ainsleydev","download_url":"https://codeload.github.com/ainsleydev/mondu-trade-woocommerce/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245659026,"owners_count":20651526,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ecommerce","mondu","php","woocommerce","wordpress"],"created_at":"2024-12-04T14:12:03.543Z","updated_at":"2025-10-07T16:13:36.956Z","avatar_url":"https://github.com/ainsleydev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg width=\"100\" height=\"25\" src=\"res/logo.svg\" alt=\"Errors Logo\"/\u003e\n\u003ch3 align=\"center\"\u003eMondu Trade Account - WooCommerce\u003c/h3\u003e\n\n![GitHub Release](https://img.shields.io/github/v/release/ainsleydev/mondu-trade-woocommerce?display_name=release\u0026style=flat\u0026cacheSeconds=3600)\n[![GNU General Public License 3.0](https://img.shields.io/github/license/ainsleyclark/squidge.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html)\n[![WP CS Check](https://github.com/ainsleydev/mondu-trade-woocommerce/actions/workflows/lint.yaml/badge.svg?branch=main)](https://github.com/ainsleydev/mondu-trade-woocommerce/actions/workflows/lint.yaml)\n[![Security](https://github.com/ainsleydev/mondu-trade-woocommerce/actions/workflows/security.yaml/badge.svg)](https://github.com/ainsleydev/mondu-trade-woocommerce/actions/workflows/security.yaml)\n[![ainsley.dev](https://img.shields.io/badge/-ainsley.dev-black?style=flat\u0026logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAAB3RJTUUH5wEYDzUGL1b35AAABA1JREFUWMPtlttvFVUUxn977ZnZu+W0tLalqRovBAUvQag0xNQbpSIosSSIJC198YknJfHJxDf9A/DBJ0x8MbFACjVqvCASq6FYFLFBvJAaAomkFCmhHGpLO+PDzOmZzpn2nKP4pCs5ycmevb7vW99as/fA//FfD1XO5p1nzuA3NWJHx5T8cVkRBPHHQfRjd0tzyZhOOQIy27bAxET9zCuvvhY0r2kC/OiRABeAN4BL/4oDr9+3lGszPs7UVNfUE23v3Nj5koszR/8N4EXg3XJckFIFuCLUuU7GWNNtTg25cu4syJx0F+gGMuU4UJKAt1Yux1UKV6TVat1qs+OYwQESMwDQCjwKsOv4iZsnwGihwbiuEek2WjJGhMrvv0UujYKa08VFkQvuTXNgz6oVeCIo1CqrZYMRwTiaytERKn44kRQAsAFYDbBrsLgLRQU0GI919TXKiHQaUQ1GBCuCCQKqjg/MqInrM4lZrgc6A1CljHhRAZ4Ip65m77FaOmbJdehC5vzZr1RAf/T6x6NDwb3/uAVfP74GnwCjZasRuXuWXASj9XQme+3t6erqPcB0IvUuYCsUH8YFBRhRNBqvyYpsn0MeOnG6wvc/9x33MPBjSvp24Na/7cDP7Y/gKIURecZoeTBObkSwWg7UNjaOeFfGLgK9KRAPAM8Wc2FeAUaEWtddbEV2WBFtREXkCqvlghE5yOQkvucBHAR+T0BooAtYXLYDI5sewxWFJ/Kk1bI2UTlW5DMFp03+JPwJ+DQFai2wbiEXUgVUas0trmuslm4jUmGi/tuwDVmrpafBuNPVrs7N/wzQA2QTUJbwYLIlOxB0tOGJ4IhqsSJts+T54Rv0lBz1RFh9ZJA385fOAHAshaMNaAF4OcWFQgeUwhMlrlJdnqjaOLkR8Y2WvbWec9VIQeo4sJf8FZ2LmmgWJO1cmm8I7wc2a6XwosGL+v+rFfnYUYplh47Obo5dvZ8Av6TgbSZ8KxYWEGxZn/u7Dbg9t8HNnwF9S2qqzqVUn4vzQF/K+m3AC1A4jGlId0QC8l0BXKVGrahe//okNR99WZAUc6EXuJiC+zxw57wOxKp/DliRAvCFKDUkxS+YIeBwyvryCHuOC0kH6oBOCj/V/gTeA6aK0oefZj3ARGJdRdh1BQ7Eqm8HHk4B/Q7oB1B9acWFEWtDf5STjGbgqbgLcQcqCQ8NL5EUAPuBsRKqz8UVYB+F97QXcSyatSXoWJ8zvB04AFQlkoaBp4HhhaqPR1TdUsLjeVni8TjhVX0odCAkd4AdKeQAHxIwXEb1Odt+Az5IeVQVcTmhgDBWAhtTNl8G9qGAwKfU2N3SnJvi/RFGMjYCD8UFdACNKRsHgZMA6v0j5ZpAlPtNyvqSiJO/AKik60y0ALlUAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIzLTAxLTI0VDE1OjUzOjA2KzAwOjAwm5vntAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMy0wMS0yNFQxNTo1MzowNiswMDowMOrGXwgAAABXelRYdFJhdyBwcm9maWxlIHR5cGUgaXB0YwAAeJzj8gwIcVYoKMpPy8xJ5VIAAyMLLmMLEyMTS5MUAxMgRIA0w2QDI7NUIMvY1MjEzMQcxAfLgEigSi4A6hcRdPJCNZUAAAAASUVORK5CYII=)](https://ainsley.dev)\n[![Twitter](https://img.shields.io/twitter/follow/ainsleydev)](https://twitter.com/ainsleydev)\n\n\u003c/div\u003e\n\n## Overview\n\nThe Mondu Trade Account - WooCommerce plugin integrates Mondu's Digital Trade Account functionality into your\nWooCommerce store, allowing your customers to apply for and manage trade accounts directly during checkout.\n\n- ✅ **Trade Account Applications**: Let customers apply for a trade account while completing their order.\n- ✅ **Webhook Integration**: Automatically update customer statuses (e.g., accepted, pending, declined) when a customer\n  has applied for a Digital Trade Account.\n- ✅ **Custom Styling and Actions**: Easily extend and customize the checkout experience with hooks and filters. Allowing\n  you to run actions when a buyer has been accepted or declined.\n- ✅ **Admin Management Tools**: Access customer trade account information, logs, and webhook settings from the WordPress\n  admin panel.\n- ✅ **Secure and Compliant**: Fully supports WooCommerce standards and uses secure connections for API communication.\n\n## Installation\n\nYou can either download a the zip file from the releases section or locate it on the WordPress Plugin install page.\n\n## Prerequisites\n\nBefore installing and using the Mondu Trade Account - WooCommerce plugin, ensure your environment meets the following\nrequirements:\n\n- **WordPress**: Requires at least version `6.7`\n- **PHP**: Requires at least version `7.4`\n- **WooCommerce**: Requires at least version `9.4`\n- **Mondu Plugin** Needs to be installed, tested version `3.0.3`\n\n## Backwards Compatibility\n\nThis plugin has direct dependency on the `Mondu Plugin`. Before updating both plugins, always test the new version on a\nstaging environment to ensure compatibility with your customizations, integrations, and WooCommerce setup.\n\nUseful Links:\n\n- [Official GitHub Repository](https://github.com/mondu-ai/bnpl-checkout-woocommerce)\n- [Changelog](https://github.com/mondu-ai/bnpl-checkout-woocommerce/blob/main/changelog.txt)\n\n## Buyer States\n\nThere are a total of 6 buyer states that a user can be in. If you are admin of the WordPress install, you can change\nthese states, but it's recommended not to.\n\n| State       | Explanation                                                                                      |\n|:------------|:-------------------------------------------------------------------------------------------------|\n| `unknown`   | The default status, when no the customer hasn't signed up yet.                                   |\n| `applied`   | Customer has tried to apply for a Trade Account, but the webhook hasn't been triggered.          |\n| `accepted`  | Customer has been approved a Trade Account and should have a buyer limit.                        |\n| `pending`   | Customer is waiting to hear from Mondu if their account has been accepted (Maximum of 48 hours). |\n| `declined`  | Customer has been flat-out refused credit from Mondu.                                            |\n| `cancelled` | Customer exited out of the Mondu Trade Application form.                                         |\n\n## Sandbox\n\nIf you have sandbox mode set on the `Mondu` plugin, you can test the following states with the email addresses listed\nbelow. Note that if an email does not follow this convention, the trade application will fail.\n\n- **`Accepted`**: accepted.good.{random-string}@example.com\n- **`Pending`**: pending.pending-brc.{random-string}@example.com\n- **`Declined`**: declined.bad.{random-string}@example.com\n\nNote that emails are sent via the Mondu internal inbox in sandbox mode, in order to see them, it's best to reach out to\nMondu.\n\n## Webhooks\n\nMondu send buyer webhooks when a user has applied for a Trade Account. The following payload will be provided via this\nwebhook once buyer onboarding requested is processed. See [here](https://docs.mondu.ai/reference/webhooks-overview) for\nmore details.\n\nIf the webhook failed, Mondu will send the webhook in increasing intervals until the `WebhookController` returns an `OK`\nresponse. Mondu will send `6` attempts every minute for all `buyer` and `order` topics until the handler responses with\na OK status code.\n\n**Example Payload**:\n\n```json\n{\n  \"topic\": \"buyer/{TOPIC_NAME}\",\n  \"buyer\": {\n    \"uuid\": \"66e8d234-23b5-1125-9592-d7390f20g01c\",\n    \"state\": \"accepted\",\n    \"external_reference_id\": \"DE-1-1000745773\",\n    \"company_name\": \"2023-02-07T15:14:22.301Z\",\n    \"first_name\": \"John\",\n    \"last_name\": \"Smith\"\n  }\n}\n```\n\n## FAQs\n\n### Is the plugin compatible with the WP block editor?\n\nThe Payment Gateway is not compatible, but the form is, see below for more details.\n\n### How do I allow for signups outside the checkout?\n\nThis plugin adds native support for allowing users to sign up to a Trade Account outside of the checkout. Perfect for\nCTA's or banners.\n\n**Note**: The user must be logged in to perform this action, this is because when Mondu responds to the Trade Account\nrequest, a customer ID is required. Before displaying the form below, ensure your users are logged in by using the\nWordPress `is_user_logged_in()` function.\n\n**Block**:\n\nYou can add the `Mondu Trade Account Form Block` to the block editor, which will output a dynamic form the user can use\nto sign up to the Trade Account.\n\n**Shortcode**:\n\nIf you want to programmatically output the shortcode, you can do so by placing the following code in your page template.\n\n```php\necho do_shortcode('[mondu_trade_account_form]');\n```\n\n---\n\n### How do I know what the status is of a customer?\n\nSimply go to the user's account on WordPress by navigating to `Users` and click on a customer. From there, you should\nsee the following fields:\n\n- `uuid` -\u003e The external UUID that's been assigned from Mondu.\n- `status` -\u003e The buyer status which can be one of `unknown`, `accepted`, pending` or `declined`.\n\n---\n\n### When will Mondu send emails to the customer?\n\n- After the buyer authorises the onboarding process in hosted checkout page.\n- Status change to accepted triggers webhook attempt buyer accepted and the email communication.\n- Status change to declined on webhook buyer declined is sent out.\n\n**It's recommended you still add email triggers for webhooks**, this is described below.\n\n---\n\n### How do I add custom styling to the payment gateway?\n\nThere may be times you want to style the checkout gateway with your own styles. To do this, you can either latch onto\nthe default class name `mondu-trade` or provide your own using a filter.\n\nAn example of this is below:\n\n```php\n/**\n * Adds a custom class to the Mondu Trade Account checkout gateway.\n *\n * @param string $class The existing CSS class for the Mondu Trade Account checkout gateway.\n * @return string The modified CSS class with the custom class name appended.\n */\nfunction add_custom_mondu_trade_account_class($class) {\n    return $class . ' my-class-name';\n}\n\nadd_filter('mondu_trade_account_checkout_class', 'add_custom_mondu_trade_account_class');\n```\n\n---\n\n### How can I get a buyer status of a user?\n\nYou can use the `mondu_trade_get_buyer_status` function to fetch the current status of a customer. This function will\nthrow a `MonduTradeException` if the provided customer ID is invalid. Ensure to handle exceptions properly when calling\nthis function.\n\n**Parameters:**\n\n- `$customer_id (int)`: The ID of the customer whose status you want to retrieve.\n\n**Returns**:\n\n- `string`: The current Mondu Trade Account status of the customer, see above for possible values.\n\n**Throws**:\n\n- `MonduTradeException`: If the customer ID is not valid.\n\n**Example**:\n\nHere’s an example of how to call the `mondu_trade_get_buyer_status` function and handle possible exceptions:\n\n```php\ntry {\n    $customer_id = 123; // Replace with the actual customer ID\n    $status = mondu_trade_get_buyer_status($customer_id);\n\n    echo \"Customer Status: \" . $status;\n} catch (MonduTradeException $e) {\n    echo \"Error: \" . $e-\u003egetMessage();\n}\n```\n\n---\n\n### How can I get a buyer limit of a user?\n\nYou can use the `mondu_trade_get_buyer_limit` function to fetch the buyer limit for a customer. This function will\nthrow a `MonduTradeException` if the provided customer ID is invalid or if the buyer status is not `accepted`. Ensure to\nhandle exceptions properly when calling this function.\n\n**Parameters:**\n\n- `$customer_id (int)`: The ID of the customer whose buyer limit you want to retrieve.\n\n**Returns**:\n\n- `array`: An associative array containing the buyer limit details (see sample below).\n\n**Throws**:\n\n- `MonduTradeException`: If the customer ID is not valid or the buyer status is not `accepted`.\n\n**Example**:\n\nHere’s an example of how to call the `mondu_trade_get_buyer_limit` function and handle possible exceptions:\n\n```php\ntry {\n    $customer_id = 123; // Replace with the actual customer ID\n    $buyer_limit = mondu_trade_get_buyer_limit($customer_id);\n\n    print_r($buyer_limit);\n} catch (MonduTradeException $e) {\n    echo \"Error: \" . $e-\u003egetMessage();\n}\n````\n\n**Sample Output**:\n\n```php\nArray (\n    [purchasing_limit] =\u003e Array (\n        [purchasing_limit_cents] =\u003e 100000\n        [balance_cents] =\u003e 10000\n        [max_purchase_value_cents] =\u003e 90000\n        [max_collections_state] =\u003e no\n    )\n)\n```\n\n---\n\n### How can I run actions when a buyer status has changed?\n\nThere are 4 different actions you can latch onto when Mondu replies with an update after a customer has applied for a\nDigital Trade Account. Below is a list of available actions.\n\n**Example Payload**\n\nBelow is an example of a buyer and topic sent via the actions, see\nthe [Mondu Webhooks Overview](https://docs.mondu.ai/reference/webhooks-overview) for more information\n\n```json\n{\n  \"topic\": \"buyer/{TOPIC_NAME}\",\n  \"buyer\": {\n    \"uuid\": \"66e8d234-23b5-1125-9592-d7390f20g01c\",\n    \"state\": \"accepted\",\n    \"external_reference_id\": \"DE-1-1000745773\",\n    \"company_name\": \"2023-02-07T15:14:22.301Z\",\n    \"first_name\": \"John\",\n    \"last_name\": \"Smith\"\n  }\n}\n```\n\n### General Webhook Action\n\n`mondu_trade_buyer_webhook_received`\n\nTriggered when a webhook related to a buyer is received from Mondu.\n\n**Parameters:**\n\n- `$state (string)`:    The current state of the buyer (e.g. `accepted`, `pending`, `declined`).\n- `$customer_id (int)`: The WooCommerce customer ID.\n- `$buyer (array)`:     The buyer object, see above for an example.\n\n**Example**:\n\n```php\n/**\n * Handles general webhook actions when a buyer webhook is received from Mondu.\n *\n * @param string $state       The current state of the buyer (e.g., accepted, pending, declined).\n * @param int    $customer_id The WooCommerce customer ID.\n * @param array  $buyer       The buyer object containing buyer details.\n * @return void\n */\nfunction handle_mondu_trade_buyer_webhook($state, $customer_id, $buyer) {\n    print_r([\n        'state' =\u003e $state,\n        'customer_id' =\u003e $customer_id,\n        'buyer' =\u003e $buyer,\n    ]);\n}\n\nadd_action('mondu_trade_buyer_webhook_received', 'handle_mondu_trade_buyer_webhook', 10, 3);\n```\n\n### Accepted\n\n`mondu_trade_buyer_accepted`\n\nTriggered when a buyer has been accepted for a Trade Account.\n\n**Parameters:**\n\n- `$customer_id (int)`: The WooCommerce customer ID.\n- `$buyer (array)`:     The buyer object, see above for an example.\n\n**Example**:\n\n```php\n/**\n * Handles the \"accepted\" webhook when a buyer is approved for a Trade Account.\n *\n * @param int   $customer_id The WooCommerce customer ID.\n * @param array $buyer       The buyer object containing buyer details.\n * @return void\n */\nfunction handle_mondu_trade_buyer_accepted($customer_id, $buyer) {\n    print_r([\n        'customer_id' =\u003e $customer_id,\n        'buyer' =\u003e $buyer,\n    ]);\n\n    // You can now retrieve the buyer limit by using the\n    // mondu_trade_get_buyer_limit($customer_id) function.\n}\n\nadd_action('mondu_trade_buyer_accepted', 'handle_mondu_trade_buyer_accepted', 10, 2);\n```\n\n### Pending\n\n`mondu_trade_buyer_pending`\n\nTriggered when a buyer is in a pending state (maximum 48 hours).\n\n**Parameters:**\n\n- `$customer_id (int)`: The WooCommerce customer ID.\n- `$buyer (array)`:     The buyer object, see above for an example.\n\n**Example**:\n\n```php\n/**\n * Handles the \"pending\" webhook when a buyer is in a pending state.\n *\n * @param int   $customer_id The WooCommerce customer ID.\n * @param array $buyer       The buyer object containing buyer details.\n * @return void\n */\nfunction handle_mondu_trade_buyer_pending($customer_id, $buyer) {\n    print_r([\n        'customer_id' =\u003e $customer_id,\n        'buyer' =\u003e $buyer,\n    ]);\n}\n\nadd_action('mondu_trade_buyer_pending', 'handle_mondu_trade_buyer_pending', 10, 2);\n```\n\n### Declined\n\n`mondu_trade_buyer_declined`\n\nTriggered when a buyer has been declined for a Trade Account.\n\n**Parameters:**\n\n- `$customer_id (int)`: The WooCommerce customer ID.\n- `$buyer (array)`:     The buyer object, see above for an example.\n\n**Example**:\n\n```php\n/**\n * Handles the \"declined\" webhook when a buyer is declined for a Trade Account.\n *\n * @param int   $customer_id The WooCommerce customer ID.\n * @param array $buyer       The buyer object containing buyer details.\n * @return void\n */\nfunction handle_mondu_trade_buyer_declined($customer_id, $buyer) {\n    print_r([\n        'customer_id' =\u003e $customer_id,\n        'buyer' =\u003e $buyer,\n    ]);\n}\n\nadd_action('mondu_trade_buyer_declined', 'handle_mondu_trade_buyer_declined', 10, 2);\n```\n\n---\n\n### How can I email a customer after their status has changed?\n\nIn some circumstances, Mondu don't send emails to customers to update them. If you would like to send emails from\nWooCommerce, you can latch onto the `mondu_trade_buyer_webhook_received` webhook and use the `WC` mailer instance.\n\nAn example of how you might do this is below.\n\n```php\n/**\n * Sends an email to the customer when their status changes.\n *\n * @param string $state The buyer state, e.g., \"accepted\", \"pending\", or \"declined\".\n * @param int $customer_id The WooCommerce customer ID.\n * @param array $buyer The buyer object containing buyer details.\n */\nfunction send_email_on_status_change($state, $customer_id, $buyer) {\n    // Retrieve customer data.\n    $customer = new WC_Customer($customer_id);\n    $email = $customer-\u003eget_email();\n\n    // Set email subject and email heading.\n    $subject = sprintf(__('Your Trade Account Status: %s', 'mondu-digital-trade-account'), ucfirst($state));\n    $email_heading = __('Trade Account Status Update', 'mondu-digital-trade-account');\n\n    // Prepare email content.\n    ob_start();\n    ?\u003e\n\n    \u003c!-- Intro --\u003e\n    \u003cp\u003e\u003c?php printf(__('Dear %s,', 'mondu-digital-trade-account'), esc_html($customer-\u003eget_first_name())); ?\u003e\u003c/p\u003e\n    \u003cp\u003e\u003c?php _e('We would like to update you on the current status of your Mondu Digital Trade Account:', 'mondu-digital-trade-account'); ?\u003e\u003c/p\u003e\n    \u003cp\u003e\u003cstrong\u003e\u003c?php printf(__('Status: %s', 'mondu-digital-trade-account'), ucfirst(esc_html($state))); ?\u003e\u003c/strong\u003e\u003c/p\u003e\n\n    \u003c!-- Status --\u003e\n    \u003c?php if ($state === 'accepted') : ?\u003e\n        \u003cp\u003e\u003c?php _e('Congratulations! Your trade account has been approved. You can now enjoy extended purchasing limits and flexible payment terms.', 'mondu-digital-trade-account'); ?\u003e\u003c/p\u003e\n    \u003c?php elseif ($state === 'pending') : ?\u003e\n        \u003cp\u003e\u003c?php _e('Your application is under review. We will notify you once a decision has been made.', 'mondu-digital-trade-account'); ?\u003e\u003c/p\u003e\n    \u003c?php elseif ($state === 'declined') : ?\u003e\n        \u003cp\u003e\u003c?php _e('Unfortunately, your trade account application was not approved. Feel free to reach out to our support team for assistance.', 'mondu-digital-trade-account'); ?\u003e\u003c/p\u003e\n    \u003c?php endif; ?\u003e\n\n    \u003c!-- Footer --\u003e\n    \u003cp\u003e\u003c?php _e('Thank you for choosing us!', 'mondu-digital-trade-account'); ?\u003e\u003c/p\u003e\n\n    \u003c?php\n    $email_body = ob_get_clean();\n\n    // Use WooCommerce mailer.\n    $mailer = WC()-\u003emailer();\n    $email_content = $mailer-\u003ewrap_message($email_heading, $email_body);\n\n    // Send the email.\n    $mailer-\u003esend($email, $subject, $email_content);\n}\n\nadd_action('mondu_trade_buyer_webhook_received', 'send_email_on_status_change', 10, 3);\n```\n\n## Development\n\nBelow are the steps to install the plugin on your local machine for development.\n\n### Setup\n\nTo get setup with plugin, follow the steps listed below.\n\n**1. Clone the Repository**\n\nClone the repository into your `/wp-content/plugins` folder.\n\n```shell\ngit clone https://github.com/ainsleydev/mondu-trade-woocommerce\ncd mondu-trade-woocommerce\n```\n\n**2. Install Dependencies**\n\nEnsure you have Composer and the WP CLI installed on your system. Run the following command to install PHP dependencies.\nThe `make setup` command will install `localtunnel` and `concurrently` on the system to run WordPress with webhook\nfunctionality.\n\n```shell\ncomposer install\nmake setup\n```\n\n**3. Setup Environment**\n\nCreate a `.env` file by copying `.env.example`:\n\n```dotenv\nMONDU_TRADE_ENV=dev\nMONDU_WEBHOOKS_URL=https://mondu-digital-trade-account-woocommerce-ainsleydev.loca.lt\n```\n\n### Running WordPress\n\nThe make file exposes a handy `serve` function which runs Wordpress, a local tunnel and tails the WordPress logs. Feel\nfree to edit this script to suit your needs.\n\n```shell\nmake serve\n```\n\n## Release\n\nTo create a new release, follow the following steps:\n\n1. **Bump Version**\n\n- Run the following command to choose the type of release (patch, minor, or major) and update the version\n  in `mondu-digital-trade-account.php`. You should merge this into `main` before creating a release.\n\n  ```shell\n  make version-bump\n  ```\n\n2. **Release**\n\n- Run this command to compare the local version with the remote version and create a new tag if they differ. It will\n  then create a new tag which will trigger the pipeline which creates a new zip file on GitHub.\n\n  ```shell\n  make release\n  ```\n\nThese steps will bump the version locally, and then create and push a new release tag to GitHub.\n\n## Copyright\n\nAll rights reserved. This plugin and its code are proprietary to ainsley.dev LTD. Unauthorized copying, distribution,\ntransmission, or storage of this plugin, its code, or content, in whole or in part, in any form or by any means, is\nstrictly prohibited without prior written permission.\n\nThis plugin is licensed for use by end-users on their WordPress sites but may not be copied, shared, modified, or\nredistributed in any form, except with explicit written permission from ainsley.dev LTD.\n\n## Licence\n\nCode Copyright 2024 ainsley.dev LTD. Code released under the [GPL-3.0](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fainsleydev%2Fmondu-trade-woocommerce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fainsleydev%2Fmondu-trade-woocommerce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fainsleydev%2Fmondu-trade-woocommerce/lists"}