//do a price check to avoid javascript hacking $noFraud = Order::priceCheck($req->RE03, $req->RE04, $req->exmoms, $req->freight, $req->total, $req->incmoms, $req->discount); if ($noFraud) { //javascript prices match to local calculation //everthing looks fine sofar, create the company $kommun = Kommun::loadById(150); //Use Ale - legacy $foretagLosen = Foretag::skapaLosen(); //a new is created in api/order if a purchase is made $isValid = 0; $foretag = new Foretag($req->delCompany, $kommun, $foretagLosen, $req->startdatum, $req->channel, $req->campcode, $isValid, $req->weeks); //param "Order::isValid" and is set to 0 - i.e. not a valid order yet $foretag->setTempLosenord($foretagLosen); //a new is created in api/order if a purchase is made. Store this one! $foretag->setPayerCompanyName($req->company); $foretag->setPayerName($req->fname . ' ' . $req->lname); $foretag->setPayerFName($req->fname); $foretag->setPayerLName($req->lname); $req->street = $req->street1; !empty($req->street2) ? $req->street = $req->street . ' ;; ' . $req->street2 : null; !empty($req->street3) ? $req->street = $req->street . ' ;; ' . $req->street3 : null; $foretag->setPayerAddress($req->street); $foretag->setPayerCo($req->co); $foretag->setPayerZipCode($req->zip); $foretag->setPayerCity($req->city); $foretag->setPayerEmail($req->email); $foretag->setPayerPhone($req->phone); $foretag->setPayerMobile($req->phone); $foretag->setPayerCountry($req->country); $foretag->setReciverCompanyName($req->delCompany); $foretag->setReciverName($req->delFname . " " . $req->delLname);