Skip to content

Conversation

@nkttiwari
Copy link

Note :- Please follow the below points while attaching test cases document link below:

- If label Tested is added then test cases document URL is mandatory.

- Link added should be a valid URL and accessible throughout the org.

- If the branch name contains hotfix / revert by default the BVT workflow check will pass.

Test Case Document URL
Please paste test case document link here....

Copy link

@lbajsarowicz lbajsarowicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ I found potential bug in promotions handling.

  • Missing handling for translations.

Comment on lines +195 to +199
$giftCardDiscountAmount = 0;
//Check if the customer has applied GiftCards
if($quote->getMageworxGiftcardsAmount()) {
$giftCardDiscountAmount = abs($quote->getMageworxGiftcardsAmount());
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be simplified with:

Suggested change
$giftCardDiscountAmount = 0;
//Check if the customer has applied GiftCards
if($quote->getMageworxGiftcardsAmount()) {
$giftCardDiscountAmount = abs($quote->getMageworxGiftcardsAmount());
}
// Check if the customer has applied GiftCards
$giftCardDiscountAmount = !empty($quote->getMageworxGiftcardsAmount())
? abs($quote->getMageworxGiftcardsAmount())
: 0;

Comment on lines +332 to +345
if($giftCardDiscountAmount > 0)
{
$totalAmount = $totalAmount - $giftCardDiscountAmount;
$giftCardDiscount = [
'gift_card_discount'=> $giftCardDiscountAmount,
];
$orderNotes = array_merge($orderNotes, $giftCardDiscount);
}
$promotions = [
'type' => 'gift_card',
'code' => 'gift_card_number',
'value' => $giftCardDiscountAmount,
'description' => 'applied',
];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When there's no Gift Card Discount applied, I believe the $promotions should be empty

Suggested change
if($giftCardDiscountAmount > 0)
{
$totalAmount = $totalAmount - $giftCardDiscountAmount;
$giftCardDiscount = [
'gift_card_discount'=> $giftCardDiscountAmount,
];
$orderNotes = array_merge($orderNotes, $giftCardDiscount);
}
$promotions = [
'type' => 'gift_card',
'code' => 'gift_card_number',
'value' => $giftCardDiscountAmount,
'description' => 'applied',
];
$promotions = [];
if($giftCardDiscountAmount > 0)
{
$totalAmount = $totalAmount - $giftCardDiscountAmount;
$giftCardDiscount = [
'gift_card_discount'=> $giftCardDiscountAmount,
];
$orderNotes = array_merge($orderNotes, $giftCardDiscount);
$promotions = [
'type' => 'gift_card',
'code' => 'gift_card_number',
'value' => $giftCardDiscountAmount,
'description' => 'applied',
];
}

'rzp_order_id' => $razorpay_order->id,
'items' => $items,
'message' => 'Razorpay Order created successfully'
'message' => 'Razorpay Order created successfully',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you considered using __() for translation support?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants