public function TransferToProvider()
 {
     $url = 'https://secure.chronopay.com/index_shop.cgi';
     $currency = GetDefaultCurrency();
     $currency = $currency['currencycode'];
     $hash = md5($GLOBALS['ISC_CFG']['serverStamp'] . $_COOKIE['SHOP_ORDER_TOKEN'] . $this->GetCombinedOrderId() . $this->GetValue('ProductId'));
     $billingDetails = $this->GetBillingDetails();
     $chronopayform['product_id'] = $this->GetValue('ProductId');
     $chronopayform['product_name'] = $GLOBALS['StoreName'];
     $chronopayform['product_price'] = $this->GetGatewayAmount();
     $chronopayform['product_price_currency'] = $currency;
     $chronopayform['language'] = $this->GetValue('LanguageCode');
     $chronopayform['cs1'] = $hash;
     $chronopayform['cs2'] = $_COOKIE['SHOP_ORDER_TOKEN'];
     $chronopayform['cb_url'] = $GLOBALS['ShopPath'] . '/modules/checkout/chronopaypage/chronopaypingback.php';
     $chronopayform['decline_url'] = $GLOBALS['ShopPath'] . '/finishorder.php';
     $chronopayform['cb_type'] = 'P';
     $chronopayform['f_name'] = $billingDetails['ordbillfirstname'];
     $chronopayform['s_name'] = $billingDetails['ordbilllastname'];
     $chronopayform['street'] = $billingDetails['ordbillstreet1'] . ' ' . $billingDetails['ordbillstreet2'];
     $chronopayform['city'] = $billingDetails['ordbillsuburb'];
     if ($billingDetails['ordbillcountryid'] == '38' || $billingDetails['ordbillcountryid'] == '226') {
         $chronopayform['state'] = GetStateISO2ByName($billingDetails['ordbillstate']);
     }
     $chronopayform['zip'] = $billingDetails['ordbillzip'];
     $chronopayform['country'] = GetCountryISO3ById($billingDetails['ordbillcountryid']);
     $chronopayform['phone'] = $billingDetails['ordbillphone'];
     $chronopayform['email'] = $billingDetails['ordbillemail'];
     header('Location: ' . $url . '?' . http_build_query($chronopayform));
 }
 protected function _ConstructPostData($postData)
 {
     // PaymentExpress accepts payments in cents
     $ccname = $postData['name'];
     $cctype = $postData['cctype'];
     $ccissueno = $postData['ccissueno'];
     $ccissuedatem = $postData['ccissuedatem'];
     $ccissuedatey = $postData['ccissuedatey'];
     $ccnum = $postData['ccno'];
     $ccexpm = $postData['ccexpm'];
     $ccexpy = $postData['ccexpy'];
     $cccvd = $postData['cccvd'];
     $currency = GetDefaultCurrency();
     $billingDetails = $this->GetBillingDetails();
     $chronoPayPostData['opcode'] = 1;
     $chronoPayPostData['product_id'] = $this->GetValue('productid');
     $chronoPayPostData['fname'] = $billingDetails['ordbillfirstname'];
     $chronoPayPostData['lname'] = $billingDetails['ordbilllastname'];
     $chronoPayPostData['cardholder'] = $ccname;
     $chronoPayPostData['zip'] = $billingDetails['ordbillzip'];
     $chronoPayPostData['street'] = $billingDetails['ordbillstreet1'] . ' ' . $billingDetails['ordbillstreet2'];
     $chronoPayPostData['city'] = $billingDetails['ordbillsuburb'];
     if ($billingDetails['ordbillcountryid'] == '38' || $billingDetails['ordbillcountryid'] == '226') {
         $chronoPayPostData['state'] = GetStateISO2ByName($billingDetails['ordbillstate']);
     }
     $chronoPayPostData['country'] = GetCountryISO3ById($billingDetails['ordbillcountryid']);
     $chronoPayPostData['email'] = $billingDetails['ordbillemail'];
     $chronoPayPostData['phone'] = $billingDetails['ordbillemail'];
     $chronoPayPostData['ip'] = $_SERVER['REMOTE_ADDR'];
     $chronoPayPostData['card_no'] = $ccnum;
     $chronoPayPostData['cvv'] = $cccvd;
     $chronoPayPostData['expirey'] = "20" . $ccexpy;
     $chronoPayPostData['expirem'] = $ccexpm;
     $chronoPayPostData['amount'] = $this->GetGatewayAmount();
     $chronoPayPostData['currency'] = $currency['currencycode'];
     $hash = md5($this->GetValue('sharedsecret') . $chronoPayPostData['opcode'] . $chronoPayPostData['product_id'] . $chronoPayPostData['fname'] . $chronoPayPostData['lname'] . $chronoPayPostData['street'] . $chronoPayPostData['ip'] . $chronoPayPostData['card_no'] . $chronoPayPostData['amount']);
     $chronoPayPostData['hash'] = $hash;
     return http_build_query($chronoPayPostData);
 }
 public function TransferToProvider()
 {
     $transactionid = 'ISC-' . $this->GetCombinedOrderId();
     $url = $this->_liveTransactionURL . $this->_liveTransactionURI;
     $session = $_COOKIE['SHOP_ORDER_TOKEN'];
     $amount = number_format($this->GetGatewayAmount(), 2, '.', '');
     $hash = md5($GLOBALS['ISC_CFG']['serverStamp'] . $this->GetCombinedOrderId() . $session . $amount);
     $currency = GetDefaultCurrency();
     $billingDetails = $this->GetBillingDetails();
     $moneyBookersPostData['pay_to_email'] = $this->GetValue('mbemail');
     $moneyBookersPostData['recipient_description'] = $GLOBALS['StoreName'];
     $moneyBookersPostData['logo_url'] = $this->GetValue('logourl');
     $moneyBookersPostData['transaction_id'] = $transactionid;
     $moneyBookersPostData['return_url'] = $GLOBALS['ShopPath'] . '/finishorder.php';
     $moneyBookersPostData['cancel_url'] = $GLOBALS['ShopPath'] . '/finishorder.php';
     $moneyBookersPostData['status_url'] = $GLOBALS['ShopPath'] . '/checkout.php?action=gateway_ping&provider=' . $this->GetId();
     $moneyBookersPostData['language'] = $this->GetValue('language');
     $moneyBookersPostData['hide_login'] = '******';
     $moneyBookersPostData['merchant_fields'] = 'isc_hash,isc_session';
     $moneyBookersPostData['isc_hash'] = $hash;
     $moneyBookersPostData['isc_session'] = $session;
     $moneyBookersPostData['amount'] = $amount;
     $moneyBookersPostData['currency'] = $currency['currencycode'];
     $moneyBookersPostData['detail1_description'] = 'For Order :';
     $moneyBookersPostData['detail1_text'] = $this->GetCombinedOrderId();
     $moneyBookersPostData['firstname'] = $billingDetails['ordbillfirstname'];
     $moneyBookersPostData['lastname'] = $billingDetails['ordbilllastname'];
     $moneyBookersPostData['address'] = $billingDetails['ordbillstreet1'];
     $moneyBookersPostData['address2'] = $billingDetails['ordbillstreet2'];
     $moneyBookersPostData['phone_number'] = $billingDetails['ordbillphone'];
     $moneyBookersPostData['postal_code'] = $billingDetails['ordbillzip'];
     $moneyBookersPostData['city'] = $billingDetails['ordbillsuburb'];
     $moneyBookersPostData['state'] = $billingDetails['ordbillstate'];
     $moneyBookersPostData['country'] = GetCountryISO3ById($billingDetails['ordbillcountryid']);
     header('Location:' . $url . '?' . http_build_query($moneyBookersPostData));
 }
Esempio n. 4
0
	public function __construct($customerId = null)
	{
		// use the same settings as orders by default
		$this->setDoubleOptIn(GetConfig('EmailIntegrationOrderDoubleOptin'));
		$this->setSendWelcome(GetConfig('EmailIntegrationOrderSendWelcome'));

		if (!$customerId) {
			return;
		}

		$entity = new ISC_ENTITY_CUSTOMER();

		$data = $entity->get($customerId);
		if (!$data) {
			throw new Interspire_EmailIntegration_Subscription_Exception();
		}

		unset($data['custpassword']);

		$this->_data = $data;
		unset($data);

		$this->setSubscriptionIP($this->_data['custregipaddress']);

		// customer custom form fields

		/** @var ISC_FORM */
		$form = $GLOBALS["ISC_CLASS_FORM"];

		// populate empty form fields as a starting point -- this makes exports of imported customers work OK because they may not have a custformsessionid, or this ensures that export data is current with configured form fields even if the stored form fields are out of date
		$formFields = $form->getFormFields(FORMFIELDS_FORM_ACCOUNT);
		foreach ($formFields as /** @var ISC_FORMFIELD_BASE */$formField) {
			if ($formField->getFieldPrivateId()) {
				continue;
			}
			$this->_data[$formField->getFieldId()] = '';
		}

		// load saved data for this customer
		if (isId($this->_data['custformsessionid'])) {
			$customFields = $form->getSavedSessionData($this->_data['custformsessionid']);
			foreach ($customFields as $fieldId => $value) {
				$this->_data['FormField_' . $fieldId] = $value;
			}
		}

		// for email integration purposes, money values must be stored in an array as both numeric and formatted to allow for translation to both number fields and text fields, while maintaining currency information
		SetupCurrency();
		$moneyFields = array('custstorecredit');
		foreach ($moneyFields as $moneyFieldId) {
			$this->_data[$moneyFieldId] = array(
				'numeric' => $this->_data[$moneyFieldId],
				'formatted' => FormatPriceInCurrency($this->_data[$moneyFieldId]),
			);
		}

		unset($this->_data['addresses']); // the addresses provided by entity class are mixed billing/shipping addresses, can't be sure so discard them
		// find last used _billing_ address for this customer by non-deleted orders
		$order = $GLOBALS['ISC_CLASS_DB']->FetchRow("SELECT ordformsessionid, ordbillstreet1, ordbillstreet2, ordbillsuburb, ordbillstate, ordbillzip, ordbillcountryid FROM `[|PREFIX|]orders` WHERE ordcustid = " . (int)$customerId . " AND deleted = 0 ORDER BY orddate DESC LIMIT 1");
		if (is_array($order)) {
			// create fields specifically for email integration based on customer data

			if (isId($order['ordformsessionid'])) {
				$customFields = $form->getSavedSessionData($order['ordformsessionid']);
				foreach ($customFields as $fieldId => $value) {
					$this->_data['CustomerSubscription_Address_FormField_' . $fieldId] = $value;
				}
			}

			$this->_data['CustomerSubscription_Address'] = array(
				'addr1' => $order['ordbillstreet1'],
				'addr2' => $order['ordbillstreet2'],
				'city' => $order['ordbillsuburb'],
				'state' => $order['ordbillstate'],
				'zip' => $order['ordbillzip'],
				'country' => GetCountryById($order['ordbillcountryid']),
				'countryiso2' => GetCountryISO2ById($order['ordbillcountryid']),
				'countryiso3' => GetCountryISO3ById($order['ordbillcountryid']),
			);

			$this->_data['CustomerSubscription_Address_address1'] = $this->_data['CustomerSubscription_Address']['addr1'];
			$this->_data['CustomerSubscription_Address_address2'] = $this->_data['CustomerSubscription_Address']['addr2'];
			$this->_data['CustomerSubscription_Address_city'] = $this->_data['CustomerSubscription_Address']['city'];
			$this->_data['CustomerSubscription_Address_state'] = $this->_data['CustomerSubscription_Address']['state'];
			$this->_data['CustomerSubscription_Address_zip'] = $this->_data['CustomerSubscription_Address']['zip'];
			$this->_data['CustomerSubscription_Address_country'] = $this->_data['CustomerSubscription_Address']['country'];
			$this->_data['CustomerSubscription_Address_countryiso2'] = $this->_data['CustomerSubscription_Address']['countryiso2'];
			$this->_data['CustomerSubscription_Address_countryiso3'] = $this->_data['CustomerSubscription_Address']['countryiso3'];
		}

		// transform customer group data if available
		if ($this->_data['customergroup']) {
			$this->_data['customergroupid'] = $this->_data['customergroup']['customergroupid'];
			$this->_data['groupname'] = $this->_data['customergroup']['groupname'];
		}
		else
		{
			$this->_data['customergroupid'] = '';
			$this->_data['groupname'] = '';
		}
		unset($this->_data['customergroup']);
	}
Esempio n. 5
0
		public function ProcessPaymentForm($data = array())
		{
			$postData = $this->_Validate($data);

			if ($postData === false) {
				return false;
			}

			// Is setup in test or live mode?
			$this->_testmode = $this->GetValue("testmode") == "YES";

			// PaySimple accepts payments in cents

			$ccname 		= $postData['name'];
			$cctype 		= $postData['cctype'];

			$ccissueno 		= $postData['ccissueno'];
			$ccissuedatem 	= $postData['ccissuedatem'];
			$ccissuedatey 	= $postData['ccissuedatey'];

			$ccnum 			= $postData['ccno'];
			$ccexpm 		= $postData['ccexpm'];
			$ccexpy 		= $postData['ccexpy'];
			$cccvd 			= $postData['cccvd'];

			$billingDetails = $this->GetBillingDetails();

			$testmode = ($this->GetValue('testmode') == 'YES');
			$message = '';

			try{
				$gateway = new Gateway();
				$gateway->production = !$testmode;

				$dynamicKey = new DynamicKey($this, $gateway);

				//Create Customer
				$customer = new Customer();
				$BillingAddress = new Address();
				$BillingAddress->AddressLine1 	= $billingDetails['ordbillstreet1'] . ' ' . $billingDetails['ordbillstreet2'];
				$BillingAddress->City 			= $billingDetails['ordbillsuburb'];
				$BillingAddress->ZipCode 		= $billingDetails['ordbillzip'];
				$customer->BillingAddress 		= $BillingAddress;
				$customer->BillingCountryName 	= GetCountryISO3ById($billingDetails['ordbillcountryid']);
				$customer->ShippingAddress 		= $BillingAddress;

				$contact = new Contact();
				$contact->EMail 	= $billingDetails['ordbillemail'];
				$contact->Phone1	= $billingDetails['ordbillphone'];

				$name = new Name();
				$name->FirstName	= $billingDetails['ordbillfirstname'];
				$name->LastName		= $billingDetails['ordbilllastname'];
				$contact->Name		= $name;

				$customer->Contact = $contact;
				$customer = $gateway->AddCustomer($dynamicKey->key, $customer);

				if ($gateway->isError()) {
					$message = $gateway->getErrorMessage();
				}

				$account = new CustomerAccountDTO();
				$account->IsCreditCard 		= true;
				$account->CreditCardNo 		= $ccnum;
				$account->CCExpiry 			= "20".$ccexpy."-".$ccexpm."-01T00:00:00";
				$account->CCType 			= $cctype;
				$account->CustomerId 		= $customer;
				$account->CardName 			= $ccname;

				if (!$gateway->isError()) {
					$account = $gateway->AddAccount($dynamicKey->key, $account);
				}
				if ($gateway->isError()) {
					$message = $gateway->getErrorMessage();
				}

				if (isset($account->Id)) {

					$PSpayment = new Payment();
					if ($testmode) {
						$PSpayment->Amount = 120;
					}
					else {
						$PSpayment->Amount = $this->GetGatewayAmount();
					}
					$PSpayment->CustomerId = $customer;
					$PSpayment->FromAccountId = $account->Id;

					$PSpayment->PaymentTypeCode = "CC";
					$PSpayment->PaymentSubTypeCode = "MOTO";

					if (!$gateway->isError()) {
						$PSpayment = $gateway->MakePayment($dynamicKey->key, $PSpayment, null);
					}
					if ($gateway->isError()) {
						$message = $gateway->getErrorMessage();
					}
				}
				else {
					$PSpayment = $account;
				}

			}
			catch (Exception $e) {
				$message = $e;
			}

			return $this->_HandleResponse($PSpayment, $message);
		}
Esempio n. 6
0
	public function __construct($orderId = null)
	{
		$this->setDoubleOptIn(GetConfig('EmailIntegrationOrderDoubleOptin'));
		$this->setSendWelcome(GetConfig('EmailIntegrationOrderSendWelcome'));
		$this->setSubscriptionIP(GetIP());

		if (!$orderId) {
			return;
		}

		$entity = new ISC_ENTITY_ORDER;

		$data = $entity->get($orderId);
		if (!$data) {
			throw new Interspire_EmailIntegration_Subscription_Exception;
		}
		$this->_data = $data;
		unset($data);

		// copy any form fields associated with the order + associated customer and place into local subscription data

		if (isId($this->_data['ordformsessionid'])) {
			/** @var ISC_FORM */
			$form = $GLOBALS["ISC_CLASS_FORM"];

			$customFields = array();

			$formData = $form->getSavedSessionData($this->_data['customer']['custformsessionid']);
			if ($formData && !empty($formData)) {
				$customFields += $formData;
			}

			$formData = $form->getSavedSessionData($this->_data['ordformsessionid']);
			if ($formData && !empty($formData)) {
				$customFields += $formData;
			}

			foreach ($customFields as $fieldId => $value) {
				$this->_data['FormField_' . $fieldId] = $value;
			}
		}

		// generate fields specifically for email integration based on order data (ones that aren't covered by simple order data or by Form Fields)

		// get the first shipping address record because IEM had shipping method as mappable field
		$this->_data['shipping_method'] = '';
		$shippingMethod = $GLOBALS['ISC_CLASS_DB']->FetchOne("SELECT `method` FROM [|PREFIX|]order_shipping WHERE order_id = " . (int)$orderId . " LIMIT 1", 'method');
		if ($shippingMethod) {
			$this->_data['shipping_method'] = $shippingMethod;
		}

		// pre-formated 'full address' mappable field to pass to providers like mailchimp
		$this->_data['OrderSubscription_BillingAddress'] = array(
			'addr1' => $this->_data['ordbillstreet1'],
			'addr2' => $this->_data['ordbillstreet2'],
			'city' => $this->_data['ordbillsuburb'],
			'state' => $this->_data['ordbillstate'],
			'zip' => $this->_data['ordbillzip'],
			'country' => $this->_data['ordbillcountrycode'],
		);

		// country-code specific fields to pass to providers like MailChimp or IEM that support (or require in IEM's case) country codes
		$this->_data['OrderSubscription_BillingAddress_countryiso2'] = $this->_data['ordbillcountrycode'];
		$this->_data['OrderSubscription_BillingAddress_countryiso3'] = GetCountryISO3ById($this->_data['ordbillcountryid']);

		// for email integration, we prefer sending the value of an order as the total amount rather than the stored (charged) total - which could be less than the value due to store credit or gift certificates
		// so, generate some columns which are internal to this subscription data and map to those instead of total_ex and total_inc
		$this->_data['total_ex_tax'] = $this->_data['subtotal_ex_tax'] + $this->_data['shipping_cost_ex_tax'] + $this->_data['handling_cost_ex_tax'] + $this->_data['wrapping_cost_ex_tax'];
		$this->_data['total_inc_tax'] = $this->_data['subtotal_inc_tax'] + $this->_data['shipping_cost_inc_tax'] + $this->_data['handling_cost_inc_tax'] + $this->_data['wrapping_cost_inc_tax'];

		// generated fields: end

		// currency values must be stored in the subscription data as both numeric and formatted so that, when translated to the mail provider, it can be sent as either a number or string depending on the destination field
		$moneyFields = array(
			'subtotal_ex_tax',
			'subtotal_inc_tax',
			'subtotal_tax',
			'total_ex_tax',
			'total_inc_tax',
			'total_tax',
			'shipping_cost_ex_tax',
			'shipping_cost_inc_tax',
			'shipping_cost_tax',
			'handling_cost_ex_tax',
			'handling_cost_inc_tax',
			'handling_cost_tax',
			'wrapping_cost_ex_tax',
			'wrapping_cost_inc_tax',
			'wrapping_cost_tax',
			'ordrefundedamount',
			'ordstorecreditamount',
			'ordgiftcertificateamount',
			'orddiscountamount',
			'coupon_discount',
		);

		foreach ($moneyFields as $moneyFieldId) {
			$this->_data[$moneyFieldId] = array(
				'numeric' => $this->_data[$moneyFieldId],
				'formatted' => FormatPriceInCurrency($this->_data[$moneyFieldId], $this->_data['orddefaultcurrencyid']),
			);
		}

		$set = new ISC_NESTEDSET_CATEGORIES;

		// instead of storing full product information, just store the data pertinent to integration rules
		foreach ($this->_data['products'] as $product) {
			$this->_products[] = $product['productid'];
			$this->_brands[] = $product['prodbrandid'];

			if ($product['prodcatids']) {
				foreach (explode(',', $product['prodcatids']) as $categoryId) {
					$this->_categories[] = $categoryId;

					// also include parent categories to trigger rules related to them
					$parents = $set->getParentPath(array('categoryid'), (int)$categoryId);
					foreach ($parents as $parentCategory) {
						$this->_categories[] = $parentCategory['categoryid'];
					}
				}
			}
		}

		$this->_products = array_unique($this->_products);
		$this->_brands = array_unique($this->_brands);
		$this->_categories = array_unique($this->_categories);

		sort($this->_products);
		sort($this->_brands);
		sort($this->_categories);

		// for now, don't need to store these - may need to store products when this is changed to supply ecommerce info
		unset($this->_data['customer']);
		unset($this->_data['products']);
	}
Esempio n. 7
0
 /**
  *	Add the customer to the orders mailing list, complete with any order parameters.
  *	$OrderRow is a reference to an object that contains all details about their order.
  */
 public function AddSubscriberToOrderList($orders)
 {
     foreach ($orders as $order) {
         // Is this person already in the subscribers table?
         if (!$this->SubscriberExists(GetConfig('MailOrderList'), $order['ordbillemail'])) {
             // Add the subscriber
             $add_xml = "<xmlrequest>\n\t\t\t\t\t\t\t\t<username>" . GetConfig('MailUsername') . "</username>\n\t\t\t\t\t\t\t\t<usertoken>" . GetConfig('MailXMLToken') . "</usertoken>\n\t\t\t\t\t\t\t\t<requesttype>subscribers</requesttype>\n\t\t\t\t\t\t\t\t<requestmethod>AddSubscriberToList</requestmethod>\n\t\t\t\t\t\t\t\t<details>\n\t\t\t\t\t\t\t\t\t<emailaddress>" . $order['ordbillemail'] . "</emailaddress>\n\t\t\t\t\t\t\t\t\t<mailinglist>" . GetConfig('MailOrderList') . "</mailinglist>\n\t\t\t\t\t\t\t\t\t<confirmed>yes</confirmed>\n\t\t\t\t\t\t\t\t\t<customfields>";
             // Do we need to add the customer's first name to the mailing list as a custom field?
             if (GetConfig('MailOrderFirstName') > 0) {
                 $add_xml .= "<item>\n\t\t\t\t\t\t\t\t\t\t<fieldid>" . GetConfig('MailOrderFirstName') . "</fieldid>\n\t\t\t\t\t\t\t\t\t\t<value>" . $order['ordbillfirstname'] . "</value>\n\t\t\t\t\t\t\t\t\t</item>";
             }
             // Do we need to add the customer's last name to the mailing list as a custom field?
             if (GetConfig('MailOrderLastName') > 0) {
                 $add_xml .= "<item>\n\t\t\t\t\t\t\t\t\t\t<fieldid>" . GetConfig('MailOrderLastName') . "</fieldid>\n\t\t\t\t\t\t\t\t\t\t<value>" . $order['ordbilllastname'] . "</value>\n\t\t\t\t\t\t\t\t\t</item>";
             }
             // Do we need to add the customer's full name to the mailing list as a custom field?
             if (GetConfig('MailOrderFullName') > 0) {
                 $add_xml .= "<item>\n\t\t\t\t\t\t\t\t\t\t<fieldid>" . GetConfig('MailOrderFullName') . "</fieldid>\n\t\t\t\t\t\t\t\t\t\t<value>" . $order['ordbillfirstname'] . " " . $order['ordbilllastname'] . "</value>\n\t\t\t\t\t\t\t\t\t</item>";
             }
             // Do we need to add the customer's zip/postcode to the mailing list as a custom field?
             if (GetConfig('MailOrderZip') > 0) {
                 $add_xml .= "<item>\n\t\t\t\t\t\t\t\t\t\t<fieldid>" . GetConfig('MailOrderZip') . "</fieldid>\n\t\t\t\t\t\t\t\t\t\t<value>" . $order['ordbillzip'] . "</value>\n\t\t\t\t\t\t\t\t\t</item>";
             }
             // Do we need to add the customer's country to the mailing list as a custom field?
             if (GetConfig('MailOrderCountry') > 0) {
                 $add_xml .= "<item>\n\t\t\t\t\t\t\t\t\t\t<fieldid>" . GetConfig('MailOrderCountry') . "</fieldid>\n\t\t\t\t\t\t\t\t\t\t<value>" . GetCountryISO3ById($order['ordbillcountryid']) . "</value>\n\t\t\t\t\t\t\t\t\t</item>";
             }
             // Do we need to add the customer's order total to the mailing list as a custom field?
             if (GetConfig('MailOrderTotal') > 0) {
                 $add_xml .= "<item>\n\t\t\t\t\t\t\t\t\t\t<fieldid>" . GetConfig('MailOrderTotal') . "</fieldid>\n\t\t\t\t\t\t\t\t\t\t<value>" . $order['ordtotalamount'] . "</value>\n\t\t\t\t\t\t\t\t\t</item>";
             }
             // Do we need to add the customer's payment method to the mailing list as a custom field?
             if (GetConfig('MailOrderPaymentMethod') > 0) {
                 $add_xml .= "<item>\n\t\t\t\t\t\t\t\t\t\t<fieldid>" . GetConfig('MailOrderPaymentMethod') . "</fieldid>\n\t\t\t\t\t\t\t\t\t\t<value>" . $order['orderpaymentmethod'] . "</value>\n\t\t\t\t\t\t\t\t\t</item>";
             }
             // Do we need to add the customer's shipping method to the mailing list as a custom field?
             if (GetConfig('MailOrderShippingMethod') > 0) {
                 $add_xml .= "<item>\n\t\t\t\t\t\t\t\t\t\t<fieldid>" . GetConfig('MailOrderShippingMethod') . "</fieldid>\n\t\t\t\t\t\t\t\t\t\t<value>" . $order['ordshipmethod'] . "</value>\n\t\t\t\t\t\t\t\t\t</item>";
             }
             $add_xml .= "\n\t\t\t\t\t\t\t\t</customfields>\n\t\t\t\t\t\t\t\t</details>\n\t\t\t\t\t\t\t</xmlrequest>";
             $add_xml = urlencode($add_xml);
             $result = PostToRemoteFileAndGetResponse(GetConfig('MailXMLPath'), "xml=" . $add_xml);
             $xml = @simplexml_load_string($result);
             $response = '';
             if ($xml && isset($xml->status)) {
                 $response = $xml->status;
             }
             if ($response == "SUCCESS") {
                 $result = array("status" => "success", "message" => GetLang('NewsletterSubscribedSuccessfully'));
             } else {
                 $result = array("status" => "fail", "message" => sprintf(GetLang('NewsletterSubscribeErrorIEM'), $xml->errormessage));
             }
         } else {
             $result = array("status" => "success", "message" => sprintf(GetLang('NewsletterAlreadySubscribed'), $order['ordbillemail']));
         }
     }
     return $result;
 }