public function processPayment($data, $form)
 {
     // 1) Main Informations
     $member = $this->Member();
     // 2) Mandatory Settings
     $inputs['CardHoldersName'] = $data['Eway_CreditCardHolderName'];
     $inputs['CardNumber'] = self::$test_mode ? self::$test_credit_card_number : implode('', $data['Eway_CreditCardNumber']);
     $inputs['CardExpiryMonth'] = substr($data['Eway_CreditCardExpiry'], 0, 2);
     $inputs['CardExpiryYear'] = substr($data['Eway_CreditCardExpiry'], 2, 2);
     if (self::$cvn_mode) {
         $inputs['CVN'] = $data['Eway_CreditCardCVN'];
     }
     $inputs['TotalAmount'] = self::$test_mode ? self::$test_amount : $this->Amount * 100;
     // 3) Payment Informations
     $inputs['CustomerInvoiceRef'] = $this->ID;
     // 4) Customer Informations
     $inputs['CustomerFirstName'] = $data['FirstName'];
     $inputs['CustomerLastName'] = $data['Surname'];
     $inputs['CustomerEmail'] = $data['Email'];
     $inputs['CustomerAddress'] = $data['Address'] . ' ' . $data['AddressLine2'] . ' ' . $data['City'] . ' ' . $data['Country'];
     $inputs['CustomerPostcode'] = $member->hasMethod('getPostCode') ? $member->getPostCode() : '';
     // 5) Empty Informations
     $inputs['CustomerInvoiceDescription'] = '';
     $inputs['TrxnNumber'] = '';
     $inputs['Option1'] = '';
     $inputs['Option2'] = '';
     $inputs['Option3'] = '';
     // 6) Eway Payment Creation
     $customerID = self::$test_mode ? EWAY_DEFAULT_CUSTOMER_ID : self::$customer_id;
     $paymentMethod = self::$cvn_mode ? REAL_TIME_CVN : REAL_TIME;
     $eway = new EwayPaymentLive();
     $eway->EwayPaymentLive($customerID, $paymentMethod, !self::$test_mode);
     foreach ($inputs as $name => $value) {
         $eway->setTransactionData($name, $value);
     }
     // 7) Eway Transaction Sending
     $ewayResponseFields = $eway->doPayment();
     // 8) Eway Response Management
     if ($ewayTrxnStatus = strtolower($ewayResponseFields['EWAYTRXNSTATUS'])) {
         $this->TxnRef = $ewayResponseFields['EWAYTRXNNUMBER'];
         $this->Message = $ewayResponseFields['EWAYTRXNERROR'];
         if ($ewayTrxnStatus == 'true') {
             $this->Status = 'Success';
             $result = new Payment_Success();
         } else {
             $this->Status = 'Failure';
             $result = new Payment_Failure('The payment has not been completed correctly. An invalid response has been received from the Eway payment.');
         }
     } else {
         $this->Status = 'Failure';
         $result = new Payment_Failure('The payment has not been completed correctly. The payment request has not been sent to the Eway server correctly.');
     }
     $this->write();
     return $result;
 }