Skip to content

Commit

Permalink
Remove unicodes from payment title. (#27)
Browse files Browse the repository at this point in the history
Co-authored-by: MykolaMalovanets <[email protected]>
  • Loading branch information
nmalevanec and MykolaMalovanets committed Nov 20, 2023
1 parent 4d3eb6d commit ebc4054
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 13 additions & 3 deletions Checkout/Api/Platform/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static function estimateShippingMethods(
Mage_Core_Controller_Request_Http $request,
Mage_Core_Controller_Response_Http $response
) {
preg_match('/cart\/(.*)\/estimate-shipping-methods/', $request->getRequestUri(), $cartIdMatches);
preg_match('/carts\/(.*)\/estimate-shipping-methods/', $request->getRequestUri(), $cartIdMatches);
$cartId = isset($cartIdMatches[1]) ? $cartIdMatches[1] : null;
/** @var Mage_Sales_Model_Quote $quote */
$quote = Mage::getModel('sales/quote');
Expand All @@ -106,8 +106,18 @@ public static function estimateShippingMethods(
return Bold_Checkout_Rest::buildResponse($response, json_encode([]));
}
$payload = json_decode($request->getRawBody());
// todo: implement estimate-shipping methods.
return Bold_Checkout_Rest::buildResponse($response, json_encode([]));
self::updateAddress($quote->getShippingAddress(), $payload->address, $quote);
$quote->getShippingAddress()->setCollectShippingRates(true);
$quote->setDataChanges(true);
$quote->collectTotals();
try {
return Bold_Checkout_Rest::buildResponse(
$response,
json_encode(Bold_Checkout_Service_Extractor_Quote_ShippingMethods::extract($quote))
);
} catch (Mage_Core_Model_Store_Exception $e) {
return self::buildErrorResponse($e->getMessage(), $response);
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Checkout/Service/PaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function getTitle()
if ($infoInstance && $infoInstance->getCcLast4()) {
$ccLast4 = $infoInstance->decrypt($infoInstance->getCcLast4());
$title .= strlen($ccLast4) === 4
? $infoInstance->getCcType() . ': ••••• •••••• ' . $ccLast4
? $infoInstance->getCcType() . ': ending in ' . $ccLast4
: $infoInstance->getCcType() . ': ' . $ccLast4;
}
return $title ?: parent::getTitle();
Expand Down

0 comments on commit ebc4054

Please sign in to comment.