Page 1 of 1

Protx payment method - bug fixes and enhancements

Posted: Sat Mar 28, 2009 9:50 am
by phpuk
Hi,

I have corrected a few issues with the Protx payment method:

Script: catalog/controller/payment/protx.php

Code: Select all

//Line 7:
//This initially was: if (!$this->config->get('paypal_test')) {
//changed to: if (!$this->config->get('protx_test')) {
Starting at Line 22:

Code: Select all

        // mod start - Must make VendorTxCode unique else payment will fail on Protx system!
		$query  = 'VendorTxCode=' . date("dmYHis") . $this->session->data['order_id'];
        // mod end

        $query .= '&Amount=' . $this->currency->format($order_info['total'], $order_info['currency'], $order_info['value'], FALSE);
		$query .= '&Currency=' . $order_info['currency'];

                // mod start - Made a little more user friendly
		$query .= '&Description=' . 'Items on ' . date($this->language->get('date_format_short')) . ' Order No: ' . $this->session->data['order_id'];
                // mod end

		$query .= '&SuccessURL=' . $this->url->https('checkout/success');
		$query .= '&FailureURL=' . $this->url->https('checkout/payment');
		$query .= '&CustomerName=' . $order_info['payment_firstname'] . ' ' . $order_info['payment_lastname'];

        // mod start - additional info to help reduce the number of failed or fraudulent transactions
        $query .= '&ContactNumber=' .   $order_info['telephone'];
        $query .= '&DeliveryAddress=' . $order_info['shipping_address_1'] . "\r\n" .
                                        $order_info['shipping_address_2'] . "\r\n" .
                                        $order_info['shipping_city'] . "\r\n" .
                                        $order_info['shipping_zone'] . "\r\n";
        $query .= '&DeliveryPostCode=' . $order_info['shipping_postcode'];
        // Duplicate the above so recieving address and card address match
        $query .= '&BillingAddress=' .  $order_info['shipping_address_1'] . "\r\n" .
                                        $order_info['shipping_address_2'] . "\r\n" .
                                        $order_info['shipping_city'] . "\r\n" .
                                        $order_info['shipping_zone'] . "\r\n";
        $query .= '&BillingPostCode=' . $order_info['shipping_postcode'];
        // mod end
The above changes should ensure a smooth payment for products / goods / services with Protx.

Phil.

Re: Protx payment method - bug fixes and enhancements

Posted: Mon Mar 30, 2009 7:44 am
by Daniel
I've added you code to the protx module in the main release.


Heres what i've done:

Code: Select all


		$query  = 'VendorTxCode=' . date("dmYHis") . $this->session->data['order_id'];
		$query .= '&Amount=' . $this->currency->format($order_info['total'], $order_info['currency'], $order_info['value'], FALSE);
		$query .= '&Currency=' . $order_info['currency'];
		$query .= '&Description=' . 'Items on ' . date($this->language->get('date_format_short')) . ' Order No: ' . $this->session->data['order_id'];
		$query .= '&SuccessURL=' . $this->url->https('checkout/success');
		$query .= '&FailureURL=' . $this->url->https('checkout/payment');
		$query .= '&CustomerName=' . $order_info['payment_firstname'] . ' ' . $order_info['payment_lastname'];
		$query .= '&ContactNumber=' .   $order_info['telephone'];
		
		if ($order_info['shipping_address_2']) {
			$query .= '&DeliveryAddress=' . $order_info['shipping_address_1'] . "\r\n" . $order_info['shipping_address_2'] . "\r\n" . $order_info['shipping_city'] . "\r\n" . $order_info['shipping_zone'] . "\r\n";
		} else {
			$query .= '&DeliveryAddress=' . $order_info['shipping_address_1'] . "\r\n" . $order_info['shipping_city'] . "\r\n" . $order_info['shipping_zone'] . "\r\n";
		}
		
		$query .= '&DeliveryPostCode=' . $order_info['shipping_postcode'];
		
		if ($order_info['shipping_address_2']) {
			$query .= '&BillingAddress=' .  $order_info['shipping_address_1'] . "\r\n" . $order_info['shipping_address_2'] . "\r\n" . $order_info['shipping_city'] . "\r\n" . $order_info['shipping_zone'] . "\r\n";
		} else {
			$query .= '&BillingAddress=' .  $order_info['shipping_address_1'] . "\r\n" . $order_info['shipping_city'] . "\r\n" . $order_info['shipping_zone'] . "\r\n";
		}
		
		$query .= '&BillingPostCode=' . $order_info['shipping_postcode'];
		$query .= '&CustomerEMail=' . $order_info['email'];
		$query .= '&VendorEMail=' . $this->config->get('config_email');

Re: Protx payment method - bug fixes and enhancements

Posted: Mon Mar 30, 2009 7:50 am
by phpuk
Hi,

Looks OK to me.

Will wait for the next version release and test in conjunction with any mods you implement to ensure nothing is broken.

Phil.