Fixed bug of sending incorrect externalId when editing payment
This commit is contained in:
parent
af90b22c3e
commit
c82faf616a
@ -194,7 +194,7 @@ if ( ! class_exists( 'WC_Retailcrm_Orders' ) ) :
|
||||
}
|
||||
|
||||
if (isset($payment) && $payment['type'] == $this->retailcrm_settings[$order->get_payment_method()] && $order->is_paid()) {
|
||||
$payment = $this->sendPayment($order, true);
|
||||
$payment = $this->sendPayment($order, true, $payment['externalId']);
|
||||
|
||||
return $payment;
|
||||
}
|
||||
@ -402,13 +402,21 @@ if ( ! class_exists( 'WC_Retailcrm_Orders' ) ) :
|
||||
*
|
||||
* @return array $payment
|
||||
*/
|
||||
protected function sendPayment($order, $update = false)
|
||||
protected function sendPayment($order, $update = false, $externalId = false)
|
||||
{
|
||||
$payment = array(
|
||||
'amount' => $order->get_total(),
|
||||
'externalId' => $order->get_id() . uniqid('-')
|
||||
'amount' => $order->get_total()
|
||||
);
|
||||
|
||||
if ($update)
|
||||
{
|
||||
$payment['externalId'] = $externalId;
|
||||
}
|
||||
else
|
||||
{
|
||||
$payment['externalId'] = $order->get_id() . uniqid('-');
|
||||
}
|
||||
|
||||
$payment['order'] = array(
|
||||
'externalId' => $order->get_id()
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user