@param number                      $money
@param Merchant_Billing_CreditCard $creditcard
@param array                       $options

@return Merchant_Billing_Response
191469
public function authorize($money, Merchant_Billing_CreditCard $creditcard, $options = array())
  {
      $this->add_creditcard($creditcard);
      $this->add_address($options);
      $this->post['PAYMENTACTION'] = 'Authorization';
      $this->post['AMT'] = $this->amount($money);
      $this->post['IPADDRESS'] = isset($options['ip']) ? $options['ip'] : $_SERVER['REMOTE_ADDR'];

      return $this->commit('DoDirectPayment');
  }
354769
private function addCreditcard(CreditCard $creditcard, $options, $action)
    {
        $xml = $this->xml;
        $year  = $this->cc_format($creditcard->year, 'two_digits');
        $month = $this->cc_format($creditcard->month, 'two_digits');

        $xml->PaymentInfo(null, $action)
            ->PayMethod(
                $this->CARD_MAPPINGS[CreditCard::type($creditcard->number)],
                'PaymentInfo'
            )
            ->CardPan($creditcard->number, 'PaymentInfo')
            ->CardExpDate("{$year}{$month}", 'PaymentInfo')
            ->CardCvv2($creditcard->verification_value, 'PaymentInfo')
            ->CardHolderName(trim($creditcard->name()), 'PaymentInfo');

        if ($options['installments']) {
            $xml->InstallmentParameters(null, 'PaymentInfo')
                ->ExtInstallmentoffset(0, 'InstallmentParameters')
                ->ExtInstallmentperiod($options['installments'], 'InstallmentParameters');
        }
    }
1259164
public static function currency($number, $currency = null, array $options = []) {
		$defaults = [
			'positive' => '+', 'signed' => false
		];
		$options += $defaults;
		$sign = '';
		if ($number > 0 && !empty($options['signed'])) {
			$sign = $options['positive'];
		}
		return $sign . parent::currency($number, $currency, $options);
	}
338840
public function populateCard($card, CreditCardPaymentForm $paymentForm)
    {
        if (!$card instanceof CreditCard) {
            return;
        }

        $card->setFirstName($paymentForm->firstName);
        $card->setLastName($paymentForm->lastName);
        $card->setNumber($paymentForm->number);
        $card->setExpiryMonth($paymentForm->month);
        $card->setExpiryYear($paymentForm->year);
        $card->setCvv($paymentForm->cvv);
    }
1140418
public function onCheckout($cart)
    {
        if (!isset($this->omnipay))
            throw new ShopException('Omnipay gateway not set.', 0);

        if ($this->isCreditCard && !isset($this->creditCard))
            throw new GatewayException('Credit Card not set.', 1);
        try {

            $response = $this->omnipay->authorize(array_merge([
                'amount'    => $cart->total,
                'currency'  => Config::get('shop.currency'),
                'card'      => $this->isCreditCard ? $this->creditCard : [],
                'returnUrl' => $this->callbackSuccess,
            ], $this->options))->send();

            if (!$response->isSuccessful()) {
                throw new CheckoutException($response->getMessage(), 1);
            }

        } catch (Exception $e) {

            throw new CheckoutException(
                'Exception caught while attempting authorize.' . "\n" . 
                $e->getMessage(),
                1
            );
        }
    }
932326
public function actionCurrency($value, $currency = null, $options = [], $textOptions = [])
    {
        return Yii::$app->formatter->asCurrency($value, $currency, $options, $textOptions);
    }
228182
public function refund($amount, $reference, array $options = [])
    {
        $url = sprintf($this->gateway->buildUrlFromString('collections').'/%s/refunds', $reference);

        return $this->gateway->commit('post', $url, [
            'amount' => (float) $this->gateway->amount($amount),
        ]);
    }
510950
def transaction_request_object(amount, creditcard, gateway_options)
     {  'AccountHolder' => creditcard.name,
        'ClientIP' => gateway_options[:ip],
        'Details' => transaction_details(amount, creditcard, gateway_options),
        'BillingAddress' => address_hash(creditcard, gateway_options, :billing_address),
        'ShippingAddress' => address_hash(creditcard, gateway_options, :shipping_address),
        'CreditCardData' => {
          'CardNumber' => creditcard.number,
          'CardExpiration' => expiration_date(creditcard),
          'AvsStreet' => gateway_options[:billing_address][:address1],
          'AvsZip' => gateway_options[:billing_address][:zip],
          'CardCode' => creditcard.verification_value } }
    end
497462
public static function balance(array $options = array())
    {
        $api = new Api\Balance();

        if (isset($options['cardNumber'])) {
            $api->setCardNumber($options['cardNumber']);
        }
        if (isset($options['pincode'])) {
            $api->setPincode($options['pincode']);
        }
        $result = $api->doRequest();

        return $result['balance'] / 100;
    }
223370
public function setCreditCard(CreditCard $creditCard)
    {
        $creditCard->setContext(Moip::PAYMENT);

        $fundingInstrument = new stdClass;
        $fundingInstrument->method = 'CREDIT_CARD';
        $fundingInstrument->creditCard = $creditCard->getData();

        $this->data->fundingInstrument = $fundingInstrument;

        unset($this->data->fundingInstruments);

        return $this;
    }
332879
protected function doTransact(Transaction $transaction, array $options = array())
    {
        $this->validateTransaction($transaction);

        $account = $transaction->getAccount();
        $result = $transaction->getResult();
        $result->setTransactor($this);

        $adjustment = $transaction->getAmount();
        if (Transaction\TransactionType::SALE === $transaction->getType()->getValue()) {
            if ($transaction->getAmount() > $account->getBalance()) {
                $result->setStatus(new Result\ResultStatus(Result\ResultStatus::DECLINED));
                $result->setMessage('Amount exceeds account balance');

                return $result;
            }

            $adjustment *= -1; // Negate the adjustment
        }

        $result->setStatus(new Result\ResultStatus(Result\ResultStatus::APPROVED));
        $account->adjustBalance($adjustment);

        return $result;
    }
1083042
private function addCreditcard(CreditCard $creditcard)
    {
        $this->xml->CardDetails(null, 'PaymentMessage');
        $this->xml->CardName($creditcard->name(), 'CardDetails');
        $this->xml->CV2($creditcard->verification_value, 'CardDetails');
        $this->xml->CardNumber($creditcard->number, 'CardDetails');
        $this->xml->ExpiryDate(null, 'CardDetails', array(
            'Month' => $creditcard->month,
            'Year' => $this->cc_format($creditcard->year, 'two_digits'),
        ));
    }
76783
protected function addPayment($params, $amount, $payment, $options)
    {
        return array_merge($params, [
            'payment' => [
                'external' => [
                    'transaction'     => Arr::get($options, 'reference'),
                    'application_key' => $this->gateway->getApplicationKey(),
                ],
                'reference' => [
                    'number'      => Arr::get($options, 'reference'),
                    'description' => Arr::get($options, 'description'),
                ],
                'total' => [
                    'amount'   => $this->gateway->amount($amount),
                    'currency' => Arr::get($options, 'currency', $this->gateway->getCurrency()),
                ],
                'origin'    => [
                    'ip'       => Arr::get($options, 'ip', ''),
                    'location' => [
                        'latitude'  => Arr::get($options, 'latitude', '0.00000'),
                        'longitude' => Arr::get($options, 'longitude', '0.00000'),
                    ],
                ],
            ],
            'recurrent' => $payment,
            'total'     => [
                'amount' => $this->gateway->amount($amount),
            ],
        ]);
    }
109622
private function addCreditcard(CreditCard $creditcard)
    {
        if (null === $creditcard->token) {
            # No token available.
            $this->post['card']['number'] = $creditcard->number;
            $this->post['card']['expiry_month'] = $creditcard->month;
            $this->post['card']['expiry_year'] = $creditcard->year;
            $this->post['card']['cvc'] = $creditcard->verification_value;
            $this->post['card']['name'] = $creditcard->name();

            return;
        }

        if (strpos($creditcard->token, 'card_') === 0) {
            return $this->post['card_token'] = $creditcard->token;
        }

        if (strpos($creditcard->token, 'cus_') === 0) {
            return $this->post['customer_token'] = $creditcard->token;
        }
    }
193234
public function store(CreditCard $creditcard, $options = array())
    {
        Options::required('email', $options);

        $this->post = array();
        $options = new Options($options);
        $this->addCreditcard($creditcard);
        $this->addAddress($options);
        $this->post['email'] = $options['email'];

        return $this->commit(self::STORE);
    }
361669
public function delete($id, $options = [])
     {
         if (isset($options['card_id'])) {
             return $this->gateway->commit('delete', $this->gateway->buildUrlFromString('customers/'.$id.'/cards/'.$options['card_id']));
         } else {
             return $this->gateway->commit('delete', $this->gateway->buildUrlFromString('customers/'.$id));
         }
     }
587667
public function toWords($amount, $currency, $options = null)
    {
        $dictionary = new PolishDictionary();
        $numberToTripletsConverter = new NumberToTripletsConverter();
        $tripletTransformer = new PolishTripletTransformer($dictionary);
        $nounGenderInflector = new PolishNounGenderInflector();
        $exponentInflector = new PolishExponentInflector($nounGenderInflector);

        $numberTransformer = (new NumberTransformerBuilder())
            ->withDictionary($dictionary)
            ->withWordsSeparatedBy(' ')
            ->transformNumbersBySplittingIntoTriplets($numberToTripletsConverter, $tripletTransformer)
            ->inflectExponentByNumbers($exponentInflector)
            ->build();

        $decimal = (int) ($amount / 100);
        $fraction = $amount % 100;

        if ($fraction === 0) {
            $fraction = null;
        }

        $currency = strtoupper($currency);

        if (!array_key_exists($currency, PolishDictionary::$currencyNames)) {
            throw new NumberToWordsException(
                sprintf('Currency "%s" is not available for "%s" language', $currency, get_class($this))
            );
        }

        $currencyNames = PolishDictionary::$currencyNames[$currency];

        $words = [];

        $words[] = $numberTransformer->toWords($decimal);
        $words[] = $nounGenderInflector->inflectNounByNumber(
            $decimal,
            $currencyNames[0][0],
            $currencyNames[0][1],
            $currencyNames[0][2]
        );

        if (null !== $fraction) {
            $words[] = $numberTransformer->toWords($fraction);
            $words[] = $nounGenderInflector->inflectNounByNumber(
                $fraction,
                $currencyNames[1][0],
                $currencyNames[1][1],
                $currencyNames[1][2]
            );
        }

        return implode(' ', $words);
    }