Skip to content
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

MOL-718 document hooks in plugin #649

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"johnpbloch/wordpress-core": "^5.0",
"fzaninotto/faker": "^1.9@dev",
"inpsyde/php-coding-standards": "^1.0.0",
"vimeo/psalm": "^4.8"
"vimeo/psalm": "^4.8",
"pronamic/wp-documentor": "dev-main"
},
"autoload": {
"psr-4": {
Expand Down
265 changes: 263 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions mollie-payments-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ function initialize()
new PaymentModule(),
new UninstallModule()
];
/**
* Declare your own module to access the plugin's container data.
*
* The module must implement the ServiceModule or ExecutableModule interface
* from the composer package "inpsyde/modularity"
*
* @since 7.0.4
*
* @param array $modules The array of declared modules.
*/
$modules = apply_filters('mollie_wc_plugin_modules', $modules);
$bootstrap->boot(...$modules);
} catch (Throwable $throwable) {
Expand Down
36 changes: 32 additions & 4 deletions src/Gateway/MolliePaymentGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,17 @@ public function initIcon()
{
if ($this->paymentMethod->shouldDisplayIcon()) {
$defaultIcon = $this->paymentMethod->getIconUrl();
$this->icon = apply_filters(
$this->id . '_icon_url',
$defaultIcon
);

/**
* Overwrite the returned icon markup.
*
* A markup of the form '<img src="{your-icon-url-here}" class="mollie-gateway-icon" />' is expected
*
* @since 6.3.0
*
* @param string $defaultIcon the icon img markup.
*/
$this->icon = apply_filters($this->id . '_icon_url', $defaultIcon);
}
}

Expand Down Expand Up @@ -376,6 +383,13 @@ protected function getSupportedCurrencies(): array
'USD',
];

/**
* Overwrite the array of supported currencies for every gateway.
*
* @since 2.0.0
*
* @param array $default array of the default supported currencies.
*/
return apply_filters(
'woocommerce_' . $this->id . '_supported_currencies',
$default
Expand Down Expand Up @@ -622,6 +636,13 @@ public function getReturnRedirectUrlForOrder(WC_Order $order): string
$hookReturnPaymentStatus = 'failed';
}
}
/**
* Action hook after customer returned from payment.
*
* @since 5.0.0
*
* @param WC_Order $order The WooCommerce order.
*/
do_action(
$this->pluginId . '_customer_return_payment_'
. $hookReturnPaymentStatus,
Expand Down Expand Up @@ -1087,6 +1108,13 @@ public function getBillingCountry()
$fallbackToShopCountry = wc_get_base_location()['country'];
$billingCountry = $customerExistsAndHasCountry? WC()->customer->get_billing_country() : $fallbackToShopCountry;

/**
* Overwrite the billing country assigned to the customer.
*
* @since 5.0.5
*
* @param string $billingCountry billing country of the customer.
*/
$billingCountry = apply_filters(
$this->pluginId
. '_is_available_billing_country_for_payment_gateways',
Expand Down
Loading