public static function create($orderId, $description, $amount = null, $extCustomerId = null, $extRefundId = null)
    {
        if (empty($orderId)) {
            throw new OpenPayU_Exception('Invalid orderId value for refund');
        }

        if (empty($description)) {
            throw new OpenPayU_Exception('Invalid description of refund');
        }
        $refund = array(
            'orderId' => $orderId,
            'refund' => array('description' => $description)
        );

        if (!empty($amount)) {
            $refund['refund']['amount'] = (int) $amount;
        }

        if (!empty($extCustomerId)) {
            $refund['refund']['extCustomerId'] = $extCustomerId;
        }

        if (!empty($extRefundId)) {
            $refund['refund']['extRefundId'] = $extRefundId;
        }

        try {
            $authType = self::getAuth();
        } catch (OpenPayU_Exception $e) {
            throw new OpenPayU_Exception($e->getMessage(), $e->getCode());
        }

        $pathUrl = OpenPayU_Configuration::getServiceUrl().'orders/'. $refund['orderId'] . '/refund';

        $data = OpenPayU_Util::buildJsonFromArray($refund);

        $result = self::verifyResponse(OpenPayU_Http::doPost($pathUrl, $data, $authType), 'RefundCreateResponse');

        return $result;
    }
public static function create($orderId, $description, $amount = null, $extCustomerId = null, $extRefundId = null)
    {
        if (empty($orderId)) {
            throw new OpenPayU_Exception('Invalid orderId value for refund');
        }

        if (empty($description)) {
            throw new OpenPayU_Exception('Invalid description of refund');
        }
        $refund = array(
            'orderId' => $orderId,
            'refund' => array('description' => $description)
        );

        if (!empty($amount)) {
            $refund['refund']['amount'] = (int) $amount;
        }

        if (!empty($extCustomerId)) {
            $refund['refund']['extCustomerId'] = $extCustomerId;
        }

        if (!empty($extRefundId)) {
            $refund['refund']['extRefundId'] = $extRefundId;
        }

        try {
            $authType = self::getAuth();
        } catch (OpenPayU_Exception $e) {
            throw new OpenPayU_Exception($e->getMessage(), $e->getCode());
        }

        $pathUrl = OpenPayU_Configuration::getServiceUrl().'orders/'. $refund['orderId'] . '/refund';

        $data = OpenPayU_Util::buildJsonFromArray($refund);

        $result = self::verifyResponse(OpenPayU_Http::doPost($pathUrl, $data, $authType), 'RefundCreateResponse');

        return $result;
    }
public static function create ( $ orderId , $ description , $ amount = null , $ extCustomerId = null , $ extRefundId = null ) { if ( empty ( $ orderId ) ) { throw new OpenPayU_Exception ( 'Invalid orderId value for refund' ) ; } if ( empty ( $ description ) ) { throw new OpenPayU_Exception ( 'Invalid description of refund' ) ; } $ refund = array ( 'orderId' => $ orderId , 'refund' => array ( 'description' => $ description ) ) ; if ( ! empty ( $ amount ) ) { $ refund [ 'refund' ] [ 'amount' ] = ( int ) $ amount ; } if ( ! empty ( $ extCustomerId ) ) { $ refund [ 'refund' ] [ 'extCustomerId' ] = $ extCustomerId ; } if ( ! empty ( $ extRefundId ) ) { $ refund [ 'refund' ] [ 'extRefundId' ] = $ extRefundId ; } try { $ authType = self :: getAuth ( ) ; } catch ( OpenPayU_Exception $ e ) { throw new OpenPayU_Exception ( $ e -> getMessage ( ) , $ e -> getCode ( ) ) ; } $ pathUrl = OpenPayU_Configuration :: getServiceUrl ( ) . 'orders/' . $ refund [ 'orderId' ] . '/refund' ; $ data = OpenPayU_Util :: buildJsonFromArray ( $ refund ) ; $ result = self :: verifyResponse ( OpenPayU_Http :: doPost ( $ pathUrl , $ data , $ authType ) , 'RefundCreateResponse' ) ; return $ result ; }
Function make refund for order
@param $orderId
@param $description
@param null|int $amount Amount of refund in pennies
@param null|string $extCustomerId Marketplace external customer ID
@param null|string $extRefundId Marketplace external refund ID
@return null|OpenPayU_Result
@throws OpenPayU_Exception
Function make refund for order