Services/PaymillManager.php
public function processPayment(PaymillMethod $paymentMethod, $amount)
    {
        /// first check that amounts are the same
        $paymentBridgeAmount = intval($this->paymentBridge->getAmount());

        /**
         * If both amounts are different, execute Exception
         */
        if ($amount != $paymentBridgeAmount) {

            throw new PaymentAmountsNotMatchException(sprintf(
                    'Amounts differ. Requested: [%s] but in PaymentBridge: [%s].',
                    $amount,
                    $paymentBridgeAmount
                )
            );
        }

        /**
         * At this point, order must be created given a card, and placed in PaymentBridge
         *
         * So, $this->paymentBridge->getOrder() must return an object
         */
        $this->paymentEventDispatcher->notifyPaymentOrderLoad($this->paymentBridge, $paymentMethod);

        /**
         * Order Not found Exception must be thrown just here
         */
        if (!$this->paymentBridge->getOrder()) {

            throw new PaymentOrderNotFoundException();
        }
        /**
         * Order exists right here
         */
        $this->paymentEventDispatcher->notifyPaymentOrderCreated($this->paymentBridge, $paymentMethod);

        /**
         * Validate the order in the module
         * params for paymill interaction
         */
        $extraData = $this->paymentBridge->getExtraData();
        $params = array(
            'amount'      => $paymentBridgeAmount,
            'currency'    => $this->paymentBridge->getCurrency(),
            'token'       => $paymentMethod->getApiToken(),
            'description' => $extraData['order_description'],
        );

        try {
            $transaction = $this
                ->paymillTransactionWrapper
                ->create($params['amount'], $params['currency'], $params['token'], $params['description']);

        } catch (PaymillException $e) {
            /**
             * create 'failed' transaction
             */
            $transaction = new Transaction();
            $transaction->setStatus('failed');
            $transaction->setDescription($e->getCode() . ' ' . $e->getMessage());
        }

        $this->processTransaction($transaction, $paymentMethod);

        return $this;
    }
public function processPayment(PaymillMethod $paymentMethod, $amount)
    {
        /// first check that amounts are the same
        $paymentBridgeAmount = intval($this->paymentBridge->getAmount());

        /**
         * If both amounts are different, execute Exception
         */
        if ($amount != $paymentBridgeAmount) {

            throw new PaymentAmountsNotMatchException(sprintf(
                    'Amounts differ. Requested: [%s] but in PaymentBridge: [%s].',
                    $amount,
                    $paymentBridgeAmount
                )
            );
        }

        /**
         * At this point, order must be created given a card, and placed in PaymentBridge
         *
         * So, $this->paymentBridge->getOrder() must return an object
         */
        $this->paymentEventDispatcher->notifyPaymentOrderLoad($this->paymentBridge, $paymentMethod);

        /**
         * Order Not found Exception must be thrown just here
         */
        if (!$this->paymentBridge->getOrder()) {

            throw new PaymentOrderNotFoundException();
        }
        /**
         * Order exists right here
         */
        $this->paymentEventDispatcher->notifyPaymentOrderCreated($this->paymentBridge, $paymentMethod);

        /**
         * Validate the order in the module
         * params for paymill interaction
         */
        $extraData = $this->paymentBridge->getExtraData();
        $params = array(
            'amount'      => $paymentBridgeAmount,
            'currency'    => $this->paymentBridge->getCurrency(),
            'token'       => $paymentMethod->getApiToken(),
            'description' => $extraData['order_description'],
        );

        try {
            $transaction = $this
                ->paymillTransactionWrapper
                ->create($params['amount'], $params['currency'], $params['token'], $params['description']);

        } catch (PaymillException $e) {
            /**
             * create 'failed' transaction
             */
            $transaction = new Transaction();
            $transaction->setStatus('failed');
            $transaction->setDescription($e->getCode() . ' ' . $e->getMessage());
        }

        $this->processTransaction($transaction, $paymentMethod);

        return $this;
    }
public function processPayment ( PaymillMethod $ paymentMethod , $ amount ) { /// first check that amounts are the same $ paymentBridgeAmount = intval ( $ this -> paymentBridge -> getAmount ( ) ) ; /**
         * If both amounts are different, execute Exception
         */ if ( $ amount != $ paymentBridgeAmount ) { throw new PaymentAmountsNotMatchException ( sprintf ( 'Amounts differ. Requested: [%s] but in PaymentBridge: [%s].' , $ amount , $ paymentBridgeAmount ) ) ; } /**
         * At this point, order must be created given a card, and placed in PaymentBridge
         *
         * So, $this->paymentBridge->getOrder() must return an object
         */ $ this -> paymentEventDispatcher -> notifyPaymentOrderLoad ( $ this -> paymentBridge , $ paymentMethod ) ; /**
         * Order Not found Exception must be thrown just here
         */ if ( ! $ this -> paymentBridge -> getOrder ( ) ) { throw new PaymentOrderNotFoundException ( ) ; } /**
         * Order exists right here
         */ $ this -> paymentEventDispatcher -> notifyPaymentOrderCreated ( $ this -> paymentBridge , $ paymentMethod ) ; /**
         * Validate the order in the module
         * params for paymill interaction
         */ $ extraData = $ this -> paymentBridge -> getExtraData ( ) ; $ params = array ( 'amount' => $ paymentBridgeAmount , 'currency' => $ this -> paymentBridge -> getCurrency ( ) , 'token' => $ paymentMethod -> getApiToken ( ) , 'description' => $ extraData [ 'order_description' ] , ) ; try { $ transaction = $ this -> paymillTransactionWrapper -> create ( $ params [ 'amount' ] , $ params [ 'currency' ] , $ params [ 'token' ] , $ params [ 'description' ] ) ; } catch ( PaymillException $ e ) { /**
             * create 'failed' transaction
             */ $ transaction = new Transaction ( ) ; $ transaction -> setStatus ( 'failed' ) ; $ transaction -> setDescription ( $ e -> getCode ( ) . ' ' . $ e -> getMessage ( ) ) ; } $ this -> processTransaction ( $ transaction , $ paymentMethod ) ; return $ this ; }
Tries to process a payment through Paymill

@param PaymillMethod $paymentMethod Payment method
@param integer       $amount        Amount

@return PaymillManager Self object

@throws PaymentAmountsNotMatchException
@throws PaymentOrderNotFoundException
@throws PaymentException
Tries to process a payment through Paymill