<?php
namespace Hepsipay\Model;
use Hepsipay\Model\Mapper\RefundMapper;
use Hepsipay\Request\CreateRefundRequest;
class Refund extends RefundResource
{
    public static function create(CreateRefundRequest $request)
    {
        $rawResponse = parent::httpClient()->post($request->getOptions()->getUrlRefund(), parent::getHttpHeaders($request), $request->toJsonString());
        return RefundMapper::create($rawResponse)->jsonDecode()->mapRefund(new Refund());
    }
}