Skip to content

Commit

Permalink
Merge pull request #245 from reepay/fix-handles
Browse files Browse the repository at this point in the history
Fix handles
  • Loading branch information
dimaspolohov authored Jun 6, 2023
2 parents a57851a + bf83b5f commit 213c318
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The Reepay plugin extends WooCommerce allowing you to take payments on your stor
See installation guide right here: https://intercom.help/reepay/reepay-plugins/woocommerce-plugin

== Changelog ==
v 1.4.68 - Change order handle generation
v 1.4.67 - Fix bugs on checkout and thank you pages
v 1.4.66 - Choose send order lines or not
v 1.4.65 - Fix instant settle to full amount
Expand Down
4 changes: 2 additions & 2 deletions includes/Functions/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ function rp_get_order_handle( WC_Order $order, $unique = false ): ?string {

if ( empty( $handle ) ) {
$handle = $unique ?
'order-' . $order->get_order_number() . '-' . time() :
'order-' . $order->get_order_number();
'order-' . $order->get_id() . '-' . time() :
'order-' . $order->get_id();

$order->add_meta_data( '_reepay_order', $handle );

Expand Down
2 changes: 1 addition & 1 deletion reepay-woocommerce-payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Description: Get a plug-n-play payment solution for WooCommerce, that is easy to use, highly secure and is built to maximize the potential of your e-commerce.
* Author: reepay
* Author URI: http://reepay.com
* Version: 1.4.67
* Version: 1.4.68
* Text Domain: reepay-checkout-gateway
* Domain Path: /languages
* WC requires at least: 3.0.0
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/functions/OrderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,31 @@ public function tear_down() {
*/
public function test_rp_get_order_handle() {
$this->assertSame(
'order-' . $this->order->get_order_number(),
'order-' . $this->order->get_id(),
rp_get_order_handle( $this->order ),
'Wrong order handle generated'
);

$this->assertSame(
'order-' . $this->order->get_order_number(),
'order-' . $this->order->get_id(),
$this->order->get_meta( '_reepay_order' ),
'Wrong order handle saved in meta'
);

$this->assertSame(
'order-' . $this->order->get_order_number(),
'order-' . $this->order->get_id(),
rp_get_order_handle( $this->order ),
'Wrong order handle returned'
);

$this->assertSame(
'order-' . $this->order->get_order_number() . '-' . time(),
'order-' . $this->order->get_id() . '-' . time(),
rp_get_order_handle( $this->order, true ),
'Wrong new unique order handle generated'
);

$this->assertSame(
'order-' . $this->order->get_order_number() . '-' . time(),
'order-' . $this->order->get_id() . '-' . time(),
$this->order->get_meta( '_reepay_order' ),
'Wrong unique order handle saved in meta'
);
Expand Down

0 comments on commit 213c318

Please sign in to comment.