Version Notes
Updated version with the relevant contents
Download this release
Release Info
| Developer | Ivan |
| Extension | paymentwall_magento_module |
| Version | 1.0.1 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.0 to 1.0.1
- app/code/local/Paymentwall/Paymentwall/Helper/Data.php +2 -0
- app/code/local/Paymentwall/Paymentwall/Model/Payment.php +14 -0
- app/code/local/Paymentwall/Paymentwall/controllers/IndexController.php +126 -0
- app/code/local/Paymentwall/Paymentwall/etc/config.xml +48 -0
- app/code/local/Paymentwall/Paymentwall/etc/system.xml +78 -0
- app/etc/modules/Paymentwall_Paymentwall.xml +14 -0
- package.xml +9 -8
app/code/local/Paymentwall/Paymentwall/Helper/Data.php
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Paymentwall_Paymentwall_Helper_Data extends Mage_Core_Helper_Abstract {}
|
app/code/local/Paymentwall/Paymentwall/Model/Payment.php
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Paymentwall_Paymentwall_Model_Payment extends Mage_Payment_Model_Method_Abstract
|
| 3 |
+
{
|
| 4 |
+
protected $_isGateway = true;
|
| 5 |
+
protected $_canUseInternal = false;
|
| 6 |
+
protected $_canUseForMultishipping = false;
|
| 7 |
+
|
| 8 |
+
protected $_code = 'paymentwall';
|
| 9 |
+
|
| 10 |
+
public function getOrderPlaceRedirectUrl()
|
| 11 |
+
{
|
| 12 |
+
return Mage::getUrl('paymentwall/index/redirect', array('_secure' => true));
|
| 13 |
+
}
|
| 14 |
+
}
|
app/code/local/Paymentwall/Paymentwall/controllers/IndexController.php
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* @category Paymentwall
|
| 4 |
+
* @package Paymentwall_Paymentwall
|
| 5 |
+
* @copyright Copyright (c) 2010 - 2013 Paymentwall (http://www.paymentwall.com)
|
| 6 |
+
*/
|
| 7 |
+
|
| 8 |
+
DEFINE('SECRET', Mage::getStoreConfig('payment/paymentwall/paymentwall_secret')); //Secret Key
|
| 9 |
+
//is set using graphical interface
|
| 10 |
+
DEFINE('APPKEY', Mage::getStoreConfig('payment/paymentwall/paymentwall_shop_id')); //Application Key
|
| 11 |
+
|
| 12 |
+
class Paymentwall_Paymentwall_IndexController extends Mage_Core_Controller_Front_Action
|
| 13 |
+
{
|
| 14 |
+
public function updateOrderState($type, $reason)
|
| 15 |
+
{
|
| 16 |
+
$order = $this->getOrder();
|
| 17 |
+
if($type == "positive") {
|
| 18 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, Mage_Sales_Model_Order::STATE_COMPLETE);
|
| 19 |
+
} else { //chargeback
|
| 20 |
+
if(($reason == 2) || ($reason == 3)) {
|
| 21 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, Mage_Sales_Model_Order::STATUS_FRAUD);
|
| 22 |
+
} else {
|
| 23 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, Mage_Sales_Model_Order::STATE_CANCELED);
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
$order->save();
|
| 28 |
+
return true;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
private function loadOrderById($orderId)
|
| 33 |
+
{
|
| 34 |
+
return Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
public function getOrder()
|
| 38 |
+
{
|
| 39 |
+
if (!$this->_order) {
|
| 40 |
+
$session = Mage::getSingleton('checkout/session');
|
| 41 |
+
$this->_order = $this->loadOrderById($session->getLastRealOrderId());
|
| 42 |
+
}
|
| 43 |
+
return $this->_order;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
function checkResponse($response) {
|
| 47 |
+
return preg_match('/^[a-z0-9]{32}$/', $response);
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
public function redirectAction()
|
| 51 |
+
{
|
| 52 |
+
require 'lib/paymentwall.php';
|
| 53 |
+
Paymentwall_Base::setApiType(Paymentwall_Base::API_GOODS);
|
| 54 |
+
Paymentwall_Base::setAppKey(APPKEY); // available in your Paymentwall merchant area
|
| 55 |
+
Paymentwall_Base::setSecretKey(SECRET); // available in your Paymentwall merchant area
|
| 56 |
+
|
| 57 |
+
$order = $this->getOrder();
|
| 58 |
+
|
| 59 |
+
$widget = new Paymentwall_Widget(
|
| 60 |
+
$order->getCustomerEmail(), // id of the end-user who's making the payment
|
| 61 |
+
Mage::getStoreConfig('payment/paymentwall/paymentwall_widget_code'), // widget code, e.g. p1; can be picked inside of your merchant account
|
| 62 |
+
array( // product details for Flexible Widget Call. To let users select the product on Paymentwall's end, leave this array empty
|
| 63 |
+
new Paymentwall_Product(
|
| 64 |
+
$order->getIncrementId(),
|
| 65 |
+
$order->getGrandTotal(),
|
| 66 |
+
$order->getOrderCurrencyCode(),
|
| 67 |
+
'Order id #' . $order->getIncrementId(),
|
| 68 |
+
Paymentwall_Product::TYPE_FIXED
|
| 69 |
+
)
|
| 70 |
+
),
|
| 71 |
+
array(
|
| 72 |
+
'email' => $order->getCustomerEmail(),
|
| 73 |
+
'success_url' => Mage::getStoreConfig('payment/paymentwall/paymentwall_url'),
|
| 74 |
+
'test_mode' => Mage::getStoreConfig('payment/paymentwall/paymentwall_istest')
|
| 75 |
+
) // additional parameters
|
| 76 |
+
);
|
| 77 |
+
echo $widget->getHtmlCode();
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
public function ipnAction()
|
| 81 |
+
{
|
| 82 |
+
require 'lib/paymentwall.php';
|
| 83 |
+
Paymentwall_Base::setApiType(Paymentwall_Base::API_GOODS);
|
| 84 |
+
Paymentwall_Base::setAppKey(APPKEY); // available in your Paymentwall merchant area
|
| 85 |
+
Paymentwall_Base::setSecretKey(SECRET); // available in your Paymentwall merchant area
|
| 86 |
+
|
| 87 |
+
$pingback = new Paymentwall_Pingback($_GET, $_SERVER['REMOTE_ADDR']);
|
| 88 |
+
|
| 89 |
+
$reason = $pingback->getParameter('reason');
|
| 90 |
+
|
| 91 |
+
$productId = $pingback->getProductId();
|
| 92 |
+
$order = $this->loadOrderById($productId);
|
| 93 |
+
$this->_order = $order;
|
| 94 |
+
if($order) {
|
| 95 |
+
if ($pingback->validate()) {
|
| 96 |
+
if ($pingback->isDeliverable()) {
|
| 97 |
+
$this->updateOrderState("positive", $reason);
|
| 98 |
+
} else if ($pingback->isCancelable()) {
|
| 99 |
+
$this->updateOrderState("negative", $reason);
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
echo 'OK'; // Paymentwall expects response to be OK, otherwise the pingback will be resent
|
| 103 |
+
} else {
|
| 104 |
+
echo $pingback->getErrorSummary();
|
| 105 |
+
}
|
| 106 |
+
} else {
|
| 107 |
+
echo 'Order not found!';
|
| 108 |
+
}
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
public function confirmNotification()
|
| 112 |
+
{
|
| 113 |
+
return "OK";
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
private function successfulPayment(){
|
| 117 |
+
$message = '
|
| 118 |
+
You should now receive an email with the link to the widget!
|
| 119 |
+
<br />
|
| 120 |
+
In case you have not got an email, please check your spam folder.
|
| 121 |
+
';
|
| 122 |
+
|
| 123 |
+
return $message;
|
| 124 |
+
}
|
| 125 |
+
}
|
| 126 |
+
?>
|
app/code/local/Paymentwall/Paymentwall/etc/config.xml
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Paymentwall_Paymentwall>
|
| 5 |
+
<version>1.0.0.0</version>
|
| 6 |
+
</Paymentwall_Paymentwall>
|
| 7 |
+
</modules>
|
| 8 |
+
<global>
|
| 9 |
+
<models>
|
| 10 |
+
<paymentwall>
|
| 11 |
+
<class>Paymentwall_Paymentwall_Model</class>
|
| 12 |
+
</paymentwall>
|
| 13 |
+
</models>
|
| 14 |
+
<blocks>
|
| 15 |
+
<paymentwall>
|
| 16 |
+
<class>Paymentwall_Paymentwall_Block</class>
|
| 17 |
+
</paymentwall>
|
| 18 |
+
</blocks>
|
| 19 |
+
<helpers>
|
| 20 |
+
<paymentwall>
|
| 21 |
+
<class>Paymentwall_Paymentwall_Helper</class>
|
| 22 |
+
</paymentwall>
|
| 23 |
+
</helpers>
|
| 24 |
+
</global>
|
| 25 |
+
<default>
|
| 26 |
+
<payment>
|
| 27 |
+
<paymentwall>
|
| 28 |
+
<active>1</active>
|
| 29 |
+
<model>paymentwall/payment</model>
|
| 30 |
+
<order_status>pending_payment</order_status>
|
| 31 |
+
<title>Paymentwall</title>
|
| 32 |
+
<fee_payer>buyer</fee_payer>
|
| 33 |
+
<allowspecific>0</allowspecific>
|
| 34 |
+
</paymentwall>
|
| 35 |
+
</payment>
|
| 36 |
+
</default>
|
| 37 |
+
<frontend>
|
| 38 |
+
<routers>
|
| 39 |
+
<paymentwall>
|
| 40 |
+
<use>standard</use>
|
| 41 |
+
<args>
|
| 42 |
+
<module>Paymentwall_Paymentwall</module>
|
| 43 |
+
<frontName>paymentwall</frontName>
|
| 44 |
+
</args>
|
| 45 |
+
</paymentwall>
|
| 46 |
+
</routers>
|
| 47 |
+
</frontend>
|
| 48 |
+
</config>
|
app/code/local/Paymentwall/Paymentwall/etc/system.xml
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<sections>
|
| 4 |
+
<payment>
|
| 5 |
+
<groups>
|
| 6 |
+
<paymentwall translate="label" module="paymentwall">
|
| 7 |
+
<label>Paymentwall</label>
|
| 8 |
+
<frontend_type>text</frontend_type>
|
| 9 |
+
<sort_order>103</sort_order>
|
| 10 |
+
<show_in_default>1</show_in_default>
|
| 11 |
+
<show_in_website>1</show_in_website>
|
| 12 |
+
<show_in_store>0</show_in_store>
|
| 13 |
+
<fields>
|
| 14 |
+
<active translate="label">
|
| 15 |
+
<label>Enabled</label>
|
| 16 |
+
<frontend_type>select</frontend_type>
|
| 17 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 18 |
+
<sort_order>1</sort_order>
|
| 19 |
+
<show_in_default>1</show_in_default>
|
| 20 |
+
<show_in_website>1</show_in_website>
|
| 21 |
+
<show_in_store>0</show_in_store>
|
| 22 |
+
</active>
|
| 23 |
+
<title translate="label">
|
| 24 |
+
<label>Title</label>
|
| 25 |
+
<frontend_type>text</frontend_type>
|
| 26 |
+
<sort_order>2</sort_order>
|
| 27 |
+
<show_in_default>1</show_in_default>
|
| 28 |
+
<show_in_website>1</show_in_website>
|
| 29 |
+
<show_in_store>1</show_in_store>
|
| 30 |
+
</title>
|
| 31 |
+
<paymentwall_shop_id translate="label">
|
| 32 |
+
<label>App ID</label>
|
| 33 |
+
<frontend_type>text</frontend_type>
|
| 34 |
+
<sort_order>3</sort_order>
|
| 35 |
+
<show_in_default>1</show_in_default>
|
| 36 |
+
<show_in_website>1</show_in_website>
|
| 37 |
+
<show_in_store>0</show_in_store>
|
| 38 |
+
</paymentwall_shop_id>
|
| 39 |
+
<paymentwall_secret translate="label">
|
| 40 |
+
<label>Secret key</label>
|
| 41 |
+
<frontend_type>text</frontend_type>
|
| 42 |
+
|
| 43 |
+
<sort_order>4</sort_order>
|
| 44 |
+
<show_in_default>1</show_in_default>
|
| 45 |
+
<show_in_website>1</show_in_website>
|
| 46 |
+
<show_in_store>0</show_in_store>
|
| 47 |
+
</paymentwall_secret>
|
| 48 |
+
<paymentwall_widget_code translate="label">
|
| 49 |
+
<label>Widget code</label>
|
| 50 |
+
<frontend_type>text</frontend_type>
|
| 51 |
+
<sort_order>5</sort_order>
|
| 52 |
+
<show_in_default>1</show_in_default>
|
| 53 |
+
<show_in_website>1</show_in_website>
|
| 54 |
+
<show_in_store>0</show_in_store>
|
| 55 |
+
</paymentwall_widget_code>
|
| 56 |
+
<paymentwall_url translate="label">
|
| 57 |
+
<label>Success URL</label>
|
| 58 |
+
<frontend_type>text</frontend_type>
|
| 59 |
+
<sort_order>6</sort_order>
|
| 60 |
+
<show_in_default>1</show_in_default>
|
| 61 |
+
<show_in_website>1</show_in_website>
|
| 62 |
+
<show_in_store>0</show_in_store>
|
| 63 |
+
</paymentwall_url>
|
| 64 |
+
<paymentwall_istest translate="label">
|
| 65 |
+
<label>Test mode?</label>
|
| 66 |
+
<frontend_type>select</frontend_type>
|
| 67 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 68 |
+
<sort_order>6</sort_order>
|
| 69 |
+
<show_in_default>1</show_in_default>
|
| 70 |
+
<show_in_website>1</show_in_website>
|
| 71 |
+
<show_in_store>0</show_in_store>
|
| 72 |
+
</paymentwall_istest>
|
| 73 |
+
</fields>
|
| 74 |
+
</paymentwall>
|
| 75 |
+
</groups>
|
| 76 |
+
</payment>
|
| 77 |
+
</sections>
|
| 78 |
+
</config>
|
app/etc/modules/Paymentwall_Paymentwall.xml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Paymentwall_Paymentwall>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>local</codePool>
|
| 7 |
+
<depends>
|
| 8 |
+
<Mage_Payment />
|
| 9 |
+
<Mage_Sales/>
|
| 10 |
+
<Mage_Checkout/>
|
| 11 |
+
</depends>
|
| 12 |
+
</Paymentwall_Paymentwall>
|
| 13 |
+
</modules>
|
| 14 |
+
</config>
|
package.xml
CHANGED
|
@@ -1,18 +1,19 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>paymentwall_magento_module</name>
|
| 4 |
-
<version>1.0.
|
| 5 |
<stability>stable</stability>
|
| 6 |
-
<license>MITL</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
-
<summary>Paymentwall
|
| 10 |
-
<description>Paymentwall
|
| 11 |
-
|
|
|
|
| 12 |
<authors><author><name>Ivan</name><user>Paymentwall</user><email>ivan.shvets@paymentwall.com</email></author></authors>
|
| 13 |
<date>2014-09-03</date>
|
| 14 |
-
<time>
|
| 15 |
-
<contents></contents>
|
| 16 |
<compatible/>
|
| 17 |
-
<dependencies><required><php><min>5.3.0</min><max>5.6.0</max></php
|
| 18 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>paymentwall_magento_module</name>
|
| 4 |
+
<version>1.0.1</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
+
<license uri="http://opensource.org/licenses/MIT">MITL</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
+
<summary>Paymentwall payment extension for Magento. 120+ payment methods in more than 200 countries.</summary>
|
| 10 |
+
<description>Paymentwall payment extension for Magento. 120+ payment methods in more than 200 countries.
|
| 11 |
+
Paymentwall’s Magneto plug-in is easy to install and fully customizable. With a single integration you’ll have access to our 120+ payment options localized in 75+ currencies and more than 200 countries. You’ll also have access to our top-notch risk management and fraud protection services, optimization assistance, 24/7 live customer support and detail analytics and reporting tools.</description>
|
| 12 |
+
<notes>Updated version with the relevant contents</notes>
|
| 13 |
<authors><author><name>Ivan</name><user>Paymentwall</user><email>ivan.shvets@paymentwall.com</email></author></authors>
|
| 14 |
<date>2014-09-03</date>
|
| 15 |
+
<time>16:15:32</time>
|
| 16 |
+
<contents><target name="magelocal"><dir name="Paymentwall"><dir name="Paymentwall"><dir name="controllers"><file name="IndexController.php" hash="8332d94b58318f02f8b34560d68a11fc"/><dir name="lib"><file name="README.md" hash=""/><file name="LICENSE" hash=""/><file name="composer.json" hash=""/><file name=".git" hash=""/><dir name="lib"><file name="paymentwall.php" hash=""/><dir name="Paymentwall"><file name="Base.php" hash=""/><file name="Pingback.php" hash=""/><file name="Product.php" hash=""/><file name="Widget.php" hash=""/><dir name="Pro"><file name="Charge.php" hash=""/><file name="Error.php" hash=""/><file name="HttpWrapper.php" hash=""/></dir></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="c204683c06f58a3f218120225b02e5b8"/><file name="system.xml" hash="ce93cbd207e6065e299939a09b18c696"/></dir><dir name="Helper"><file name="Data.php" hash="85a20e437bbbf0ca1fd72314eb6a9633"/></dir><dir name="Model"><file name="Payment.php" hash="3aaa8cc29139e89a13aa0ee307ed355e"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Paymentwall_Paymentwall.xml" hash="fb1fcfe999b25202a0364158ae9eba92"/></dir></target></contents>
|
| 17 |
<compatible/>
|
| 18 |
+
<dependencies><required><php><min>5.3.0</min><max>5.6.0</max></php></required></dependencies>
|
| 19 |
</package>
|
