Skip to content

Commit

Permalink
Merge pull request #502 from razorpay/lineitem-restr
Browse files Browse the repository at this point in the history
changes order object datatype
  • Loading branch information
poojarazor authored Sep 11, 2023
2 parents 95f58b1 + 552756d commit e7473eb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions woo-razorpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,7 @@ protected function createRazorpayOrderId($orderId, $sessionKey)
}
catch (Exception $e)
{
rzpLogInfo("rzp order error " . $e->getMessage());
return $e;
}

Expand Down Expand Up @@ -1239,7 +1240,7 @@ private function getOrderCreationData($orderId)
}

$data = array(
'receipt' => $orderId,
'receipt' => (string)$orderId,
'amount' => (int) round($order->get_total() * 100),
'currency' => $this->getOrderCurrency($order),
'payment_capture' => ($this->getSetting('payment_action') === self::AUTHORIZE) ? 0 : 1,
Expand Down Expand Up @@ -1309,16 +1310,16 @@ public function orderArg1CC($data, $order)

$data['line_items'][$i]['type'] = $type;
$data['line_items'][$i]['sku'] = $product->get_sku();
$data['line_items'][$i]['variant_id'] = $item->get_variation_id();
$data['line_items'][$i]['product_id'] = $product->get_id();
$data['line_items'][$i]['variant_id'] = (string)$item->get_variation_id();
$data['line_items'][$i]['product_id'] = (string)$product->get_id();
$data['line_items'][$i]['price'] = (empty($productDetails['price'])=== false) ? round(wc_get_price_excluding_tax($product)*100) + round($item->get_subtotal_tax()*100 / $item->get_quantity()) : 0;
$data['line_items'][$i]['offer_price'] = (empty($productDetails['sale_price'])=== false) ? (int) $productDetails['sale_price']*100 : $productDetails['price']*100;
$data['line_items'][$i]['quantity'] = (int)$item->get_quantity();
$data['line_items'][$i]['name'] = mb_substr($item->get_name(), 0, 125, "UTF-8");
$data['line_items'][$i]['description'] = mb_substr($item->get_name(), 0, 250,"UTF-8");
$productImage = $product->get_image_id()?? null;
$data['line_items'][$i]['image_url'] = $productImage? wp_get_attachment_url( $productImage ) : null;
$data['line_items'][$i]['product_url'] = $product->get_permalink();
$data['line_items'][$i]['image_url'] = (string)($productImage? wp_get_attachment_url( $productImage ) : "");
$data['line_items'][$i]['product_url'] = (string)$product->get_permalink();

$i++;
}
Expand Down

0 comments on commit e7473eb

Please sign in to comment.