Version Notes
E-Mail simplification.
Download this release
Release Info
| Developer | FRAUD.AGENCY |
| Extension | Fraudagency_Paymentapi |
| Version | 0.3.7 |
| Comparing to | |
| See all releases | |
Code changes from version 0.3.4 to 0.3.7
- app/code/community/Fraudagency/Paymentapi/Block/Adminhtml/System/Config/Form/Button.php +0 -0
- app/code/community/Fraudagency/Paymentapi/Helper/Data.php +0 -0
- app/code/community/Fraudagency/Paymentapi/Model/Observer.php +154 -153
- app/code/community/Fraudagency/Paymentapi/controllers/Adminhtml/PaymentapiController.php +0 -0
- app/code/community/Fraudagency/Paymentapi/etc/adminhtml.xml +0 -0
- app/code/community/Fraudagency/Paymentapi/etc/config.xml +0 -0
- app/code/community/Fraudagency/Paymentapi/etc/system.xml +0 -0
- app/design/adminhtml/default/default/template/paymentapi/system/config/button.phtml +0 -0
- app/etc/modules/Fraudagency_Paymentapi.xml +0 -0
- package.xml +6 -6
app/code/community/Fraudagency/Paymentapi/Block/Adminhtml/System/Config/Form/Button.php
CHANGED
|
File without changes
|
app/code/community/Fraudagency/Paymentapi/Helper/Data.php
CHANGED
|
File without changes
|
app/code/community/Fraudagency/Paymentapi/Model/Observer.php
CHANGED
|
@@ -1,173 +1,174 @@
|
|
| 1 |
<?php
|
| 2 |
class Fraudagency_Paymentapi_Model_Observer {
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
$customerData = Mage::getSingleton('customer/session')->getCustomer();
|
| 38 |
$customerID = $customerData->getId();
|
| 39 |
}
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
| 52 |
'customer' => $customerID,
|
| 53 |
'name' => $this->_billingname,
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
'order_amount' => $grandtotal,
|
| 70 |
'order_currency' => $currency,
|
| 71 |
'order_id' => $quoteid,
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
'payment_method' => $paymentCode,
|
| 99 |
'payment_method_txt' => $paymentTitle,
|
| 100 |
'status' => $status
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
'key' => $license_key,
|
| 105 |
'query' => 'check_order',
|
| 106 |
'payment_method' => $array_with_payment_methods,
|
| 107 |
'order' => $array_with_order_information
|
| 108 |
-
|
| 109 |
$response = json_decode(file_get_contents(('https://fraud.agency/api/?q='. urlencode(json_encode($array))), 0, stream_context_create(array('https' => array('timeout' => 5)))), 1);
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
$response = json_decode(file_get_contents(('https://fraud.agency/api/?q='. urlencode(json_encode($array))), 0, stream_context_create(array('https' => array('timeout' => 5)))), 1);
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
}
|
| 173 |
?>
|
| 1 |
<?php
|
| 2 |
class Fraudagency_Paymentapi_Model_Observer {
|
| 3 |
+
protected $_pmethods = array();
|
| 4 |
+
private $_email = '';
|
| 5 |
+
private $_billingname = '';
|
| 6 |
+
private $_billingaddress = '';
|
| 7 |
+
private $_billingzip = '';
|
| 8 |
+
private $_billingcity = '';
|
| 9 |
+
private $_billingstate = '';
|
| 10 |
+
private $_billingcountry = '';
|
| 11 |
+
public function paymentApi($observer) {
|
| 12 |
+
$action_name = $observer->getEvent()->getControllerAction()->getFullActionName();
|
| 13 |
+
$pos = strrpos($action_name, "_");
|
| 14 |
+
$action = substr($action_name,$pos+1);
|
| 15 |
+
$param_billing = Mage::app()->getFrontController()->getRequest()->getParam('billing', array());
|
| 16 |
+
if( ($action == 'saveBilling' && $param_billing['use_for_shipping'] == 1) || $action == 'saveShipping') {
|
| 17 |
+
$enablePaymentapi = Mage::getStoreConfig('paymentapi/general/activate_fraudagency_paymentapi_enable');
|
| 18 |
+
$enablePaymentapi = intval($enablePaymentapi);
|
| 19 |
+
if($enablePaymentapi) {
|
| 20 |
+
$license_key = Mage::getStoreConfig('paymentapi/general/apikey_fraudagency_paymentapi_apikey');
|
| 21 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
| 22 |
+
$quoteid = $quote->getId();
|
| 23 |
+
if($quoteid) {
|
| 24 |
+
$address=$quote->getBillingAddress();
|
| 25 |
+
if($address->getAddressType() == 'billing') {
|
| 26 |
+
$this->_email = $address->getData('email');
|
| 27 |
+
$this->_billingname = $address->getData("firstname").' '.$address->getData("lastname");
|
| 28 |
+
$this->_billingaddress = $address->getData("street").' '.$address->getStreet(2);
|
| 29 |
+
$this->_billingzip = $address->getData("postcode");
|
| 30 |
+
$this->_billingcity = $address->getData("city");
|
| 31 |
+
$this->_billingstate = $address->getRegionCode();
|
| 32 |
+
$this->_billingcountry = $address->getCountry();
|
| 33 |
+
}
|
| 34 |
+
$address=$quote->getShippingAddress();
|
| 35 |
+
if($address->getAddressType()=='shipping') {
|
| 36 |
+
if(Mage::getSingleton('customer/session')->isLoggedIn()) {
|
| 37 |
$customerData = Mage::getSingleton('customer/session')->getCustomer();
|
| 38 |
$customerID = $customerData->getId();
|
| 39 |
}
|
| 40 |
+
$shipname = $address->getData("firstname").' '.$address->getData("lastname");
|
| 41 |
+
$shipaddress = $address->getStreet(1).' '.$address->getStreet(2);
|
| 42 |
+
$shipPostcode = $address->getData("postcode");
|
| 43 |
+
$shipCity = $address->getData("city");
|
| 44 |
+
$shipRegion = $address->getRegionCode();
|
| 45 |
+
$shipCountry = $address->getCountry();
|
| 46 |
+
$shipPhone = $address->getData("telephone");
|
| 47 |
+
$session_id = Mage::getModel("core/session")->getEncryptedSessionId();
|
| 48 |
+
$order_total = Mage::getSingleton('checkout/session')->getQuote()->getTotals();
|
| 49 |
+
$grandtotal = $order_total["grand_total"]->getValue();
|
| 50 |
+
$currency = Mage::getSingleton('checkout/session')->getQuote()->getQuoteCurrencyCode();
|
| 51 |
+
$array_with_order_information = array(
|
| 52 |
+
'shopsystem' => 'magento',
|
| 53 |
+
'appversion' => '0.3.6',
|
| 54 |
'customer' => $customerID,
|
| 55 |
'name' => $this->_billingname,
|
| 56 |
+
'address' => $this->_billingaddress,
|
| 57 |
+
'city' => $this->_billingcity,
|
| 58 |
+
'state' => $this->_billingstate,
|
| 59 |
+
'zip' => $this->_billingzip,
|
| 60 |
+
'country' => $this->_billingcountry,
|
| 61 |
+
'shipname' => $shipname,
|
| 62 |
+
'shipaddr' => $shipaddress,
|
| 63 |
+
'shipcity' => $shipCity,
|
| 64 |
+
'shipstate' => $shipRegion,
|
| 65 |
+
'shipzip' => $shipPostcode,
|
| 66 |
+
'shipcountry' => $shipCountry,
|
| 67 |
+
'phone' => $shipPhone,
|
| 68 |
+
'email' => strtolower($this->_email),
|
| 69 |
+
'passwordmd5' => NULL,
|
| 70 |
+
'order_amount' => $grandtotal,
|
|
|
|
| 71 |
'order_currency' => $currency,
|
| 72 |
'order_id' => $quoteid,
|
| 73 |
+
'cc_num' => NULL,
|
| 74 |
+
'cc_b_name' => NULL,
|
| 75 |
+
'cc_bin_phone' => NULL,
|
| 76 |
+
'cc_avs_result' => NULL,
|
| 77 |
+
'cc_ccv_result' => NULL,
|
| 78 |
+
'sessionid' => $session_id,
|
| 79 |
+
'ip' => $_SERVER['REMOTE_ADDR'],
|
| 80 |
+
'user_agent' => $_SERVER['HTTP_USER_AGENT'],
|
| 81 |
+
'accept_language' => $_SERVER['HTTP_ACCEPT_LANGUAGE'],
|
| 82 |
+
'forwardedip' => ((!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : NULL)
|
| 83 |
+
);
|
| 84 |
+
$allAvailablePaymentMethods = Mage::getModel('payment/config')->getAllMethods();
|
| 85 |
+
$ActivePaymentMethods = Mage::getSingleton('payment/config')->getActiveMethods();
|
| 86 |
+
foreach ($ActivePaymentMethods as $Code=>$payment) {
|
| 87 |
+
$Activemethods[] = $Code;
|
| 88 |
+
}
|
| 89 |
+
$store = Mage::app()->getStore();
|
| 90 |
+
foreach ($allAvailablePaymentMethods as $paymentCode=>$paymentModel) {
|
| 91 |
+
$active = Mage::getStoreConfigFlag('payment/'.$paymentCode.'/active', $store);
|
| 92 |
+
if($active) {
|
| 93 |
+
$status = $active;
|
| 94 |
+
} else {
|
| 95 |
+
$status = '0';
|
| 96 |
+
}
|
| 97 |
+
$paymentTitle = Mage::getStoreConfig('payment/'.$paymentCode.'/title');
|
| 98 |
+
$array_with_payment_methods[] = array(
|
| 99 |
'payment_method' => $paymentCode,
|
| 100 |
'payment_method_txt' => $paymentTitle,
|
| 101 |
'status' => $status
|
| 102 |
+
);
|
| 103 |
+
}
|
| 104 |
+
$array = array(
|
| 105 |
'key' => $license_key,
|
| 106 |
'query' => 'check_order',
|
| 107 |
'payment_method' => $array_with_payment_methods,
|
| 108 |
'order' => $array_with_order_information
|
| 109 |
+
);
|
| 110 |
$response = json_decode(file_get_contents(('https://fraud.agency/api/?q='. urlencode(json_encode($array))), 0, stream_context_create(array('https' => array('timeout' => 5)))), 1);
|
| 111 |
+
if (empty($response['err_msg']) && $response['call']==1) {
|
| 112 |
+
foreach ($response['accepted_payment_method'] as $key => $value) {
|
| 113 |
+
if (in_array($value['payment_method'], $Activemethods)) {
|
| 114 |
+
$this->_pmethods[] = $value['payment_method'];
|
| 115 |
+
}
|
| 116 |
+
}
|
| 117 |
+
Mage::getSingleton('core/session')->setPaymentMethods($this->_pmethods);
|
| 118 |
+
}
|
| 119 |
+
}
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
} elseif($action == 'saveOrder') {
|
| 123 |
+
Mage::getSingleton('core/session')->setPaymentMethods('');
|
| 124 |
+
}
|
| 125 |
+
}
|
| 126 |
+
public function paymentMethodActive(Varien_Event_Observer $observer) {
|
| 127 |
+
$event = $observer->getEvent();
|
| 128 |
+
$method = $event->getMethodInstance();
|
| 129 |
+
$result = $event->getResult();
|
| 130 |
+
$getPaymentMethods = Mage::getSingleton('core/session')->getPaymentMethods();
|
| 131 |
+
if(count($getPaymentMethods) > 0) {
|
| 132 |
+
if (!in_array($method->getCode(),$getPaymentMethods)) {
|
| 133 |
+
$result->isAvailable = false;
|
| 134 |
+
}
|
| 135 |
+
}
|
| 136 |
+
}
|
| 137 |
+
public function handle_adminSystemConfigChangedSection() {
|
| 138 |
+
$enablePaymentapi = Mage::getStoreConfig('paymentapi/general/activate_fraudagency_paymentapi_enable');
|
| 139 |
+
$enablePaymentapi = intval($enablePaymentapi);
|
| 140 |
+
$allAvailablePaymentMethods = Mage::getModel('payment/config')->getAllMethods();
|
| 141 |
+
$store = Mage::app()->getStore();
|
| 142 |
+
foreach ($allAvailablePaymentMethods as $paymentCode=>$paymentModel) {
|
| 143 |
+
$active = Mage::getStoreConfigFlag('payment/'.$paymentCode.'/active', $store);
|
| 144 |
+
if($active) {
|
| 145 |
+
$status = $active;
|
| 146 |
+
} else {
|
| 147 |
+
$status = '0';
|
| 148 |
+
}
|
| 149 |
+
$paymentTitle = Mage::getStoreConfig('payment/'.$paymentCode.'/title');
|
| 150 |
+
$array_with_payment_methods[] = array(
|
| 151 |
+
'payment_method' => $paymentCode,
|
| 152 |
+
'payment_method_txt' => $paymentTitle,
|
| 153 |
+
'status' => $status
|
| 154 |
+
);
|
| 155 |
+
}
|
| 156 |
+
if($enablePaymentapi) {
|
| 157 |
+
$license_key = Mage::getStoreConfig('paymentapi/general/apikey_fraudagency_paymentapi_apikey');
|
| 158 |
+
$array = array(
|
| 159 |
+
'key' => $license_key,
|
| 160 |
+
'query' => 'init_license_key',
|
| 161 |
+
'payment_method' => $array_with_payment_methods
|
| 162 |
+
);
|
| 163 |
$response = json_decode(file_get_contents(('https://fraud.agency/api/?q='. urlencode(json_encode($array))), 0, stream_context_create(array('https' => array('timeout' => 5)))), 1);
|
| 164 |
+
$session = Mage::getSingleton('core/session');
|
| 165 |
+
if (empty($response['err_msg']) && $response['call']==1) {
|
| 166 |
+
$session->addSuccess('License key is valid and active');
|
| 167 |
+
} else {
|
| 168 |
+
$session->addError('License key is not valid');
|
| 169 |
+
throw new Exception("stop");
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
}
|
| 173 |
}
|
| 174 |
?>
|
app/code/community/Fraudagency/Paymentapi/controllers/Adminhtml/PaymentapiController.php
CHANGED
|
File without changes
|
app/code/community/Fraudagency/Paymentapi/etc/adminhtml.xml
CHANGED
|
File without changes
|
app/code/community/Fraudagency/Paymentapi/etc/config.xml
CHANGED
|
File without changes
|
app/code/community/Fraudagency/Paymentapi/etc/system.xml
CHANGED
|
File without changes
|
app/design/adminhtml/default/default/template/paymentapi/system/config/button.phtml
CHANGED
|
File without changes
|
app/etc/modules/Fraudagency_Paymentapi.xml
CHANGED
|
File without changes
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Fraudagency_Paymentapi</name>
|
| 4 |
-
<version>0.3.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -15,11 +15,11 @@ How it works:
|
|
| 15 |
We gather information about the customer before the payment methods are displayed. Then we delivery your Magento-shop a list of payment methods which will be available for the customer.
|
| 16 |

|
| 17 |
Please note that you need a license-key to use our service. Visit our website for more information: https://fraud.agency</description>
|
| 18 |
-
<notes>
|
| 19 |
<authors><author><name>FRAUD.AGENCY</name><user>x15_eu</user><email>info@fraud.agency</email></author></authors>
|
| 20 |
-
<date>2014-
|
| 21 |
-
<time>
|
| 22 |
-
<contents><target name="magecommunity"><dir name="Fraudagency"><dir name="Paymentapi"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="a0e7a4bb70f428e90839712a06ec0cc5"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="a97f541415729338cb3fb591399af67e"/></dir><dir name="Model"><file name="Observer.php" hash="
|
| 23 |
<compatible/>
|
| 24 |
-
<dependencies><required><php><min>5.0.0</min><max>5.
|
| 25 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Fraudagency_Paymentapi</name>
|
| 4 |
+
<version>0.3.7</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
|
| 7 |
<channel>community</channel>
|
| 15 |
We gather information about the customer before the payment methods are displayed. Then we delivery your Magento-shop a list of payment methods which will be available for the customer.
|
| 16 |

|
| 17 |
Please note that you need a license-key to use our service. Visit our website for more information: https://fraud.agency</description>
|
| 18 |
+
<notes>E-Mail simplification.</notes>
|
| 19 |
<authors><author><name>FRAUD.AGENCY</name><user>x15_eu</user><email>info@fraud.agency</email></author></authors>
|
| 20 |
+
<date>2014-09-18</date>
|
| 21 |
+
<time>16:46:45</time>
|
| 22 |
+
<contents><target name="magecommunity"><dir name="Fraudagency"><dir name="Paymentapi"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="a0e7a4bb70f428e90839712a06ec0cc5"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="a97f541415729338cb3fb591399af67e"/></dir><dir name="Model"><file name="Observer.php" hash="f85bf873a9f399b03d0b4a73c55586e2"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="PaymentapiController.php" hash="fac8a7e2bafd68705f0e39493fd9756e"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="79cd9aaf297d5ab176b7bb80df941fdd"/><file name="config.xml" hash="ef9cd943deadb9167a6867afcdc5247e"/><file name="system.xml" hash="08c92615822b047e0997a9e8ee52db16"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Fraudagency_Paymentapi.xml" hash="d5b931b7c46b3f64646f2802015f225f"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="paymentapi"><dir name="system"><dir name="config"><file name="button.phtml" hash="239cb1c998aefad8b1aaf89c15146669"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
| 23 |
<compatible/>
|
| 24 |
+
<dependencies><required><php><min>5.0.0</min><max>5.6.0</max></php></required></dependencies>
|
| 25 |
</package>
|
