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

@return Merchant_Billing_Response
327223
public function authorize($money, Merchant_Billing_CreditCard $creditcard, $options = array())
  {
      $this->add_invoice($options);
      $this->add_creditcard($creditcard);
      $this->add_address($options);
      $this->add_customer_data($options);
      $this->add_duplicate_window();

      return $this->commit('AUTH_ONLY', $money);
  }
870561
function Payment(options) {
  if (!(this instanceof Payment))
    return new Payment(options);

  this.merchantData = null;
  this.transactions = [];
  this.refundTo = [];
  this.memo = null;

  if (options)
    this.fromOptions(options);
}
351375
public function format(Money $money, $options = [], $textOptions = [])
    {
        return \Yii::$app->formatter->asCurrency($money->amount, $money->currency->code, $options, $textOptions);
    }
485490
public function charge($amount, array $options = []): Successful
    {
        $response = BraintreeTransaction::sale(array_merge([
            'amount' => number_format($amount * (1 + ($this->taxPercentage() / 100)), 2, '.', ''),
            'paymentMethodToken' => $this->paymentMethod()->token,
            'options' => [
                'submitForSettlement' => true,
            ],
            'recurring' => true,
        ], $options));

        if (! $response->success) {
            throw new Exception('Braintree was unable to perform a charge: '.$response->message);
        }

        return $response;
    }
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);
    }
807589
private function insertData($amount, CreditCard $creditcard, $type, $options = array())
    {
        $month = $this->cc_format($creditcard->month, 'two_digits');
        $year = $this->cc_format($creditcard->year, 'two_digits');

        $this->xml .= <<<XML
 <OrderFormDoc>
 <Mode DataType="String">{$this->payment_mode}</Mode>
 <Consumer>
 <PaymentMech>
 <Type DataType="String">{$this->payment_mech_type}</Type>
 <CreditCard>
 <Number DataType="String">{$creditcard->number}</Number>
 <Expires DataType="ExpirationDate">{$month}/{$year}</Expires>
 <Cvv2Val DataType="String">{$creditcard->verification_value}</Cvv2Val>
 <Cvv2Indicator DataType="String">1</Cvv2Indicator>
 </CreditCard>
 </PaymentMech>
 </Consumer>
XML;
        $this->addTransactionElement($amount, $type, $options);
        $this->addBillingAddress($options);
        $this->addShippingAddress($options);
    }
154474
public function create($creditcard, $options = [])
     {
         if (isset($options['customer'])) {
             $params['card'] = $creditcard;

             return $this->gateway->commit('post', $this->gateway->buildUrlFromString('customers/'.$options['customer'].'/cards'), $params);
         } else {
             $params['email'] = Arr::get($options, 'email');
             $params['description'] = Arr::get($options, 'name');
             $params['card'] = $creditcard;

             return $this->gateway->commit('post', $this->gateway->buildUrlFromString('customers'), $params);
         }
     }
172725
private function addInvoice($money, $options, $action)
    {
        $this->xml->OrderInfo(null, $action)
            ->OrderId($options['order_id'], 'OrderInfo')
            ->OrderDesc($options['order_id'], 'OrderInfo')
            ->OrderAmount($this->amount($money), 'OrderInfo')
            ->Currency(static::$default_currency, 'OrderInfo')
            ->PayerEmail("", 'OrderInfo');
        if (true == $options['moto']) {
            $this->xml->MOTO(1, 'OrderInfo');
        }
    }
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;
    }
1179757
public function create($amount, $payment, $options = [])
    {
        $params = [];

        $params = $this->addPaymentMethod($params, $payment, $options);
        $params = $this->addOrder($params, $amount, $options);
        $params = $this->addCustomer($params, $options);

        return $this->gateway->commit('post', $this->gateway->buildUrlFromString('charges'), $params);
    }
694863
protected function addOrder(array $params, $money, array $options)
    {
        $params['items'][] = [
            'id'          => Arr::get($options, 'reference'),
            'title'       => Arr::get($options, 'description'),
            'description' => Arr::get($options, 'description'),
            'unit_price'  => (float) $this->gateway->amount($money),
            'quantity'    => 1,
            'currency_id' => Arr::get($options, 'currency'),
        ];

        return array_merge($params, [
            'currency_id'        => Arr::get($options, 'currency'),
            'external_reference' => Arr::get($options, 'reference'),
            'expires'            => Arr::get($options, 'expires', false),
        ]);
    }
613754
public function capture($money, $authorization, $options = array())
  {
      $this->post = array('trans_id' => $authorization);
      $this->add_customer_data($options);

      return $this->commit('PRIOR_AUTH_CAPTURE', $money);
  }
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'),
        ));
    }
36919
protected function addInvoice($money, $options)
    {
        $this->xml->TxnDetails(null, 'Transaction')
            ->merchantreference($options['order_id'], 'TxnDetails')
            ->amount(
                $this->amount($money),
                'TxnDetails',
                array('currency' => self::$default_currency)
            );
        $this->addThreeDSecure($options);
    }
932361
public function updateCard($token, array $options = [])
    {
        $customer = $this->asBraintreeCustomer();

        $response = PaymentMethod::create(
            array_replace_recursive([
                'customerId' => $customer->id,
                'paymentMethodNonce' => $token,
                'options' => [
                    'makeDefault' => true,
                    'verifyCard' => true,
                ],
            ], $options)
        );

        if (! $response->success) {
            throw new Exception('Braintree was unable to create a payment method: '.$response->message);
        }

        $paypalAccount = $response->paymentMethod instanceof PaypalAccount;

        $this->forceFill([
            'paypal_email' => $paypalAccount ? $response->paymentMethod->email : null,
            'card_brand' => $paypalAccount ? null : $response->paymentMethod->cardType,
            'card_last_four' => $paypalAccount ? null : $response->paymentMethod->last4,
        ])->save();

        $this->updateSubscriptionsToPaymentMethod(
            $response->paymentMethod->token
        );
    }
976565
function DoVFTInquiry($ccno,
                          $amount,
                          $instnumber,
                          $vftcode) {

        $posnetRequest = new PosnetRequest();

        $posnetRequest->ccno = $ccno;
        $posnetRequest->amount = $amount;
        $posnetRequest->instnumber = $instnumber;
        $posnetRequest->vftcode = $vftcode;

        return $this->DoTran($posnetRequest, "vftinquiry");
    }
701839
public function transaction(string $id, array $optional = []): Response
    {
        return $this->client->uses('Bill.Transaction', $this->getVersion())
                    ->show($id, $optional);
    }