src/Factory/Invoice.php
public function charge(ChargeRequest $oChargeRequest)
    {
        if (empty($this->iId)) {
            $oInvoice = $this->save();
        } else {
            $oInvoiceModel = Factory::model('Invoice', 'nails/module-invoice');
            $oInvoice      = $oInvoiceModel->getById($this->iId);
        }

        $oChargeRequest->setInvoice($this->iId);
        $oChargeRequest->setDescription('Payment for invoice ' . $this->sRef);
        return $oChargeRequest->execute(
            $oInvoice->totals->raw->grand,
            $oInvoice->currency->code
        );
    }
public function charge(ChargeRequest $oChargeRequest)
    {
        if (empty($this->iId)) {
            $oInvoice = $this->save();
        } else {
            $oInvoiceModel = Factory::model('Invoice', 'nails/module-invoice');
            $oInvoice      = $oInvoiceModel->getById($this->iId);
        }

        $oChargeRequest->setInvoice($this->iId);
        $oChargeRequest->setDescription('Payment for invoice ' . $this->sRef);
        return $oChargeRequest->execute(
            $oInvoice->totals->raw->grand,
            $oInvoice->currency->code
        );
    }
public function charge ( ChargeRequest $ oChargeRequest ) { if ( empty ( $ this -> iId ) ) { $ oInvoice = $ this -> save ( ) ; } else { $ oInvoiceModel = Factory :: model ( 'Invoice' , 'nails/module-invoice' ) ; $ oInvoice = $ oInvoiceModel -> getById ( $ this -> iId ) ; } $ oChargeRequest -> setInvoice ( $ this -> iId ) ; $ oChargeRequest -> setDescription ( 'Payment for invoice ' . $ this -> sRef ) ; return $ oChargeRequest -> execute ( $ oInvoice -> totals -> raw -> grand , $ oInvoice -> currency -> code ) ; }
Charges an invoice

@param ChargeRequest $oChargeRequest

@return ChargeResponse
@throws InvoiceException
Charges an invoice