v7‰PNG  IHDR Ÿ f Õ†C1 sRGB ®Îé gAMA ± üa pHYs à ÃÇo¨d GIDATx^íÜL”÷ð÷Yçªö("Bh_ò«®¸¢§q5kÖ*:þ0A­ºšÖ¥]VkJ¢M»¶f¸±8\k2íll£1]q®ÙÔ‚ÆT getConfig('customer_id')); } public function _initSetupForm(Am_Form_Setup $form) { $form->addText("customer_id")->setLabel("eWAY customer ID\n" . 'Your unique eWAY customer ID assigned to you when you join eWAY. eg 87654321'); $form->addAdvCheckbox("testing")->setLabel("Test Mode Enabled"); } public function getGateway() { return $this->getConfig('testing') ? self::GATEWAY_URL_TEST : self::GATEWAY_URL; } public function _doBill(Invoice $invoice, $doFirst, CcRecord $cc, Am_Paysystem_Result $result) { $xml = new SimpleXMLElement(''); $xml->ewayCustomerID = $this->getConfig('customer_id'); $xml->ewayTotalAmount = $doFirst ? ($invoice->first_total * 100) : ($invoice->second_total * 100); $xml->ewayCustomerFirstName = $cc->cc_name_f; $xml->ewayCustomerLastName = $cc->cc_name_l; $xml->ewayCustomerEmail = $invoice->getUser()->email; $xml->ewayCustomerAddress = $cc->cc_street; $xml->ewayCustomerPostcode = $cc->cc_zip; $xml->ewayCustomerInvoiceDescription = $invoice->getLineDescription(); $xml->ewayCustomerInvoiceRef = $invoice->public_id; $xml->ewayCardHoldersName = sprintf('%s %s', $cc->cc_name_f, $cc->cc_name_l); $xml->ewayCardNumber = $cc->cc_number; $xml->ewayCardExpiryMonth = $cc->getExpire('%1$02d'); $xml->ewayCardExpiryYear = $cc->getExpire('%2$02d'); ; $xml->ewayTrxnNumber = $invoice->public_id; $xml->ewayOption1 = ''; $xml->ewayOption2 = ''; $xml->ewayOption3 = ''; $xml->ewayCVN = $cc->getCvv(); $request = new Am_HttpRequest($this->getGateway(), Am_HttpRequest::METHOD_POST); $request->setBody($xml->asXML()); $request->setHeader('Content-type', 'text/xml'); $tr = new Am_Paysystem_Transaction_CreditCard_Eway($this, $invoice, $request, $doFirst); $tr->run($result); } } class Am_Paysystem_Transaction_CreditCard_Eway extends Am_Paysystem_Transaction_CreditCard { public function validate() { $xml = $this->vars; if ($xml->ewayTrxnStatus != 'True') { $this->result->setFailed($xml->ewayTrxnError); return; } $this->result->setSuccess(); } public function parseResponse() { $this->vars = new SimpleXMLElement($this->response->getBody()); return $this->vars; } public function getUniqId() { return $this->vars->ewayTrxnNumber; } }