
07-06-2015, 05:21 AM
|
|
 | |
|
|
 X-Cart team
|
|
Join Date: Jan 2009
Posts: 2,431
|
|
|
Re: Correct way to modify a Payment .php file in XC5
The good way to achieve it is to decorate this class and define the new version of the getCrypt() method as follows there:
PHP Code:
protected function getCrypt() { $currency = $this->transaction->getCurrency();
$shippingAddress = $this->getProfile()->getShippingAddress(); if (null === $shippingAddress) { $shippingAddress = $this->getProfile()->getBillingAddress(); }
$fields = array( 'VendorTxCode' => $this->getTransactionId(), 'ReferrerID' => '653E8C42-AD93-4654-BB91-C645678FA97B', 'Amount' => round($this->transaction->getValue(), 2), 'Currency' => strtoupper($currency->getCode()), 'Description' => 'Your Cart',
'SuccessURL' => $this->getReturnURL(null, true), 'FailureURL' => $this->getReturnURL(null, true, true),
'CustomerName' => $this->getProfile()->getBillingAddress()->getFirstname() . ' ' . $this->getProfile()->getBillingAddress()->getLastname(), 'BillingSurname' => $this->getProfile()->getBillingAddress()->getLastname(), 'BillingFirstnames' => $this->getProfile()->getBillingAddress()->getFirstname(), 'BillingAddress1' => $this->getProfile()->getBillingAddress()->getStreet(), 'BillingCity' => $this->getProfile()->getBillingAddress()->getCity(), 'BillingPostCode' => $this->getProfile()->getBillingAddress()->getZipcode(), 'BillingCountry' => strtoupper($this->getProfile()->getBillingAddress()->getCountry()->getCode()),
'DeliverySurname' => $shippingAddress->getLastname(), 'DeliveryFirstnames' => $shippingAddress->getFirstname(), 'DeliveryAddress1' => $shippingAddress->getStreet(), 'DeliveryCity' => $shippingAddress->getCity(), 'DeliveryPostCode' => $shippingAddress->getZipcode(), 'DeliveryCountry' => strtoupper($shippingAddress->getCountry()->getCode()),
'Basket' => $this->getBasket(), 'AllowGiftAid' => 0, 'ApplyAVSCV2' => 0, 'Apply3DSecure' => 0, );
if ('US' === $fields['BillingCountry']) { $fields['BillingState'] = $this->getProfile()->getBillingAddress()->getState()->getCode(); }
if ('US' === $fields['DeliveryCountry']) { $fields['DeliveryState'] = $shippingAddress->getState()->getCode(); }
$cryptedFields = array(); foreach ($fields as $key => $value) { $cryptedFields[] = $key . '=' . $value; }
return $this->encryptAndEncode(implode('&', $cryptedFields)); }
Please, let me know if it helps.
Tony
|
|