/** * @expectedException NfeFocus\Exception\FieldRequiredException */ public function testEmptyEmail() { $email = ''; $receiver = new Receiver(); $receiver->setEmail($email); }
function sanitizeTransaction($response) { $receiver = new Receiver(); $receiver->setId($response['RECEIVERID']); $receiver->setEmail($response['RECEIVEREMAIL']); $receiver->setBusiness($response['RECEIVERBUSINESS']); $customer = new Customer(); $customer->setFirstName($response['FIRSTNAME']); $customer->setLastName($response['LASTNAME']); $customer->setEmail($response['EMAIL']); $customer->setPaypalId($response['PAYERID']); $customer->setStatus($response['PAYERSTATUS']); $customer->setAddressCountryCode($response['COUNTRYCODE']); $customer->setAddressCountry($response['SHIPTOCOUNTRYNAME']); $customer->setAddressStreet($response['SHIPTOSTREET']); $customer->setAddressCity($response['SHIPTOCITY']); $customer->setAddressState($response['SHIPTOSTATE']); $customer->setAddressZip($response['SHIPTOZIP']); $customer->setAddressStatus($response['ADDRESSSTATUS']); $transaction = new Transaction(); $transaction->setSubject($response['SUBJECT']); $transaction->setTxnId($response['TRANSACTIONID']); $transaction->setTxnType($response['PAYMENTTYPE']); $transaction->setPaymentDate($response['ORDERTIME']); $transaction->setGross($response['AMT']); $transaction->setFee($response['FEEAMT']); $transaction->setCurrencyCode($response['CURRENCYCODE']); $transaction->setPaymentStatus($response['PAYMENTSTATUS']); $transaction->setPendingReason($response['PENDINGREASON']); $transaction->setReasonCode($response['REASONCODE']); $transaction->setReasonCode($response['REASONCODE']); $transaction->setReceiver($receiver); $transaction->setCustomer($customer); return $transaction; }