Skip to content
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
12 changes: 12 additions & 0 deletions includes/Integrations/Dokan.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ public function order_status_changed( $order_id, $old_status, $order_status, $or
$this->send( 'order_dokan_complete', $order, $vendor_id );
break;

case 'cancelled':
$this->send( 'order_dokan_cancelled', $order, $vendor_id );
break;

case 'failed':
$this->send( 'order_dokan_failed', $order, $vendor_id );
break;

case 'refunded':
$this->send( 'order_dokan_refunded', $order, $vendor_id );
break;

default:
// code...
break;
Expand Down
15 changes: 15 additions & 0 deletions includes/Integrations/WooCommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ public function order_status_changed( $order_id, $old_status, $order_status, $or
$this->send( 'order_customer_complete', $order );
break;

case 'cancelled':
$this->send( 'order_admin_cancelled', $order );
$this->send( 'order_customer_cancelled', $order );
break;

case 'failed':
$this->send( 'order_admin_failed', $order );
$this->send( 'order_customer_failed', $order );
break;

case 'refunded':
$this->send( 'order_admin_refunded', $order );
$this->send( 'order_customer_refunded', $order );
break;

default:
// code...
break;
Expand Down
9 changes: 9 additions & 0 deletions includes/Notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,25 @@ public function all() {
// WC Admin
$notifications['order_admin_processing'] = __NAMESPACE__ . '\Notifications\WC\ProcessingAdmin';
$notifications['order_admin_complete'] = __NAMESPACE__ . '\Notifications\WC\CompleteAdmin';
$notifications['order_admin_cancelled'] = __NAMESPACE__ . '\Notifications\WC\CancelledAdmin';
$notifications['order_admin_failed'] = __NAMESPACE__ . '\Notifications\WC\FailedAdmin';
$notifications['order_admin_refunded'] = __NAMESPACE__ . '\Notifications\WC\RefundedAdmin';

// WC Customers
$notifications['order_customer_hold'] = __NAMESPACE__ . '\Notifications\WC\HoldCustomer';
$notifications['order_customer_processing'] = __NAMESPACE__ . '\Notifications\WC\ProcessingCustomer';
$notifications['order_customer_complete'] = __NAMESPACE__ . '\Notifications\WC\CompleteCustomer';
$notifications['order_customer_cancelled'] = __NAMESPACE__ . '\Notifications\WC\CancelledCustomer';
$notifications['order_customer_failed'] = __NAMESPACE__ . '\Notifications\WC\FailedCustomer';
$notifications['order_customer_refunded'] = __NAMESPACE__ . '\Notifications\WC\RefundedCustomer';
}

if ( class_exists( 'WeDevs_Dokan' ) ) {
$notifications['order_dokan_processing'] = __NAMESPACE__ . '\Notifications\Dokan\ProcessingVendor';
$notifications['order_dokan_complete'] = __NAMESPACE__ . '\Notifications\Dokan\CompleteVendor';
$notifications['order_dokan_cancelled'] = __NAMESPACE__ . '\Notifications\Dokan\CancelledVendor';
$notifications['order_dokan_failed'] = __NAMESPACE__ . '\Notifications\Dokan\FailedVendor';
$notifications['order_dokan_refunded'] = __NAMESPACE__ . '\Notifications\Dokan\RefundedVendor';
}

$this->notifications = apply_filters( 'texty_available_notifications', $notifications );
Expand Down
23 changes: 23 additions & 0 deletions includes/Notifications/Dokan/CancelledVendor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace Texty\Notifications\Dokan;

class CancelledVendor extends Base {

/**
* Initialize
*/
public function __construct() {
$this->title = __( 'Vendor - When Order Status is Cancelled', 'texty' );
$this->id = 'order_dokan_cancelled';
$this->group = 'dokan';
$this->type = 'vendor';

$this->default = <<<'EOD'
Order #{order_id} has been cancelled.
Customer: {billing_name}
Total: {order_total}
Site: {site_name}
EOD;
}
}
23 changes: 23 additions & 0 deletions includes/Notifications/Dokan/FailedVendor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace Texty\Notifications\Dokan;

class FailedVendor extends Base {

/**
* Initialize
*/
public function __construct() {
$this->title = __( 'Vendor - When Order Status is Failed', 'texty' );
$this->id = 'order_dokan_failed';
$this->group = 'dokan';
$this->type = 'vendor';

$this->default = <<<'EOD'
Payment failed for order #{order_id}.
Customer: {billing_name}
Total: {order_total}
Site: {site_name}
EOD;
}
}
23 changes: 23 additions & 0 deletions includes/Notifications/Dokan/RefundedVendor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace Texty\Notifications\Dokan;

class RefundedVendor extends Base {

/**
* Initialize
*/
public function __construct() {
$this->title = __( 'Vendor - When Order Status is Refunded', 'texty' );
$this->id = 'order_dokan_refunded';
$this->group = 'dokan';
$this->type = 'vendor';

$this->default = <<<'EOD'
A refund has been processed for order #{order_id}.
Customer: {billing_name}
Refund Amount: {order_total}
Site: {site_name}
EOD;
}
}
23 changes: 23 additions & 0 deletions includes/Notifications/WC/CancelledAdmin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace Texty\Notifications\WC;

class CancelledAdmin extends Base {

/**
* Initialize
*/
public function __construct() {
$this->title = __( 'Admin - When Order Status is Cancelled', 'texty' );
$this->id = 'order_admin_cancelled';
$this->group = 'wc';
$this->default_recipients = [ 'administrator' ];

$this->default = <<<'EOD'
Order #{order_id} has been cancelled.
Customer: {billing_name}
Total: {order_total}
Site: {site_name}
EOD;
}
}
20 changes: 20 additions & 0 deletions includes/Notifications/WC/CancelledCustomer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Texty\Notifications\WC;

class CancelledCustomer extends Base {

/**
* Initialize
*/
public function __construct() {
$this->title = __( 'Customer - When Order Status is Cancelled', 'texty' );
$this->id = 'order_customer_cancelled';
$this->group = 'wc';
$this->type = 'user';

$this->default = <<<'EOD'
Hi {billing_name}, your order #{order_id} from {site_name} has been cancelled. If you have any questions, please contact our support.
EOD;
}
}
23 changes: 23 additions & 0 deletions includes/Notifications/WC/FailedAdmin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace Texty\Notifications\WC;

class FailedAdmin extends Base {

/**
* Initialize
*/
public function __construct() {
$this->title = __( 'Admin - When Order Status is Failed', 'texty' );
$this->id = 'order_admin_failed';
$this->group = 'wc';
$this->default_recipients = [ 'administrator' ];

$this->default = <<<'EOD'
Payment failed for order #{order_id}.
Customer: {billing_name}
Total: {order_total}
Site: {site_name}
EOD;
}
}
20 changes: 20 additions & 0 deletions includes/Notifications/WC/FailedCustomer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Texty\Notifications\WC;

class FailedCustomer extends Base {

/**
* Initialize
*/
public function __construct() {
$this->title = __( 'Customer - When Order Status is Failed', 'texty' );
$this->id = 'order_customer_failed';
$this->group = 'wc';
$this->type = 'user';

$this->default = <<<'EOD'
Hi {billing_name}, your payment for order #{order_id} on {site_name} failed. Please try placing your order again or contact us for assistance.
EOD;
}
}
23 changes: 23 additions & 0 deletions includes/Notifications/WC/RefundedAdmin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace Texty\Notifications\WC;

class RefundedAdmin extends Base {

/**
* Initialize
*/
public function __construct() {
$this->title = __( 'Admin - When Order Status is Refunded', 'texty' );
$this->id = 'order_admin_refunded';
$this->group = 'wc';
$this->default_recipients = [ 'administrator' ];

$this->default = <<<'EOD'
A refund has been processed for order #{order_id}.
Customer: {billing_name}
Refund Amount: {order_total}
Site: {site_name}
EOD;
}
}
20 changes: 20 additions & 0 deletions includes/Notifications/WC/RefundedCustomer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Texty\Notifications\WC;

class RefundedCustomer extends Base {

/**
* Initialize
*/
public function __construct() {
$this->title = __( 'Customer - When Order Status is Refunded', 'texty' );
$this->id = 'order_customer_refunded';
$this->group = 'wc';
$this->type = 'user';

$this->default = <<<'EOD'
Hi {billing_name}, we have processed a refund for your order #{order_id} from {site_name}. The amount was {order_total}.
EOD;
}
}