Bridge/Payum/CreditBalance/Action/ConvertAction.php
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

        /** @var PaymentInterface $payment */
        $payment = $request->getSource();

        $details = ArrayObject::ensureArrayObject($payment->getDetails());

        if (isset($details[Constants::FIELD_STATUS])) {
            return;
        }

        if (null === $sale = $payment->getSale()) {
            throw new RuntimeException("Payment's sale must be defined at this point.");
        }
        if (null === $customer = $sale->getCustomer()) {
            throw new RuntimeException("Sale's customer must be defined at this point.");
        }

        $details->defaults(array(
            Constants::FIELD_STATUS  => null,
            Constants::FIELD_AMOUNT  => $payment->getAmount(),
            Constants::FIELD_BALANCE => $customer->getCreditBalance(),
        ));

        $request->setResult((array) $details);
    }
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

        /** @var PaymentInterface $payment */
        $payment = $request->getSource();

        $details = ArrayObject::ensureArrayObject($payment->getDetails());

        if (isset($details[Constants::FIELD_STATUS])) {
            return;
        }

        if (null === $sale = $payment->getSale()) {
            throw new RuntimeException("Payment's sale must be defined at this point.");
        }
        if (null === $customer = $sale->getCustomer()) {
            throw new RuntimeException("Sale's customer must be defined at this point.");
        }

        $details->defaults(array(
            Constants::FIELD_STATUS  => null,
            Constants::FIELD_AMOUNT  => $payment->getAmount(),
            Constants::FIELD_BALANCE => $customer->getCreditBalance(),
        ));

        $request->setResult((array) $details);
    }
public function execute ( $ request ) { RequestNotSupportedException :: assertSupports ( $ this , $ request ) ; /** @var PaymentInterface $payment */ $ payment = $ request -> getSource ( ) ; $ details = ArrayObject :: ensureArrayObject ( $ payment -> getDetails ( ) ) ; if ( isset ( $ details [ Constants :: FIELD_STATUS ] ) ) { return ; } if ( null === $ sale = $ payment -> getSale ( ) ) { throw new RuntimeException ( "Payment's sale must be defined at this point." ) ; } if ( null === $ customer = $ sale -> getCustomer ( ) ) { throw new RuntimeException ( "Sale's customer must be defined at this point." ) ; } $ details -> defaults ( array ( Constants :: FIELD_STATUS => null , Constants :: FIELD_AMOUNT => $ payment -> getAmount ( ) , Constants :: FIELD_BALANCE => $ customer -> getCreditBalance ( ) , ) ) ; $ request -> setResult ( ( array ) $ details ) ; }
{@inheritDoc}

@param Convert $request
{ @inheritDoc }