-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Calculation/Transaction Sync Status Meta Box (#214)
* Save Calculation Results to Cart and Order (#207) * Persist calculation results on cart and order * Ensure correct tax results get set on subscription * Admin Order Meta Box (#208) * Add meta box to orders * Change copied notification from alert to tool tip * INT 2155 Transaction Sync Data in Metabox (#211) * Add meta box to orders * Change copied notification from alert to tool tip * Add transaction sync data to order metabox * Refactor sync queue link method for better readability. * Remove usage of deprecated function * Remove storing of raw request and response and section for them in the order meta box (#213) * Version 4.1.0
- Loading branch information
1 parent
465a81f
commit b6a1bc9
Showing
22 changed files
with
893 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
includes/TaxCalculation/class-cart-tax-calculation-result-data-store.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
/** | ||
* Cart Tax Calculation Result Data Store | ||
* | ||
* Persists tax calculation result to cart. | ||
* | ||
* @package TaxJar | ||
*/ | ||
|
||
namespace TaxJar; | ||
|
||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; // Exit if accessed directly. | ||
} | ||
|
||
/** | ||
* Class Cart_Tax_Calculation_Result_Data_Store | ||
*/ | ||
class Cart_Tax_Calculation_Result_Data_Store implements Tax_Calculation_Result_Data_Store { | ||
|
||
/** | ||
* Cart to persist result on | ||
* | ||
* @var \WC_Cart | ||
*/ | ||
private $cart; | ||
|
||
/** | ||
* Cart_Tax_Calculation_Result_Data_Store Constructor | ||
* | ||
* @param \WC_Cart $cart Cart to persist results on. | ||
*/ | ||
public function __construct( \WC_Cart $cart ) { | ||
$this->cart = $cart; | ||
} | ||
|
||
/** | ||
* Persist results on the cart | ||
* | ||
* @param Tax_Calculation_Result $calculation_result Result of tax calculation. | ||
*/ | ||
public function update( Tax_Calculation_Result $calculation_result ) { | ||
$calculation_result->set_raw_request(''); | ||
$calculation_result->set_raw_response(''); | ||
$this->cart->tax_calculation_results = $calculation_result->to_json(); | ||
} | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
includes/TaxCalculation/class-order-tax-calculation-result-data-store.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
/** | ||
* Order Tax Calculation Result Data Store | ||
* | ||
* Persists tax calculation result to order. | ||
* | ||
* @package TaxJar | ||
*/ | ||
|
||
namespace TaxJar; | ||
|
||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; // Exit if accessed directly. | ||
} | ||
|
||
/** | ||
* Class Order_Tax_Calculation_Result_Data_Store | ||
*/ | ||
class Order_Tax_Calculation_Result_Data_Store implements Tax_Calculation_Result_Data_Store { | ||
|
||
/** | ||
* Order to persist result on | ||
* | ||
* @var \WC_Order | ||
*/ | ||
private $order; | ||
|
||
/** | ||
* Order_Tax_Calculation_Result_Data_Store Constructor | ||
* | ||
* @param \WC_Order $order Order to persist results on. | ||
*/ | ||
public function __construct( \WC_Order $order ) { | ||
$this->order = $order; | ||
} | ||
|
||
/** | ||
* Persist results on the order | ||
* | ||
* @param Tax_Calculation_Result $calculation_result Result of tax calculation. | ||
*/ | ||
public function update( Tax_Calculation_Result $calculation_result ) { | ||
$calculation_result->set_raw_request(''); | ||
$calculation_result->set_raw_response(''); | ||
$this->order->update_meta_data( '_taxjar_tax_result', $calculation_result->to_json() ); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* Admin Meta Boxes | ||
* | ||
* Adds meta box to order type posts. | ||
* | ||
* @package TaxJar | ||
*/ | ||
|
||
namespace TaxJar; | ||
|
||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; // Exit if accessed directly. | ||
} | ||
|
||
/** | ||
* Class Admin_Meta_Boxes | ||
*/ | ||
class Admin_Meta_Boxes { | ||
|
||
/** | ||
* Admin_Meta_Boxes Constructor. | ||
*/ | ||
public function __construct() { | ||
add_action( 'add_meta_boxes', array( $this, 'add_order_meta_box' ), 30 ); | ||
} | ||
|
||
/** | ||
* Add meta box to order post types. | ||
*/ | ||
public function add_order_meta_box() { | ||
foreach ( wc_get_order_types( 'order-meta-boxes' ) as $type ) { | ||
add_meta_box( | ||
'taxjar', | ||
__( 'TaxJar', 'taxjar' ), | ||
'\TaxJar\Order_Meta_Box::output', | ||
$type, | ||
'normal', | ||
'low' | ||
); | ||
} | ||
} | ||
} |
Oops, something went wrong.