protected function createPartialPayment($amount, $status, $write = true)
    {
        /** @var Payment $payment */
        $payment = Payment::create(array(
            'Gateway' => $this->payment->Gateway,
            'TransactionReference' => $this->payment->TransactionReference,
            'SuccessUrl' => $this->payment->SuccessUrl,
            'FailureUrl' => $this->payment->FailureUrl,
            'InitialPaymentID' => $this->payment->ID
        ));

        $payment->setCurrency($this->payment->getCurrency());
        $payment->setAmount($amount);

        // set status later, because otherwise amount and currency become immutable
        $payment->Status = $status;

        // allow extensions to update/modify the partial payment
        ErrorHandling::safeExtend($this, 'updatePartialPayment', $payment, $this->payment);

        if ($write) {
            ErrorHandling::safeguard(function () use (&$payment) {
                $payment->write();
            }, 'Unable to write newly created partial Payment!');
        }

        return $payment;
    }
protected function createPartialPayment($amount, $status, $write = true)
    {
        /** @var Payment $payment */
        $payment = Payment::create(array(
            'Gateway' => $this->payment->Gateway,
            'TransactionReference' => $this->payment->TransactionReference,
            'SuccessUrl' => $this->payment->SuccessUrl,
            'FailureUrl' => $this->payment->FailureUrl,
            'InitialPaymentID' => $this->payment->ID
        ));

        $payment->setCurrency($this->payment->getCurrency());
        $payment->setAmount($amount);

        // set status later, because otherwise amount and currency become immutable
        $payment->Status = $status;

        // allow extensions to update/modify the partial payment
        ErrorHandling::safeExtend($this, 'updatePartialPayment', $payment, $this->payment);

        if ($write) {
            ErrorHandling::safeguard(function () use (&$payment) {
                $payment->write();
            }, 'Unable to write newly created partial Payment!');
        }

        return $payment;
    }
protected function createPartialPayment ( $ amount , $ status , $ write = true ) { /** @var Payment $payment */ $ payment = Payment :: create ( array ( 'Gateway' => $ this -> payment -> Gateway , 'TransactionReference' => $ this -> payment -> TransactionReference , 'SuccessUrl' => $ this -> payment -> SuccessUrl , 'FailureUrl' => $ this -> payment -> FailureUrl , 'InitialPaymentID' => $ this -> payment -> ID ) ) ; $ payment -> setCurrency ( $ this -> payment -> getCurrency ( ) ) ; $ payment -> setAmount ( $ amount ) ; // set status later, because otherwise amount and currency become immutable $ payment -> Status = $ status ; // allow extensions to update/modify the partial payment ErrorHandling :: safeExtend ( $ this , 'updatePartialPayment' , $ payment , $ this -> payment ) ; if ( $ write ) { ErrorHandling :: safeguard ( function ( ) use ( & $ payment ) { $ payment -> write ( ) ; } , 'Unable to write newly created partial Payment!' ) ; } return $ payment ; }
Create a partial payment that will be based on the current payment.
This new payment will inherit the Gateway, TransactionReference, SuccessUrl and FailureUrl
of the initial payment.
@param float $amount the amount that the partial payment should have
@param string $status the desired payment status
@param boolean $write whether or not to directly write the new Payment to DB (optional)
@throws \Exception
@return Payment the newly created payment (already written to the DB)
Create a partial payment that will be based on the current payment . This new payment will inherit the Gateway TransactionReference SuccessUrl and FailureUrl of the initial payment .