Get Unirgy_Giftcert balance.

@param $giftcertCode
@return float
@throws \Magento\Framework\Exception\NoSuchEntityException
439608
public function getUnirgyGiftCertBalanceByCode($giftcertCode)
    {
        /** @var \Unirgy\Giftcert\Model\Cert $giftCert */
        $unirgyInstance = $this->unirgyCertRepository->getInstance();

        $result = 0;
        if ($unirgyInstance) {
            $giftCert = $unirgyInstance->get($giftcertCode);
            if ($giftCert && $giftCert->getStatus() === 'A' && $giftCert->getBalance() > 0) {
                $result = $giftCert->getBalance();
            }
        }

        return (float) $result;
    }
745340
protected function getCurrencyIso4217NumericCode($textCurrencyCode)
    {
        $currencies = null;

        $localIso417data = __DIR__ . DS . "Config" . DS . "iso4217.xml";

        $currencyXmlDataUrl = "http://www.currency-iso.org/dam/downloads/lists/list_one.xml";

        $xmlData = @file_get_contents($currencyXmlDataUrl);

        try {
            $currencies = new \SimpleXMLElement($xmlData);

            // Update the local currencies copy.
            @file_put_contents($localIso417data, $xmlData);
        } catch (\Exception $ex) {
            Tlog::getInstance()->warning("Failed to get currency XML data from $currencyXmlDataUrl: ".$ex->getMessage());
            try {
                $currencies = new \SimpleXMLElement(@file_get_contents($localIso417data));
            } catch (\Exception $ex) {
                Tlog::getInstance()->warning("Failed to get currency XML data from local copy $localIso417data: ".$ex->getMessage());
            }
        }

        if (null !== $currencies) {
            foreach ($currencies->CcyTbl->CcyNtry as $country) {
                if ($country->Ccy == $textCurrencyCode) {
                    return (string) $country->CcyNbr;
                }
            }
        }

        // Last chance
        switch ($textCurrencyCode) {
            case 'USD':
                return 840;
            case 'GBP':
                return 826;
                break;
            case 'EUR':
                return 978;
                break;
        }

        throw new \RuntimeException(
            Translator::getInstance()->trans(
                "Failed to get ISO 4217 data for currency %curr, payment is not possible.",
                ['%curr' => $textCurrencyCode]
            )
        );
    }
866095
public static function getStoreAmountOfCurrency($amount, $currencyCode) {
        $currencyCode   = strtoupper($currencyCode);
        $amount         = (int) $amount;

        if( in_array($currencyCode, self::FULL_VALUE_CURRENCIES, true) ) {
            return (float) $amount;
        }

        if( in_array($currencyCode, self::DIV_1000_VALUE_CURRENCIES, true) ) {
            return (float) ($amount / self::DIV_1000);
        }

        return (float) ($amount / self::DIV_100);
    }
477955
public function getDynamicCount($blnParentIsDynamic = false)
    {
        $intReturn = 0;

        if (($this->__dynamic || $blnParentIsDynamic) && is_object($this->__dynamiccounter)) {
            $intReturn = $this->__dynamiccounter->getValidator()->getValue();
        }

        return (int) $intReturn;
    }
1247212
public function GetBasketQuantityForVoucher(TdbShopVoucher &$oVoucher)
    {
        $iCurrentPosition = $this->getItemPointer();
        $this->GoToStart();
        $iAmount = 0;
        while ($oItem = &$this->Next()) {
            $bIncludeProduct = $oVoucher->AllowVoucherForArticle($oItem);
            if ($bIncludeProduct) {
                $iAmount = $iAmount + $oItem->dAmount;
            }
        }
        $this->setItemPointer($iCurrentPosition);

        return $iAmount;
    }
1095359
public static function getCurrencySymbol($isocode) {
		return empty(self::$currencySymbols[$isocode])?$isocode:self::$currencySymbols[$isocode];
	}
460014
public function getMethodInstance($code)
    {
        $key = self::XML_PATH_PAYMENT_METHODS . '/' . $code . '/model';
        $class = Mage::getStoreConfig($key);

        if (!$class && strpos($code, 'adyen_hpp') !== false) {
            $methodCode = substr($code, strlen('adyen_hpp_'));
            Mage::getSingleton('adyen/observer')->createPaymentMethodFromHpp(
                $methodCode, array(),
                Mage::app()->getStore(), '0'
            );
            $class = Mage::getStoreConfig($key);
        } elseif (!$class && strpos($code, 'adyen_oneclick') !== false) {
            $methodCode = substr($code, strlen('adyen_oneclick_'));
            $store = Mage::getSingleton('adminhtml/session_quote')->getStore();
            Mage::getSingleton('adyen/billing_agreement_observer')->createPaymentMethodFromOneClick(
                $methodCode,
                array(), $store
            );
            $class = Mage::getStoreConfig($key, $store->getId());
        }

        $methodInstance = Mage::getModel($class);
        if (method_exists($methodInstance, 'setCode')) {
            $methodInstance->setCode($code);
        }

        return $methodInstance;
    }
75627
public function getCurrency($code = null)
    {
        $code = $code ?: $this->getUserCurrency();

        return Arr::get($this->getCurrencies(), strtoupper($code));
    }
101060
def form_valid(self,form):
        '''
        
        '''
        emailTo = form.cleaned_data.get('emailTo')
        emailType = form.cleaned_data.get('emailType')
        recipientName = form.cleaned_data.get('recipientName')
        fromName = form.cleaned_data.get('fromName')
        message = form.cleaned_data.get('message')

        logger.info('Processing gift certificate.')

        try:
            voucher = Voucher.create_new_code(
                prefix='GC_',
                name=_('Gift certificate: %s%s for %s' % (getConstant('general__currencySymbol'),self.amount, emailTo)),
                category=getConstant('vouchers__giftCertCategory'),
                originalAmount=self.amount,
                singleUse=False,
                forFirstTimeCustomersOnly=False,
                expirationDate=None,
            )
        except IntegrityError:
            logger.error('Error creating gift certificate voucher for Invoice #%s' % self.invoiceId)
            emailErrorMessage(_('Gift certificate transaction not completed'), self.invoiceId)

        template = getConstant('vouchers__giftCertTemplate')

        # Attempt to attach a PDF of the gift certificate
        rf = RequestFactory()
        pdf_request = rf.get('/')

        pdf_kwargs = {
            'currencySymbol': getConstant('general__currencySymbol'),
            'businessName': getConstant('contact__businessName'),
            'certificateAmount': voucher.originalAmount,
            'certificateCode': voucher.voucherId,
            'certificateMessage': message,
            'recipientName': recipientName,
            'fromName': fromName,
        }
        if recipientName:
            pdf_kwargs.update({})

        attachment = GiftCertificatePDFView(request=pdf_request).get(request=pdf_request,**pdf_kwargs).content or None

        if attachment:
            attachment_name = 'gift_certificate.pdf'
        else:
            attachment_name = None

        # Send a confirmation email
        email_class = EmailRecipientMixin()
        email_class.email_recipient(
            subject=template.subject,
            content=template.content,
            send_html=template.send_html,
            html_content=template.html_content,
            from_address=template.defaultFromAddress,
            from_name=template.defaultFromName,
            cc=template.defaultCC,
            to=emailTo,
            currencySymbol=getConstant('general__currencySymbol'),
            businessName=getConstant('contact__businessName'),
            certificateAmount=voucher.originalAmount,
            certificateCode=voucher.voucherId,
            certificateMessage=message,
            recipientName=recipientName,
            fromName=fromName,
            emailType=emailType,
            recipient_name=recipientName,
            attachment_name=attachment_name,
            attachment=attachment
        )

        # Remove the invoice session data
        self.request.session.pop(INVOICE_VALIDATION_STR,None)

        return HttpResponseRedirect(self.get_success_url())
626639
public static function getSubUnit($currencyCode)
    {
        $subunits = static::getCurrencyData($currencyCode)['sub_unit'];
        if (!is_int($subunits)) {
            throw new UnexpectedValueException(sprintf(
                'The currency sub-units value must be an integer; "%s" given',
                is_object($subunits) ? get_class($subunits) : gettype($subunits)
            ));
        }
        if ($subunits < 1) {
            throw new UnexpectedValueException(sprintf(
                'The currency sub-units value must be greater than 1; "%s" given',
                $subunits
            ));
        }
        return $subunits;
    }
852822
private function provideCurrency($currencyCode)
    {
        $currency = $this->currencyRepository->findOneBy(['code' => $currencyCode]);
        if (null === $currency) {
            /** @var CurrencyInterface $currency */
            $currency = $this->createCurrency($currencyCode);

            $this->currencyRepository->add($currency);
        }

        return $currency;
    }
429842
public function getVendorArticleCount($sVendorId)
    {
        // current category unique ident
        $sActIdent = $this->_getUserViewId();

        // loading from cache
        $aVendorData = $this->_getVendorCache();

        if (!$aVendorData || !isset($aVendorData[$sVendorId][$sActIdent])) {
            $iCnt = $this->setVendorArticleCount($aVendorData, $sVendorId, $sActIdent);
        } else {
            $iCnt = $aVendorData[$sVendorId][$sActIdent];
        }

        return $iCnt;
    }
158705
public function disableRecurringPayments(string $currencyCode, string $paymentProviderId): BalanceInterface
    {
        $response = $this->client->post(
            $this->getBaseEndpointUri()->withPath("{$this->getBaseEndpointUri()->getPath()}/recurring-setup")->withQuery(http_build_query(['supportedCurrencyId' => $currencyCode])),
            (string) json_encode((object) [
                'providerId' => $paymentProviderId,
                'chargePerUsage' => 'true',
            ])
        );

        return $this->entitySerializer->deserialize(
            (string) $response->getBody(),
            $this->getEntityClass(),
            'json'
        );
    }
1162544
public function setGiftCertificateAmount(Money $money = null): OrderInterface
    {
        $this->giftCertificateAmount = $money->getAmount();

        return $this;
    }
1222409
public function get(string $cardId, string $encryptCode)
    {
        $params = [
            'card_id' => $cardId,
            'encrypt_code' => $encryptCode,
        ];

        return $this->httpPostJson('cgi-bin/card/invoice/reimburse/getinvoiceinfo', $params);
    }
1151209
public static function getCurrencyForCode($code)
    {
        $currency = KlarnaCurrency::fromCode($code);
        if ($currency === null) {
            throw new Klarna_UnknownCurrencyException($code);
        }
        return $currency;
    }
215542
public static function getRsaFromCert($x509) {
    $rsa = $x509->getPublicKey();
    if (!$rsa) {
      throw new InvalidMessageException("Invalid message: certificate missing or does not have public key");
    }
    $rsa->setEncryptionMode(Constants::RSA_ENC_MODE);
    $rsa->setSignatureMode(Constants::RSA_SIG_MODE);
    $rsa->setHash(Constants::RSA_HASH);
    return $rsa;
  }