public function getPayment($request, $match)
    {
        Pluf::loadFunction('Pluf_Shortcuts_GetObjectOr404');
        // Check wallets and permissions to access wallets
        $wallet = Pluf_Shortcuts_GetObjectOr404('Bank_Wallet', $match['parentId']);
        if ($request->user->getId() !== $wallet->owner_id && ! User_Precondition::isOwner($request)) {
            throw new Pluf_Exception_PermissionDenied("Permission is denied");
        }
        // Check payment
        $transfer = Pluf_Shortcuts_GetObjectOr404('Bank_Transfer', $match['modelId']);
        $payment = Pluf_Shortcuts_GetObjectOr404('Bank_Receipt', $transfer->receipt_id);
        if ($payment->owner_id !== 'bank-wallet' && $payment->owner_id !== $wallet->id) {
            throw new Pluf_Exception_DoesNotExist('The payment is not blong to the wallet.');
        }
        $preState = $payment->id >= 0 && $payment->isPayed();
        if ($preState) {
            return $transfer;
        }
        $payment = Bank_Service::update($payment);
        $paid = $payment->isPayed();
        if (! $preState && $paid) {
            // The payment is payed and it is first time that we inform about it.
            // Update balance of wallet
            $wallet->total_deposit += $transfer->amount;
            $wallet->update();
            // Notify user
            if (! Pluf::f('test_unit', false)) {
                $context = array(
                    'wallet' => $wallet,
                    'user' => $request->user,
                    'receipt' => $payment,
                    'transfer' => $transfer
                );
                User_Notify::push($wallet->get_owner(), array(
                    'Message' => 'Bank/Message/wallet-charge.txt'
                ), $context);
            }
        }
        return $transfer;
    }
public function getPayment($request, $match)
    {
        Pluf::loadFunction('Pluf_Shortcuts_GetObjectOr404');
        // Check wallets and permissions to access wallets
        $wallet = Pluf_Shortcuts_GetObjectOr404('Bank_Wallet', $match['parentId']);
        if ($request->user->getId() !== $wallet->owner_id && ! User_Precondition::isOwner($request)) {
            throw new Pluf_Exception_PermissionDenied("Permission is denied");
        }
        // Check payment
        $transfer = Pluf_Shortcuts_GetObjectOr404('Bank_Transfer', $match['modelId']);
        $payment = Pluf_Shortcuts_GetObjectOr404('Bank_Receipt', $transfer->receipt_id);
        if ($payment->owner_id !== 'bank-wallet' && $payment->owner_id !== $wallet->id) {
            throw new Pluf_Exception_DoesNotExist('The payment is not blong to the wallet.');
        }
        $preState = $payment->id >= 0 && $payment->isPayed();
        if ($preState) {
            return $transfer;
        }
        $payment = Bank_Service::update($payment);
        $paid = $payment->isPayed();
        if (! $preState && $paid) {
            // The payment is payed and it is first time that we inform about it.
            // Update balance of wallet
            $wallet->total_deposit += $transfer->amount;
            $wallet->update();
            // Notify user
            if (! Pluf::f('test_unit', false)) {
                $context = array(
                    'wallet' => $wallet,
                    'user' => $request->user,
                    'receipt' => $payment,
                    'transfer' => $transfer
                );
                User_Notify::push($wallet->get_owner(), array(
                    'Message' => 'Bank/Message/wallet-charge.txt'
                ), $context);
            }
        }
        return $transfer;
    }
public function getPayment ( $ request , $ match ) { Pluf :: loadFunction ( 'Pluf_Shortcuts_GetObjectOr404' ) ; // Check wallets and permissions to access wallets $ wallet = Pluf_Shortcuts_GetObjectOr404 ( 'Bank_Wallet' , $ match [ 'parentId' ] ) ; if ( $ request -> user -> getId ( ) !== $ wallet -> owner_id && ! User_Precondition :: isOwner ( $ request ) ) { throw new Pluf_Exception_PermissionDenied ( "Permission is denied" ) ; } // Check payment $ transfer = Pluf_Shortcuts_GetObjectOr404 ( 'Bank_Transfer' , $ match [ 'modelId' ] ) ; $ payment = Pluf_Shortcuts_GetObjectOr404 ( 'Bank_Receipt' , $ transfer -> receipt_id ) ; if ( $ payment -> owner_id !== 'bank-wallet' && $ payment -> owner_id !== $ wallet -> id ) { throw new Pluf_Exception_DoesNotExist ( 'The payment is not blong to the wallet.' ) ; } $ preState = $ payment -> id >= 0 && $ payment -> isPayed ( ) ; if ( $ preState ) { return $ transfer ; } $ payment = Bank_Service :: update ( $ payment ) ; $ paid = $ payment -> isPayed ( ) ; if ( ! $ preState && $ paid ) { // The payment is payed and it is first time that we inform about it. // Update balance of wallet $ wallet -> total_deposit += $ transfer -> amount ; $ wallet -> update ( ) ; // Notify user if ( ! Pluf :: f ( 'test_unit' , false ) ) { $ context = array ( 'wallet' => $ wallet , 'user' => $ request -> user , 'receipt' => $ payment , 'transfer' => $ transfer ) ; User_Notify :: push ( $ wallet -> get_owner ( ) , array ( 'Message' => 'Bank/Message/wallet-charge.txt' ) , $ context ) ; } } return $ transfer ; }
Returns the payment with given id.
It also creates a transfer if payment is successfully payed.

@param Pluf_HTTP_Request $request
@param array $match
@throws Pluf_Exception_PermissionDenied
@throws Pluf_Exception_DoesNotExist
@return Bank_Transfer
Returns the payment with given id . It also creates a transfer if payment is successfully payed .