From 86692c0f9a7b8be74db088f4563e25969b8a4ccd Mon Sep 17 00:00:00 2001 From: Mauko Maunde Date: Thu, 4 Jun 2020 13:33:41 +0300 Subject: [PATCH] June release --- inc/wc_mpesa_gateway.php | 2 +- inc/woocommerce.php | 82 +++++++++++++++++++++------------------- osen-wc-mpesa.php | 24 ++++++------ updates.json | 8 ++-- 4 files changed, 60 insertions(+), 56 deletions(-) diff --git a/inc/wc_mpesa_gateway.php b/inc/wc_mpesa_gateway.php index 2c4e3aa..901ca25 100755 --- a/inc/wc_mpesa_gateway.php +++ b/inc/wc_mpesa_gateway.php @@ -234,7 +234,7 @@ public function init_form_fields() 'title' => __('Manual Payments', 'woocommerce'), 'label' => __('Enable C2B API(Offline Payments)', 'woocommerce'), 'type' => 'checkbox', - 'description' => '' . (($this->get_option('idtype') == 4) ? 'This requires C2B Validation, which is an optional feature that needs to be activated on M-Pesa.
Request for activation by sending an email to apisupport@safaricom.co.ke, or through a chat on the developer portal.
' : '') . 'Once enabled, click here to register confirmation & validation URLs

Kindly note that if this is disabled, the user can still resend an STK push if the first one fails.

', + 'description' => '' . (($this->get_option('idtype') == 4) ? 'This requires C2B Validation, which is an optional feature that needs to be activated on M-Pesa.
Request for activation by sending an email to apisupport@safaricom.co.ke, or through a chat on the developer portal.
' : '') . 'Once enabled, click here to register confirmation & validation URLs

Kindly note that if this is disabled, the user can still resend an STK push if the first one fails.

', 'default' => 'no', ), // 'enable_b2c' => array( diff --git a/inc/woocommerce.php b/inc/woocommerce.php index d45c104..cb25245 100755 --- a/inc/woocommerce.php +++ b/inc/woocommerce.php @@ -1,4 +1,5 @@ __('Baringo', 'woocommerce'), @@ -66,10 +67,10 @@ function mpesa_ke_woocommerce_counties($counties) } //add_filter('manage_edit-shop_order_columns', 'wcmpesa_new_order_column'); -function wcmpesa_new_order_column($columns) +function wcmpesa_new_order_column($columns) { - $columns['mpesa'] = 'Reinitiate Mpesa'; - return $columns; + $columns['mpesa'] = 'Reinitiate Mpesa'; + return $columns; } /** @@ -79,46 +80,49 @@ function wcmpesa_new_order_column($columns) * @param string $column The name of the column being acted upon * @return void */ -add_action('manage_shop_order_custom_column','shop_order_payments_table_column_content', 10); +add_action('manage_shop_order_custom_column', 'shop_order_payments_table_column_content', 10); function shop_order_payments_table_column_content($column_id, $post_id) { - $order_id = get_post_meta($post_id, '_order_id', true); - switch ($column_id) { + $order_id = get_post_meta($post_id, '_order_id', true); + switch ($column_id) { - case 'mpesa': - $statuses = array( - "processing" => "This Order Is Processing", - "on-hold" => "This Order Is On Hold", - "complete" => "This Order Is Complete", - "cancelled" => "This Order Is Cancelled", - "refunded" => "This Order Is Refunded", - "failed" => "This Order Failed" - ); + case 'mpesa': + $statuses = array( + "processing" => "This Order Is Processing", + "on-hold" => "This Order Is On Hold", + "complete" => "This Order Is Complete", + "cancelled" => "This Order Is Cancelled", + "refunded" => "This Order Is Refunded", + "failed" => "This Order Failed" + ); - echo ($value = get_post_meta($post_id, '_order_status', true)) ? ''.esc_attr($statuses[$value]).'') : 'Set Status'; - break; - } + echo ($value = get_post_meta($post_id, '_order_status', true)) ? '' . esc_attr($statuses[$value]) . '') : 'Set Status'; + break; + } } add_filter('woocommerce_email_attachments', 'woocommerce_emails_attach_downloadables', 10, 3); -function woocommerce_emails_attach_downloadables($attachments, $status, $order) +function woocommerce_emails_attach_downloadables($attachments, $status, $order) { - if (! is_object($order) || ! isset($status)) { - return $attachments; - } - if (empty($order)) { - return $attachments; - } - if (! $order->has_downloadable_item()) { - return $attachments; - } - $allowed_statuses = array('customer_invoice', 'customer_completed_order'); - if (isset($status) && in_array($status, $allowed_statuses)) { - foreach ($order->get_items() as $item_id => $item) { - foreach ($order->get_item_downloads($item) as $download) { - $attachments[] = str_replace(content_url(), WP_CONTENT_DIR, $download['file']); - } - } - } - return $attachments; -} \ No newline at end of file + if (!is_object($order) || !isset($status)) { + return $attachments; + } + if (empty($order)) { + return $attachments; + } + if (method_exists($order, 'has_downloadable_item')) { + if (!$order->has_downloadable_item()) { + return $attachments; + } + $allowed_statuses = array('customer_invoice', 'customer_completed_order'); + if (isset($status) && in_array($status, $allowed_statuses)) { + foreach ($order->get_items() as $item_id => $item) { + foreach ($order->get_item_downloads($item) as $download) { + $attachments[] = str_replace(content_url(), WP_CONTENT_DIR, $download['file']); + } + } + } + } + + return $attachments; +} diff --git a/osen-wc-mpesa.php b/osen-wc-mpesa.php index dc400dc..4639131 100755 --- a/osen-wc-mpesa.php +++ b/osen-wc-mpesa.php @@ -170,10 +170,10 @@ function mpesa_row_meta($links, $file) 'shortcode' => isset($c2b['shortcode']) ? $c2b['shortcode'] : '174379', 'type' => isset($c2b['idtype']) ? $c2b['idtype'] : 4, 'passkey' => isset($c2b['passkey']) ? $c2b['passkey'] : 'bfb279f9aa9bdbcf158e97dd71a467cd2e0c893059b10f78e6b72ada1ed2c919', - 'validate' => home_url('wcpesa/validate/'), - 'confirm' => home_url('wcpesa/confirm/'), - 'reconcile' => home_url('wcpesa/reconcile/'), - 'timeout' => home_url('wcpesa/timeout/') + 'validate' => home_url('lipwa/validate/'), + 'confirm' => home_url('lipwa/confirm/'), + 'reconcile' => home_url('lipwa/reconcile/'), + 'timeout' => home_url('lipwa/timeout/') ) ); @@ -187,10 +187,10 @@ function mpesa_row_meta($links, $file) 'shortcode' => isset($c2b['shortcode']) ? $c2b['shortcode'] : '174379', 'type' => isset($c2b['idtype']) ? $c2b['idtype'] : 4, 'passkey' => isset($c2b['passkey']) ? $c2b['passkey'] : 'bfb279f9aa9bdbcf158e97dd71a467cd2e0c893059b10f78e6b72ada1ed2c919', - 'validate' => home_url('wcpesa/validate/'), - 'confirm' => home_url('wcpesa/confirm/'), - 'reconcile' => home_url('wcpesa/reconcile/'), - 'timeout' => home_url('wcpesa/timeout/') + 'validate' => home_url('lipwa/validate/'), + 'confirm' => home_url('lipwa/confirm/'), + 'reconcile' => home_url('lipwa/reconcile/'), + 'timeout' => home_url('lipwa/timeout/') ) ); @@ -207,10 +207,10 @@ function mpesa_row_meta($links, $file) // 'passkey' => isset($b2c['passkey']) ? $b2c['passkey'] : '', // 'username' => isset($b2c['username']) ? $b2c['username'] : '', // 'password' => isset($b2c['password']) ? $b2c['password'] : '', -// 'validate' => home_url('wcpesa/validate/'), -// 'confirm' => home_url('wcpesa/confirm/'), -// 'reconcile' => home_url('wcpesa/reconcile/'), -// 'timeout' => home_url('wcpesa/timeout/') +// 'validate' => home_url('lipwa/validate/'), +// 'confirm' => home_url('lipwa/confirm/'), +// 'reconcile' => home_url('lipwa/reconcile/'), +// 'timeout' => home_url('lipwa/timeout/') // ) // ); diff --git a/updates.json b/updates.json index b565239..d4a8080 100644 --- a/updates.json +++ b/updates.json @@ -1,12 +1,12 @@ { "name": "Mpesa for Woocommerce", - "version": "1.20.57", - "download_url": "https://github.com/osenco/osen-wc-mpesa/archive/v1.20.57.zip", + "version": "1.20.6", + "download_url": "https://github.com/osenco/osen-wc-mpesa/archive/v1.20.6.zip", "homepage": "https://wc-mpesa.osen.co.ke/", "requires": "4.5", "tested": "5.4", - "last_updated": "2020-05-27 14:17:00", + "last_updated": "2020-06-03 14:17:00", "upgrade_notice": "Autoupdates from here on", "author": "Osen Concepts", @@ -15,7 +15,7 @@ "sections": { "description": "

This plugin seeks to provide a simple plug-n-play implementation for integrating M-Pesa Payments into online stores built with WooCommerce and WordPress.

", "installation": "Download the latest release from Github, and extract the zip file in your plugins directory of your WordPress instalation", - "changelog": "", + "changelog": "", "going_live": "

While we have made all efforts to ensure this plugin works out of the box - with minimum configuration required - the service provider requires that the user go through a certain ardous process to migrate from sandbox(test) environment to production.

We have made a tutorial here to walk you through the process. We however have a team ready on call to assist you in this are, at a fiat fee of KSh 4000 one-off, should you find it difficult.

" },