@param number $money
@param string $authorization
@param array  $options

@return Merchant_Billing_Response
429584
public function capture($money, $authorization, $options = array())
  {
      $options = array_merge($options, array('authorization' => $authorization));
      $this->build_xml($money, 'Capture', null, $options);

      return $this->commit();
  }
2283
public function push($amount = null, $number = null, $reference = null, $description = null, $account = null)
    {
        $account = $account ?: $this->account;
        $time = Carbon::now()->format('YmdHis');
        $configs = (new ConfigurationRepository)->useAccount($account);

        $shortCode = $configs->getAccountKey('lnmo.shortcode');
        $passkey   = $configs->getAccountKey('lnmo.passkey');
        $callback  = $configs->getAccountKey('lnmo.callback');

        $body = [
            'BusinessShortCode' => $shortCode,
            'Password'          => $this->getPassword($shortCode, $passkey, $time),
            'Timestamp'         => $time,
            'TransactionType'   => 'CustomerPayBillOnline',
            'Amount'            => $amount ?: $this->amount,
            'PartyA'            => $number ?: $this->number,
            'PartyB'            => $shortCode,
            'PhoneNumber'       => $number ?: $this->number,
            'CallBackURL'       => $callback,
            'AccountReference'  => $reference ?: $this->reference,
            'TransactionDesc'   => $description ?: $this->description,
        ];

        try {
            $response = $this->makeRequest(
                $body,
                Core::instance()->getEndpoint(MPESA_LNMO, $account),
                $account
            );

            return json_decode($response->getBody());
        } catch (RequestException $exception) {
            return json_decode($exception->getResponse()->getBody());
        }
    }
83133
public function refund($amount, $reference, array $options = [])
    {
        $params = [
            'type'   => 'refund',
            'amount' => $amount,
            'status' => new Status('refunded'),
        ];

        return $this->gateway->commit(null, null, $params);
    }
47929
public function create($amount, $payment, $options = [])
    {
        $params = [];

        $params['transaction'] = 'fail';

        if ($payment === 'success') {
            $params['transaction'] = 'success';
        }

        return $this->gateway->commit('post', 'charges', $params);
    }
235606
public function charge($amount, array $options = array())
	{
		// $options = array_merge([
		// 	'currency' => $this->getCurrency(),
		// ], $options);
		
		$options['amount'] = $amount / 100;
		
		// if (! array_key_exists('source', $options) && $this->billable->hasBraintreeId()) {
		// 	$options['customer'] = $this->billable->getBraintreeId();
		// }
		
		// if (! array_key_exists('source', $options) && ! array_key_exists('customer', $options)) {
		// 	throw new InvalidArgumentException("No payment source provided.");
		// }
		
		// try {
			$response = BraintreeCharge::sale($options);
		// }
		// catch (StripeErrorCard $e) {
		// 	return false;
		// }
		
		return $response;
	}
270331
public static function charge(array $options = array())
    {
        $api = new Api\Charge();

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

        return $result['request']['result'] == 1;
    }
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);
    }
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;
    }
1356362
protected function doTransact(Transaction $transaction, array $options = array())
    {
        $this->_validateTransaction($transaction);

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

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

        return $result;
    }
309579
public function toWords($amount, $currency, $options = null)
    {
        $dictionary = new GermanDictionary();
        $numberToTripletsConverter = new NumberToTripletsConverter();
        $tripletTransformer = new GermanTripletTransformer($dictionary);
        $exponentInflector = new GermanExponentInflector();


        $numberTransformer = (new NumberTransformerBuilder())
            ->withDictionary($dictionary)
            ->withWordsSeparatedBy(' ')
            ->transformNumbersBySplittingIntoPowerAwareTriplets($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, GermanDictionary::$currencyNames)) {
            throw new NumberToWordsException(
                sprintf('Currency "%s" is not available for "%s" language', $currency, get_class($this))
            );
        }

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

        $return = trim($numberTransformer->toWords($decimal));
        $level = ($decimal === 1) ? 0 : 1;

        if ($level > 0) {
            if (count($currencyNames[0]) > 1) {
                $return .= ' ' . $currencyNames[0][$level];
            } else {
                $return .= ' ' . $currencyNames[0][0];
            }
        } else {
            $return .= ' ' . $currencyNames[0][0];
        }

        if (null !== $fraction) {
            $return .= ' '.$dictionary::$and.' ';

            $return .= trim($numberTransformer->toWords($fraction));

            $level = $fraction === 1 ? 0 : 1;

            if ($level > 0) {
                if (count($currencyNames[1]) > 1) {
                    $return .= ' ' . $currencyNames[1][$level];
                } else {
                    $return .= ' ' . $currencyNames[1][0];
                }
            } else {
                $return .= ' ' . $currencyNames[1][0];
            }
        }

        return $return;
    }
977962
protected function doTransact(Transaction $transaction, array $options = array())
    {
        $this->validateTransaction($transaction);
        $params = $this->buildParams($transaction, $options);
        $result = $transaction->getResult();
        $result->setTransactor($this);

        $postUrl = $options['post_url'];
        $client = $this->getClient();

        $request = $client->post($postUrl)
            ->addPostFields($params);

        try {
            $response = $request->send();
            $data = array();
            parse_str($response->getBody(true), $data);
        } catch (BadResponseException $e) {
            $data = array(
                'response' => '3',
                'message' => $e->getMessage()
            );
        }

        if (empty($data['response']) || '1' != $data['response']) {
            $result->setStatus(new Result\ResultStatus((!empty($data['response']) && '2' == $data['response']) ? Result\ResultStatus::DECLINED : Result\ResultStatus::ERROR));
            $result->setMessage(empty($data['responsetext']) ? 'An error occurred while processing the payment. Please try again.' : $data['responsetext']);

            if (!empty($data['transactionid'])) {
                $result->setExternalId($data['transactionid']);
            }
        } else {
            $result->setStatus(new Result\ResultStatus(Result\ResultStatus::APPROVED));
            $result->setExternalId($data['transactionid']);
        }

        $result->setData('request', $params);
        $result->setData('response', $data);

        return $result;
    }
873342
public function refund($amount, $reference, array $options = [])
    {
        $url = sprintf($this->gateway->buildUrlFromString('charges').'/%s/refund', $reference);

        return $this->gateway->commit('post', $url, [
            'amount'      => $this->gateway->amount($amount),
            'description' => Arr::get($options, 'description'),
        ]);
    }
828973
public function getAccounts($options = [])
    {
        $paramsUrl = $this->prepareParametersUrl($options, ['all']);
        $response = $this->sendRequest(sprintf('accounts%s', $paramsUrl));

        $result = [];

        if ($response->getStatusCode() == 200) {
            $responseJson = $response->json();

            foreach ($responseJson['accounts'] as $item) {
                $account = new Account();
                Account::hydrate($item, $account);

                $result[] = $account;
            }
        }

        return $result;
    }
1321950
public function push($amount = null, $number = null, $reference = null, $command = null, $account = null)
    {
        $account = $account ?: $this->account;
        $configs = (new ConfigurationRepository)->useAccount($account);

        if (!$configs->getAccountKey('sandbox')) {
            throw new ErrorException('Cannot simulate a transaction in the live environment.');
        }

        $shortCode = $configs->getAccountKey('lnmo.shortcode');

        $body = [
            'CommandID'     => $command ?: $this->command,
            'Amount'        => $amount ?: $this->amount,
            'Msisdn'        => $number ?: $this->number,
            'ShortCode'     => $shortCode,
            'BillRefNumber' => $reference ?: $this->reference,
        ];

        try {
            $response = $this->makeRequest(
                $body,
                Core::instance()->getEndpoint(MPESA_SIMULATE, $account),
                $account
            );

            return json_decode($response->getBody());
        } catch (RequestException $exception) {
            return json_decode($exception->getResponse()->getBody());
        }
    }
268472
public function void($authorization, $options = array())
    {
        $this->required_options('pasref, order_id', $options);
        $this->buildVoidRequest($authorization, $options);

        return $this->commit();
    }
1010013
private function addInvoice($money, $options)
    {
        $this->post['amount'] = $this->amount($money / 100);
        $this->post['currency'] = self::$default_currency;
        $this->post['description'] = $options['description'];
    }
931157
public function refund($amount, $reference, array $options = [])
    {
        $params = [];

        if ($amount !== null) {
            $params['amount'] = $this->gateway->amount($amount);
        }

        if (array_key_exists('reason', $options)) {
            $params['reason'] = $options['reason'];
        }

        $url = sprintf($this->gateway->buildUrlFromString('orders').'/%s/refund', $reference);

        return $this->gateway->commit('post', $url, $params);
    }