Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blocked currencies KWD, OMR, BHD. #461

Merged
merged 4 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion Controller/Payment/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,30 @@ public function execute()
. " and amount:" . $amount);
// @codeCoverageIgnoreEnd

$currency = $mazeOrder->getOrderCurrencyCode();
Copy link
Contributor

Choose a reason for hiding this comment

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

@yashgit891 , lets use it directly here, we don't to assign it new var


if (in_array($currency, ["KWD", "BHD", "OMR"]))
Copy link
Contributor

Choose a reason for hiding this comment

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

@yashgit891 , use === true

Copy link
Contributor

Choose a reason for hiding this comment

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

Also define these currency as const array as well.

{
$this->logger->info($currency . " currency is not supported at the moment.");

$responseContent = [
'message' => 'Unable to create your order. Please contact support.',
'parameters' => []
];

$code = 400;

$response = $this->resultFactory->create(ResultFactory::TYPE_JSON);
$response->setData($responseContent);
$response->setHttpResponseCode($code);

return $response;
}

$order = $this->rzp->order->create([
'amount' => $amount,
'receipt' => $receipt_id,
'currency' => $mazeOrder->getOrderCurrencyCode(),
'currency' => $currency,
'payment_capture' => $payment_capture,
'notes' => [
'referrer' => $_SERVER['HTTP_REFERER']
Expand Down
5 changes: 5 additions & 0 deletions Model/Resolver/PlaceRazorpayOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
];
}

if (in_array($order_currency_code, ["KWD", "BHD", "OMR"]))
{
throw new \Exception($order_currency_code . " currency is not supported at the moment.");
Copy link
Contributor

Choose a reason for hiding this comment

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

@yashgit891 , please add info log here as well

}

$amount = (int) (number_format($order_grand_total * 100, 0, ".", ""));
$payment_action = $this->scopeConfig->getValue('payment/razorpay/rzp_payment_action', $storeScope);
$payment_capture = 1;
Expand Down
Loading