FraudShields - Version 1.3.0.0

Version Notes

The first stable release of the FraudShields Extension

Download this release

Release Info

Developer Shaya Krauss
Extension FraudShields
Version 1.3.0.0
Comparing to
See all releases


Code changes from version 1.2.1.0 to 1.3.0.0

app/code/local/FraudShields/Post/Model/Observer.php CHANGED
@@ -1,100 +1,101 @@
1
-
2
- <?php
3
-
4
- class FraudShields_Post_Model_Observer {
5
- public $cardnum;
6
- public $exp;
7
-
8
- public function postSomething1(Varien_Event_Observer $observer) {
9
- $order = $observer->getEvent()->getOrder();
10
- $this->cardnum = $order->getPayment()->getCcNumber();
11
- $this->exp = str_pad($order->getPayment()->getCcExpMonth(),2,'0',STR_PAD_LEFT) . substr($order->getPayment()->getCcExpYear(), -2);
12
- }
13
-
14
- public function postSomething(Varien_Event_Observer $observer) {
15
- $parms=Mage::app()->getFrontController()->getRequest()->getParams();
16
- //Get Payment Detail
17
- extract($parms);
18
- $payment;
19
- $order = $observer->getEvent()->getOrder();
20
- $cardsStorage = Mage::getModel('paygate/authorizenet_cards')->setPayment($order->getPayment());
21
- foreach ($cardsStorage->getCards() as $card) {
22
- $lastTransId = $card->getLastTransId();
23
- }
24
- //Get Shipping Detail
25
- $shipping=array();
26
- $_shippingAddress = $order->getShippingAddress();
27
- $_billingAddress = $order->getBillingAddress();
28
- $items = $order->getAllItems();
29
- $itemcount=count($items);
30
- $name=array();
31
- $unitPrice=array();
32
- $sku=array();
33
- $ids=array();
34
- $qty=array();
35
- foreach ($items as $itemId => $item)
36
- {
37
- $name[] = $item->getName();
38
- $unitPrice[]=$item->getPrice();
39
- $sku[]=$item->getSku();
40
- $ids[]=$item->getProductId();
41
- $qty[]=$item->getQtyToInvoice();
42
- }
43
- $shipping_street = $_shippingAddress->getStreet();
44
- $billing_street = $_billingAddress->getStreet();
45
- $message = Mage::getModel('giftmessage/message');
46
- $gift_message_id = $order->getGiftMessageId();
47
- $message->load((int)$gift_message_id);
48
- $postdata=array(
49
- "order_id" => $order->getIncrementId(),
50
- "customername" => $order->getCustomerName(), // Customer Name
51
- "customeremail" => $order->getCustomerEmail(),// Customer Email
52
- "shippingmethod" => $order->getShippingMethod(), // Shipping Method
53
- "shippingamount" => $order->getShippingAmount(), // ShippingAmount
54
- "grandtotal" => $order->getGrandTotal(), // Grand Total
55
- "domain" => Mage::getBaseUrl(), // Domain nname
56
- "shipping_firstname" => $_shippingAddress->getFirstname(),
57
- "shipping_lastname" => $_shippingAddress->getLastname(),
58
- "shipping_company" => $_shippingAddress->getCompany(),
59
- "shipping_street" => $shipping_street[0],
60
- "shipping_region" => $_shippingAddress->getRegion(),
61
- "shipping_city" => $_shippingAddress->getCity(),
62
- "shipping_postcode" => $_shippingAddress->getPostcode(),
63
- "shipping_telephone" => $_shippingAddress->getTelephone(),
64
- "shipping_country_id" => $_shippingAddress->getCountry(),
65
- "billing_firstname" => $_billingAddress->getFirstname(),
66
- "billing_lastname" => $_billingAddress->getLastname(),
67
- "billing_company" => $_billingAddress->getCompany(),
68
- "billing_street" => $billing_street[0],
69
- "billing_region" => $_billingAddress->getRegion(),
70
- "billing_city" => $_billingAddress->getCity(),
71
- "billing_postcode" => $_billingAddress->getPostcode(),
72
- "billing_telephone" => $_billingAddress->getTelephone(),
73
- "billing_country_id" => $_billingAddress->getCountry(),
74
- "ip" => $_SERVER["REMOTE_ADDR"],
75
- "cardnum" => $this->cardnum,
76
- "exp" => $this->exp,
77
- "key" => "8bfe220e83ec40c5ab7c5f21ca3e8643ItsHot",
78
- "gift_message" => $message->getData('message'),
79
- "version" => "1.2",
80
- "GatewayRefNum" => $lastTransId, // TODO: Add
81
- "GatewayResult" => "", // TODO: Add
82
- "GatewayError" => "", // TODO: Add
83
- "GatewayAVS" => "", // TODO: Add
84
- "GatewayCVV" => "", // TODO: Add
85
- "OrderItems" => "" // TODO: Add
86
- );
87
-
88
- $json = json_encode($postdata);
89
-
90
- // Server url where json data send
91
- $curl = curl_init('https://x1.fidelipay.com/fs');
92
- curl_setopt($curl, CURLOPT_FAILONERROR, true);
93
- curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
94
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
95
- curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
96
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
97
- curl_setopt ($curl, CURLOPT_POSTFIELDS,$json);
98
- $result = curl_exec($curl);
99
- }
 
100
  }
1
+ <?php
2
+
3
+ class FraudShields_Post_Model_Observer extends Mage_Payment_Block_Info {
4
+ public $cardnum;
5
+ public $exp;
6
+
7
+ public function FraudShieldsBefore(Varien_Event_Observer $observer) {
8
+ $order = $observer->getEvent()->getOrder();
9
+ $this->cardnum = $order->getPayment()->getCcNumber();
10
+ $this->exp = str_pad($order->getPayment()->getCcExpMonth(),2,'0',STR_PAD_LEFT) . substr($order->getPayment()->getCcExpYear(), -2);
11
+ }
12
+
13
+ public function FraudShieldsAfter(Varien_Event_Observer $observer) {
14
+ $parms=Mage::app()->getFrontController()->getRequest()->getParams();
15
+ //Get Payment Detail
16
+ extract($parms);
17
+ $payment;
18
+ $order = $observer->getEvent()->getOrder();
19
+ $cardsStorage = Mage::getModel('paygate/authorizenet_cards')->setPayment($order->getPayment());
20
+ foreach ($cardsStorage->getCards() as $card) {
21
+ $lastTransId = $card->getLastTransId();
22
+ }
23
+ //Get Shipping Detail
24
+ $shipping=array();
25
+ $_shippingAddress = $order->getShippingAddress();
26
+ $_billingAddress = $order->getBillingAddress();
27
+ $items = $order->getAllItems();
28
+ $itemcount=count($items);
29
+ $name=array();
30
+ $unitPrice=array();
31
+ $sku=array();
32
+ $ids=array();
33
+ $qty=array();
34
+ $OrderItems = array();
35
+ foreach ($items as $itemId => $item)
36
+ {
37
+ $OrderItems[] = array(
38
+ 'name' => $item->getName(),
39
+ 'unitPrice' => $item->getPrice(),
40
+ 'sku' => $item->getSku(),
41
+ 'qty' => $item->getQtyOrdered()
42
+ );
43
+ }
44
+ $shipping_street = $_shippingAddress->getStreet();
45
+ $billing_street = $_billingAddress->getStreet();
46
+ $message = Mage::getModel('giftmessage/message');
47
+ $gift_message_id = $order->getGiftMessageId();
48
+ $message->load((int)$gift_message_id);
49
+ $postdata=array(
50
+ "order_id" => $order->getIncrementId(),
51
+ "customername" => $order->getCustomerName(), // Customer Name
52
+ "customeremail" => $order->getCustomerEmail(),// Customer Email
53
+ "shippingmethod" => $order->getShippingMethod(), // Shipping Method
54
+ "shippingamount" => $order->getShippingAmount(), // ShippingAmount
55
+ "grandtotal" => $order->getGrandTotal(), // Grand Total
56
+ "domain" => Mage::getBaseUrl(), // Domain nname
57
+ "shipping_firstname" => $_shippingAddress->getFirstname(),
58
+ "shipping_lastname" => $_shippingAddress->getLastname(),
59
+ "shipping_company" => $_shippingAddress->getCompany(),
60
+ "shipping_street" => $shipping_street[0],
61
+ "shipping_region" => $_shippingAddress->getRegion(),
62
+ "shipping_city" => $_shippingAddress->getCity(),
63
+ "shipping_postcode" => $_shippingAddress->getPostcode(),
64
+ "shipping_telephone" => $_shippingAddress->getTelephone(),
65
+ "shipping_country_id" => $_shippingAddress->getCountry(),
66
+ "billing_firstname" => $_billingAddress->getFirstname(),
67
+ "billing_lastname" => $_billingAddress->getLastname(),
68
+ "billing_company" => $_billingAddress->getCompany(),
69
+ "billing_street" => $billing_street[0],
70
+ "billing_region" => $_billingAddress->getRegion(),
71
+ "billing_city" => $_billingAddress->getCity(),
72
+ "billing_postcode" => $_billingAddress->getPostcode(),
73
+ "billing_telephone" => $_billingAddress->getTelephone(),
74
+ "billing_country_id" => $_billingAddress->getCountry(),
75
+ "ip" => $_SERVER["REMOTE_ADDR"],
76
+ "cardnum" => $this->cardnum,
77
+ "exp" => $this->exp,
78
+ "key" => Mage::getStoreConfig('tab1/general/text_field'),
79
+ "gift_message" => $message->getData('message'),
80
+ "version" => (string) Mage::getConfig()->getNode()->modules->FraudShields_Post->version,
81
+ "GatewayRefNum" => $lastTransId,
82
+ "GatewayResult" => "", // TODO: Add
83
+ "GatewayError" => "", // TODO: Add
84
+ "GatewayAVS" => "", // TODO: Add
85
+ "GatewayCVV" => "", // TODO: Add
86
+ "OrderItems" => $OrderItems // TODO: Add
87
+ );
88
+
89
+ $json = json_encode($postdata);
90
+
91
+ // Server url where json data send
92
+ $curl = curl_init('https://x1.fidelipay.com/fs');
93
+ curl_setopt($curl, CURLOPT_FAILONERROR, true);
94
+ curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
95
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
96
+ curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
97
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
98
+ curl_setopt ($curl, CURLOPT_POSTFIELDS,$json);
99
+ $result = curl_exec($curl);
100
+ }
101
  }
app/code/local/FraudShields/Post/etc/adminhtml.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <tab1>
12
+ <title>FraudShields Config</title> <!-- Used in resources tree -->
13
+ </tab1>
14
+ </children>
15
+ </config>
16
+ </children>
17
+ </system>
18
+ </children>
19
+ </admin>
20
+ </resources>
21
+ </acl>
22
+ </config>
app/code/local/FraudShields/Post/etc/config.xml CHANGED
@@ -1,30 +1,35 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <FraudShields_Post>
5
- <version>1.0.1</version>
6
- </FraudShields_Post>
7
- </modules>
8
- <global>
9
- <events>
10
- <sales_order_place_before>
11
- <observers>
12
- <fraudshields_post_model_observer>
13
- <type>singleton</type>
14
- <class>FraudShields_Post_Model_Observer</class>
15
- <method>postSomething1</method>
16
- </fraudshields_post_model_observer>
17
- </observers>
18
- </sales_order_place_before>
19
- <sales_order_place_after>
20
- <observers>
21
- <fraudshields_post_model_observer>
22
- <type>singleton</type>
23
- <class>FraudShields_Post_Model_Observer</class>
24
- <method>postSomething</method>
25
- </fraudshields_post_model_observer>
26
- </observers>
27
- </sales_order_place_after>
28
- </events>
29
- </global>
 
 
 
 
 
30
  </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <FraudShields_Post>
5
+ <version>1.3.0.0</version>
6
+ </FraudShields_Post>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <fraudshields_post>
11
+ <class>FraudShields_Post_Model</class>
12
+ </fraudshields_post>
13
+ </models>
14
+ <events>
15
+ <sales_order_place_before>
16
+ <observers>
17
+ <fraudshields_post>
18
+ <class>fraudshields_post/observer</class>
19
+ <method>FraudShieldsBefore</method>
20
+ <type>singleton</type>
21
+ </fraudshields_post>
22
+ </observers>
23
+ </sales_order_place_before>
24
+ <sales_order_place_after>
25
+ <observers>
26
+ <fraudshields_post>
27
+ <class>fraudshields_post/observer</class>
28
+ <method>FraudShieldsAfter</method>
29
+ <type>singleton</type>
30
+ </fraudshields_post>
31
+ </observers>
32
+ </sales_order_place_after>
33
+ </events>
34
+ </global>
35
  </config>
app/code/local/FraudShields/Post/etc/system.xml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <tab1 translate="label" module="adminhtml">
5
+ <label>FraudShields Configuration</label>
6
+ <tab>sales</tab>
7
+ <sort_order>1000</sort_order>
8
+ <show_in_default>1</show_in_default>
9
+ <show_in_website>1</show_in_website>
10
+ <show_in_store>1</show_in_store>
11
+ <groups>
12
+ <general translate="label comment">
13
+ <label>General</label>
14
+ <sort_order>50</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <expanded>1</expanded>
19
+ <fields>
20
+ <text_field translate="label comment">
21
+ <label>FraudShields Key</label>
22
+ <comment>Your Personal FraudShields Key Here</comment>
23
+ <frontend_type>password</frontend_type>
24
+ <sort_order>10</sort_order>
25
+ <show_in_default>1</show_in_default>
26
+ <show_in_website>1</show_in_website>
27
+ <show_in_store>1</show_in_store>
28
+ </text_field>
29
+ </fields>
30
+ </general>
31
+ </groups>
32
+ </tab1>
33
+ </sections>
34
+ </config>
app/etc/modules/FraudShields_Post.xml CHANGED
@@ -1,10 +1,9 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <FraudShields_Post>
5
- <codePool>local</codePool>
6
- <active>true</active>
7
- </FraudShields_Post>
8
- </modules>
9
- </config>
10
-
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <FraudShields_Post>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </FraudShields_Post>
8
+ </modules>
9
+ </config>
 
package.xml CHANGED
@@ -1,18 +1,20 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>FraudShields</name>
4
- <version>1.2.1.0</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>FraudShields Extension</summary>
10
- <description>This is the description for the FraudShields Extension</description>
11
- <notes>No Notes</notes>
 
 
12
  <authors><author><name>Shaya Krauss</name><user>fpswebmaster</user><email>webmaster@fidelitypayment.com</email></author></authors>
13
- <date>2013-12-05</date>
14
- <time>21:02:03</time>
15
- <contents><target name="magelocal"><dir name="FraudShields"><dir name="Post"><dir name="Model"><file name="Observer.php" hash="cd4cde9fd2dfe5ca2cb81403a95afc94"/></dir><dir name="etc"><file name="config.xml" hash="c7a9f8c4dcc90e66ece35758f26087e1"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="FraudShields_Post.xml" hash="72319e4ae2fa32e50b34401ad68c68fc"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>FraudShields</name>
4
+ <version>1.3.0.0</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>FraudShields Online Fraud Protection Extension</summary>
10
+ <description>This is the official FraudShields Magento Extension.&#xD;
11
+ &#xD;
12
+ For more info visit http://fraudshields.com/</description>
13
+ <notes>The first stable release of the FraudShields Extension</notes>
14
  <authors><author><name>Shaya Krauss</name><user>fpswebmaster</user><email>webmaster@fidelitypayment.com</email></author></authors>
15
+ <date>2013-12-27</date>
16
+ <time>17:32:50</time>
17
+ <contents><target name="magelocal"><dir name="FraudShields"><dir name="Post"><dir name="Model"><file name="Observer.php" hash="2c38d8a777f40e90680118da25fcf08d"/></dir><dir name="etc"><file name="config.xml" hash="d437c91c58849dc592ec512de60efb40"/><file name="adminhtml.xml" hash="d677b49801a1a685a51c9d72f1466143"/><file name="system.xml" hash="5377821d52d403032a31a690bbe0f8af"/></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="FraudShields_Post.xml" hash="ce04ec50e7e1ad4ebbcbec6180c9f925"/></dir></dir></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>