<commit_before><?php

namespace Omnipay\TwoCheckoutPlus\Message;

/**
 * Purchase Request.
 *
 * @method PurchaseResponse send()
 */
class PurchaseRequest extends AbstractRequest
{
    public function getData()
    {
        $this->validate('accountNumber', 'returnUrl');

        $data = array();
        $data['sid'] = $this->getAccountNumber();
        $data['mode'] = '2CO';
        $data['merchant_order_id'] = $this->getTransactionId();
        $data['currency_code'] = $this->getCurrency();
        $data['x_receipt_link_url'] = $this->getReturnUrl();

        // Do not pass for live sales i.e if its false.
        if ($this->getDemoMode()) {
            $data['demo'] = 'Y';
        }

        if ($this->getLanguage()) {
            $data['lang'] = $this->getLanguage();
        }

        if ($this->getCoupon()) {
            $data['coupon'] = $this->getCoupon();
        }

        // needed to determine which API endpoint to use in OffsiteResponse
        if ($this->getTestMode()) {
            $data['sandbox'] = true;
        }

        $i = 0;

        // Setup Products information
        foreach ($this->getCart() as $item) {
            $data['li_'.$i.'_type'] = $item['type'];
            $data['li_'.$i.'_name'] = $item['name'];
            $data['li_'.$i.'_price'] = $item['price'];
            $data['li_'.$i.'_quantity'] = $item['quantity'];
            $data['li_'.$i.'_tangible'] = $item['tangible'];

            // optional item/product parameters
            if (isset($item['product_id'])) {
                $data['li_'.$i.'_product_id'] = $item['product_id'];
            }
            if (isset($item['description'])) {
                $data['li_'.$i.'_description'] = $item['description'];
            }
            if (isset($item['recurrence'])) {
                $data['li_'.$i.'_recurrence'] = $item['recurrence'];
            }
            if (isset($item['duration'])) {
                $data['li_'.$i.'_duration'] = $item['duration'];
            }
            if (isset($item['startup_fee'])) {
                $data['li_'.$i.'_startup_fee'] = $item['startup_fee'];
            }

            ++$i;
        }

        if ($this->getCard()) {
            $data['card_holder_name'] = $this->getCard()->getName();
            $data['street_address'] = $this->getCard()->getAddress1();
            $data['street_address2'] = $this->getCard()->getAddress2();
            $data['city'] = $this->getCard()->getCity();
            $data['state'] = $this->getCard()->getState();<commit_msg>made tangible lineitem parameter optional<commit_after><?php

namespace Omnipay\TwoCheckoutPlus\Message;

/**
 * Purchase Request.
 *
 * @method PurchaseResponse send()
 */
class PurchaseRequest extends AbstractRequest
{
    public function getData()
    {
        $this->validate('accountNumber', 'returnUrl');

        $data = array();
        $data['sid'] = $this->getAccountNumber();
        $data['mode'] = '2CO';
        $data['merchant_order_id'] = $this->getTransactionId();
        $data['currency_code'] = $this->getCurrency();
        $data['x_receipt_link_url'] = $this->getReturnUrl();

        // Do not pass for live sales i.e if its false.
        if ($this->getDemoMode()) {
            $data['demo'] = 'Y';
        }

        if ($this->getLanguage()) {
            $data['lang'] = $this->getLanguage();
        }

        if ($this->getCoupon()) {
            $data['coupon'] = $this->getCoupon();
        }

        // needed to determine which API endpoint to use in OffsiteResponse
        if ($this->getTestMode()) {
            $data['sandbox'] = true;
        }

        $i = 0;

        // Setup Products information
        foreach ($this->getCart() as $item) {
            $data['li_'.$i.'_type'] = $item['type'];
            $data['li_'.$i.'_name'] = $item['name'];
            $data['li_'.$i.'_price'] = $item['price'];
            $data['li_'.$i.'_quantity'] = $item['quantity'];

            // optional item/product parameters
            if (isset($item['tangible'])) {
                $data['li_'.$i.'_tangible'] = $item['tangible'];
            }
            if (isset($item['product_id'])) {
                $data['li_'.$i.'_product_id'] = $item['product_id'];
            }
            if (isset($item['description'])) {
                $data['li_'.$i.'_description'] = $item['description'];
            }
            if (isset($item['recurrence'])) {
                $data['li_'.$i.'_recurrence'] = $item['recurrence'];
            }
            if (isset($item['duration'])) {
                $data['li_'.$i.'_duration'] = $item['duration'];
            }
            if (isset($item['startup_fee'])) {
                $data['li_'.$i.'_startup_fee'] = $item['startup_fee'];
            }

            ++$i;
        }

        if ($this->getCard()) {
            $data['card_holder_name'] = $this->getCard()->getName();
            $data['street_address'] = $this->getCard()->getAddress1();
            $data['street_address2'] = $this->getCard()->getAddress2();
            $data['city'] = $this->getCard()->getCity();
            $data['state'] = $this->getCard()->getState();
{'fraction_non_alphanumeric': 0.20198289269051323, 'fraction_numerical': 0.0019440124416796269, 'mean_word_length': 2.038984051978736, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '795573', 'n_tokens_mistral': 1558, 'n_tokens_neox': 1533, 'n_words': 245}