Version Description
Download this release
Release Info
Developer | constantcontact |
Plugin | Creative Mail – Easier WordPress & WooCommerce Email Marketing |
Version | 1.1.5 |
Comparing to | |
See all releases |
Code changes from version 1.1.4 to 1.1.5
- CHANGELOG.md +3 -0
- README.md +2 -1
- creative-mail-plugin.php +3 -3
- readme.txt +7 -1
- src/managers/email-manager.php +203 -16
- vendor/autoload.php +1 -1
- vendor/composer/ClassLoader.php +1 -1
- vendor/composer/autoload_real.php +4 -4
- vendor/composer/autoload_static.php +4 -4
CHANGELOG.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
Changelog
|
2 |
=========
|
3 |
|
|
|
|
|
|
|
4 |
#### 1.1.4 - September 2 2020
|
5 |
- Minor improvements
|
6 |
|
1 |
Changelog
|
2 |
=========
|
3 |
|
4 |
+
#### 1.1.5 - September 9 2020
|
5 |
+
- Fixes an issue where order notification emails would not always go out.
|
6 |
+
|
7 |
#### 1.1.4 - September 2 2020
|
8 |
- Minor improvements
|
9 |
|
README.md
CHANGED
@@ -3,7 +3,7 @@ Contributors: Constant Contact
|
|
3 |
Tags: email, marketing, newsletter, subscribe, contact form, constant contact, crm, automations, ecommerce, promotion, offers, retargeting
|
4 |
Requires at least: 4.6
|
5 |
Tested up to: 5.5
|
6 |
-
Stable tag: 1.1.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
Requires PHP: 5.6
|
@@ -88,6 +88,7 @@ Creative Mail by Constant Contact [Privacy Policy](https://endurance.clarip.com/
|
|
88 |
6. Enhance your brand with logomaker
|
89 |
|
90 |
== Changelog ==
|
|
|
91 |
* 1.1.4 - Minor improvements
|
92 |
* 1.1.3 - Implemented a new design
|
93 |
* 1.1.2 - Add support for beta versions of Jetpack
|
3 |
Tags: email, marketing, newsletter, subscribe, contact form, constant contact, crm, automations, ecommerce, promotion, offers, retargeting
|
4 |
Requires at least: 4.6
|
5 |
Tested up to: 5.5
|
6 |
+
Stable tag: 1.1.5
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
Requires PHP: 5.6
|
88 |
6. Enhance your brand with logomaker
|
89 |
|
90 |
== Changelog ==
|
91 |
+
* 1.1.5 - Fixes an issue where order notification emails would not always go out.
|
92 |
* 1.1.4 - Minor improvements
|
93 |
* 1.1.3 - Implemented a new design
|
94 |
* 1.1.2 - Add support for beta versions of Jetpack
|
creative-mail-plugin.php
CHANGED
@@ -6,7 +6,7 @@ use CreativeMail\CreativeMail;
|
|
6 |
* Plugin URI: https://wordpress.org/plugins/creative-mail-by-constant-contact/
|
7 |
* Description: Free email marketing designed specifically for WordPress, Jetpack and WooCommerce. Send newsletters, promotions, updates and transactional e-commerce emails. Simple and easy, powered by Constant Contact’s rock solid reliability.
|
8 |
* Author: Constant Contact
|
9 |
-
* Version: 1.1.
|
10 |
* Author URI: https://www.constantcontact.com
|
11 |
*/
|
12 |
|
@@ -20,7 +20,7 @@ function _load_ce4wp_plugin() {
|
|
20 |
|
21 |
define('CE4WP_PLUGIN_DIR', __DIR__ . '/');
|
22 |
define('CE4WP_PLUGIN_URL', plugin_dir_url(__FILE__) . '/');
|
23 |
-
define('CE4WP_PLUGIN_VERSION', '1.1.
|
24 |
define('CE4WP_INSTANCE_UUID_KEY', 'ce4wp_instance_uuid');
|
25 |
define('CE4WP_INSTANCE_HANDSHAKE_TOKEN', 'ce4wp_handshake_token');
|
26 |
define('CE4WP_INSTANCE_HANDSHAKE_EXPIRATION', 'ce4wp_handshake_expiration');
|
@@ -35,7 +35,7 @@ function _load_ce4wp_plugin() {
|
|
35 |
define('CE4WP_APP_GATEWAY_URL', 'https://app-gateway.creativemail.com/');
|
36 |
define('CE4WP_APP_URL', 'https://app.creativemail.com/');
|
37 |
define('CE4WP_ENVIRONMENT', 'PRODUCTION');
|
38 |
-
define('CE4WP_BUILD_NUMBER', '
|
39 |
define('CE4WP_BATCH_SIZE', 500);
|
40 |
define('CE4WP_WC_API_KEY_ID', 'ce4wp_woocommerce_api_key_id');
|
41 |
define('CE4WP_WC_API_CONSUMER_KEY', 'ce4wp_woocommerce_consumer_key');
|
6 |
* Plugin URI: https://wordpress.org/plugins/creative-mail-by-constant-contact/
|
7 |
* Description: Free email marketing designed specifically for WordPress, Jetpack and WooCommerce. Send newsletters, promotions, updates and transactional e-commerce emails. Simple and easy, powered by Constant Contact’s rock solid reliability.
|
8 |
* Author: Constant Contact
|
9 |
+
* Version: 1.1.5
|
10 |
* Author URI: https://www.constantcontact.com
|
11 |
*/
|
12 |
|
20 |
|
21 |
define('CE4WP_PLUGIN_DIR', __DIR__ . '/');
|
22 |
define('CE4WP_PLUGIN_URL', plugin_dir_url(__FILE__) . '/');
|
23 |
+
define('CE4WP_PLUGIN_VERSION', '1.1.5');
|
24 |
define('CE4WP_INSTANCE_UUID_KEY', 'ce4wp_instance_uuid');
|
25 |
define('CE4WP_INSTANCE_HANDSHAKE_TOKEN', 'ce4wp_handshake_token');
|
26 |
define('CE4WP_INSTANCE_HANDSHAKE_EXPIRATION', 'ce4wp_handshake_expiration');
|
35 |
define('CE4WP_APP_GATEWAY_URL', 'https://app-gateway.creativemail.com/');
|
36 |
define('CE4WP_APP_URL', 'https://app.creativemail.com/');
|
37 |
define('CE4WP_ENVIRONMENT', 'PRODUCTION');
|
38 |
+
define('CE4WP_BUILD_NUMBER', '574');
|
39 |
define('CE4WP_BATCH_SIZE', 500);
|
40 |
define('CE4WP_WC_API_KEY_ID', 'ce4wp_woocommerce_api_key_id');
|
41 |
define('CE4WP_WC_API_CONSUMER_KEY', 'ce4wp_woocommerce_consumer_key');
|
readme.txt
CHANGED
@@ -3,13 +3,18 @@ Contributors: Constant Contact
|
|
3 |
Tags: email, marketing, newsletter, subscribe, contact form, constant contact, crm, automations, ecommerce, promotion, offers, retargeting
|
4 |
Requires at least: 4.6
|
5 |
Tested up to: 5.5
|
6 |
-
Stable tag: 1.1.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
Requires PHP: 5.6
|
10 |
Website: https://www.creativemail.com
|
11 |
|
|
|
|
|
|
|
12 |
== Description ==
|
|
|
|
|
13 |
Creative Mail was designed specifically for WordPress and WooCommerce.
|
14 |
|
15 |
Our intelligent (and super fun) email editor simplifies email marketing campaign creation and pulls your WordPress blog posts, website images and WooCommerce products right into your email content. Leads from your WordPress website, ecommerce store and contact forms are automatically captured and routed into our included Contacts CRM and synced with your email marketing lists.
|
@@ -88,6 +93,7 @@ Creative Mail by Constant Contact [Privacy Policy](https://endurance.clarip.com/
|
|
88 |
6. Enhance your brand with logomaker
|
89 |
|
90 |
== Changelog ==
|
|
|
91 |
* 1.1.4 - Minor improvements
|
92 |
* 1.1.3 - Implemented a new design
|
93 |
* 1.1.2 - Add support for beta versions of Jetpack
|
3 |
Tags: email, marketing, newsletter, subscribe, contact form, constant contact, crm, automations, ecommerce, promotion, offers, retargeting
|
4 |
Requires at least: 4.6
|
5 |
Tested up to: 5.5
|
6 |
+
Stable tag: 1.1.5
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
Requires PHP: 5.6
|
10 |
Website: https://www.creativemail.com
|
11 |
|
12 |
+
Creative Mail was designed specifically for WordPress and WooCommerce.
|
13 |
+
Our intelligent (and super fun) email editor simplifies email marketing campaign creation and pulls your WordPress blog posts, website images and WooCommerce products right into your email content.
|
14 |
+
|
15 |
== Description ==
|
16 |
+
https://www.youtube.com/watch?v=6Zq73emGH1k
|
17 |
+
|
18 |
Creative Mail was designed specifically for WordPress and WooCommerce.
|
19 |
|
20 |
Our intelligent (and super fun) email editor simplifies email marketing campaign creation and pulls your WordPress blog posts, website images and WooCommerce products right into your email content. Leads from your WordPress website, ecommerce store and contact forms are automatically captured and routed into our included Contacts CRM and synced with your email marketing lists.
|
93 |
6. Enhance your brand with logomaker
|
94 |
|
95 |
== Changelog ==
|
96 |
+
* 1.1.5 - Fixes an issue where order notification emails would not always go out.
|
97 |
* 1.1.4 - Minor improvements
|
98 |
* 1.1.3 - Implemented a new design
|
99 |
* 1.1.2 - Add support for beta versions of Jetpack
|
src/managers/email-manager.php
CHANGED
@@ -190,7 +190,7 @@ class EmailManager
|
|
190 |
$data->note = $array['customer_note'];
|
191 |
$data->order_url = $this->get_view_order_url($data->order_id, null);
|
192 |
|
193 |
-
$this->execute_trigger("customer_note", $data);
|
194 |
}
|
195 |
|
196 |
public function ce_email_notification_customer_new_account($customer_id) {
|
@@ -221,7 +221,7 @@ class EmailManager
|
|
221 |
$data->order_id = $order_id;
|
222 |
$data->order_url = $this->get_view_order_url($order_id, null);
|
223 |
|
224 |
-
$this->execute_trigger("payment_received", $data);
|
225 |
}
|
226 |
|
227 |
public function ce_email_notification_failed($order_id, $order) {
|
@@ -229,42 +229,42 @@ class EmailManager
|
|
229 |
$data->order_id = $order_id;
|
230 |
$data->order_url = $this->get_view_order_url($order_id, $order);
|
231 |
|
232 |
-
$this->execute_trigger("failed_order", $data);
|
233 |
}
|
234 |
public function ce_email_notification_hold($order_id, $order) {
|
235 |
$data = new stdClass();
|
236 |
$data->order_id = $order_id;
|
237 |
$data->order_url = $this->get_view_order_url($order_id, $order);
|
238 |
|
239 |
-
$this->execute_trigger("customer_on_hold_order", $data);
|
240 |
}
|
241 |
public function ce_email_notification_processing($order_id, $order) {
|
242 |
$data = new stdClass();
|
243 |
$data->order_id = $order_id;
|
244 |
$data->order_url = $this->get_view_order_url($order_id, $order);
|
245 |
|
246 |
-
$this->execute_trigger("customer_processing_order", $data);
|
247 |
}
|
248 |
public function ce_email_notification_completed($order_id, $order) {
|
249 |
$data = new stdClass();
|
250 |
$data->order_id = $order_id;
|
251 |
$data->order_url = $this->get_view_order_url($order_id, $order);
|
252 |
|
253 |
-
$this->execute_trigger("customer_completed_order", $data);
|
254 |
}
|
255 |
public function ce_email_notification_refunded($order_id, $order) {
|
256 |
$data = new stdClass();
|
257 |
$data->order_id = $order_id;
|
258 |
$data->order_url = $this->get_view_order_url($order_id, $order);
|
259 |
|
260 |
-
$this->execute_trigger("customer_refunded_order", $data);
|
261 |
}
|
262 |
public function ce_email_notification_cancelled($order_id, $order) {
|
263 |
$data = new stdClass();
|
264 |
$data->order_id = $order_id;
|
265 |
$data->order_url = $this->get_view_order_url($order_id, $order);
|
266 |
|
267 |
-
$this->execute_trigger("cancelled_order", $data);
|
268 |
}
|
269 |
|
270 |
public function ce_email_notification_new_order($order_id, $order) {
|
@@ -272,7 +272,7 @@ class EmailManager
|
|
272 |
$data->order_id = $order_id;
|
273 |
$data->order_url = $this->get_view_order_url($order_id, $order);
|
274 |
|
275 |
-
$this->execute_trigger("new_order", $data);
|
276 |
}
|
277 |
|
278 |
public function ce_email_notification_invoice($order, $type) {
|
@@ -285,27 +285,214 @@ class EmailManager
|
|
285 |
$data->order_id = $order->id;
|
286 |
$data->order_url = $this->get_view_order_url( $order->id, $order );
|
287 |
|
288 |
-
$this->execute_trigger( "customer_invoice", $data );
|
289 |
}
|
290 |
|
291 |
-
public function execute_trigger($type, $data ) {
|
292 |
// if not managed do not trigger
|
293 |
if (!$this->is_email_managed($type)) {
|
294 |
return;
|
295 |
}
|
296 |
|
297 |
-
$
|
298 |
-
$
|
299 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
300 |
|
301 |
-
wp_remote_post(
|
302 |
'method' => 'POST',
|
|
|
303 |
'headers' => array(
|
304 |
'x-account-id' => OptionsHelper::get_connected_account_id(),
|
305 |
'x-api-key' => OptionsHelper::get_instance_api_key(),
|
306 |
'content-type' => 'application/json'
|
307 |
),
|
308 |
-
'body' => wp_json_encode($
|
309 |
));
|
310 |
}
|
311 |
|
190 |
$data->note = $array['customer_note'];
|
191 |
$data->order_url = $this->get_view_order_url($data->order_id, null);
|
192 |
|
193 |
+
$this->execute_trigger("customer_note", $data, wc_get_order($data->order_id));
|
194 |
}
|
195 |
|
196 |
public function ce_email_notification_customer_new_account($customer_id) {
|
221 |
$data->order_id = $order_id;
|
222 |
$data->order_url = $this->get_view_order_url($order_id, null);
|
223 |
|
224 |
+
$this->execute_trigger("payment_received", $data, wc_get_order($order_id));
|
225 |
}
|
226 |
|
227 |
public function ce_email_notification_failed($order_id, $order) {
|
229 |
$data->order_id = $order_id;
|
230 |
$data->order_url = $this->get_view_order_url($order_id, $order);
|
231 |
|
232 |
+
$this->execute_trigger("failed_order", $data, $order);
|
233 |
}
|
234 |
public function ce_email_notification_hold($order_id, $order) {
|
235 |
$data = new stdClass();
|
236 |
$data->order_id = $order_id;
|
237 |
$data->order_url = $this->get_view_order_url($order_id, $order);
|
238 |
|
239 |
+
$this->execute_trigger("customer_on_hold_order", $data, $order);
|
240 |
}
|
241 |
public function ce_email_notification_processing($order_id, $order) {
|
242 |
$data = new stdClass();
|
243 |
$data->order_id = $order_id;
|
244 |
$data->order_url = $this->get_view_order_url($order_id, $order);
|
245 |
|
246 |
+
$this->execute_trigger("customer_processing_order", $data, $order);
|
247 |
}
|
248 |
public function ce_email_notification_completed($order_id, $order) {
|
249 |
$data = new stdClass();
|
250 |
$data->order_id = $order_id;
|
251 |
$data->order_url = $this->get_view_order_url($order_id, $order);
|
252 |
|
253 |
+
$this->execute_trigger("customer_completed_order", $data, $order);
|
254 |
}
|
255 |
public function ce_email_notification_refunded($order_id, $order) {
|
256 |
$data = new stdClass();
|
257 |
$data->order_id = $order_id;
|
258 |
$data->order_url = $this->get_view_order_url($order_id, $order);
|
259 |
|
260 |
+
$this->execute_trigger("customer_refunded_order", $data, $order);
|
261 |
}
|
262 |
public function ce_email_notification_cancelled($order_id, $order) {
|
263 |
$data = new stdClass();
|
264 |
$data->order_id = $order_id;
|
265 |
$data->order_url = $this->get_view_order_url($order_id, $order);
|
266 |
|
267 |
+
$this->execute_trigger("cancelled_order", $data, $order);
|
268 |
}
|
269 |
|
270 |
public function ce_email_notification_new_order($order_id, $order) {
|
272 |
$data->order_id = $order_id;
|
273 |
$data->order_url = $this->get_view_order_url($order_id, $order);
|
274 |
|
275 |
+
$this->execute_trigger("new_order", $data, $order);
|
276 |
}
|
277 |
|
278 |
public function ce_email_notification_invoice($order, $type) {
|
285 |
$data->order_id = $order->id;
|
286 |
$data->order_url = $this->get_view_order_url( $order->id, $order );
|
287 |
|
288 |
+
$this->execute_trigger( "customer_invoice", $data, $order );
|
289 |
}
|
290 |
|
291 |
+
public function execute_trigger($type, $data, $order = null) {
|
292 |
// if not managed do not trigger
|
293 |
if (!$this->is_email_managed($type)) {
|
294 |
return;
|
295 |
}
|
296 |
|
297 |
+
$requestItem = new stdClass();
|
298 |
+
$requestItem->type = $type;
|
299 |
+
$endpoint = EnvironmentHelper::get_app_gateway_url('wordpress').'/v1.0/wc/trigger';
|
300 |
+
if(!is_null($order))
|
301 |
+
{
|
302 |
+
try {
|
303 |
+
$dp = 2; // decimal point
|
304 |
+
$order_data = array(
|
305 |
+
'id' => $order->get_id(),
|
306 |
+
'number' => $order->get_order_number(),
|
307 |
+
'date_created' => wc_format_datetime($order->get_date_created() ? $order->get_date_created()->getTimestamp() : 0),
|
308 |
+
'date_modified' => wc_format_datetime($order->get_date_modified() ? $order->get_date_modified()->getTimestamp() : 0),
|
309 |
+
'date_completed' => wc_format_datetime($order->get_date_completed() ? $order->get_date_completed()->getTimestamp() : 0),
|
310 |
+
'status' => $order->get_status(),
|
311 |
+
'currency' => $order->get_currency(),
|
312 |
+
'total' => wc_format_decimal($order->get_total(), $dp),
|
313 |
+
'subtotal' => wc_format_decimal($order->get_subtotal(), $dp),
|
314 |
+
'total_line_items_quantity' => $order->get_item_count(),
|
315 |
+
'total_tax' => wc_format_decimal($order->get_total_tax(), $dp),
|
316 |
+
'shipping_total' => wc_format_decimal($order->get_shipping_total(), $dp),
|
317 |
+
'cart_tax' => wc_format_decimal($order->get_cart_tax(), $dp),
|
318 |
+
'shipping_tax' => wc_format_decimal($order->get_shipping_tax(), $dp),
|
319 |
+
'discount_total' => wc_format_decimal($order->get_total_discount(), $dp),
|
320 |
+
'shipping_methods' => $order->get_shipping_method(),
|
321 |
+
'payment_details' => array(
|
322 |
+
'method_id' => $order->get_payment_method(),
|
323 |
+
'method_title' => $order->get_payment_method_title(),
|
324 |
+
'paid' => !is_null($order->get_date_paid()),
|
325 |
+
),
|
326 |
+
'billing' => array(
|
327 |
+
'first_name' => $order->get_billing_first_name(),
|
328 |
+
'last_name' => $order->get_billing_last_name(),
|
329 |
+
'company' => $order->get_billing_company(),
|
330 |
+
'address_1' => $order->get_billing_address_1(),
|
331 |
+
'address_2' => $order->get_billing_address_2(),
|
332 |
+
'city' => $order->get_billing_city(),
|
333 |
+
'state' => $order->get_billing_state(),
|
334 |
+
'postcode' => $order->get_billing_postcode(),
|
335 |
+
'country' => $order->get_billing_country(),
|
336 |
+
'email' => $order->get_billing_email(),
|
337 |
+
'phone' => $order->get_billing_phone(),
|
338 |
+
),
|
339 |
+
'shipping' => array(
|
340 |
+
'first_name' => $order->get_shipping_first_name(),
|
341 |
+
'last_name' => $order->get_shipping_last_name(),
|
342 |
+
'company' => $order->get_shipping_company(),
|
343 |
+
'address_1' => $order->get_shipping_address_1(),
|
344 |
+
'address_2' => $order->get_shipping_address_2(),
|
345 |
+
'city' => $order->get_shipping_city(),
|
346 |
+
'state' => $order->get_shipping_state(),
|
347 |
+
'postcode' => $order->get_shipping_postcode(),
|
348 |
+
'country' => $order->get_shipping_country(),
|
349 |
+
),
|
350 |
+
'customer_note' => $order->get_customer_note(),
|
351 |
+
'customer_ip' => $order->get_customer_ip_address(),
|
352 |
+
'customer_user_agent' => $order->get_customer_user_agent(),
|
353 |
+
'customer_id' => $order->get_user_id(),
|
354 |
+
'view_order_url' => $order->get_view_order_url(),
|
355 |
+
'line_items' => array(),
|
356 |
+
'shipping_lines' => array(),
|
357 |
+
'tax_lines' => array(),
|
358 |
+
'fee_lines' => array(),
|
359 |
+
'coupon_lines' => array()
|
360 |
+
);
|
361 |
+
|
362 |
+
// add line items
|
363 |
+
foreach ($order->get_items() as $item_id => $item) {
|
364 |
+
$product = $item->get_product();
|
365 |
+
$item_meta = $item->get_formatted_meta_data();
|
366 |
+
|
367 |
+
foreach ($item_meta as $key => $values) {
|
368 |
+
$item_meta[$key]->label = $values->display_key;
|
369 |
+
unset($item_meta[$key]->display_key);
|
370 |
+
unset($item_meta[$key]->display_value);
|
371 |
+
}
|
372 |
+
|
373 |
+
try {
|
374 |
+
|
375 |
+
$product_data = array(
|
376 |
+
'images' => array(),
|
377 |
+
'downloads' => array()
|
378 |
+
);
|
379 |
+
$attachment_ids = $product->get_gallery_image_ids();
|
380 |
+
foreach ($attachment_ids as $attachment_id) {
|
381 |
+
$product_data['images'][] = wp_get_attachment_url($attachment_id);
|
382 |
+
}
|
383 |
+
|
384 |
+
$product_data['on_sale'] = $product->is_on_sale();
|
385 |
+
$product_data["sale_price"] = $product->get_sale_price();
|
386 |
+
$product_data["regular_price"] = $product->get_regular_price();
|
387 |
+
|
388 |
+
$item_downloads = $item->get_item_downloads();
|
389 |
+
|
390 |
+
if ($item_downloads) {
|
391 |
+
foreach ( $item_downloads as $file )
|
392 |
+
{
|
393 |
+
$downloads[] = array(
|
394 |
+
'line_item_id' => $item->get_id(),
|
395 |
+
'product_id' => $item->get_product_id(),
|
396 |
+
'download_url' => $file['download_url'],
|
397 |
+
'download_name' => $file['name'],
|
398 |
+
'download_id' => $file['id'],
|
399 |
+
'downloads_remaining' => $file['downloads_remaining'],
|
400 |
+
'access_expires' => $file['access_expires'],
|
401 |
+
);
|
402 |
+
}
|
403 |
+
}
|
404 |
+
|
405 |
+
} catch (\Exception $exc)
|
406 |
+
{
|
407 |
+
// unable to get this data
|
408 |
+
}
|
409 |
+
|
410 |
+
$src = wc_placeholder_img_src();
|
411 |
+
if ( $image_id = $product->get_image_id() ) {
|
412 |
+
list( $src ) = wp_get_attachment_image_src( $image_id, 'full' );
|
413 |
+
}
|
414 |
+
|
415 |
+
$order_data['line_items'][] = array(
|
416 |
+
'id' => $item_id,
|
417 |
+
'subtotal' => wc_format_decimal($order->get_line_subtotal($item, false, false), $dp),
|
418 |
+
'subtotal_tax' => wc_format_decimal($item->get_subtotal_tax(), $dp),
|
419 |
+
'total' => wc_format_decimal($order->get_line_total($item, false, false), $dp),
|
420 |
+
'total_tax' => wc_format_decimal($item->get_total_tax(), $dp),
|
421 |
+
'price' => wc_format_decimal($order->get_item_total($item, false, false), $dp),
|
422 |
+
'quantity' => $item->get_quantity(),
|
423 |
+
'tax_class' => $item->get_tax_class(),
|
424 |
+
'name' => $item->get_name(),
|
425 |
+
'product_id' => $item->get_product_id(),
|
426 |
+
'product_image' => $src,
|
427 |
+
'product_data' => $product_data,
|
428 |
+
'sku' => is_object($product) ? $product->get_sku() : null,
|
429 |
+
'meta' => array_values($item_meta),
|
430 |
+
'product_url' => get_the_permalink( $item->get_product_id() ),
|
431 |
+
'variation_id' => $item->get_variation_id()
|
432 |
+
);
|
433 |
+
}
|
434 |
+
|
435 |
+
// add shipping
|
436 |
+
foreach ($order->get_shipping_methods() as $shipping_item_id => $shipping_item) {
|
437 |
+
$order_data['shipping_lines'][] = array(
|
438 |
+
'id' => $shipping_item_id,
|
439 |
+
'method_id' => $shipping_item->get_method_id(),
|
440 |
+
'method_title' => $shipping_item->get_name(),
|
441 |
+
'total' => wc_format_decimal($shipping_item->get_total(), $dp),
|
442 |
+
);
|
443 |
+
}
|
444 |
+
|
445 |
+
// add taxes
|
446 |
+
foreach ($order->get_tax_totals() as $tax_code => $tax) {
|
447 |
+
$order_data['tax_lines'][] = array(
|
448 |
+
'id' => $tax->id,
|
449 |
+
'rate_id' => $tax->rate_id,
|
450 |
+
'code' => $tax_code,
|
451 |
+
'title' => $tax->label,
|
452 |
+
'total' => wc_format_decimal($tax->amount, $dp),
|
453 |
+
'compound' => (bool)$tax->is_compound,
|
454 |
+
);
|
455 |
+
}
|
456 |
+
|
457 |
+
// add fees
|
458 |
+
foreach ($order->get_fees() as $fee_item_id => $fee_item) {
|
459 |
+
$order_data['fee_lines'][] = array(
|
460 |
+
'id' => $fee_item_id,
|
461 |
+
'title' => $fee_item->get_name(),
|
462 |
+
'tax_class' => $fee_item->get_tax_class(),
|
463 |
+
'total' => wc_format_decimal($order->get_line_total($fee_item), $dp),
|
464 |
+
'total_tax' => wc_format_decimal($order->get_line_tax($fee_item), $dp),
|
465 |
+
);
|
466 |
+
}
|
467 |
+
|
468 |
+
// add coupons
|
469 |
+
foreach ($order->get_items('coupon') as $coupon_item_id => $coupon_item) {
|
470 |
+
$order_data['coupon_lines'][] = array(
|
471 |
+
'id' => $coupon_item_id,
|
472 |
+
'code' => $coupon_item->get_code(),
|
473 |
+
'amount' => wc_format_decimal($coupon_item->get_discount(), $dp),
|
474 |
+
);
|
475 |
+
}
|
476 |
+
$data->order = $order_data;
|
477 |
+
$endpoint = EnvironmentHelper::get_app_gateway_url('wordpress') . '/v1.0/wc/trigger-with-data';
|
478 |
+
|
479 |
+
}
|
480 |
+
catch (\Exception $ex) {
|
481 |
+
// something failed here
|
482 |
+
}
|
483 |
+
}
|
484 |
+
|
485 |
+
$requestItem->data = wp_json_encode($data);
|
486 |
|
487 |
+
wp_remote_post($endpoint, array(
|
488 |
'method' => 'POST',
|
489 |
+
'timeout' => 10,
|
490 |
'headers' => array(
|
491 |
'x-account-id' => OptionsHelper::get_connected_account_id(),
|
492 |
'x-api-key' => OptionsHelper::get_instance_api_key(),
|
493 |
'content-type' => 'application/json'
|
494 |
),
|
495 |
+
'body' => wp_json_encode($requestItem)
|
496 |
));
|
497 |
}
|
498 |
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInitaa1185c8d086eb67e40a651bef2b4322::getLoader();
|
vendor/composer/ClassLoader.php
CHANGED
@@ -60,7 +60,7 @@ class ClassLoader
|
|
60 |
public function getPrefixes()
|
61 |
{
|
62 |
if (!empty($this->prefixesPsr0)) {
|
63 |
-
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
64 |
}
|
65 |
|
66 |
return array();
|
60 |
public function getPrefixes()
|
61 |
{
|
62 |
if (!empty($this->prefixesPsr0)) {
|
63 |
+
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
64 |
}
|
65 |
|
66 |
return array();
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit9a06407d8929adf6e344919a2e2e0ab2
|
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
-
spl_autoload_register(array('
|
26 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
27 |
-
spl_autoload_unregister(array('
|
28 |
|
29 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
30 |
if ($useStaticLoader) {
|
31 |
require_once __DIR__ . '/autoload_static.php';
|
32 |
|
33 |
-
call_user_func(\Composer\Autoload\
|
34 |
} else {
|
35 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
36 |
foreach ($map as $namespace => $path) {
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInitaa1185c8d086eb67e40a651bef2b4322
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
+
spl_autoload_register(array('ComposerAutoloaderInitaa1185c8d086eb67e40a651bef2b4322', 'loadClassLoader'), true, true);
|
26 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
27 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitaa1185c8d086eb67e40a651bef2b4322', 'loadClassLoader'));
|
28 |
|
29 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
30 |
if ($useStaticLoader) {
|
31 |
require_once __DIR__ . '/autoload_static.php';
|
32 |
|
33 |
+
call_user_func(\Composer\Autoload\ComposerStaticInitaa1185c8d086eb67e40a651bef2b4322::getInitializer($loader));
|
34 |
} else {
|
35 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
36 |
foreach ($map as $namespace => $path) {
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'F' =>
|
@@ -121,9 +121,9 @@ class ComposerStaticInit9a06407d8929adf6e344919a2e2e0ab2
|
|
121 |
public static function getInitializer(ClassLoader $loader)
|
122 |
{
|
123 |
return \Closure::bind(function () use ($loader) {
|
124 |
-
$loader->prefixLengthsPsr4 =
|
125 |
-
$loader->prefixDirsPsr4 =
|
126 |
-
$loader->classMap =
|
127 |
|
128 |
}, null, ClassLoader::class);
|
129 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInitaa1185c8d086eb67e40a651bef2b4322
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'F' =>
|
121 |
public static function getInitializer(ClassLoader $loader)
|
122 |
{
|
123 |
return \Closure::bind(function () use ($loader) {
|
124 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInitaa1185c8d086eb67e40a651bef2b4322::$prefixLengthsPsr4;
|
125 |
+
$loader->prefixDirsPsr4 = ComposerStaticInitaa1185c8d086eb67e40a651bef2b4322::$prefixDirsPsr4;
|
126 |
+
$loader->classMap = ComposerStaticInitaa1185c8d086eb67e40a651bef2b4322::$classMap;
|
127 |
|
128 |
}, null, ClassLoader::class);
|
129 |
}
|