<?php

namespace PortalPeople\netsuite\jobs;

use Yii;
use yii\base\BaseObject;
use yii\httpclient\Client;
use PortalPeople\netsuite\models\Netsuite;
class Sendtonetsuite extends BaseObject implements \common\components\Queue\JobInterface
{
    public $id;

    public function execute($queue)
    {
        $class = Yii::$app->netsuite->cartClass;
        $cart = $class::findOne(['id' => $this->id, 'status' => 'Paid']);
        if ($cart) {
            //Create SO
            return Netsuite::createso($cart->id);
        }
    }




    /**
     * {@inheritdoc}
     */
    public function getTtr()
    {
        return 300;
    }

    /**
     * {@inheritdoc}
     */
    public function canRetry($attempt, $error)
    {
        return $attempt < 3;
    }
}
