Version Description
09/01/2018 =
New - Updated required WooCommerce version to 2.2.0
New - Tested with WooCommerce 3.3 beta, no issues found
New - Better message on "Order Received" page for open/pending payments
New - Allow users to set the order status for orders where a payment was cancelled
New - Added support for Polylang Pro (polylang-pro) to getSiteUrlWithLanguage()
New - Updated credit card icon in WooCommerce checkout to show icons for MasterCard, Visa, AMEX, CartaSi, Cartes Bancaires
New - Better way to check if WooCommerce is activated and has correct version (so plugin doesn't de-activate on WooCommerce updates)
New - Redact customer IBAN in notification-mails
New - Update how "Select your bank" is shown in the dropdown for iDEAL and KBC/CBC (and show a default)
Fix - Fix error by making sure order is not removed/exists (in checkPendingPaymentOrdersExpiration)
Fix - Make sure payments cancelled at Mollie are also cancelled in WooCommerce, so customers can select a new payment method
Fix - KBC/CBC: Make sure KBC/CBC is listed as "Automatic Recurring Payment" gateway in WooCommerce
Fix - Fix (no title) showing in settings for SEPA Direct Debit for some new installs
Fix - Fix wrong date formatting shown for bank transfer instructions, thank you profoX!
Fix - Typo in SEPA Direct Debit description, thank you Yame-!
Fix - It's possible to set the initial status of bank transfer to pending instead of on-hold, but in that case the payment instructions would not be shown on the Order Received page (missing in condition)
Fix - Make sure webhook processing for Paid doesn't run on status PaidOut
Fix - Improve orderNeedsPayment so there are less false-positives if users use 3PD plugins to change the order status too early
Fix - Add WC_Subscriptions_Manager::activate_subscriptions_for_order to make sure subscriptions are always activated when payment is paid, independent of order status
Release Info
Developer | davdebcom |
Plugin | Mollie Payments for WooCommerce |
Version | 2.8.0 |
Comparing to | |
See all releases |
Code changes from version 2.7.0 to 2.8.0
- assets/images/creditcard.png +0 -0
- includes/mollie/wc/gateway/abstract.php +179 -39
- includes/mollie/wc/gateway/abstractseparecurring.php +12 -8
- includes/mollie/wc/gateway/banktransfer.php +4 -4
- includes/mollie/wc/gateway/directdebit.php +3 -4
- includes/mollie/wc/gateway/ideal.php +5 -5
- includes/mollie/wc/gateway/kbc.php +4 -4
- includes/mollie/wc/gateway/sofort.php +1 -1
- includes/mollie/wc/helper/settings.php +25 -4
- includes/mollie/wc/plugin.php +7 -1
- mollie-payments-for-woocommerce.php +58 -54
- readme.txt +24 -1
Binary file
|
@@ -70,6 +70,10 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
|
|
70 |
add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
|
71 |
add_action('woocommerce_email_after_order_table', array($this, 'displayInstructions'), 10, 3);
|
72 |
|
|
|
|
|
|
|
|
|
73 |
if (!$this->isValidForUse())
|
74 |
{
|
75 |
// Disable gateway if it's not valid for use
|
@@ -214,7 +218,7 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
|
|
214 |
/* translators: Placeholder 1: payment method title. The surrounding %s's Will be replaced by a link to the Mollie profile */
|
215 |
__('%s not enabled in your Mollie profile. You can enabled it by editing your %sMollie profile%s.', 'mollie-payments-for-woocommerce'),
|
216 |
$this->getDefaultTitle(),
|
217 |
-
'<a href="https://www.mollie.com/
|
218 |
'</a>'
|
219 |
);
|
220 |
|
@@ -707,7 +711,7 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
|
|
707 |
{
|
708 |
$order->add_order_note(sprintf(
|
709 |
/* translators: Placeholder 1: payment method title, placeholder 2: payment status, placeholder 3: payment ID */
|
710 |
-
__('%s payment %s (%s).', 'mollie-payments-for-woocommerce'),
|
711 |
$this->method_title,
|
712 |
$payment->status,
|
713 |
$payment->id . ($payment->mode == 'test' ? (' - ' . __('test mode', 'mollie-payments-for-woocommerce')) : '')
|
@@ -736,47 +740,49 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
|
|
736 |
|
737 |
}
|
738 |
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
{
|
745 |
|
746 |
-
|
747 |
-
if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
|
748 |
-
$order_id = $order->id;
|
749 |
-
} else {
|
750 |
-
$order_id = $order->get_id();
|
751 |
-
}
|
752 |
|
753 |
-
|
754 |
-
|
|
|
|
|
|
|
|
|
755 |
|
756 |
-
|
757 |
-
|
758 |
|
759 |
-
|
760 |
-
|
761 |
-
$order->payment_complete($payment->id);
|
762 |
-
}
|
763 |
-
else
|
764 |
-
{
|
765 |
-
$order->payment_complete();
|
766 |
-
}
|
767 |
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
$payment->id . ($payment->mode == 'test' ? (' - ' . __('test mode', 'mollie-payments-for-woocommerce')) : '')
|
774 |
-
));
|
775 |
|
776 |
-
|
777 |
-
|
|
|
|
|
|
|
|
|
|
|
778 |
|
779 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
780 |
|
781 |
/**
|
782 |
* @param $payment
|
@@ -813,9 +819,16 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
|
|
813 |
->unsetActiveMolliePayment( $order_id, $payment->id )
|
814 |
->setCancelledMolliePaymentId( $order_id, $payment->id );
|
815 |
|
|
|
|
|
|
|
816 |
|
817 |
// New order status
|
818 |
-
|
|
|
|
|
|
|
|
|
819 |
|
820 |
// Overwrite plugin-wide
|
821 |
$new_order_status = apply_filters(Mollie_WC_Plugin::PLUGIN_ID . '_order_status_cancelled', $new_order_status);
|
@@ -1117,13 +1130,105 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
|
|
1117 |
return null;
|
1118 |
}
|
1119 |
|
1120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1121 |
* @param WC_Order $order
|
1122 |
* @return bool
|
1123 |
*/
|
1124 |
protected function orderNeedsPayment (WC_Order $order)
|
1125 |
{
|
1126 |
-
|
|
|
|
|
|
|
|
|
|
|
1127 |
{
|
1128 |
return true;
|
1129 |
}
|
@@ -1243,6 +1348,7 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
|
|
1243 |
$slug = ''; // default is NO slug/language
|
1244 |
|
1245 |
if (is_plugin_active('polylang/polylang.php')
|
|
|
1246 |
|| is_plugin_active('mlang/mlang.php')
|
1247 |
|| is_plugin_active('mlanguage/mlanguage.php')
|
1248 |
)
|
@@ -1299,6 +1405,40 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
|
|
1299 |
return !empty($api_key) && preg_match('/^(live|test)_\w+$/', $api_key);
|
1300 |
}
|
1301 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1302 |
/**
|
1303 |
* @return mixed
|
1304 |
*/
|
70 |
add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
|
71 |
add_action('woocommerce_email_after_order_table', array($this, 'displayInstructions'), 10, 3);
|
72 |
|
73 |
+
// Adjust title and text on Order Received page in some cases, see issue #166
|
74 |
+
add_filter( 'the_title', array ( $this, 'onOrderReceivedTitle' ), 10, 2 );
|
75 |
+
add_filter( 'woocommerce_thankyou_order_received_text', array( $this, 'onOrderReceivedText'), 10, 2 );
|
76 |
+
|
77 |
if (!$this->isValidForUse())
|
78 |
{
|
79 |
// Disable gateway if it's not valid for use
|
218 |
/* translators: Placeholder 1: payment method title. The surrounding %s's Will be replaced by a link to the Mollie profile */
|
219 |
__('%s not enabled in your Mollie profile. You can enabled it by editing your %sMollie profile%s.', 'mollie-payments-for-woocommerce'),
|
220 |
$this->getDefaultTitle(),
|
221 |
+
'<a href="https://www.mollie.com/dashboard/settings/profiles" target="_blank">',
|
222 |
'</a>'
|
223 |
);
|
224 |
|
711 |
{
|
712 |
$order->add_order_note(sprintf(
|
713 |
/* translators: Placeholder 1: payment method title, placeholder 2: payment status, placeholder 3: payment ID */
|
714 |
+
__('%s payment %s (%s), not processed.', 'mollie-payments-for-woocommerce'),
|
715 |
$this->method_title,
|
716 |
$payment->status,
|
717 |
$payment->id . ($payment->mode == 'test' ? (' - ' . __('test mode', 'mollie-payments-for-woocommerce')) : '')
|
740 |
|
741 |
}
|
742 |
|
743 |
+
/**
|
744 |
+
* @param WC_Order $order
|
745 |
+
* @param Mollie_API_Object_Payment $payment
|
746 |
+
*/
|
747 |
+
protected function onWebhookPaid( WC_Order $order, Mollie_API_Object_Payment $payment ) {
|
|
|
748 |
|
749 |
+
if ( $payment->isPaid() ) {
|
|
|
|
|
|
|
|
|
|
|
750 |
|
751 |
+
// Get order ID in the correct way depending on WooCommerce version
|
752 |
+
if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
|
753 |
+
$order_id = $order->id;
|
754 |
+
} else {
|
755 |
+
$order_id = $order->get_id();
|
756 |
+
}
|
757 |
|
758 |
+
// Add messages to log
|
759 |
+
Mollie_WC_Plugin::debug( __METHOD__ . ' called for order ' . $order_id );
|
760 |
|
761 |
+
// WooCommerce 2.2.0 has the option to store the Payment transaction id.
|
762 |
+
$woo_version = get_option( 'woocommerce_version', 'Unknown' );
|
|
|
|
|
|
|
|
|
|
|
|
|
763 |
|
764 |
+
if ( version_compare( $woo_version, '2.2.0', '>=' ) ) {
|
765 |
+
$order->payment_complete( $payment->id );
|
766 |
+
} else {
|
767 |
+
$order->payment_complete();
|
768 |
+
}
|
|
|
|
|
769 |
|
770 |
+
$paymentMethodTitle = $this->getPaymentMethodTitle( $payment );
|
771 |
+
$order->add_order_note( sprintf(
|
772 |
+
/* translators: Placeholder 1: payment method title, placeholder 2: payment ID */
|
773 |
+
__( 'Order completed using %s payment (%s).', 'mollie-payments-for-woocommerce' ),
|
774 |
+
$paymentMethodTitle,
|
775 |
+
$payment->id . ( $payment->mode == 'test' ? ( ' - ' . __( 'test mode', 'mollie-payments-for-woocommerce' ) ) : '' )
|
776 |
+
) );
|
777 |
|
778 |
+
// Mark the order as processed and paid via Mollie
|
779 |
+
$this->setOrderPaidAndProcessed( $order );
|
780 |
+
|
781 |
+
// Remove (old) cancelled payments from this order
|
782 |
+
Mollie_WC_Plugin::getDataHelper()->unsetCancelledMolliePaymentId( $order_id );
|
783 |
+
|
784 |
+
}
|
785 |
+
}
|
786 |
|
787 |
/**
|
788 |
* @param $payment
|
819 |
->unsetActiveMolliePayment( $order_id, $payment->id )
|
820 |
->setCancelledMolliePaymentId( $order_id, $payment->id );
|
821 |
|
822 |
+
// What status does the user want to give orders with cancelled payments?
|
823 |
+
$settings_helper = Mollie_WC_Plugin::getSettingsHelper();
|
824 |
+
$order_status_cancelled_payments = $settings_helper->getOrderStatusCancelledPayments();
|
825 |
|
826 |
// New order status
|
827 |
+
if($order_status_cancelled_payments == 'pending' || $order_status_cancelled_payments == null) {
|
828 |
+
$new_order_status = self::STATUS_PENDING;
|
829 |
+
} elseif ($order_status_cancelled_payments == 'cancelled' ) {
|
830 |
+
$new_order_status = self::STATUS_CANCELLED;
|
831 |
+
}
|
832 |
|
833 |
// Overwrite plugin-wide
|
834 |
$new_order_status = apply_filters(Mollie_WC_Plugin::PLUGIN_ID . '_order_status_cancelled', $new_order_status);
|
1130 |
return null;
|
1131 |
}
|
1132 |
|
1133 |
+
/**
|
1134 |
+
* @param WC_Order $order
|
1135 |
+
*/
|
1136 |
+
public function onOrderReceivedTitle( $title, $id ) {
|
1137 |
+
|
1138 |
+
if ( is_order_received_page() && get_the_ID() === $id ) {
|
1139 |
+
global $wp;
|
1140 |
+
|
1141 |
+
$order_id = apply_filters( 'woocommerce_thankyou_order_id', absint( $wp->query_vars['order-received'] ) );
|
1142 |
+
$order_key = apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['key'] ) ? '' : wc_clean( $_GET['key'] ) );
|
1143 |
+
if ( $order_id > 0 ) {
|
1144 |
+
$order = wc_get_order( $order_id );
|
1145 |
+
if ( $order->get_order_key() != $order_key ) {
|
1146 |
+
$order = false;
|
1147 |
+
}
|
1148 |
+
}
|
1149 |
+
|
1150 |
+
$order = Mollie_WC_Plugin::getDataHelper()->getWcOrder( $order );
|
1151 |
+
|
1152 |
+
if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
|
1153 |
+
$order_payment_method = $order->payment_method;
|
1154 |
+
} else {
|
1155 |
+
$order_payment_method = $order->get_payment_method();
|
1156 |
+
}
|
1157 |
+
|
1158 |
+
// Invalid gateway
|
1159 |
+
if ( $this->id !== $order_payment_method ) {
|
1160 |
+
return $title;
|
1161 |
+
}
|
1162 |
+
|
1163 |
+
// Title for cancelled orders
|
1164 |
+
if ( $order->has_status( 'cancelled' ) ) {
|
1165 |
+
$title = __( 'Order cancelled', 'mollie-payments-for-woocommerce' );
|
1166 |
+
|
1167 |
+
return $title;
|
1168 |
+
}
|
1169 |
+
|
1170 |
+
// Checks and title for pending/open orders
|
1171 |
+
if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
|
1172 |
+
$payment = Mollie_WC_Plugin::getDataHelper()->getActiveMolliePayment( $order->id );
|
1173 |
+
} else {
|
1174 |
+
$payment = Mollie_WC_Plugin::getDataHelper()->getActiveMolliePayment( $order->get_id() );
|
1175 |
+
}
|
1176 |
+
|
1177 |
+
// Mollie payment not found or invalid gateway
|
1178 |
+
if ( ! $payment || $payment->method != $this->getMollieMethodId() ) {
|
1179 |
+
return $title;
|
1180 |
+
}
|
1181 |
+
|
1182 |
+
if ( $payment->isOpen() ) {
|
1183 |
+
$title .= __( ', payment pending.', 'mollie-payments-for-woocommerce' );
|
1184 |
+
|
1185 |
+
return $title;
|
1186 |
+
}
|
1187 |
+
|
1188 |
+
}
|
1189 |
+
|
1190 |
+
return $title;
|
1191 |
+
|
1192 |
+
}
|
1193 |
+
|
1194 |
+
/**
|
1195 |
+
* @param WC_Order $order
|
1196 |
+
*/
|
1197 |
+
public function onOrderReceivedText( $text, $order ) {
|
1198 |
+
|
1199 |
+
if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
|
1200 |
+
$order_payment_method = $order->payment_method;
|
1201 |
+
} else {
|
1202 |
+
$order_payment_method = $order->get_payment_method();
|
1203 |
+
}
|
1204 |
+
|
1205 |
+
// Invalid gateway
|
1206 |
+
if ( $this->id !== $order_payment_method ) {
|
1207 |
+
return $text;
|
1208 |
+
}
|
1209 |
+
|
1210 |
+
if ( $order->has_status( 'cancelled' ) ) {
|
1211 |
+
$text = __( 'Your order has been cancelled.', 'mollie-payments-for-woocommerce' );
|
1212 |
+
|
1213 |
+
return $text;
|
1214 |
+
}
|
1215 |
+
|
1216 |
+
return $text;
|
1217 |
+
|
1218 |
+
}
|
1219 |
+
|
1220 |
+
/**
|
1221 |
* @param WC_Order $order
|
1222 |
* @return bool
|
1223 |
*/
|
1224 |
protected function orderNeedsPayment (WC_Order $order)
|
1225 |
{
|
1226 |
+
// Check whether the order is processed and paid via Mollie
|
1227 |
+
if ( ! $this->isOrderPaidAndProcessed( $order ) ) {
|
1228 |
+
return true;
|
1229 |
+
}
|
1230 |
+
|
1231 |
+
if ($order->needs_payment())
|
1232 |
{
|
1233 |
return true;
|
1234 |
}
|
1348 |
$slug = ''; // default is NO slug/language
|
1349 |
|
1350 |
if (is_plugin_active('polylang/polylang.php')
|
1351 |
+
|| is_plugin_active('polylang-pro/polylang-pro.php')
|
1352 |
|| is_plugin_active('mlang/mlang.php')
|
1353 |
|| is_plugin_active('mlanguage/mlanguage.php')
|
1354 |
)
|
1405 |
return !empty($api_key) && preg_match('/^(live|test)_\w+$/', $api_key);
|
1406 |
}
|
1407 |
|
1408 |
+
|
1409 |
+
/**
|
1410 |
+
* @return bool
|
1411 |
+
*/
|
1412 |
+
protected function setOrderPaidAndProcessed( WC_Order $order ) {
|
1413 |
+
|
1414 |
+
if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
|
1415 |
+
$order_id = $order->id;
|
1416 |
+
update_post_meta( $order_id, '_mollie_paid_and_processed', '1' );
|
1417 |
+
} else {
|
1418 |
+
$order->update_meta_data( '_mollie_paid_and_processed', '1' );
|
1419 |
+
$order->save();
|
1420 |
+
}
|
1421 |
+
return true;
|
1422 |
+
}
|
1423 |
+
|
1424 |
+
|
1425 |
+
/**
|
1426 |
+
* @return bool
|
1427 |
+
*/
|
1428 |
+
protected function isOrderPaidAndProcessed( WC_Order $order ) {
|
1429 |
+
|
1430 |
+
if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
|
1431 |
+
$order_id = $order->id;
|
1432 |
+
$paid_and_processed = get_post_meta( $order_id, '_mollie_paid_and_processed', $single = true );
|
1433 |
+
} else {
|
1434 |
+
$paid_and_processed = $order->get_meta( '_mollie_paid_and_processed', true );
|
1435 |
+
}
|
1436 |
+
|
1437 |
+
return $paid_and_processed;
|
1438 |
+
|
1439 |
+
}
|
1440 |
+
|
1441 |
+
|
1442 |
/**
|
1443 |
* @return mixed
|
1444 |
*/
|
@@ -136,14 +136,18 @@ abstract class Mollie_WC_Gateway_AbstractSepaRecurring extends Mollie_WC_Gateway
|
|
136 |
*/
|
137 |
protected function onWebhookPaid(WC_Order $order, Mollie_API_Object_Payment $payment)
|
138 |
{
|
139 |
-
|
140 |
-
|
141 |
-
if (
|
142 |
-
$this->
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
|
|
|
|
|
|
|
|
147 |
}
|
148 |
}
|
149 |
}
|
136 |
*/
|
137 |
protected function onWebhookPaid(WC_Order $order, Mollie_API_Object_Payment $payment)
|
138 |
{
|
139 |
+
if ( $payment->isPaid() ) {
|
140 |
+
parent::onWebhookPaid( $order, $payment );
|
141 |
+
if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
|
142 |
+
if ( $this->is_subscription( $order->id ) ) {
|
143 |
+
$this->deleteOrderFromPendingPaymentQueue( $order );
|
144 |
+
WC_Subscriptions_Manager::activate_subscriptions_for_order($order);
|
145 |
+
}
|
146 |
+
} else {
|
147 |
+
if ( $this->is_subscription( $order->get_id() ) ) {
|
148 |
+
$this->deleteOrderFromPendingPaymentQueue( $order );
|
149 |
+
WC_Subscriptions_Manager::activate_subscriptions_for_order($order);
|
150 |
+
}
|
151 |
}
|
152 |
}
|
153 |
}
|
@@ -177,13 +177,13 @@ class Mollie_WC_Gateway_BankTransfer extends Mollie_WC_Gateway_Abstract
|
|
177 |
{
|
178 |
$instructions .= sprintf(
|
179 |
/* translators: Placeholder 1: consumer name, placeholder 2: consumer IBAN, placeholder 3: consumer BIC */
|
180 |
-
__('Payment completed by <strong>%s</strong> (IBAN: %s, BIC: %s)', 'mollie-payments-for-woocommerce'),
|
181 |
$payment->details->consumerName,
|
182 |
-
|
183 |
$payment->details->consumerBic
|
184 |
);
|
185 |
}
|
186 |
-
elseif ($data_helper->hasOrderStatus($order, 'on-hold'))
|
187 |
{
|
188 |
if (!$admin_instructions)
|
189 |
{
|
@@ -212,7 +212,7 @@ class Mollie_WC_Gateway_BankTransfer extends Mollie_WC_Gateway_Abstract
|
|
212 |
{
|
213 |
$expiry_date = DateTime::createFromFormat( 'U', time() );
|
214 |
$expiry_date->add( new DateInterval( $payment->expiryPeriod ) );
|
215 |
-
$expiry_date = $expiry_date->format(
|
216 |
$expiry_date = date_i18n( wc_date_format(), strtotime( $expiry_date ) );
|
217 |
|
218 |
if ($admin_instructions)
|
177 |
{
|
178 |
$instructions .= sprintf(
|
179 |
/* translators: Placeholder 1: consumer name, placeholder 2: consumer IBAN, placeholder 3: consumer BIC */
|
180 |
+
__('Payment completed by <strong>%s</strong> (IBAN (last 4 digits): %s, BIC: %s)', 'mollie-payments-for-woocommerce'),
|
181 |
$payment->details->consumerName,
|
182 |
+
substr($payment->details->consumerAccount, -4),
|
183 |
$payment->details->consumerBic
|
184 |
);
|
185 |
}
|
186 |
+
elseif ($data_helper->hasOrderStatus($order, 'on-hold') || $data_helper->hasOrderStatus($order, 'pending') )
|
187 |
{
|
188 |
if (!$admin_instructions)
|
189 |
{
|
212 |
{
|
213 |
$expiry_date = DateTime::createFromFormat( 'U', time() );
|
214 |
$expiry_date->add( new DateInterval( $payment->expiryPeriod ) );
|
215 |
+
$expiry_date = $expiry_date->format( 'Y-m-d H:i:s' );
|
216 |
$expiry_date = date_i18n( wc_date_format(), strtotime( $expiry_date ) );
|
217 |
|
218 |
if ($admin_instructions)
|
@@ -14,7 +14,6 @@ class Mollie_WC_Gateway_DirectDebit extends Mollie_WC_Gateway_Abstract {
|
|
14 |
public function init_form_fields() {
|
15 |
parent::init_form_fields();
|
16 |
|
17 |
-
unset( $this->form_fields['title'] );
|
18 |
unset( $this->form_fields['display_logo'] );
|
19 |
unset( $this->form_fields['description'] );
|
20 |
|
@@ -31,7 +30,7 @@ class Mollie_WC_Gateway_DirectDebit extends Mollie_WC_Gateway_Abstract {
|
|
31 |
* @return string
|
32 |
*/
|
33 |
protected function getSettingsDescription() {
|
34 |
-
return __( 'SEPA Direct Debit is used for recurring payments with WooCommerce Subscriptions, and will not be shown in the WooCommerce checkout for regular payments! You also need to enable iDEAL
|
35 |
}
|
36 |
|
37 |
/**
|
@@ -62,9 +61,9 @@ class Mollie_WC_Gateway_DirectDebit extends Mollie_WC_Gateway_Abstract {
|
|
62 |
if ( $payment->isPaid() && $payment->details ) {
|
63 |
return sprintf(
|
64 |
/* translators: Placeholder 1: consumer name, placeholder 2: consumer IBAN, placeholder 3: consumer BIC */
|
65 |
-
__( 'Payment completed by <strong>%s</strong> (IBAN: %s, BIC: %s)', 'mollie-payments-for-woocommerce' ),
|
66 |
$payment->details->consumerName,
|
67 |
-
|
68 |
$payment->details->consumerBic
|
69 |
);
|
70 |
}
|
14 |
public function init_form_fields() {
|
15 |
parent::init_form_fields();
|
16 |
|
|
|
17 |
unset( $this->form_fields['display_logo'] );
|
18 |
unset( $this->form_fields['description'] );
|
19 |
|
30 |
* @return string
|
31 |
*/
|
32 |
protected function getSettingsDescription() {
|
33 |
+
return __( 'SEPA Direct Debit is used for recurring payments with WooCommerce Subscriptions, and will not be shown in the WooCommerce checkout for regular payments! You also need to enable iDEAL if you want to use SEPA Direct Debit.', 'mollie-payments-for-woocommerce' );
|
34 |
}
|
35 |
|
36 |
/**
|
61 |
if ( $payment->isPaid() && $payment->details ) {
|
62 |
return sprintf(
|
63 |
/* translators: Placeholder 1: consumer name, placeholder 2: consumer IBAN, placeholder 3: consumer BIC */
|
64 |
+
__( 'Payment completed by <strong>%s</strong> (IBAN (last 4 digits): %s, BIC: %s)', 'mollie-payments-for-woocommerce' ),
|
65 |
$payment->details->consumerName,
|
66 |
+
substr($payment->details->consumerAccount, -4),
|
67 |
$payment->details->consumerBic
|
68 |
);
|
69 |
}
|
@@ -28,8 +28,8 @@ class Mollie_WC_Gateway_Ideal extends Mollie_WC_Gateway_AbstractSepaRecurring
|
|
28 |
'issuers_empty_option' => array(
|
29 |
'title' => __('Issuers empty option', 'mollie-payments-for-woocommerce'),
|
30 |
'type' => 'text',
|
31 |
-
'description' => sprintf(__('This text will be displayed as the first option in the iDEAL issuers drop down', 'mollie-payments-for-woocommerce'), $this->getDefaultTitle()),
|
32 |
-
'default' => '',
|
33 |
'desc_tip' => true,
|
34 |
),
|
35 |
));
|
@@ -85,7 +85,7 @@ class Mollie_WC_Gateway_Ideal extends Mollie_WC_Gateway_AbstractSepaRecurring
|
|
85 |
$selected_issuer = $this->getSelectedIssuer();
|
86 |
|
87 |
$html = '<select name="' . Mollie_WC_Plugin::PLUGIN_ID . '_issuer_' . $this->id . '">';
|
88 |
-
$html .= '<option value="">' . esc_html(__($this->get_option('issuers_empty_option',
|
89 |
foreach ($issuers->issuers as $issuer)
|
90 |
{
|
91 |
$html .= '<option value="' . esc_attr($issuer->id) . '"' . ($selected_issuer == $issuer->id ? ' selected=""' : '') . '>' . esc_html($issuer->name) . '</option>';
|
@@ -108,9 +108,9 @@ class Mollie_WC_Gateway_Ideal extends Mollie_WC_Gateway_AbstractSepaRecurring
|
|
108 |
{
|
109 |
return sprintf(
|
110 |
/* translators: Placeholder 1: consumer name, placeholder 2: consumer IBAN, placeholder 3: consumer BIC */
|
111 |
-
__('Payment completed by <strong>%s</strong> (IBAN: %s, BIC: %s)', 'mollie-payments-for-woocommerce'),
|
112 |
$payment->details->consumerName,
|
113 |
-
|
114 |
$payment->details->consumerBic
|
115 |
);
|
116 |
}
|
28 |
'issuers_empty_option' => array(
|
29 |
'title' => __('Issuers empty option', 'mollie-payments-for-woocommerce'),
|
30 |
'type' => 'text',
|
31 |
+
'description' => sprintf(__('This text will be displayed as the first option in the iDEAL issuers drop down, if nothing is entered, "Select your bank" will be shown.', 'mollie-payments-for-woocommerce'), $this->getDefaultTitle()),
|
32 |
+
'default' => 'Select your bank',
|
33 |
'desc_tip' => true,
|
34 |
),
|
35 |
));
|
85 |
$selected_issuer = $this->getSelectedIssuer();
|
86 |
|
87 |
$html = '<select name="' . Mollie_WC_Plugin::PLUGIN_ID . '_issuer_' . $this->id . '">';
|
88 |
+
$html .= '<option value="">' . esc_html(__($this->get_option('issuers_empty_option', $this->getDefaultDescription()), 'mollie-payments-for-woocommerce')) . '</option>';
|
89 |
foreach ($issuers->issuers as $issuer)
|
90 |
{
|
91 |
$html .= '<option value="' . esc_attr($issuer->id) . '"' . ($selected_issuer == $issuer->id ? ' selected=""' : '') . '>' . esc_html($issuer->name) . '</option>';
|
108 |
{
|
109 |
return sprintf(
|
110 |
/* translators: Placeholder 1: consumer name, placeholder 2: consumer IBAN, placeholder 3: consumer BIC */
|
111 |
+
__('Payment completed by <strong>%s</strong> (IBAN (last 4 digits): %s, BIC: %s)', 'mollie-payments-for-woocommerce'),
|
112 |
$payment->details->consumerName,
|
113 |
+
substr($payment->details->consumerAccount, -4),
|
114 |
$payment->details->consumerBic
|
115 |
);
|
116 |
}
|
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
class Mollie_WC_Gateway_Kbc extends
|
3 |
{
|
4 |
/**
|
5 |
*
|
@@ -28,8 +28,8 @@ class Mollie_WC_Gateway_Kbc extends Mollie_WC_Gateway_Abstract
|
|
28 |
'issuers_empty_option' => array(
|
29 |
'title' => __('Issuers empty option', 'mollie-payments-for-woocommerce'),
|
30 |
'type' => 'text',
|
31 |
-
'description' => sprintf(__('This text will be displayed as the first option in the KBC/CBC issuers drop down', 'mollie-payments-for-woocommerce'), $this->getDefaultTitle()),
|
32 |
-
'default' => '',
|
33 |
'desc_tip' => true,
|
34 |
),
|
35 |
));
|
@@ -85,7 +85,7 @@ class Mollie_WC_Gateway_Kbc extends Mollie_WC_Gateway_Abstract
|
|
85 |
$selected_issuer = $this->getSelectedIssuer();
|
86 |
|
87 |
$html = '<select name="' . Mollie_WC_Plugin::PLUGIN_ID . '_issuer_' . $this->id . '">';
|
88 |
-
$html .= '<option value="">' . esc_html(__($this->get_option('issuers_empty_option',
|
89 |
foreach ($issuers->issuers as $issuer)
|
90 |
{
|
91 |
$html .= '<option value="' . esc_attr($issuer->id) . '"' . ($selected_issuer == $issuer->id ? ' selected=""' : '') . '>' . esc_html($issuer->name) . '</option>';
|
1 |
<?php
|
2 |
+
class Mollie_WC_Gateway_Kbc extends Mollie_WC_Gateway_AbstractSepaRecurring
|
3 |
{
|
4 |
/**
|
5 |
*
|
28 |
'issuers_empty_option' => array(
|
29 |
'title' => __('Issuers empty option', 'mollie-payments-for-woocommerce'),
|
30 |
'type' => 'text',
|
31 |
+
'description' => sprintf(__('This text will be displayed as the first option in the KBC/CBC issuers drop down, if nothing is entered, "Select your bank" will be shown.', 'mollie-payments-for-woocommerce'), $this->getDefaultTitle()),
|
32 |
+
'default' => 'Select your bank',
|
33 |
'desc_tip' => true,
|
34 |
),
|
35 |
));
|
85 |
$selected_issuer = $this->getSelectedIssuer();
|
86 |
|
87 |
$html = '<select name="' . Mollie_WC_Plugin::PLUGIN_ID . '_issuer_' . $this->id . '">';
|
88 |
+
$html .= '<option value="">' . esc_html(__($this->get_option('issuers_empty_option', $this->getDefaultDescription()), 'mollie-payments-for-woocommerce')) . '</option>';
|
89 |
foreach ($issuers->issuers as $issuer)
|
90 |
{
|
91 |
$html .= '<option value="' . esc_attr($issuer->id) . '"' . ($selected_issuer == $issuer->id ? ' selected=""' : '') . '>' . esc_html($issuer->name) . '</option>';
|
@@ -60,7 +60,7 @@ class Mollie_WC_Gateway_Sofort extends Mollie_WC_Gateway_AbstractSepaRecurring
|
|
60 |
{
|
61 |
$instructions .= sprintf(
|
62 |
/* translators: Placeholder 1: consumer name, placeholder 2: consumer IBAN, placeholder 3: consumer BIC */
|
63 |
-
__('Payment completed by <strong>%s</strong> (IBAN: %s, BIC: %s)', 'mollie-payments-for-woocommerce'),
|
64 |
$payment->details->consumerName,
|
65 |
implode(' ', str_split($payment->details->consumerAccount, 4)),
|
66 |
$payment->details->consumerBic
|
60 |
{
|
61 |
$instructions .= sprintf(
|
62 |
/* translators: Placeholder 1: consumer name, placeholder 2: consumer IBAN, placeholder 3: consumer BIC */
|
63 |
+
__('Payment completed by <strong>%s</strong> (IBAN (last 4 digits): %s, BIC: %s)', 'mollie-payments-for-woocommerce'),
|
64 |
$payment->details->consumerName,
|
65 |
implode(' ', str_split($payment->details->consumerAccount, 4)),
|
66 |
$payment->details->consumerBic
|
@@ -31,6 +31,16 @@ class Mollie_WC_Helper_Settings
|
|
31 |
return trim(get_option($this->getSettingId('payment_description')));
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
/**
|
35 |
* @return string
|
36 |
*/
|
@@ -212,7 +222,7 @@ class Mollie_WC_Helper_Settings
|
|
212 |
$content .= sprintf(
|
213 |
/* translators: The surrounding %s's Will be replaced by a link to the Mollie profile */
|
214 |
__('The following payment methods are activated in your %sMollie profile%s:', 'mollie-payments-for-woocommerce'),
|
215 |
-
'<a href="https://www.mollie.com/
|
216 |
'</a>'
|
217 |
);
|
218 |
|
@@ -316,7 +326,7 @@ class Mollie_WC_Helper_Settings
|
|
316 |
/* translators: Placeholder 1: API key mode (live or test). The surrounding %s's Will be replaced by a link to the Mollie profile */
|
317 |
__('The API key is used to connect to Mollie. You can find your <strong>%s</strong> API key in your %sMollie profile%s', 'mollie-payments-for-woocommerce'),
|
318 |
'live',
|
319 |
-
'<a href="https://www.mollie.com/
|
320 |
'</a>'
|
321 |
),
|
322 |
'css' => 'width: 350px',
|
@@ -342,7 +352,7 @@ class Mollie_WC_Helper_Settings
|
|
342 |
/* translators: Placeholder 1: API key mode (live or test). The surrounding %s's Will be replaced by a link to the Mollie profile */
|
343 |
__('The API key is used to connect to Mollie. You can find your <strong>%s</strong> API key in your %sMollie profile%s', 'mollie-payments-for-woocommerce'),
|
344 |
'test',
|
345 |
-
'<a href="https://www.mollie.com/
|
346 |
'</a>'
|
347 |
),
|
348 |
'css' => 'width: 350px',
|
@@ -361,7 +371,18 @@ class Mollie_WC_Helper_Settings
|
|
361 |
'default' => $default_payment_description,
|
362 |
'css' => 'width: 350px',
|
363 |
),
|
364 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
365 |
'id' => $this->getSettingId('payment_locale'),
|
366 |
'title' => __('Payment screen language', 'mollie-payments-for-woocommerce'),
|
367 |
'type' => 'select',
|
31 |
return trim(get_option($this->getSettingId('payment_description')));
|
32 |
}
|
33 |
|
34 |
+
/**
|
35 |
+
* Order status for cancelled payments
|
36 |
+
*
|
37 |
+
* @return string|null
|
38 |
+
*/
|
39 |
+
public function getOrderStatusCancelledPayments ()
|
40 |
+
{
|
41 |
+
return trim(get_option($this->getSettingId('order_status_cancelled_payments')));
|
42 |
+
}
|
43 |
+
|
44 |
/**
|
45 |
* @return string
|
46 |
*/
|
222 |
$content .= sprintf(
|
223 |
/* translators: The surrounding %s's Will be replaced by a link to the Mollie profile */
|
224 |
__('The following payment methods are activated in your %sMollie profile%s:', 'mollie-payments-for-woocommerce'),
|
225 |
+
'<a href="https://www.mollie.com/dashboard/settings/profiles" target="_blank">',
|
226 |
'</a>'
|
227 |
);
|
228 |
|
326 |
/* translators: Placeholder 1: API key mode (live or test). The surrounding %s's Will be replaced by a link to the Mollie profile */
|
327 |
__('The API key is used to connect to Mollie. You can find your <strong>%s</strong> API key in your %sMollie profile%s', 'mollie-payments-for-woocommerce'),
|
328 |
'live',
|
329 |
+
'<a href="https://www.mollie.com/dashboard/settings/profiles" target="_blank">',
|
330 |
'</a>'
|
331 |
),
|
332 |
'css' => 'width: 350px',
|
352 |
/* translators: Placeholder 1: API key mode (live or test). The surrounding %s's Will be replaced by a link to the Mollie profile */
|
353 |
__('The API key is used to connect to Mollie. You can find your <strong>%s</strong> API key in your %sMollie profile%s', 'mollie-payments-for-woocommerce'),
|
354 |
'test',
|
355 |
+
'<a href="https://www.mollie.com/dashboard/settings/profiles" target="_blank">',
|
356 |
'</a>'
|
357 |
),
|
358 |
'css' => 'width: 350px',
|
371 |
'default' => $default_payment_description,
|
372 |
'css' => 'width: 350px',
|
373 |
),
|
374 |
+
array(
|
375 |
+
'id' => $this->getSettingId('order_status_cancelled_payments'),
|
376 |
+
'title' => __('Order status after cancelled payment', 'mollie-payments-for-woocommerce'),
|
377 |
+
'type' => 'select',
|
378 |
+
'options' => array(
|
379 |
+
'pending' => __('Pending', 'mollie-payments-for-woocommerce'),
|
380 |
+
'cancelled' => __('Cancelled', 'mollie-payments-for-woocommerce'),
|
381 |
+
),
|
382 |
+
'desc' => __('Status for orders when a payment is cancelled. Default: pending. Orders with status Pending can be paid with another payment method, customers can try again. Cancelled orders are final. Set this to Cancelled if you only have one payment method or don\'t want customers to re-try paying with a different payment method.', 'mollie-payments-for-woocommerce'),
|
383 |
+
'default' => 'pending',
|
384 |
+
),
|
385 |
+
array(
|
386 |
'id' => $this->getSettingId('payment_locale'),
|
387 |
'title' => __('Payment screen language', 'mollie-payments-for-woocommerce'),
|
388 |
'type' => 'select',
|
@@ -7,7 +7,7 @@ class Mollie_WC_Plugin
|
|
7 |
{
|
8 |
const PLUGIN_ID = 'mollie-payments-for-woocommerce';
|
9 |
const PLUGIN_TITLE = 'Mollie Payments for WooCommerce';
|
10 |
-
const PLUGIN_VERSION = '2.
|
11 |
|
12 |
const DB_VERSION = '1.0';
|
13 |
const DB_VERSION_PARAM_NAME = 'mollie-db-version';
|
@@ -99,6 +99,12 @@ class Mollie_WC_Plugin
|
|
99 |
$items = $wpdb->get_results("SELECT * FROM {$wpdb->mollie_pending_payment} WHERE expired_time < {$currentDate->getTimestamp()};");
|
100 |
foreach ($items as $item){
|
101 |
$order = Mollie_WC_Plugin::getDataHelper()->getWcOrder( $item->post_id );
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
if ($order->get_status() == Mollie_WC_Gateway_Abstract::STATUS_COMPLETED){
|
103 |
|
104 |
$new_order_status = Mollie_WC_Gateway_Abstract::STATUS_FAILED;
|
7 |
{
|
8 |
const PLUGIN_ID = 'mollie-payments-for-woocommerce';
|
9 |
const PLUGIN_TITLE = 'Mollie Payments for WooCommerce';
|
10 |
+
const PLUGIN_VERSION = '2.8.0';
|
11 |
|
12 |
const DB_VERSION = '1.0';
|
13 |
const DB_VERSION_PARAM_NAME = 'mollie-db-version';
|
99 |
$items = $wpdb->get_results("SELECT * FROM {$wpdb->mollie_pending_payment} WHERE expired_time < {$currentDate->getTimestamp()};");
|
100 |
foreach ($items as $item){
|
101 |
$order = Mollie_WC_Plugin::getDataHelper()->getWcOrder( $item->post_id );
|
102 |
+
|
103 |
+
// Check that order actually exists
|
104 |
+
if ( $order == false ) {
|
105 |
+
return false;
|
106 |
+
}
|
107 |
+
|
108 |
if ($order->get_status() == Mollie_WC_Gateway_Abstract::STATUS_COMPLETED){
|
109 |
|
110 |
$new_order_status = Mollie_WC_Gateway_Abstract::STATUS_FAILED;
|
@@ -3,17 +3,24 @@
|
|
3 |
* Plugin Name: Mollie Payments for WooCommerce
|
4 |
* Plugin URI: https://github.com/mollie/WooCommerce
|
5 |
* Description: Accept payments in WooCommerce with the official Mollie plugin
|
6 |
-
* Version: 2.
|
7 |
* Author: Mollie
|
8 |
* Author URI: https://www.mollie.com
|
9 |
* Requires at least: 3.8
|
10 |
-
* Tested up to: 4.
|
11 |
* Text Domain: mollie-payments-for-woocommerce
|
12 |
* Domain Path: /i18n/languages/
|
13 |
* License: GPLv2 or later
|
14 |
-
* WC requires at least: 2.
|
15 |
-
* WC tested up to: 3.
|
16 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
require_once 'includes/mollie/wc/autoload.php';
|
18 |
|
19 |
// TODO: Add more constants WP-style, and move from classes to here.
|
@@ -28,25 +35,28 @@ if ( ! defined( 'M4W_PLUGIN_DIR' ) ) {
|
|
28 |
define( 'M4W_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
29 |
}
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
/**
|
32 |
* Called when plugin is loaded
|
33 |
*/
|
34 |
-
function mollie_wc_plugin_init
|
35 |
-
{
|
36 |
-
if (!class_exists('WooCommerce'))
|
37 |
-
{
|
38 |
-
/*
|
39 |
-
* Plugin depends on WooCommerce
|
40 |
-
* is_plugin_active() is not available yet :(
|
41 |
-
*/
|
42 |
-
return;
|
43 |
-
}
|
44 |
|
45 |
-
|
46 |
-
|
47 |
|
48 |
-
|
49 |
-
|
50 |
}
|
51 |
|
52 |
/**
|
@@ -54,20 +64,12 @@ function mollie_wc_plugin_init ()
|
|
54 |
*/
|
55 |
function mollie_wc_plugin_activation_hook ()
|
56 |
{
|
57 |
-
// WooCommerce plugin not activated
|
58 |
-
if (!is_plugin_active('woocommerce/woocommerce.php'))
|
59 |
-
{
|
60 |
-
$title = sprintf(
|
61 |
-
__('Could not activate plugin %s', 'mollie-payments-for-woocommerce'),
|
62 |
-
'Mollie Payments for WooCommerce'
|
63 |
-
);
|
64 |
-
$message = ''
|
65 |
-
. '<h1><strong>' . $title . '</strong></h1><br/>'
|
66 |
-
. 'WooCommerce plugin not activated. Please activate WooCommerce plugin first.';
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
|
|
71 |
|
72 |
// Register Mollie autoloader
|
73 |
Mollie_WC_Autoload::register();
|
@@ -85,33 +87,35 @@ function mollie_wc_plugin_activation_hook ()
|
|
85 |
}
|
86 |
}
|
87 |
|
88 |
-
|
89 |
-
* Called when admin is initialised
|
90 |
-
*/
|
91 |
-
function mollie_wc_plugin_admin_init ()
|
92 |
-
{
|
93 |
-
// WooCommerce plugin not activated
|
94 |
-
if (!is_plugin_active('woocommerce/woocommerce.php'))
|
95 |
-
{
|
96 |
-
// Deactivate myself
|
97 |
-
deactivate_plugins(plugin_basename(__FILE__));
|
98 |
|
99 |
-
|
100 |
-
}
|
101 |
-
}
|
102 |
|
103 |
-
|
104 |
-
{
|
105 |
-
|
106 |
-
|
107 |
-
wp_unschedule_event( $nextScheduledTime, 'pending_payment_confirmation_check' );
|
108 |
-
}
|
109 |
-
echo '<div class="error"><p>' . sprintf(__('%s deactivated because it depends on WooCommerce.', 'mollie-payments-for-woocommerce'), Mollie_WC_Plugin::PLUGIN_TITLE) . '</p></div>';
|
110 |
-
}
|
111 |
|
112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
|
114 |
-
add_action('admin_init', 'mollie_wc_plugin_admin_init');
|
115 |
add_action('init', 'mollie_wc_plugin_init');
|
116 |
|
117 |
/**
|
3 |
* Plugin Name: Mollie Payments for WooCommerce
|
4 |
* Plugin URI: https://github.com/mollie/WooCommerce
|
5 |
* Description: Accept payments in WooCommerce with the official Mollie plugin
|
6 |
+
* Version: 2.8.0
|
7 |
* Author: Mollie
|
8 |
* Author URI: https://www.mollie.com
|
9 |
* Requires at least: 3.8
|
10 |
+
* Tested up to: 4.9
|
11 |
* Text Domain: mollie-payments-for-woocommerce
|
12 |
* Domain Path: /i18n/languages/
|
13 |
* License: GPLv2 or later
|
14 |
+
* WC requires at least: 2.2.0
|
15 |
+
* WC tested up to: 3.3
|
16 |
*/
|
17 |
+
|
18 |
+
// Exit if accessed directly.
|
19 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
20 |
+
exit;
|
21 |
+
}
|
22 |
+
|
23 |
+
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
24 |
require_once 'includes/mollie/wc/autoload.php';
|
25 |
|
26 |
// TODO: Add more constants WP-style, and move from classes to here.
|
35 |
define( 'M4W_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
36 |
}
|
37 |
|
38 |
+
/**
|
39 |
+
* Check if WooCommerce is active and of a supported version
|
40 |
+
*/
|
41 |
+
function mollie_wc_check_woocommerce_status() {
|
42 |
+
if ( ! class_exists( 'WooCommerce' ) || version_compare( get_option( 'woocommerce_db_version' ), '2.2', '<' ) ) {
|
43 |
+
remove_action('init', 'mollie_wc_plugin_init');
|
44 |
+
add_action( 'admin_notices', 'mollie_wc_plugin_inactive' );
|
45 |
+
return;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
add_action( 'plugins_loaded', 'mollie_wc_check_woocommerce_status' );
|
49 |
+
|
50 |
/**
|
51 |
* Called when plugin is loaded
|
52 |
*/
|
53 |
+
function mollie_wc_plugin_init() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
+
// Register Mollie autoloader
|
56 |
+
Mollie_WC_Autoload::register();
|
57 |
|
58 |
+
// Setup and start plugin
|
59 |
+
Mollie_WC_Plugin::init();
|
60 |
}
|
61 |
|
62 |
/**
|
64 |
*/
|
65 |
function mollie_wc_plugin_activation_hook ()
|
66 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
+
if ( ! class_exists( 'WooCommerce' ) || version_compare( get_option( 'woocommerce_db_version' ), '2.2', '<' ) ) {
|
69 |
+
remove_action('init', 'mollie_wc_plugin_init');
|
70 |
+
add_action( 'admin_notices', 'mollie_wc_plugin_inactive' );
|
71 |
+
return;
|
72 |
+
}
|
73 |
|
74 |
// Register Mollie autoloader
|
75 |
Mollie_WC_Autoload::register();
|
87 |
}
|
88 |
}
|
89 |
|
90 |
+
register_activation_hook(__FILE__, 'mollie_wc_plugin_activation_hook');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
|
92 |
+
function mollie_wc_plugin_inactive() {
|
|
|
|
|
93 |
|
94 |
+
$nextScheduledTime = wp_next_scheduled( 'pending_payment_confirmation_check' );
|
95 |
+
if ( $nextScheduledTime ) {
|
96 |
+
wp_unschedule_event( $nextScheduledTime, 'pending_payment_confirmation_check' );
|
97 |
+
}
|
|
|
|
|
|
|
|
|
98 |
|
99 |
+
if ( ! is_admin() ) {
|
100 |
+
return;
|
101 |
+
}
|
102 |
+
|
103 |
+
if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
|
104 |
+
|
105 |
+
echo '<div class="error"><p>';
|
106 |
+
echo sprintf( esc_html__( '%1$sMollie Payments for WooCommerce is inactive.%2$s The %3$sWooCommerce plugin%4$s must be active for it to work. Please %5$sinstall & activate WooCommerce »%6$s', 'mollie-payments-for-woocommerce' ), '<strong>', '</strong>', '<a href="https://wordpress.org/plugins/woocommerce/">', '</a>', '<a href="' . esc_url( admin_url( 'plugins.php' ) ) . '">', '</a>' );
|
107 |
+
echo '</p></div>';
|
108 |
+
}
|
109 |
+
|
110 |
+
if ( version_compare( get_option( 'woocommerce_db_version' ), '2.2', '<' ) ) {
|
111 |
+
|
112 |
+
echo '<div class="error"><p>';
|
113 |
+
echo sprintf( esc_html__( '%1$sMollie Payments for WooCommerce is inactive.%2$s This version requires WooCommerce 2.2 or newer. Please %3$supdate WooCommerce to version 2.2 or newer »%4$s', 'mollie-payments-for-woocommerce' ), '<strong>', '</strong>', '<a href="' . esc_url( admin_url( 'plugins.php' ) ) . '">', '</a>' );
|
114 |
+
echo '</p></div>';
|
115 |
+
|
116 |
+
}
|
117 |
+
}
|
118 |
|
|
|
119 |
add_action('init', 'mollie_wc_plugin_init');
|
120 |
|
121 |
/**
|
@@ -4,7 +4,7 @@ Tags: mollie, payments, woocommerce, payment gateway, e-commerce, credit card, i
|
|
4 |
Requires at least: 3.8
|
5 |
Tested up to: 4.9
|
6 |
Requires PHP: 5.3
|
7 |
-
Stable tag: 2.
|
8 |
Requires PHP: 5.3
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -159,6 +159,29 @@ Automatic updates should work like a charm; as always though, ensure you backup
|
|
159 |
|
160 |
== Changelog ==
|
161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
= 2.7.0 - 07/09/2017 =
|
163 |
|
164 |
* New - Support for gift cards! See: https://www.mollie.com/en/blog/post/mollie-launches-gift-cards/
|
4 |
Requires at least: 3.8
|
5 |
Tested up to: 4.9
|
6 |
Requires PHP: 5.3
|
7 |
+
Stable tag: 2.8.0
|
8 |
Requires PHP: 5.3
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
159 |
|
160 |
== Changelog ==
|
161 |
|
162 |
+
= 2.8.0 - 09/01/2018 =
|
163 |
+
|
164 |
+
* New - Updated required WooCommerce version to 2.2.0
|
165 |
+
* New - Tested with WooCommerce 3.3 beta, no issues found
|
166 |
+
* New - Better message on "Order Received" page for open/pending payments
|
167 |
+
* New - Allow users to set the order status for orders where a payment was cancelled
|
168 |
+
* New - Added support for Polylang Pro (polylang-pro) to getSiteUrlWithLanguage()
|
169 |
+
* New - Updated credit card icon in WooCommerce checkout to show icons for MasterCard, Visa, AMEX, CartaSi, Cartes Bancaires
|
170 |
+
* New - Better way to check if WooCommerce is activated and has correct version (so plugin doesn't de-activate on WooCommerce updates)
|
171 |
+
* New - Redact customer IBAN in notification-mails
|
172 |
+
* New - Update how "Select your bank" is shown in the dropdown for iDEAL and KBC/CBC (and show a default)
|
173 |
+
|
174 |
+
* Fix - Fix error by making sure order is not removed/exists (in checkPendingPaymentOrdersExpiration)
|
175 |
+
* Fix - Make sure payments cancelled at Mollie are also cancelled in WooCommerce, so customers can select a new payment method
|
176 |
+
* Fix - KBC/CBC: Make sure KBC/CBC is listed as "Automatic Recurring Payment" gateway in WooCommerce
|
177 |
+
* Fix - Fix (no title) showing in settings for SEPA Direct Debit for some new installs
|
178 |
+
* Fix - Fix wrong date formatting shown for bank transfer instructions, thank you profoX!
|
179 |
+
* Fix - Typo in SEPA Direct Debit description, thank you Yame-!
|
180 |
+
* Fix - It's possible to set the initial status of bank transfer to pending instead of on-hold, but in that case the payment instructions would not be shown on the Order Received page (missing in condition)
|
181 |
+
* Fix - Make sure webhook processing for Paid doesn't run on status PaidOut
|
182 |
+
* Fix - Improve orderNeedsPayment so there are less false-positives if users use 3PD plugins to change the order status too early
|
183 |
+
* Fix - Add WC_Subscriptions_Manager::activate_subscriptions_for_order to make sure subscriptions are always activated when payment is paid, independent of order status
|
184 |
+
|
185 |
= 2.7.0 - 07/09/2017 =
|
186 |
|
187 |
* New - Support for gift cards! See: https://www.mollie.com/en/blog/post/mollie-launches-gift-cards/
|