magento_safepay - Version 0.1.3

Version Notes

This is our first version. We will have updates when needed

Download this release

Release Info

Developer SafePay Network
Extension magento_safepay
Version 0.1.3
Comparing to
See all releases


Version 0.1.3

Files changed (35) hide show
  1. app/code/local/Safepaynetwork/Safepay/Block/Form/Creditcard.php +55 -0
  2. app/code/local/Safepaynetwork/Safepay/Block/Form/payment_form.php +83 -0
  3. app/code/local/Safepaynetwork/Safepay/Block/Onepage/Button.php +64 -0
  4. app/code/local/Safepaynetwork/Safepay/Block/Onepage/safepayproxy.php +219 -0
  5. app/code/local/Safepaynetwork/Safepay/Model/Adminhtml/System/Source/Timeout.php +23 -0
  6. app/code/local/Safepaynetwork/Safepay/Model/Method/Creditcard.php +9 -0
  7. app/code/local/Safepaynetwork/Safepay/controllers/IndexController.php +10 -0
  8. app/code/local/Safepaynetwork/Safepay/etc/config.xml +50 -0
  9. app/code/local/Safepaynetwork/Safepay/etc/system.xml +62 -0
  10. app/design/frontend/base/default/layout/safepay.xml +41 -0
  11. app/design/frontend/base/default/template/safepay/button.phtml +20 -0
  12. app/design/frontend/base/default/template/safepay/form/creditcard.phtml +1 -0
  13. app/design/frontend/base/default/template/safepay/info.phtml +84 -0
  14. app/design/frontend/base/default/template/safepay/js/safepay.js +0 -0
  15. app/design/frontend/base/default/template/safepay/onepage.phtml +77 -0
  16. app/design/frontend/base/default/template/safepay/payment.phtml +75 -0
  17. app/design/frontend/base/default/template/safepay/success.phtml +51 -0
  18. app/etc/modules/Safepaynetwork_Safepay.xml +12 -0
  19. package.xml +22 -0
  20. skin/frontend/base/default/css/safepay.css +346 -0
  21. skin/frontend/base/default/images/safepay/banner.jpg +0 -0
  22. skin/frontend/base/default/images/safepay/btn_window_close.gif +0 -0
  23. skin/frontend/base/default/images/safepay/confirm.jpg +0 -0
  24. skin/frontend/base/default/images/safepay/denied.jpg +0 -0
  25. skin/frontend/base/default/images/safepay/guide.gif +0 -0
  26. skin/frontend/base/default/images/safepay/loading-message.png +0 -0
  27. skin/frontend/base/default/images/safepay/overlay.png +0 -0
  28. skin/frontend/base/default/images/safepay/preloader.gif +0 -0
  29. skin/frontend/base/default/images/safepay/restart.png +0 -0
  30. skin/frontend/base/default/images/safepay/safepay-logo.jpg +0 -0
  31. skin/frontend/base/default/images/safepay/safepay.gif +0 -0
  32. skin/frontend/base/default/images/safepay/safepay.jpg +0 -0
  33. skin/frontend/base/default/images/safepay/sp-banner.jpg +0 -0
  34. skin/frontend/base/default/images/safepay/terminate.png +0 -0
  35. skin/frontend/base/default/images/safepay/timeout.jpg +0 -0
app/code/local/Safepaynetwork/Safepay/Block/Form/Creditcard.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Safepaynetwork_Safepay_Block_Form_Creditcard extends Mage_Payment_Block_Form
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->setTemplate('safepay/form/creditcard.phtml');
8
+ }
9
+ protected function getCreditCardForm()
10
+ {
11
+ $safepay_args = array(
12
+ 'cardTypes' => array(
13
+ 'VISA' => 'VISA',
14
+ 'AMEX' => 'AMEX',
15
+ 'MasterCard' => 'MasterCard',
16
+ 'Discover' => 'Discover',
17
+ 'SM' => 'Switch/Maestro', // Switch/Maestro
18
+ 'SO' => 'SOLO', // SOLO
19
+ 'DINERS' =>'DINERS CLUB'
20
+ ),
21
+ 'dates' => array(
22
+ '1' => '01 - January',
23
+ '2' => '02 - February',
24
+ '3' => '03 - March',
25
+ '4' => '04 - April',
26
+ '5' => '05 - May',
27
+ '6' => '06 - June',
28
+ '7' => '07 - July',
29
+ '8' => '08 - August',
30
+ '9' => '09 - September',
31
+ '10' => '10 - October',
32
+ '11' => '11 - November',
33
+ '12' => '12 - December'
34
+ ),
35
+ 'years' => array(
36
+ '2014' =>'2014',
37
+ '2015' =>'2015',
38
+ '2016' =>'2016',
39
+ '2017' =>'2017',
40
+ '2018' =>'2018',
41
+ '2019' =>'2019',
42
+ '2020' =>'2020',
43
+ '2021' =>'2021',
44
+ '2022' =>'2022',
45
+ '2023' =>'2023'
46
+ )
47
+ );
48
+ $_code = 'safepaynetwork_creditcard';
49
+ ob_start();
50
+ require_once(dirname(__FILE__).'/payment_form.php');
51
+ $form = ob_get_contents();
52
+ ob_end_clean();
53
+ return $form;
54
+ }
55
+ }
app/code/local/Safepaynetwork/Safepay/Block/Form/payment_form.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="payment_form_<?php echo $_code ?>" style="display:none;">
2
+ <div id="safepay-wrapper">
3
+ <div id="sp-form">
4
+ <div class="left-safepay">
5
+ <a target="_blank" href="https://www.usesafepay.com"><img style="margin: 0px 10px 5px 0px;" alt="SafePay payment" src="<?php echo $this->getSkinUrl('images/safepay/'); ?>safepay.jpg"/></a>
6
+ </div>
7
+ <div class="right-safepay">
8
+ <table>
9
+ <tbody><tr>
10
+ <td><label for="nameoncard" class="label">Name On Card <em>*</em> </label>
11
+ <br />
12
+ <input type="text" value="" name="payment[nameoncard]" id="nameoncard" class="text ajax-field input-text required-entry" />
13
+ </td>
14
+ </tr><tr>
15
+ <td>
16
+ <label for="creditcardtype" class="label">Credit Card Type <em>*</em></label><br />
17
+ <select name="payment[creditcardtype]" id="creditcardtype" class="select ajax-field">
18
+ <?php foreach($safepay_args['cardTypes'] as $k => $v) : ?>
19
+ <option value="<?php echo $k ?>"> <?php echo $v ?></option>
20
+ <?php endforeach; ?>
21
+ </select>
22
+ </td>
23
+ </tr>
24
+ <tr>
25
+ <td><label for="creditcardnumber" class="label">Credit Card Number <em>*</em></label><br/>
26
+ <input type="text" value="" name="payment[creditcardnumber]" id="creditcardnumber" class="text ajax-field required-entry input-text validate-cc-number validate-cc-type"/></td>
27
+ </tr>
28
+ <tr>
29
+ <td>
30
+ <label style="width: 100%; display: inline-block; text-align: left;" for="expirationdate" class="label">Expiration date <em>*</em></label><br/>
31
+ <div class="safepay_select_wrapper" style="width: 175px;">
32
+ <select style="width: 165px;" name="payment[expirationdate]" id="expirationdate" class="select50 ajax-field required-entry">
33
+ <option value="">Month</option>
34
+ <?php foreach($safepay_args['dates'] as $k => $v) : ?>
35
+ <option value="<?php echo $k ?>"> <?php echo $v ?></option>
36
+ <?php endforeach; ?>
37
+ </select>
38
+ </div>
39
+ <div class="safepay_select_wrapper" style="150px;">
40
+ <select style="width: 80px;" name="payment[exy]" id="exy" class="select50 ajax-field required-entry">
41
+ <option value="">Year</option>
42
+ <?php foreach($safepay_args['years'] as $k => $v) : ?>
43
+ <option value="<?php echo $k ?>"> <?php echo $v ?></option>
44
+ <?php endforeach; ?>
45
+ </select>
46
+ </div>
47
+ </td>
48
+ </tr>
49
+ <tr>
50
+ <td>
51
+ <label for="verification" class="label">Card Verification Number<em>*</em></label><br/>
52
+ <input type="text" value="" name="payment[verification]" id="verification" class="text ajax-field input-text cvv required-entry validate-cc-cvn" style="width: 40px;"/> <span id="wit" class="cvv-what-is-this" style="margin-left: 5px; color: #1E7EC8;text-decoration: underline;">What is this?</span>
53
+ </td>
54
+ </tr>
55
+ </tbody></table>
56
+ </div>
57
+ <div id="sp-guide">
58
+ <div class="sp-guide-inner">
59
+ <table>
60
+ <tbody><tr>
61
+ <td>
62
+ <span class="sp-container">
63
+ <span class="sp-close"><img alt="Close" src="<?php echo $this->getSkinUrl('images/safepay/'); ?>btn_window_close.gif"></span>
64
+ <img alt="Safe Pay" src="<?php echo $this->getSkinUrl('images/safepay/'); ?>guide.gif"/>
65
+ </span>
66
+ </td>
67
+ </tr>
68
+ </tbody></table>
69
+ </div>
70
+ </div>
71
+ </div>
72
+
73
+ </div>
74
+
75
+ <div id="sp-temp-load">
76
+ <div id="sp-loading">
77
+ <div id="sp-loading-inner">
78
+ <img src="<?php echo $this->getSkinUrl('images/safepay/'); ?>loading-message.png" class="loading-message" />
79
+ <img src="<?php echo $this->getSkinUrl('images/safepay/'); ?>preloader.gif" class="reloader" />
80
+ </div>
81
+ </div>
82
+ </div>
83
+ </div>
app/code/local/Safepaynetwork/Safepay/Block/Onepage/Button.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Button.php
4
+ *
5
+ */
6
+ class Safepaynetwork_Safepay_Block_Onepage_Button extends Mage_Checkout_Block_Onepage_Review_Info
7
+ {
8
+ protected $safePayStatus = 'ERROR';
9
+ protected function _construct()
10
+ {
11
+ if($this->getQuote()->getPayment()->getMethod()=='safepaynetwork_creditcard')
12
+ {
13
+ $creditCardNumber = $this->getQuote()->getPayment()->getCreditcardnumber();
14
+ $creditCardFirstSix = substr($creditCardNumber, 0, 6);
15
+ $creditCardLastSix = substr($creditCardNumber, strlen($creditCardNumber)-6, 6);
16
+ $creditCardType = $this->getQuote()->getPayment()->getCreditcardtype();
17
+
18
+ $safePayRequest = array(
19
+ 'amount' => trim($this->getQuote()->getGrandTotal()),
20
+ 'billingcity' => trim($this->getQuote()->getBillingAddress()->getCity()),
21
+ 'billingcountry' => trim($this->getQuote()->getBillingAddress()->getCountry()),
22
+ 'billingaddress1' => trim($this->getQuote()->getBillingAddress()->getStreetFull()),
23
+ 'billingaddress2' => '',
24
+ 'billingpostal' => trim($this->getQuote()->getBillingAddress()->getPostcode()),
25
+ 'billingfirstname' => trim($this->getQuote()->getBillingAddress()->getFirstname()),
26
+ 'billinglastname' => trim($this->getQuote()->getBillingAddress()->getLastname()),
27
+ 'creditcardfirstsix' => trim($creditCardFirstSix),
28
+ 'creditcardlastsix' => trim($creditCardLastSix),
29
+ 'creditcardtype' => trim($creditCardType),
30
+ 'customeremail' => trim($this->getQuote()->getCustomerEmail()),
31
+ 'merchanttransactionid' => time() . trim($this->getQuote()->getId())
32
+ );
33
+
34
+ $auth = array(
35
+ 'login' => trim(Mage::getStoreConfig('payment/safepaynetwork_creditcard/username')),
36
+ 'password' => Mage::getStoreConfig('payment/safepaynetwork_creditcard/password')
37
+ );
38
+
39
+ $proxy = new SafePayProxy();
40
+ $proxy->init($auth);
41
+ $safepayResponse = $proxy->authorize_trans($safePayRequest);
42
+
43
+ //$safepayResponse = 'TIMEDOUT';
44
+
45
+ $timeoutAction = Mage::getStoreConfig('payment/safepaynetwork_creditcard/timeout_action');
46
+ $threadhold = Mage::getStoreConfig('payment/safepaynetwork_creditcard/threshold');
47
+
48
+ if( $safepayResponse == 'TIMEDOUT' && ($timeoutAction=='allow' || $timeoutAction=='threshold' && (float)$this->getQuote()->getGrandTotal() <= (float)$threadhold))
49
+ {
50
+ return;
51
+ }
52
+
53
+ $this->safePayStatus = $safepayResponse;
54
+
55
+ }
56
+ else
57
+ return;
58
+ }
59
+ public function getQuote()
60
+ {
61
+ return Mage::getSingleton('checkout/session')->getQuote();
62
+ }
63
+ }
64
+ require_once(dirname(__FILE__).'/safepayproxy.php');
app/code/local/Safepaynetwork/Safepay/Block/Onepage/safepayproxy.php ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*-----------------------------------------------------------------------------
3
+ * Safe Pay Merchant API Proxy Class
4
+ * Author: Tommy Adeniyi
5
+ * Company: BHS-Consultants
6
+ * Date: January 2012
7
+ *
8
+ * Class handles communication with Merchant API and returns response
9
+ **USAGE:
10
+ $proxy = new SafePayProxy;
11
+ $proxy->init(array("login"=>"paul@yopstore.com","password"=>"paul"));
12
+ $proxy->authorize_trans(array( "amount" => 150,
13
+ "baddress" => 1,
14
+ "bpostal" => "12345",
15
+ "bcountry" => "CA",
16
+ "bip" => "196.156.2.3",
17
+ "cid" => "a@a.com",
18
+ "bfirstname" => "Andres",
19
+ "blastname" => "Lara",
20
+ "details" => "MJ's Nose",
21
+ "mtransactionid"=> "7778p88dmjnsssmjbbnk",
22
+ "cfirstsix" => "123456",
23
+ "clastsix" => "098765",
24
+ "cname" => "Andres Lara",
25
+ "ctype" => "VISA"));
26
+
27
+ * athentication returns 'PROCEED','CEASE' and "TIMEDOUT'
28
+ * error codes are also returned if validation fails
29
+ * see below for complete list of error codes
30
+ 400 :Precondition Failed
31
+ 400 :Invalid Request : text validation failed (More details in the error message)
32
+ 400.0 :Invalid card
33
+ 400.1 :Invalid card type
34
+ 400.2 :Invalid device
35
+ 400.3 :Invalid language
36
+ 400.4 :Invalid country
37
+ 400.5 :Invalid Handshake code
38
+ 400.6 :Invalid token
39
+ 400.7 :Invalid filter
40
+ 403 : Forbidden
41
+ 403.0 :Wrong credentials
42
+ 403.1 :Wrong auth code
43
+ 403.2 :Wrong handshake code
44
+ 403.3 :Wrong token
45
+ 403.4 :Not the owner
46
+ 404 :Not found
47
+ 404.0 :Merchant not found
48
+ 404.1 :Consumer not found
49
+ 404.2 :User not found
50
+ 404.3 :Card not found
51
+ 404.4 :Device not found
52
+ 404.5 :Transaction not found
53
+ 412.0 :Card has been disabled
54
+ 412 :Precondition failed
55
+ 412.1 :Card has been deleted
56
+ 412.2 :Card limit for a consumer has been reached
57
+ 412.3 :Device is not ready
58
+ 412.4 :Device has already been handshaked
59
+ 412.5 :The user profile has already been validated
60
+ 412.6 :This transaction has already been web-authenticated
61
+ 412.7 :This transaction cannot be web-authenticated
62
+ 412.8 :Transaction does not satisfy the prerequisites to be processed.
63
+ 412.9 :The given resource already exists.
64
+ 500 :Internal Server error
65
+ 500 :Internal Server Error
66
+ *------------------------------------------------------------------------------
67
+ *
68
+ */
69
+
70
+ error_reporting(E_ALL);
71
+ ini_set('display_errors', 'off');
72
+ set_time_limit(120);
73
+
74
+ class SafePayProxy{
75
+
76
+ // Class Properties
77
+ var $merchantLogin;
78
+ var $merchantPassword;
79
+ var $authrequestURL;
80
+ var $authtokenrequestURL;
81
+ var $curl;
82
+ var $transactionData;
83
+ var $transactionId;
84
+ var $insertId;
85
+ var $curlPostData;
86
+ var $curl_response;
87
+
88
+ function SafePayProxy(){
89
+
90
+
91
+ }
92
+
93
+ function init($creds){
94
+
95
+ $this->merchantLogin = $creds['login'];
96
+ $this->merchantPassword = $creds['password'];
97
+ $this->authrequestURL = "https://api.usesafepay.com/v1/merchants/".$this->merchantLogin."/transactions/request";
98
+
99
+ }
100
+
101
+ function authorize_trans($transData){
102
+
103
+ $this->transactionData = $transData;
104
+ $address1=$transData["billingaddress1"];
105
+ $address1=str_replace("#","Unit ",$address1);
106
+ $address2=$transData["billingaddress2"];
107
+ $address2=str_replace("#","Unit ",$address2);
108
+
109
+ $address=trim($address1).", ".trim($address2).", ".trim($transData["billingcity"]).", ".trim($transData["billingcountry"]).". ".trim($transData["billingpostal"]);
110
+
111
+ $url = file_get_contents('http://maps.googleapis.com/maps/api/geocode/xml?address='.urlencode($address).'&sensor=true');
112
+ if($url===false){return 'ERROR';}
113
+ $xml = simplexml_load_string($url);
114
+ $tracks = $xml->result;
115
+ $streetname="";
116
+ $streetnumber="";
117
+ $suitenumber="";
118
+ foreach($tracks as $key) {
119
+ foreach($key->address_component as $val) {
120
+ if ($val->type == "subpremise") {
121
+ $suitenumber = $val->long_name;
122
+ }
123
+ if ($val->type == "street_number") {
124
+ $streetnumber = $val->long_name;
125
+ }
126
+ if ($val->type == "route") {
127
+ $streetname = $val->long_name;
128
+ }
129
+ }
130
+ }
131
+
132
+ //Generate XML output from object properties
133
+ $this->curlPostData ="<?xml version='1.0'?>";
134
+ $this->curlPostData .="<transactionCreate>";
135
+ $this->curlPostData .="<amount>".$transData["amount"]."</amount>";
136
+ $this->curlPostData .="<billingCity>".$transData["billingcity"]."</billingCity>";
137
+ $this->curlPostData .="<billingCountry>".$transData["billingcountry"]."</billingCountry>";
138
+ $this->curlPostData .="<billingPostalCode>".$transData["billingpostal"]."</billingPostalCode>";
139
+
140
+ $this->curlPostData .="<billingStreetName>".$streetname."</billingStreetName>";
141
+ $this->curlPostData .="<billingStreetNumber>".$streetnumber."</billingStreetNumber>";
142
+ $this->curlPostData .="<billingSuiteNumber>".$suitenumber."</billingSuiteNumber>";
143
+
144
+ $this->curlPostData .="<buyerFirstName>".$transData["billingfirstname"]."</buyerFirstName>";
145
+ $this->curlPostData .="<buyerLastName>".$transData["billinglastname"]."</buyerLastName>";
146
+
147
+ $this->curlPostData .="<card>";
148
+ $this->curlPostData .="<firstSixDigits>".$transData["creditcardfirstsix"]."</firstSixDigits>";
149
+ $this->curlPostData .="<lastSixDigits>".$transData["creditcardlastsix"]."</lastSixDigits>";
150
+ $this->curlPostData .="<type>".$transData["creditcardtype"]."</type>";
151
+ $this->curlPostData .="</card>";
152
+
153
+ $this->curlPostData .="<consumerEmail>".$transData["customeremail"]."</consumerEmail>";
154
+ $this->curlPostData .="<merchantTransactionId>".$transData["merchanttransactionid"]."</merchantTransactionId>";
155
+ $this->curlPostData .="</transactionCreate>";
156
+ // Write XML string to a temp file
157
+ // Neccessary for CURLOPT_PUT, CURLOPT_INFILE and CURLOPT_INFILESIZE
158
+ $putData = tmpfile();
159
+ fwrite($putData, $this->curlPostData);
160
+ fseek($putData, 0);
161
+ // CURL request
162
+ $this->curl = curl_init($this->authrequestURL);
163
+ curl_setopt($this->curl, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));
164
+ curl_setopt($this->curl, CURLOPT_CONNECTTIMEOUT, 120);
165
+ curl_setopt($this->curl, CURLOPT_TIMEOUT, 120);
166
+ curl_setopt($this->curl, CURLOPT_USERPWD, $this->merchantLogin . ":" . $this->merchantPassword);
167
+ curl_setopt($this->curl, CURLOPT_RETURNTRANSFER,true);
168
+ curl_setopt($this->curl, CURLOPT_PUT, true);
169
+ curl_setopt($this->curl, CURLOPT_INFILE, $putData);
170
+ curl_setopt($this->curl, CURLOPT_INFILESIZE, strlen($this->curlPostData));
171
+ // Execute CURL request
172
+ $this->curl_response = curl_exec($this->curl);
173
+ //die($this->curl);
174
+ // Check for CURL error.. if so send an error response
175
+ if(curl_errno($this->curl))
176
+ {
177
+ return curl_error($this->curl);
178
+ }
179
+ curl_close($this->curl);
180
+ return $this->handle_curl_response();
181
+
182
+ }
183
+
184
+ function handle_curl_response(){
185
+ //print_r($this->curl_response);
186
+ // No errors so far.. create a simplexml object from response
187
+ libxml_use_internal_errors(true);
188
+ if(@simplexml_load_string($this->curl_response)){
189
+ $xml = simplexml_load_string($this->curl_response);
190
+ }else{
191
+ return 'ERROR';
192
+ }
193
+ //print_r ($xml);
194
+ // Note: xml returned could contain a status node or a code and message node
195
+ // If there is a status node....
196
+ if($xml->status){
197
+ $trans_response = $xml->status; //PROCEED , CEASE OR TIMEDOUT
198
+ $transactionId = $xml->transactionId;
199
+ return $trans_response;
200
+ }else{
201
+ // Else there is a code and message node
202
+ // Safepay Validation Errors
203
+ $code = $xml->code;
204
+ $message = $xml->message;
205
+ if($code==404.1){ // Consumer not found
206
+ return 'PROCEED';
207
+ }else if($code==404.2){ // User not found
208
+ return 'PROCEED';
209
+ }else{ // Info Sent for Auth is not accurate with Safepay
210
+ //codes 400.0-400.7,403.0-403.4, 404.0-404.5, 412.0-412.9,500
211
+ return $code;
212
+ //print_r ($safepay_response);
213
+ //return 'ERROR';
214
+ }
215
+ }
216
+
217
+ }
218
+ }
219
+ ?>
app/code/local/Safepaynetwork/Safepay/Model/Adminhtml/System/Source/Timeout.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Safepaynetwork_Safepay_Model_Adminhtml_System_Source_Timeout
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return
8
+ array(
9
+ array(
10
+ 'value' => 'allow',
11
+ 'label' => 'Allow Timeouts To Proceed',
12
+ ),
13
+ array(
14
+ 'value' => 'stop',
15
+ 'label' => 'Force Safepay Validation',
16
+ ),
17
+ array(
18
+ 'value' => 'threshold',
19
+ 'label' => 'Proceed Below Threshold Value',
20
+ ),
21
+ );
22
+ }
23
+ }
app/code/local/Safepaynetwork/Safepay/Model/Method/Creditcard.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Safepaynetwork_Safepay_Model_Method_Creditcard extends Mage_Payment_Model_Method_Abstract {
3
+ protected $_code = 'safepaynetwork_creditcard';
4
+
5
+ protected $_isInitializeNeeded = true;
6
+ protected $_canUseInternal = true;
7
+ protected $_canUseForMultishipping = false;
8
+ protected $_formBlockType = 'safepay/form_creditcard';
9
+ }
app/code/local/Safepaynetwork/Safepay/controllers/IndexController.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Safepaynetwork_Safepay_IndexController extends Mage_Core_Controller_Front_Action {
3
+
4
+ public function indexAction() {
5
+
6
+ $this->loadLayout();
7
+ $this->renderLayout();
8
+
9
+ }
10
+ }
app/code/local/Safepaynetwork/Safepay/etc/config.xml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <modules>
3
+ <Safepaynetwork_Safepay>
4
+ <version>0.1.0</version>
5
+ </Safepaynetwork_Safepay>
6
+ </modules>
7
+ <global>
8
+ <models>
9
+ <safepay>
10
+ <class>Safepaynetwork_Safepay_Model</class>
11
+ </safepay>
12
+ <safepay_adminhtml>
13
+ <class>Safepaynetwork_Safepay_Adminhtml_Model</class>
14
+ </safepay_adminhtml>
15
+ </models>
16
+ <blocks>
17
+ <safepay>
18
+ <class>Safepaynetwork_Safepay_Block</class>
19
+ </safepay>
20
+ </blocks>
21
+ </global>
22
+ <frontend>
23
+ <layout>
24
+ <updates>
25
+ <safepay>
26
+ <file>safepay.xml</file>
27
+ </safepay>
28
+ </updates>
29
+ </layout>
30
+ </frontend>
31
+ <default>
32
+ <payment>
33
+ <safepaynetwork_creditcard>
34
+ <active>1</active>
35
+
36
+ <order_status>pending</order_status>
37
+
38
+ <model>safepay/method_creditcard</model>
39
+
40
+ <title>Credit card</title>
41
+
42
+ <payment_action>sale</payment_action>
43
+
44
+ <allowspecific>0</allowspecific>
45
+
46
+ <sort_order>1</sort_order>
47
+ </safepaynetwork_creditcard>
48
+ </payment>
49
+ </default>
50
+ </config>
app/code/local/Safepaynetwork/Safepay/etc/system.xml ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <safepaynetwork_creditcard translate="label">
7
+ <label>Safepay Network</label>
8
+ <sort_order>690</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>0</show_in_store>
12
+ <fields>
13
+ <active translate="label">
14
+ <label>Enabled</label>
15
+ <frontend_type>select</frontend_type>
16
+ <source_model>adminhtml/system_config_source_yesno</source_model>
17
+ <sort_order>1</sort_order>
18
+ <show_in_default>1</show_in_default>
19
+ <show_in_website>1</show_in_website>
20
+ <show_in_store>0</show_in_store>
21
+ </active>
22
+ <username translate="comment">
23
+ <label>Username</label>
24
+ <frontend_type>text</frontend_type>
25
+ <sort_order>20</sort_order>
26
+ <show_in_default>1</show_in_default>
27
+ <show_in_website>1</show_in_website>
28
+ <show_in_store>1</show_in_store>
29
+ </username>
30
+ <password translate="comment">
31
+ <label>Password</label>
32
+ <frontend_type>password</frontend_type>
33
+ <sort_order>30</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ <comment></comment>
38
+ </password>
39
+ <timeout_action translate="comment">
40
+ <label>Timeout Action</label>
41
+ <frontend_type>select</frontend_type>
42
+ <sort_order>40</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ <source_model>safepay/adminhtml_system_source_timeout</source_model>
47
+ </timeout_action>
48
+ <threshold translate="comment">
49
+ <label>Threshold</label>
50
+ <frontend_type>text</frontend_type>
51
+ <sort_order>50</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ <comment>Cart value below this threshold will be allowed to proceed (if we select the Threshold timeout action)</comment>
56
+ </threshold>
57
+ </fields>
58
+ </safepaynetwork_creditcard>
59
+ </groups>
60
+ </payment>
61
+ </sections>
62
+ </config>
app/design/frontend/base/default/layout/safepay.xml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <checkout_onepage_index translate="label">
4
+ <reference name="head">
5
+ <action method="addJs"><script>safepay/js/safepay.js</script></action>
6
+ <action method="addCss">
7
+ <name>css/safepay.css</name>
8
+ <params>media="all"</params>
9
+ </action>
10
+ </reference>
11
+
12
+ <label>One Page Checkout</label>
13
+
14
+ <reference name="checkout.onepage">
15
+ <action method="setTemplate"><template>safepay/onepage.phtml</template></action>
16
+ </reference>
17
+
18
+ <reference name="checkout.onepage.payment">
19
+ <action method="setTemplate"><template>safepay/payment.phtml</template></action>
20
+ </reference>
21
+ </checkout_onepage_index>
22
+
23
+ <checkout_onepage_success translate="label">
24
+ <reference name="head">
25
+ <action method="addCss">
26
+ <name>css/safepay.css</name>
27
+ <params>media="all"</params>
28
+ </action>
29
+ </reference>
30
+ <reference name="content">
31
+ <action method="unsetChildren"></action>
32
+ <block type="checkout/onepage_success" name="checkout.success" template="safepay/success.phtml"/>
33
+ </reference>
34
+ </checkout_onepage_success>
35
+
36
+ <checkout_onepage_review translate="label">
37
+ <reference name="root">
38
+ <block type="safepay/onepage_button" name="onepage.button" as="button" template="safepay/button.phtml"/>
39
+ </reference>
40
+ </checkout_onepage_review>
41
+ </layout>
app/design/frontend/base/default/template/safepay/button.phtml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if($this->safePayStatus=='PROCEED'): ?>
2
+ <img class="sp_icon" alt="safepay" src="<?php echo $this->getSkinUrl('images/safepay/'); ?>confirm.jpg"/>
3
+ <button type="submit" title="<?php echo $this->__('Place Order') ?>" class="sp_checkout_btn button btn-checkout" onclick="review.save();"><span><span><?php echo $this->__('Place Order') ?></span></span></button>
4
+ <?php elseif($this->safePayStatus=='TIMEDOUT'): ?>
5
+ <img style="width: 300px;" class="sp_icon" alt="safepay" src="<?php echo $this->getSkinUrl('images/safepay/'); ?>timeout.jpg"/>
6
+ <button type="submit" title="<?php echo $this->__('Restart') ?>" class="restart_btn sp_checkout_btn" onclick="$$('#opc-payment .step-title')[0].click(); submitPaymentSP();"><span><span><?php echo $this->__('Place Order') ?></span></span></button>
7
+ <?php elseif($this->safePayStatus=='CEASE'): ?>
8
+ <img class="sp_icon" alt="safepay" src="<?php echo $this->getSkinUrl('images/safepay/'); ?>denied.jpg"/>
9
+ <button type="submit" title="<?php echo $this->__('Terminate') ?>" class="terminate_btn sp_checkout_btn" onclick="window.location.href = '<?php echo Mage::getBaseUrl() ?>';"><span><span><?php echo $this->__('Place Order') ?></span></span></button>
10
+ <?php else: ?>
11
+ <button type="submit" title="<?php echo $this->__('Place Order') ?>" class="button btn-checkout" onclick="review.save();"><span><span><?php echo $this->__('Place Order') ?></span></span></button>
12
+ <?php endif; ?>
13
+
14
+ <script type="text/javascript">
15
+ //<![CDATA[
16
+ if(payment.currentMethod === 'safepaynetwork_creditcard') {
17
+ document.getElementById('sp-temp-load').style.display = "none";
18
+ }
19
+ //]]>
20
+ </script>
app/design/frontend/base/default/template/safepay/form/creditcard.phtml ADDED
@@ -0,0 +1 @@
 
1
+ <?php echo $this->getCreditCardForm(); ?>
app/design/frontend/base/default/template/safepay/info.phtml ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php echo $this->getChildHtml('items_before'); ?>
28
+ <div id="checkout-review-table-wrapper">
29
+ <table class="data-table" id="checkout-review-table">
30
+ <?php if ($this->helper('tax')->displayCartBothPrices()): $colspan = $rowspan = 2; else: $colspan = $rowspan = 1; endif; ?>
31
+ <col />
32
+ <col width="1" />
33
+ <col width="1" />
34
+ <col width="1" />
35
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
36
+ <col width="1" />
37
+ <col width="1" />
38
+ <?php endif; ?>
39
+ <thead>
40
+ <tr>
41
+ <th rowspan="<?php echo $rowspan ?>"><?php echo $this->__('Product Name') ?></th>
42
+ <th colspan="<?php echo $colspan ?>" class="a-center"><?php echo $this->__('Price') ?></th>
43
+ <th rowspan="<?php echo $rowspan ?>" class="a-center"><?php echo $this->__('Qty') ?></th>
44
+ <th colspan="<?php echo $colspan ?>" class="a-center"><?php echo $this->__('Subtotal') ?></th>
45
+ </tr>
46
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
47
+ <tr>
48
+ <th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
49
+ <th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
50
+ <th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
51
+ <th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
52
+ </tr>
53
+ <?php endif; ?>
54
+ </thead>
55
+ <?php echo $this->getChildHtml('totals'); ?>
56
+ <tbody>
57
+ <?php foreach($this->getItems() as $_item): ?>
58
+ <?php echo $this->getItemHtml($_item)?>
59
+ <?php endforeach ?>
60
+ </tbody>
61
+ </table>
62
+ </div>
63
+ <?php echo $this->getChildHtml('items_after'); ?>
64
+ <script type="text/javascript">
65
+ //<![CDATA[
66
+ decorateTable('checkout-review-table');
67
+ truncateOptions();
68
+ //]]>
69
+ </script>
70
+ <div id="checkout-review-submit">
71
+ <?php echo $this->getChildHtml('agreements') ?>
72
+ <div class="buttons-set" id="review-buttons-container">
73
+ <p class="f-left"><?php echo $this->__('Forgot an Item?') ?> <a href="<?php echo $this->getUrl('checkout/cart') ?>"><?php echo $this->__('Edit Your Cart') ?></a></p>
74
+ <?php echo $this->getChildHtml('button') ?>
75
+ <span class="please-wait" id="review-please-wait" style="display:none;">
76
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Submitting order information...') ?>" title="<?php echo $this->__('Submitting order information...') ?>" class="v-middle" /> <?php echo $this->__('Submitting order information...') ?>
77
+ </span>
78
+ </div>
79
+ <script type="text/javascript">
80
+ //<![CDATA[
81
+ review = new Review('<?php echo $this->getUrl('checkout/onepage/saveOrder', array('form_key' => Mage::getSingleton('core/session')->getFormKey())) ?>', '<?php echo $this->getUrl('checkout/onepage/success') ?>', $('checkout-agreements'));
82
+ //]]>
83
+ </script>
84
+ </div>
app/design/frontend/base/default/template/safepay/js/safepay.js ADDED
File without changes
app/design/frontend/base/default/template/safepay/onepage.phtml ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <div class="page-title">
28
+ <h1><?php echo $this->__('Checkout') ?></h1>
29
+ </div>
30
+ <script type="text/javascript" src="<?php echo $this->getJsUrl('varien/accordion.js') ?>"></script>
31
+ <script type="text/javascript" src="<?php echo $this->getSkinUrl('js/opcheckout.js') ?>"></script>
32
+ <ol class="opc" id="checkoutSteps">
33
+ <?php $i=0; foreach($this->getSteps() as $_stepId => $_stepInfo): ?>
34
+ <?php if (!$this->getChild($_stepId) || !$this->getChild($_stepId)->isShow()): continue; endif; $i++ ?>
35
+ <li id="opc-<?php echo $_stepId ?>" class="section<?php echo !empty($_stepInfo['allow'])?' allow':'' ?><?php echo !empty($_stepInfo['complete'])?' saved':'' ?>">
36
+ <div class="step-title">
37
+ <span class="number"><?php echo $i ?></span>
38
+ <h2><?php echo $_stepInfo['label'] ?></h2>
39
+ <a href="#"><?php echo $this->__('Edit') ?></a>
40
+ </div>
41
+ <div id="checkout-step-<?php echo $_stepId ?>" class="step a-item" style="display:none;">
42
+ <?php echo $this->getChildHtml($_stepId) ?>
43
+ </div>
44
+ </li>
45
+ <?php endforeach ?>
46
+ </ol>
47
+ <script type="text/javascript">
48
+ //<![CDATA[
49
+ var accordion = new Accordion('checkoutSteps', '.step-title', true);
50
+ <?php if($this->getActiveStep()): ?>
51
+ accordion.openSection('opc-<?php echo $this->getActiveStep() ?>');
52
+ <?php endif ?>
53
+ var checkout = new Checkout(accordion,{
54
+ progress: '<?php echo $this->getUrl('checkout/onepage/progress') ?>',
55
+ review: '<?php echo $this->getUrl('checkout/onepage/review') ?>',
56
+ saveMethod: '<?php echo $this->getUrl('checkout/onepage/saveMethod') ?>',
57
+ failure: '<?php echo $this->getUrl('checkout/cart') ?>'}
58
+ );
59
+ //]]>
60
+ </script>
61
+ <a style="display: inline-block; width: 100%; text-align: center; margin-top: 20px;" href="https://www.usesafepay.com" class="sp-banner" target="_blank"><img alt="safepay" src="<?php echo $this->getSkinUrl('images/safepay/'); ?>banner.jpg" style="margin-bottom: 20px;"/></a>
62
+ <script type="text/javascript">
63
+ //<![CDATA[
64
+
65
+ submitPaymentSP = function()
66
+ {
67
+ if(payment.currentMethod == 'safepaynetwork_creditcard') {
68
+ var validator = new Validation(payment.form);
69
+ if(validator.validate()) {
70
+ document.getElementById('sp-temp-load').style.display = "block";
71
+ }
72
+ }
73
+ payment.save();
74
+ };
75
+
76
+ //]]>
77
+ </script>
app/design/frontend/base/default/template/safepay/payment.phtml ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <script type="text/javascript">
28
+ //<![CDATA[
29
+ var quoteBaseGrandTotal = <?php echo (float)$this->getQuoteBaseGrandTotal(); ?>;
30
+ var checkQuoteBaseGrandTotal = quoteBaseGrandTotal;
31
+ var payment = new Payment('co-payment-form', '<?php echo $this->getUrl('checkout/onepage/savePayment') ?>');
32
+ var lastPrice;
33
+ //]]>
34
+ </script>
35
+ <form action="" id="co-payment-form">
36
+ <fieldset>
37
+ <?php echo $this->getChildHtml('methods') ?>
38
+ </fieldset>
39
+ </form>
40
+ <div class="tool-tip" id="payment-tool-tip" style="display:none;">
41
+ <div class="btn-close"><a href="#" id="payment-tool-tip-close" title="<?php echo $this->__('Close') ?>"><?php echo $this->__('Close') ?></a></div>
42
+ <div class="tool-tip-content"><img src="<?php echo $this->getSkinUrl('images/cvv.gif') ?>" alt="<?php echo $this->__('Card Verification Number Visual Reference') ?>" title="<?php echo $this->__('Card Verification Number Visual Reference') ?>" /></div>
43
+ </div>
44
+ <div class="buttons-set" id="payment-buttons-container">
45
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
46
+ <p class="back-link"><a href="#" onclick="checkout.back(); return false;"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
47
+ <button type="button" class="button" onclick="submitPaymentSP();"><span><span><?php echo $this->__('Continue') ?></span></span></button>
48
+ <span class="please-wait" id="payment-please-wait" style="display:none;">
49
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
50
+ </span>
51
+ </div>
52
+ <script type="text/javascript">
53
+ //<![CDATA[
54
+ function toggleToolTip(event){
55
+ if($('payment-tool-tip')){
56
+ $('payment-tool-tip').setStyle({
57
+ top: (Event.pointerY(event)-560)+'px'//,
58
+ //left: (Event.pointerX(event)+100)+'px'
59
+ })
60
+ $('payment-tool-tip').toggle();
61
+ }
62
+ Event.stop(event);
63
+ }
64
+ if($('payment-tool-tip-close')){
65
+ Event.observe($('payment-tool-tip-close'), 'click', toggleToolTip);
66
+ }
67
+ //]]>
68
+ </script>
69
+ <script type="text/javascript">
70
+ //<![CDATA[
71
+ payment.currentMethod = "<?php echo $this->getChild('methods')->getSelectedMethodCode() ?>";
72
+ //]]>
73
+ </script>
74
+
75
+
app/design/frontend/base/default/template/safepay/success.phtml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <div class="multiple-checkout">
28
+ <div class="page-title">
29
+ <h1><?php echo $this->__('Order Success') ?></h1>
30
+ </div>
31
+ <h2 class="sub-title"><?php echo $this->__('Thank you for your purchase!') ?></h2>
32
+ <p><?php echo $this->__('We are processing your order and you will soon receive an email with details of the order. Once the order has shipped you will receive another email with a link to track its progress.') ?></p>
33
+ <?php if($_orderIds = $this->getOrderIds()): ?>
34
+ <p>
35
+ <?php $flag = false ?>
36
+ <?php echo $this->__('Your order number is ') ?>
37
+ <?php foreach ($_orderIds as $orderId=>$incrementId): ?>
38
+ <?php if ($flag): ?>
39
+ <?php echo ', ' ?>
40
+ <?php endif; ?>
41
+ <?php $flag = true ?>
42
+ <a href="<?php echo $this->getViewOrderUrl($orderId) ?>"><?php echo $incrementId ?></a>
43
+ <?php endforeach; ?>
44
+ </p>
45
+ <?php endif; ?>
46
+ <?php echo $this->getChildHtml() ?>
47
+ <div class="buttons-set">
48
+ <button type="button" title="<?php echo $this->__('Continue Shopping') ?>" class="button" onclick="setLocation('<?php echo Mage::getBaseUrl(); ?>')"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
49
+ </div>
50
+ <a style="display: inline-block; width: 100%; text-align: center; margin-top: 20px;" href="https://www.usesafepay.com" class="sp-banner" target="_blank"><img alt="safepay" src="<?php echo $this->getSkinUrl('images/safepay/'); ?>banner.jpg" style="margin-bottom: 20px;"/></a>
51
+ </div>
app/etc/modules/Safepaynetwork_Safepay.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Safepaynetwork_Safepay>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <depends>
8
+ <Mage_Payment />
9
+ </depends>
10
+ </Safepaynetwork_Safepay>
11
+ </modules>
12
+ </config>
package.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>magento_safepay</name>
4
+ <version>0.1.3</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Protect your business against online fraud attacks and all subsequent fraud-chargebacks and financial losses.&#xD;
10
+ </summary>
11
+ <description>Online payment fraud is the fastest growing type of fraud across the global payment landscape. With all occurrences of online fraud, merchants are held 100% liable. This liability includes fraud-chargebacks, loss of goods/services, replenishment costs, further penalties and other administration costs. This can be very crippling to your business and bottom line.&#xD;
12
+ &#xD;
13
+ Using its proprietary solution, SafePay Network Inc. is committed to protecting both your business and customers against online payment fraud, 24/7. There is no disruption to your business or your customers&#x2019; experiences. There are no cart abandonment issues. Consumers will have a greater peace of mind shopping online with your business because they feel safer!! This service is completely free to consumers to register and it&#x2019;s incredibly simple to setup. It&#x2019;s truly simple, safe and seamless.&#xD;
14
+ </description>
15
+ <notes>This is our first version. We will have updates when needed</notes>
16
+ <authors><author><name>SafePay Network</name><user>mbhinder</user><email>m.bhinder@safepay-inc.com</email></author></authors>
17
+ <date>2014-05-22</date>
18
+ <time>03:42:21</time>
19
+ <contents><target name="magelocal"><dir name="Safepaynetwork"><dir name="Safepay"><dir name="Block"><dir name="Form"><file name="Creditcard.php" hash="7cd70ff0e692de18b9d5582f932a70c1"/><file name="payment_form.php" hash="118768d4a8f5033970fbe68bcfd0b04d"/></dir><dir name="Onepage"><file name="Button.php" hash="9ffbd20fa4853b319b3c5e82bc71aa99"/><file name="safepayproxy.php" hash="0d2158f34963335c23631a2edf5422f2"/></dir></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Source"><file name="Timeout.php" hash="fead901f6eb9d0fea5ef29891cf140fb"/></dir></dir></dir><dir name="Method"><file name="Creditcard.php" hash="e7846b090de9a3fe5314960b023e48c3"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="be5da120ce97b8d80475d8ca1877310d"/></dir><dir name="etc"><file name="config.xml" hash="c6acd14f3180e42190913bdc5333ad52"/><file name="system.xml" hash="f96365b6fcffdf190f7b6f2dbbe3c8a6"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="safepay"><file name="button.phtml" hash="b3582b4cd83b8af4e313129597c04f7f"/><dir name="form"><file name="creditcard.phtml" hash="d3ba3e8b690af58542009e3ae5fa113b"/></dir><file name="info.phtml" hash="d367ea0de7104a27e89ad3b01786052f"/><dir name="js"><file name="safepay.js" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><file name="onepage.phtml" hash="b4114c8008bd81acd461eafdf54f6a5f"/><file name="payment.phtml" hash="45acc9a7b135c80fe3c2d2ba2fa97207"/><file name="success.phtml" hash="941111e2d2d2bf12ea36a1797ac60226"/></dir></dir><dir name="layout"><file name="safepay.xml" hash="29ca87c5fea4b99fc2156a4b9437472a"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="safepay.css" hash="05f25edff863ff787dbbbfec3685dff4"/></dir><dir name="images"><dir name="safepay"><file name="banner.jpg" hash="6491498250b108081a867e58f9f42b4d"/><file name="btn_window_close.gif" hash="c83f3cbbb2aedfc580dff78d5cfb63ed"/><file name="confirm.jpg" hash="90209e20c0095a61fea3b02e73b45564"/><file name="denied.jpg" hash="3302f1b119ba5dd8ca628331d85f619f"/><file name="guide.gif" hash="83cdd38bf110b0f9c52fe84b56f45298"/><file name="loading-message.png" hash="5067e7295f88f4817d3fdba555c8ef8e"/><file name="overlay.png" hash="a5e3e817a7704d5970bb78808ea5554d"/><file name="preloader.gif" hash="450b7678704469401f56a1b70bcce175"/><file name="restart.png" hash="1fda5d4eeb764c739c977449f3d6d46a"/><file name="safepay-logo.jpg" hash="d0d20728dc4f021b387cc507bac4a8d9"/><file name="safepay.gif" hash="f2f726aec74ab5845769c6cb47991610"/><file name="safepay.jpg" hash="454a635883729da331f95dbc61f5d106"/><file name="sp-banner.jpg" hash="1c67a168a9d843186136dd6db422166d"/><file name="terminate.png" hash="72b567618463aac7e6c503ed8c7830c2"/><file name="timeout.jpg" hash="0b01d7908b1321d1671f821ef302bf0e"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Safepaynetwork_Safepay.xml" hash="b7fbe0c78fc8d1666bf5bd38bc567308"/></dir></target></contents>
20
+ <compatible/>
21
+ <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
22
+ </package>
skin/frontend/base/default/css/safepay.css ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #center_column{
2
+ width: 757px!important;
3
+ }
4
+ .left-safepay a{
5
+ display: inline-block;
6
+ width: 100%;
7
+ text-align: center;
8
+ }
9
+ .left-safepay a img{
10
+ margin: 0!important;
11
+ }
12
+
13
+ .left-safepay {
14
+ float: left;
15
+ padding-top: 50px;
16
+ text-align: center;
17
+ width: 35%;
18
+ }
19
+ .right-safepay {
20
+ border-left: 1px solid #EFEFEF;
21
+ float: left;
22
+ margin-left: 3%;
23
+ padding-left: 6%;
24
+ width: 55%;
25
+ }
26
+ #sp-confirm{
27
+ width: 100%;
28
+ margin: 10px 0;
29
+ float: left;
30
+ }
31
+ #safepay-wrapper #cart_navigation{
32
+ width: 100%;
33
+ float: left;
34
+ margin-top: 25px;
35
+ }
36
+
37
+ #safepay-wrapper {
38
+ background: none repeat scroll 0 0 #FFFFFF;
39
+ border: 1px solid #EEEEEE;
40
+ float: left;
41
+ padding: 2%;
42
+ width: 96%;
43
+ }
44
+ .right-safepay p{
45
+ padding-bottom: 10px;
46
+ }
47
+ .right-safepay table tr td{
48
+ padding: 5px 0;
49
+ }
50
+
51
+ .right-safepay table tr td .text {
52
+ border: 1px solid #CCCCCC;
53
+ font-size: 12px;
54
+ height: 20px;
55
+ line-height: 20px;
56
+ margin-left: 0;
57
+ margin-top: 2px;
58
+ padding: 0 3px !important;
59
+ width: 256px;
60
+ }
61
+ .right-safepay table tr td .select {
62
+ border: 1px solid #CCCCCC;
63
+ height: 24px;
64
+ line-height: 24px;
65
+ margin-top: 3px;
66
+ padding: 3px;
67
+ width: 264px;
68
+ }
69
+ .right-safepay table tr td .select50 {
70
+ border: 1px solid #CCCCCC;
71
+ height: 24px;
72
+ line-height: 24px;
73
+ margin-top: 3px;
74
+ padding: 3px;
75
+ }
76
+ .right-safepay table tr td .select50:last-child {
77
+ margin-left: 3px;
78
+ width: 80px;
79
+ }
80
+ .right-safepay table tr td label{
81
+ font-weight: bold;
82
+ text-align: right;
83
+ }
84
+ .right-safepay table tr td:first-child{
85
+ text-align: left;
86
+ }
87
+ .right-safepay table{
88
+ width: 100%;
89
+ }
90
+ #safepay-wrapper h3{
91
+ background: none repeat scroll 0 0 #EEEEEE;
92
+ color: #333333;
93
+ font-size: 15px;
94
+ font-weight: bold;
95
+ margin: 10px 0;
96
+ padding: 10px 5px;
97
+ }
98
+ .right-safepay label em{
99
+ color: #EB340A;
100
+ font-style: normal;
101
+ }
102
+ #sp-guide{
103
+ display: none;
104
+ }
105
+ #wit{
106
+ cursor: help;
107
+ }
108
+ #wit:hover{
109
+ text-decoration: none;
110
+ }
111
+ body > .sp-guide-inner {
112
+ display: block;
113
+ height: 226px;
114
+ left: 0;
115
+ position: absolute;
116
+ text-align: center;
117
+ top: 0;
118
+ vertical-align: middle;
119
+ width: 474px;
120
+ z-index: 99999999;
121
+ position: fixed;
122
+ top: 150px;
123
+ left: 400px;
124
+ }
125
+ body > .sp-guide-inner img{
126
+ vertical-align: middle;
127
+ }
128
+ body > .sp-guide-inner table{
129
+ width: 100%;
130
+ height: 100%;
131
+ }
132
+ body > .sp-guide-inner table tr{
133
+ width: 100%;
134
+ height: 100%;
135
+ }
136
+ body > .sp-guide-inner table tr td{
137
+ width: 100%;
138
+ height: 100%;
139
+ vertical-align: middle;
140
+ }
141
+ body > .sp-guide-inner table tr td .sp-container{
142
+ margin: 0 auto;
143
+ padding: 20px;
144
+ display: inline-block;
145
+ background: none repeat scroll 0 0 #EAF6FF;
146
+ position: relative;
147
+ border: 1px solid #0173CA;
148
+ }
149
+ body > .sp-guide-inner table tr td .sp-container img{
150
+ width: 100%;
151
+ height: 100%;
152
+ }
153
+ body > .sp-guide-inner table tr td .sp-close{
154
+ position: absolute;
155
+ top: 5px;
156
+ right: 5px;
157
+ display: inline-block;
158
+ cursor: pointer;
159
+ }
160
+
161
+ #sp-loading {
162
+ height: 325px;
163
+ left: 400px;
164
+ margin: 150px auto 0;
165
+ top: 150px;
166
+ width: 600px;
167
+ z-index: 8888;
168
+ }
169
+ #sp-temp-load{
170
+ background: url('../images/safepay/overlay.png');
171
+ height: 100%;
172
+ left: 0;
173
+ position: fixed;
174
+ top: 0;
175
+ width: 100%;
176
+ z-index: 9999999;
177
+ display:none;
178
+ }
179
+ #sp-loading #sp-loading-inner{
180
+ width: 100%;
181
+ height: 100%;
182
+ position: relative;
183
+ }
184
+ #sp-loading #sp-loading-inner .loading-message{
185
+ width: 100%;
186
+ height: 100%;
187
+ position: relative;
188
+ }
189
+ #sp-loading #sp-loading-inner .reloader{
190
+ position: absolute;
191
+ bottom: 20px;
192
+ left: 220px;
193
+ z-index: 10;
194
+ }
195
+ #sp-loading-wrapper{
196
+ width: 100%;
197
+ height: 100%;
198
+ background: none repeat scroll 0 0 rgba(113, 113, 113, 0.4);
199
+ position: fixed;
200
+ top: 0;
201
+ left: 0;
202
+ z-index: 999;
203
+ }
204
+ #sp-loading-wrapper.active, #sp-loading.active{
205
+ display: block!important;
206
+ }
207
+ .sp-cancel-action{
208
+ position: absolute;
209
+ right: 10px;
210
+ top: 10px;
211
+ cursor: pointer;
212
+ z-index: 9999999;
213
+ }
214
+ #sp-form {
215
+ float: left;
216
+ margin-bottom: 20px;
217
+ width: 100%;
218
+ }
219
+ #cart_navigation .timeout {
220
+ background: url("../img/safepay/restart.png") no-repeat scroll left top rgba(0, 0, 0, 0);
221
+ border: medium none;
222
+ display: inline-block;
223
+ height: 45px;
224
+ margin-right: 10px;
225
+ padding: 0;
226
+ text-indent: -99999px;
227
+ width: 140px;
228
+ }
229
+ #cart_navigation .cease {
230
+ background: url("../img/safepay/terminate.png") no-repeat scroll left top rgba(0, 0, 0, 0);
231
+ border: medium none;
232
+ display: inline-block;
233
+ height: 45px;
234
+ margin: 0 10px 0 0;
235
+ padding: 0;
236
+ text-indent: -99999px;
237
+ width: 140px;
238
+ }
239
+ #cart_navigation.timeout {
240
+ background: url("../img/safepay/timeout.jpg") no-repeat scroll 15px 21px rgba(0, 0, 0, 0);
241
+ padding: 50px 2%;
242
+ }
243
+ #cart_navigation.proceed {
244
+ background: url("../img/safepay/confirm.jpg") no-repeat scroll 15px 12px rgba(0, 0, 0, 0);
245
+ padding: 50px 2%;
246
+ }
247
+ #cart_navigation.cease {
248
+ background: url("../img/safepay/denied.jpg") no-repeat scroll 15px 21px rgba(0, 0, 0, 0);
249
+ padding: 50px 2%;
250
+ }
251
+ span.button {
252
+ background: url("../img/button.png") repeat-x scroll 0 0 rgba(0, 0, 0, 0);
253
+ border-radius: 7px;
254
+ box-shadow: 0 2px 2px #DDDDDD;
255
+ color: #FFFFFF;
256
+ cursor: pointer;
257
+ font-family: Arial,Helvetica,sans-serif;
258
+ font-size: 12px;
259
+ font-weight: bold;
260
+ line-height: 24px;
261
+ border: 0 none;
262
+ height: 24px;
263
+ margin: 0;
264
+ padding: 0 12px;
265
+ }
266
+ span.button:hover {
267
+ background-position: 0 -24px;
268
+ }
269
+ .content .error {
270
+ background: none repeat scroll 0 0 #FFBBBB;
271
+ border: 1px solid #FF0000;
272
+ margin-bottom: 15px;
273
+ }
274
+ #safepay-wrapper img, .sp-banner img{
275
+ padding: 0!important;
276
+ border: none!important;
277
+ }
278
+ .sp-banner img{
279
+ width: 100%!important;
280
+ max-width: none!important;
281
+ }
282
+ .right-safepay table tr td{
283
+ border: none!important;
284
+ }
285
+ .ajax-field{
286
+ border-radius: 0!important;
287
+ box-shadow: none!important;
288
+ }
289
+
290
+ .checkout-content .buttons {
291
+ clear: both;
292
+ }
293
+
294
+ .buttons {
295
+ background: none repeat scroll 0 0 #FFFFFF;
296
+ border: 1px solid #EEEEEE;
297
+ float: left;
298
+ margin: 20px 0 !important;
299
+ overflow: auto;
300
+ padding: 2%;
301
+ width: 96%;
302
+ }
303
+ #safepay-wrapper .error ol{
304
+ margin: 0;
305
+ }
306
+ #safepay-wrapper .error ol li{
307
+ color: #FF0101;
308
+ }
309
+ #safepay-wrapper .error{
310
+ padding: 15px 15px 15px 30px;
311
+ }
312
+ #payment_form_safepaynetwork_creditcard{
313
+ width: 620px;
314
+ }
315
+ .safepay_select_wrapper{
316
+ float: left;
317
+ text-align: left;
318
+ }
319
+ .sp_icon{
320
+ float: right;
321
+ }
322
+ .terminate_btn{
323
+ width: 140px;
324
+ height: 45px;
325
+ text-indent: -999999px;
326
+ background: url('../images/safepay/terminate.png') top left no-repeat;
327
+ float: right;
328
+ border: none;
329
+ cursor: pointer;
330
+ margin-left: 10px;
331
+ }
332
+ .restart_btn{
333
+ width: 140px;
334
+ height: 45px;
335
+ text-indent: -999999px;
336
+ background: url('../images/safepay/restart.png') top left no-repeat;
337
+ float: right;
338
+ border: none;
339
+ cursor: pointer;
340
+ margin-left: 10px;
341
+ }
342
+ .sp_checkout_btn{
343
+ float: right!important;
344
+ margin-left: 500px!important;
345
+ margin-top: 20px!important;
346
+ }
skin/frontend/base/default/images/safepay/banner.jpg ADDED
Binary file
skin/frontend/base/default/images/safepay/btn_window_close.gif ADDED
Binary file
skin/frontend/base/default/images/safepay/confirm.jpg ADDED
Binary file
skin/frontend/base/default/images/safepay/denied.jpg ADDED
Binary file
skin/frontend/base/default/images/safepay/guide.gif ADDED
Binary file
skin/frontend/base/default/images/safepay/loading-message.png ADDED
Binary file
skin/frontend/base/default/images/safepay/overlay.png ADDED
Binary file
skin/frontend/base/default/images/safepay/preloader.gif ADDED
Binary file
skin/frontend/base/default/images/safepay/restart.png ADDED
Binary file
skin/frontend/base/default/images/safepay/safepay-logo.jpg ADDED
Binary file
skin/frontend/base/default/images/safepay/safepay.gif ADDED
Binary file
skin/frontend/base/default/images/safepay/safepay.jpg ADDED
Binary file
skin/frontend/base/default/images/safepay/sp-banner.jpg ADDED
Binary file
skin/frontend/base/default/images/safepay/terminate.png ADDED
Binary file
skin/frontend/base/default/images/safepay/timeout.jpg ADDED
Binary file