<?php
namespace Hepsipay\Model;
use Hepsipay\Options;
use Hepsipay\Model\Mapper\PaymentMapper;
use Hepsipay\Request\CreatePaymentRequest;
use Hepsipay\Request\RetrievePaymentRequest;
class Payment extends PaymentResource
{
    public static function create(CreatePaymentRequest $request)
    {
        $rawResponse = parent::httpClient()->post($request->getOptions()->getUrlPay(), parent::getHttpHeaders($request), $request->toJsonString());
        return PaymentMapper::create($rawResponse)->jsonDecode()->mapPayment(new Payment());
    }
}