$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); $req->delStreet = $req->delStreet1; !empty($req->delStreet2) ? $req->delStreet = $req->delStreet . ' ;; ' . $req->delStreet2 : null; !empty($req->delStreet3) ? $req->delStreet = $req->delStreet . ' ;; ' . $req->delStreet3 : null; $foretag->setReciverAddress($req->delStreet); $foretag->setReciverCo($req->delCo); $foretag->setReciverZipCode($req->delZip); $foretag->setReciverCity($req->delCity); $foretag->setReciverEmail($req->delEmail); $foretag->setReciverPhone($req->delPhone); $foretag->setReciverMobile($req->delPhone);