Atwix_Western_Union_Payment_Module - Version 1.0.0

Version Notes

Atwix Western Union Payment module adds a new Payment Method for Magento.

Download this release

Release Info

Developer Magento Core Team
Extension Atwix_Western_Union_Payment_Module
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/Atwix/WesternUnionPayment/Block/Form/Westernunionpayment.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Atwix_WesternUnionPayment_Block_Form_Westernunionpayment extends Mage_Payment_Block_Form
3
+ {
4
+
5
+ protected function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->setTemplate('westernunionpayment/form/westernunionpayment.phtml');
9
+ }
10
+
11
+ }
app/code/local/Atwix/WesternUnionPayment/Block/Info/Westernunionpayment.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Atwix_WesternUnionPayment_Block_Info_Westernunionpayment extends Mage_Payment_Block_Info
3
+ {
4
+
5
+ protected $_payableTo;
6
+
7
+ protected function _construct()
8
+ {
9
+ parent::_construct();
10
+ $this->setTemplate('westernunionpayment/info/westernunionpayment.phtml');
11
+ }
12
+
13
+ public function getPayableTo()
14
+ {
15
+ if (is_null($this->_payableTo)) {
16
+ $this->_convertAdditionalData();
17
+ }
18
+ return $this->_payableTo;
19
+ }
20
+
21
+ protected function _convertAdditionalData()
22
+ {
23
+ $details = @unserialize($this->getInfo()->getAdditionalData());
24
+ if (is_array($details)) {
25
+ $this->_payableTo = isset($details['payable_to']) ? (string) $details['payable_to'] : '';
26
+ } else {
27
+ $this->_payableTo = '';
28
+ }
29
+ return $this;
30
+ }
31
+ }
app/code/local/Atwix/WesternUnionPayment/Model/PaymentMethod.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Atwix_WesternUnionPayment_Model_PaymentMethod extends Mage_Payment_Model_Method_Abstract {
3
+ /**
4
+ * Prevent any rendering
5
+ *
6
+ * @return string
7
+ */
8
+ protected $_code = 'westernunionpayment';
9
+ protected $_formBlockType = 'westernunionpayment/form_westernunionpayment';
10
+ protected $_infoBlockType = 'westernunionpayment/info_westernunionpayment';
11
+
12
+
13
+ public function assignData($data)
14
+ {
15
+ $details = array();
16
+ if ($this->getPayableTo()) {
17
+ $details['payable_to'] = $this->getPayableTo();
18
+ }
19
+
20
+ if (!empty($details)) {
21
+ $this->getInfoInstance()->setAdditionalData(serialize($details));
22
+ }
23
+ return $this;
24
+ }
25
+
26
+ public function getPayableTo()
27
+ {
28
+ return $this->getConfigData('payable_to');
29
+ }
30
+ }
app/code/local/Atwix/WesternUnionPayment/etc/config.xml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <global>
4
+ <blocks>
5
+ <westernunionpayment>
6
+ <class>Atwix_WesternUnionPayment_Block</class>
7
+ </westernunionpayment>
8
+ </blocks>
9
+
10
+ <models>
11
+ <westernunionpayment>
12
+ <class>Atwix_WesternUnionPayment_Model</class>
13
+ </westernunionpayment>
14
+ </models>
15
+
16
+ <resources>
17
+ <westernunionpayment_setup>
18
+ <setup>
19
+ <module>Atwix_WesternUnionPayment</module>
20
+ </setup>
21
+ <connection>
22
+ <use>core_setup</use>
23
+ </connection>
24
+ </westernunionpayment_setup>
25
+ <westernunionpayment_write>
26
+ <connection>
27
+ <use>core_write</use>
28
+ </connection>
29
+ </westernunionpayment_write>
30
+ <westernunionpayment_read>
31
+ <connection>
32
+ <use>core_read</use>
33
+ </connection>
34
+ </westernunionpayment_read>
35
+ </resources>
36
+ </global>
37
+
38
+ <default>
39
+ <payment>
40
+ <westernunionpayment>
41
+ <active>1</active>
42
+ <model>westernunionpayment/paymentMethod</model>
43
+ <order_status>pending</order_status>
44
+ <title>Western Union Payment</title>
45
+ </westernunionpayment>
46
+ </payment>
47
+ </default>
48
+ </config>
app/code/local/Atwix/WesternUnionPayment/etc/system.xml ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <westernunionpayment translate="label" module="payment">
7
+ <label>Western Union Payment</label>
8
+ <sort_order>999</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</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
+
23
+ <order_status translate="label">
24
+ <label>New Order Status</label>
25
+ <frontend_type>select</frontend_type>
26
+ <source_model>adminhtml/system_config_source_order_status_new</source_model>
27
+ <sort_order>20</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>0</show_in_store>
31
+ </order_status>
32
+ <sort_order translate="label">
33
+ <label>Sort Order</label>
34
+ <frontend_type>text</frontend_type>
35
+ <sort_order>100</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>0</show_in_store>
39
+ </sort_order>
40
+ <title translate="label">
41
+ <label>Title</label>
42
+ <frontend_type>text</frontend_type>
43
+ <sort_order>10</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>1</show_in_store>
47
+ </title>
48
+ <allowspecific translate="label">
49
+ <label>Payment from Applicable Countries</label>
50
+ <frontend_type>allowspecific</frontend_type>
51
+ <sort_order>50</sort_order>
52
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>0</show_in_store>
56
+ </allowspecific>
57
+ <specificcountry translate="label">
58
+ <label>Payment from Specific Countries</label>
59
+ <frontend_type>multiselect</frontend_type>
60
+ <sort_order>51</sort_order>
61
+ <source_model>adminhtml/system_config_source_country</source_model>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>0</show_in_store>
65
+ <can_be_empty>1</can_be_empty>
66
+ </specificcountry>
67
+ <payable_to translate="label">
68
+ <label>Payment Information</label>
69
+ <frontend_type>textarea</frontend_type>
70
+ <sort_order>61</sort_order>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>1</show_in_store>
74
+ </payable_to>
75
+ </fields>
76
+ </westernunionpayment>
77
+ </groups>
78
+ </payment>
79
+ </sections>
80
+ </config>
app/design/adminhtml/default/default/template/westernunionpayment/info/westernunionpayment.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <p><?php echo $this->getMethod()->getTitle() ?></p>
2
+ <?php if($this->getInfo()->getAdditionalData()): ?>
3
+ <?php if($this->getPayableTo()): ?>
4
+ <p><strong><?php echo $this->__('Payment Information:') ?></strong> <?php echo $this->htmlEscape($this->getPayableTo()) ?></p>
5
+ <?php endif; ?>
6
+ <?php endif; ?>
app/design/frontend/default/default/template/westernunionpayment/form/westernunionpayment.phtml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <ul class="form-list checkmo-list" id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none">
2
+ <?php if ($this->getMethod()->getPayableTo()): ?>
3
+ <li><?php echo Mage::helper('payment')->__('<label>Payment Information:</label> %s', $this->getMethod()->getPayableTo()) ?></li>
4
+ <?php endif; ?>
5
+ </ul>
app/design/frontend/default/default/template/westernunionpayment/info/westernunionpayment.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <p><?php echo $this->getMethod()->getTitle() ?></p>
2
+ <?php if($this->getInfo()->getAdditionalData()): ?>
3
+ <?php if($this->getPayableTo()): ?>
4
+ <p><strong><?php echo $this->__('Payment Information:') ?></strong> <?php echo $this->htmlEscape($this->getPayableTo()) ?></p>
5
+ <?php endif; ?>
6
+ <?php endif; ?>
app/etc/modules/Atwix_WesternUnionPayment.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Atwix_WesternUnionPayment>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <depends>
8
+ <Mage_Payment />
9
+ </depends>
10
+ </Atwix_WesternUnionPayment>
11
+ </modules>
12
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Atwix_Western_Union_Payment_Module</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>GPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Atwix Western Union Payment Module</summary>
10
+ <description>Atwix Western Union Payment Module</description>
11
+ <notes>Atwix Western Union Payment module adds a new Payment Method for Magento.</notes>
12
+ <authors><author><name>atwix</name><user>auto-converted</user><email>info@atwix.com</email></author></authors>
13
+ <date>2011-04-27</date>
14
+ <time>10:50:20</time>
15
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="westernunionpayment"><dir name="info"><file name="westernunionpayment.phtml" hash="aa0b1aa54889aa6f5c9636d8c58bac3b"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="westernunionpayment"><dir name="form"><file name="westernunionpayment.phtml" hash="73e5e56301ff42a540f94bb7e8254d3d"/></dir><dir name="info"><file name="westernunionpayment.phtml" hash="aa0b1aa54889aa6f5c9636d8c58bac3b"/></dir></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Atwix"><dir name="WesternUnionPayment"><dir name="Block"><dir name="Form"><file name="Westernunionpayment.php" hash="95f61e1cdeb1d359a1bcaa46cdab88a2"/></dir><dir name="Info"><file name="Westernunionpayment.php" hash="5989ddd4f7f16149b5251404ec1c5c02"/></dir></dir><dir name="etc"><file name="config.xml" hash="f811bf52ed53b2c7cffed3f5d69a9d98"/><file name="system.xml" hash="82f69325b3d1548921a25378c331f69e"/></dir><dir name="Model"><file name="PaymentMethod.php" hash="979406f8bba02e8b2a755cf21e2db41a"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Atwix_WesternUnionPayment.xml" hash="1602ce163e7387c6daf838bef06757eb"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>