setType($parts[1]); $response->setModifierCode($parts[2]); switch ($parts[2]) { case 2090: // break was intentionally omitted case 2091: $response->setMessage($parts[3]); break; case 2011: $response->setApprovalCode(self::APPROVED); $response->setDetailedMessage($parts[5]); $response->setSyncCountersIncrement($parts[6]); $response->setItemId($parts[7]); $response->setBatchId($parts[8]); $response->setRouteCode($parts[9]); $response->setAccountNumber($parts[10]); $response->setCheckNumber($parts[11]); $response->setAmount($parts[12]); $response->setInvoiceNumber($parts[13]); $response->setClerkId($parts[14]); $response->setLocalTransactionTime($parts[15]); $response->setOriginalRequestStatus($parts[16]); break; default: throw new Exception('Unsupported response modifier code'); } return $response; } public function getMessage() { return $this->message; } public function setMessage($message) { $this->message = $message; return $this; } public function getDetailedMessage() { return $this->detailedMessage; } public function setDetailedMessage($detailedMessage) { $this->detailedMessage = $detailedMessage; return $this; } public function toArray() { return [ $this->getType(), $this->getModifierCode(), $this->getMessage(), $this->getApprovalCode(), $this->getDetailedMessage(), $this->getSyncCountersIncrement(), $this->getItemId(), $this->getBatchId(), $this->getRouteCode(), $this->getAccountNumber(), $this->getCheckNumber(), $this->getAmount(), $this->getInvoiceNumber(), $this->getClerkId(), $this->getLocalTransactionTime(), $this->getOriginalRequestStatus(), ]; } public function getApprovalCode() { return $this->approvalCode; } public function setApprovalCode($approvalCode) { $this->approvalCode = $approvalCode; return $this; } public function getSyncCountersIncrement() { return $this->syncCountersIncrement; } public function setSyncCountersIncrement($syncCountersIncrement) { $this->syncCountersIncrement = $syncCountersIncrement; return $this; } public function getItemId() { return $this->itemId; } public function setItemId($itemId) { $this->itemId = $itemId; return $this; } public function getBatchId() { return $this->batchId; } public function setBatchId($batchId) { $this->batchId = $batchId; return $this; } public function getRouteCode() { return $this->routeCode; } public function setRouteCode($routeCode) { $this->routeCode = $routeCode; return $this; } public function getAccountNumber() { return $this->accountNumber; } public function setAccountNumber($accountNumber) { $this->accountNumber = $accountNumber; return $this; } public function getCheckNumber() { return $this->checkNumber; } public function setCheckNumber($checkNumber) { $this->checkNumber = $checkNumber; return $this; } public function getAmount() { return $this->amount; } public function setAmount($amount) { $this->amount = $amount; return $this; } public function getInvoiceNumber() { return $this->invoiceNumber; } public function setInvoiceNumber($invoiceNumber) { $this->invoiceNumber = $invoiceNumber; return $this; } public function getClerkId() { return $this->clerkId; } public function setClerkId($clerkId) { $this->clerkId = $clerkId; return $this; } public function getClerkInitials() { return $this->clerkInitials; } public function setClerkInitials($clerkInitials) { $this->clerkInitials = $clerkInitials; return $this; } public function getOriginalRequestStatus() { return $this->originalRequestStatus; } public function setOriginalRequestStatus($originalRequestStatus) { $this->originalRequestStatus = $originalRequestStatus; return $this; } public function __toString() { $clone = clone $this; $clone->setAccountNumber($this->mask($clone->getAccountNumber(), null, 4)); return implode(self::STRING_SEPARATOR, $clone->toArray()); } }