public function refund( MShop_Order_Item_Interface $order )
	{
		$orderManager = MShop_Factory::createManager( $this->_getContext(), 'order' );

		$serviceItem = $this->_getOrderServiceItem( $order->getBaseId() );

		if( ( $tid = $serviceItem->getAttribute('TRANSACTIONID') ) === null )
		{
			$msg = sprintf( 'PayPal Express: Payment transaction ID for order ID "%1$s" not available', $order->getId() );
			throw new MShop_Service_Exception( $msg );
		}

		$values = $this->_getAuthParameter();
		$values['METHOD'] = 'RefundTransaction';
		$values['REFUNDSOURCE'] = 'instant';
		$values['REFUNDTYPE'] = 'Full';
		$values['TRANSACTIONID'] = $tid;
		$values['INVOICEID'] = $order->getId();

		$urlQuery = http_build_query( $values, '', '&' );
		$response = $this->_getCommunication()->transmit( $this->_apiendpoint, 'POST', $urlQuery );
		$rvals = $this->_checkResponse( $order->getId(), $response, __METHOD__ );

		$attributes = array( 'REFUNDTRANSACTIONID' => $rvals['REFUNDTRANSACTIONID'] );
		$this->_saveAttributes( $attributes, $serviceItem );

		$order->setPaymentStatus( MShop_Order_Item_Abstract::PAY_REFUND );
		$orderManager->saveItem( $order );
	}
public function refund( MShop_Order_Item_Interface $order )
	{
		$orderManager = MShop_Factory::createManager( $this->_getContext(), 'order' );

		$serviceItem = $this->_getOrderServiceItem( $order->getBaseId() );

		if( ( $tid = $serviceItem->getAttribute('TRANSACTIONID') ) === null )
		{
			$msg = sprintf( 'PayPal Express: Payment transaction ID for order ID "%1$s" not available', $order->getId() );
			throw new MShop_Service_Exception( $msg );
		}

		$values = $this->_getAuthParameter();
		$values['METHOD'] = 'RefundTransaction';
		$values['REFUNDSOURCE'] = 'instant';
		$values['REFUNDTYPE'] = 'Full';
		$values['TRANSACTIONID'] = $tid;
		$values['INVOICEID'] = $order->getId();

		$urlQuery = http_build_query( $values, '', '&' );
		$response = $this->_getCommunication()->transmit( $this->_apiendpoint, 'POST', $urlQuery );
		$rvals = $this->_checkResponse( $order->getId(), $response, __METHOD__ );

		$attributes = array( 'REFUNDTRANSACTIONID' => $rvals['REFUNDTRANSACTIONID'] );
		$this->_saveAttributes( $attributes, $serviceItem );

		$order->setPaymentStatus( MShop_Order_Item_Abstract::PAY_REFUND );
		$orderManager->saveItem( $order );
	}
public function refund ( MShop_Order_Item_Interface $ order ) { $ orderManager = MShop_Factory :: createManager ( $ this -> _getContext ( ) , 'order' ) ; $ serviceItem = $ this -> _getOrderServiceItem ( $ order -> getBaseId ( ) ) ; if ( ( $ tid = $ serviceItem -> getAttribute ( 'TRANSACTIONID' ) ) === null ) { $ msg = sprintf ( 'PayPal Express: Payment transaction ID for order ID "%1$s" not available' , $ order -> getId ( ) ) ; throw new MShop_Service_Exception ( $ msg ) ; } $ values = $ this -> _getAuthParameter ( ) ; $ values [ 'METHOD' ] = 'RefundTransaction' ; $ values [ 'REFUNDSOURCE' ] = 'instant' ; $ values [ 'REFUNDTYPE' ] = 'Full' ; $ values [ 'TRANSACTIONID' ] = $ tid ; $ values [ 'INVOICEID' ] = $ order -> getId ( ) ; $ urlQuery = http_build_query ( $ values , '' , '&' ) ; $ response = $ this -> _getCommunication ( ) -> transmit ( $ this -> _apiendpoint , 'POST' , $ urlQuery ) ; $ rvals = $ this -> _checkResponse ( $ order -> getId ( ) , $ response , __METHOD__ ) ; $ attributes = array ( 'REFUNDTRANSACTIONID' => $ rvals [ 'REFUNDTRANSACTIONID' ] ) ; $ this -> _saveAttributes ( $ attributes , $ serviceItem ) ; $ order -> setPaymentStatus ( MShop_Order_Item_Abstract :: PAY_REFUND ) ; $ orderManager -> saveItem ( $ order ) ; }
Refunds the money for the given order if supported.

@param MShop_Order_Item_Interface $order Order invoice object
Refunds the money for the given order if supported .