<commit_before><?php

namespace Omnipay\Migs\Message;

/**
 * Migs Purchase Request
 */
class TwoPartyPurchaseRequest extends AbstractRequest
{
    protected $action = 'pay';

    public function getData()
    {
        $this->validate('amount', 'transactionId', 'card');

        $this->getCard()->validate();

        $data = $this->getBaseData();
        $data['vpc_CardNum'] = $this->getCard()->getNumber();
        $data['vpc_CardExp'] = $this->getCard()->getExpiryDate('ym');
        $data['vpc_CardSecurityCode'] = $this->getCard()->getCvv();
        $data['vpc_SecureHash']  = $this->calculateHash($data);
        $data['vpc_SecureHashType']  = 'SHA256';

        return $data;
    }

    public function sendData($data)
    {
        $httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), [], http_build_query($data));

        return $this->response = new Response($this, $httpResponse->getBody()->getContents());
    }

    public function getEndpoint()
    {
        return $this->endpoint.'vpcdps';
    }
}
<commit_msg>Set correct content type so MIGS picks up the fields. Without it we get "Required field vpc_Merchant was not present in the request" (#16)<commit_after><?php

namespace Omnipay\Migs\Message;

/**
 * Migs Purchase Request
 */
class TwoPartyPurchaseRequest extends AbstractRequest
{
    protected $action = 'pay';

    public function getData()
    {
        $this->validate('amount', 'transactionId', 'card');

        $this->getCard()->validate();

        $data = $this->getBaseData();
        $data['vpc_CardNum'] = $this->getCard()->getNumber();
        $data['vpc_CardExp'] = $this->getCard()->getExpiryDate('ym');
        $data['vpc_CardSecurityCode'] = $this->getCard()->getCvv();
        $data['vpc_SecureHash']  = $this->calculateHash($data);
        $data['vpc_SecureHashType']  = 'SHA256';

        return $data;
    }

    public function sendData($data)
    {
        $headers = [
          'Content-Type'  => 'application/x-www-form-urlencoded',
        ];

        $httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), $headers, http_build_query($data));

        return $this->response = new Response($this, $httpResponse->getBody()->getContents());
    }

    public function getEndpoint()
    {
        return $this->endpoint.'vpcdps';
    }
}

{'fraction_non_alphanumeric': 0.17253218884120172, 'fraction_numerical': 0.0034334763948497852, 'mean_word_length': 3.2151898734177213, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6331232', 'n_tokens_mistral': 730, 'n_tokens_neox': 707, 'n_words': 129}