Skip to content

Commit

Permalink
v1.4.9
Browse files Browse the repository at this point in the history
  • Loading branch information
iverok committed Jul 1, 2020
1 parent f9cd85b commit 823f858
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
10 changes: 7 additions & 3 deletions Vipps.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,9 @@ protected function callback_restore_session ($orderid) {
} else {
WC()->customer = new WC_Customer(); // Reset from session
}
// This is to provide defaults; real address will come from Vipps in this sitation. IOK 2019-10-25
WC()->customer->set_billing_address_to_base();
WC()->customer->set_shipping_address_to_base();

// The normal "restore cart from session" thing runs on wp_loaded, and only there, and cannot
// be called from outside the WC_Cart object. We cannot easily run this on wp_loaded, and it does
Expand All @@ -1077,6 +1080,7 @@ protected function callback_restore_session ($orderid) {
// Therefore, we will just recreate the 'data' bit of the contents and set the cart contents directly
// from the now restored session. IOK 2020-04-08
$newcart = array();

foreach(WC()->session->get('cart',true) as $key => $values) {
$product = wc_get_product( $values['variation_id'] ? $values['variation_id'] : $values['product_id'] );
$values['data'] = $product;
Expand All @@ -1085,9 +1089,8 @@ protected function callback_restore_session ($orderid) {
WC()->cart->set_cart_contents($newcart);
WC()->cart->calculate_totals();

// This is to provide defaults; real address will come from Vipps in this sitation. IOK 2019-10-25
WC()->customer->set_billing_address_to_base();
WC()->customer->set_shipping_address_to_base();
// IOK 2020-07-01 plugins expect this to be called: hopefully they'll not get confused by it happening twice
do_action( 'woocommerce_cart_loaded_from_session', WC()->cart);

return WC()->session;
}
Expand Down Expand Up @@ -1222,6 +1225,7 @@ public function vipps_shipping_details_callback_handler($order, $vippsdata,$vipp
// and anyway, some plugins override the class of the cart, so just using WC_Cart will sometimes break.
// Now however, the session is stored in the order, and the cart will not have been deleted, so we should
// now be able to calculate shipping for the actual cart with no further manipulation. IOK 2020-04-08
WC()->cart->calculate_totals();
$acart = WC()->cart;

$shipping_methods = array();
Expand Down
2 changes: 1 addition & 1 deletion VippsApi.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ public function capture_payment($order,$amount,$requestid=1) {
$headers['X-Source-Address'] = $ip;
$headers['Ocp-Apim-Subscription-Key'] = $subkey;


$transaction = array();
// Ignore refOrderId - for child-transactions
$transaction['amount'] = round($amount);
Expand Down Expand Up @@ -422,6 +421,7 @@ private function http_call($command,$data,$verb='GET',$headers=null,$encoding='u
if ($verb == 'GET' && $data_encoded) {
$url .= "?$data_encoded";
}

$return = wp_remote_request($url,$args);
$headers = array();
$content=NULL;
Expand Down
11 changes: 7 additions & 4 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,9 @@ This project is hosted on Github at: https://github.com/vippsas/vipps-woocommerc

== Upgrade Notice ==

= 1.4.8 =
Fixed a bug in express checkout shipping calculations where cart totals could be wrong, affecting free shipping.
Added filter 'woo_vipps_payment_return_url' to allow plugins to add extra arguments to return URL
Changed license to MIT from AGPL
= 1.4.9 =
Fixed a bug in the session-restore code for Express Checkout that could affect pricing of shipping
Added a do-action call to 'woocommerce_cart_loaded_from_session' in callbacks to allow dynamic pricing plugins to run their code

== Frequently Asked Questions ==

Expand Down Expand Up @@ -200,6 +199,10 @@ From version 1.1.13 you can also modify the javascript using the new WP hooks li

== Changelog ==

= 2020.07.01 version 1.4.9 =
Fixed a bug in the session-restore code for Express Checkout that could affect pricing of shipping
Added a do-action call to 'woocommerce_cart_loaded_from_session' in callbacks to allow dynamic pricing plugins to run their code

= 2020.06.29 version 1.4.8 =
* Fixed a bug in express checkout shipping calculations where cart totals could be wrong
* Changed license from AGPLv3 (http://www.gnu.org/licenses/agpl-3.0.html) to MIT (https://choosealicense.com/licenses/mit/)
Expand Down
2 changes: 1 addition & 1 deletion woo-vipps.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Author URI: https://www.wp-hosting.no/
Text-domain: woo-vipps
Domain Path: /languages
Version: 1.4.8
Version: 1.4.9
Requires at least: 4.7
Tested up to: 5.4.2
Expand Down

0 comments on commit 823f858

Please sign in to comment.