public function getPricingErrors(array $normalized) { $i18n = Localization::getTranslator(); $pricingSettings = []; $cfg = new Config(); $priceMSG = null; try { $price = ServiceLocater::resolve($normalized, 'PricingProvider')->getPrice(); if (!is_numeric($price->get())) { $pricingSettings[] = ['id' => '#sources-methods-error', 'error' => $i18n->_('Unknown format encountered:') . ' "' . $price . '".']; } $priceMSG = $i18n->_('Current Price would be: ') . $cfg->getCurrencyMeta()->format($price); } catch (Exception $e) { $pricingSettings[] = ['id' => '#sources-methods-error', 'error' => $e->getMessage()]; } return ['errors' => $pricingSettings, 'price' => $priceMSG]; }
public function setData(array $data) { $this->data = $data; $this->walletProvider = ServiceLocater::resolve($this->data['walletProvider'], 'WalletProvider'); $this->pricingProvider = ServiceLocater::resolve($this->data['pricingProvider'], 'PricingProvider'); }