payitsimplepayment - Version 1.1.0

Version Notes

Added allowed countries configuration, added new error codes and extended information about them.

Download this release

Release Info

Developer Eric Benayoun
Extension payitsimplepayment
Version 1.1.0
Comparing to
See all releases


Code changes from version 1.0.5 to 1.1.0

app/code/community/PayItSimple/Payment/Model/Api.php CHANGED
@@ -105,7 +105,8 @@ class PayItSimple_Payment_Model_Api extends Mage_Core_Model_Abstract
105
if (!isset($result['Result'])) {
106
throw new ErrorException('Unknown result from gateway.', self::ERROR_UNKNOWN_GW_RESULT_CODE);
107
} elseif ($result['Result'] != 0) {
108
- throw new ErrorException($this->getGatewayError((int)$result['Result']) . $result['ResponseStatus'], (int)$result['Result']);
109
}
110
} catch (Zend_Http_Client_Exception $e) {
111
$this->setError(self::ERROR_HTTP_REQUEST, $e->getMessage());
@@ -189,26 +190,39 @@ class PayItSimple_Payment_Model_Api extends Mage_Core_Model_Abstract
189
$errors = array(
190
0 => 'The operation completed successfully',
191
4 => 'The operation was denied',
192
- 501 => 'Invalid credentials',
193
- 502 => 'Invalid installment plan number',
194
- 503 => 'Invalid installment plan status',
195
- 504 => 'Invalid card type',
196
- 505 => 'Invalid number of installments',
197
- 506 => 'Invalid amount format',
198
- 508 => 'Invalid country code',
199
- 509 => 'Invalid response URL',
200
- 510 => 'Invalid cardholder name format',
201
- 511 => 'This amount is not allowed',
202
- 520 => 'Invalid CVV (3-4 numbers)',
203
- 521 => 'Invalid card number (8-20 numbers)',
204
- 522 => 'Invalid expiration date (m=1-12,y=current year or higher)',
205
- 523 => 'Invalid consumer full name (min 2 words + min 2 characters for each word)',
206
- 524 => 'Invalid email (email format)',
207
- 525 => 'Invalid address (2-50 characters)',
208
- 526 => 'Invalid ZIP code (2-9 characters)',
209
- 599 => 'General error',
210
);
211
return (is_null($code)) ? $errors : $errors[$code];
212
}
213
-
214
}
105
if (!isset($result['Result'])) {
106
throw new ErrorException('Unknown result from gateway.', self::ERROR_UNKNOWN_GW_RESULT_CODE);
107
} elseif ($result['Result'] != 0) {
108
+ //throw new ErrorException($this->getGatewayError((int)$result['Result']) . $result['ResponseStatus'], (int)$result['Result']);
109
+ throw new ErrorException($result['ResponseStatus']['Message']."\n(".$result['ErrorAdditionalInfo'].")", (int)$result['Result']);
110
}
111
} catch (Zend_Http_Client_Exception $e) {
112
$this->setError(self::ERROR_HTTP_REQUEST, $e->getMessage());
190
$errors = array(
191
0 => 'The operation completed successfully',
192
4 => 'The operation was denied',
193
+ 501 => 'Invalid Credentials',
194
+ 502 => 'Invalid Installment Plan Number',
195
+ 503 => 'Invalid Installment Plan Status',
196
+ 504 => 'Card type not supported',
197
+ 505 => 'Invalid Number of Installments',
198
+ 506 => 'Invalid Amount Format',
199
+ 508 => 'Invalid Country Code',
200
+ 509 => 'Invalid Response URL',
201
+ 510 => 'Invalid Card holder Name',
202
+ 511 => 'Invalid Amount',
203
+ 520 => 'Invalid CVV',
204
+ 521 => 'Invalid Card Number',
205
+ 522 => 'Invalid Expiration Date ',
206
+ 523 => 'Invalid Consumer Full Name ',
207
+ 524 => 'Invalid Email Format',
208
+ 525 => 'Invalid Address ',
209
+ 526 => 'Invalid ZIP Code ',
210
+ 527 => 'Card bin not supported ',
211
+ 528 => 'Card issue country not supported',
212
+ 599 => 'General Error Occurred',
213
+ 600 => 'Gateway failed to process request',
214
+ 601 => 'Invalid ZIP Code ',
215
+ 602 => 'Invalid Address ',
216
+ 603 => 'Invalid CVV',
217
+ 604 => 'Invalid Expiration Date ',
218
+ 606 => 'Invalid Address or Zip',
219
+ 607 => 'Invalid card number',
220
+ 608 => 'Problem with card',
221
+ 609 => 'Insufficient funds',
222
+ 610 => 'Credit card was declined',
223
+ 630 => 'Failed to connect to gateway',
224
+ 640 => 'Problem with merchant details on gateway',
225
);
226
return (is_null($code)) ? $errors : $errors[$code];
227
}
228
}
app/code/community/PayItSimple/Payment/Model/PisMethod.php CHANGED
@@ -1,10 +1,10 @@
1
<?php
2
class PayItSimple_Payment_Model_PisMethod extends Mage_Payment_Model_Method_Cc
3
{
4
- protected $_code = 'pis_cc';
5
protected $_canSaveCc = true;
6
- protected $_formBlockType = 'pis_payment/form_pis';
7
- protected $_infoBlockType = 'pis_payment/info_pis';
8
protected $_canAuthorize = true;
9
protected $_canCapture = true;
10
protected $_canCapturePartial = false;
@@ -164,7 +164,7 @@ class PayItSimple_Payment_Model_PisMethod extends Mage_Payment_Model_Method_Cc
164
'Email' => $order->getCustomerEmail(),
165
'AvsAddress' => $address,
166
'AvsZip' => $billingaddress->getData('postcode'),
167
- 'CountryId' => '840', // USA only
168
'AmountBeforeFees' => $amount,
169
'CardHolder' => $billingaddress->getData('firstname')
170
. ' ' . $billingaddress->getData('lastname'),
@@ -228,5 +228,35 @@ class PayItSimple_Payment_Model_PisMethod extends Mage_Payment_Model_Method_Cc
228
return $this->getConfigData('api_url');
229
}
230
231
-
232
}
1
<?php
2
class PayItSimple_Payment_Model_PisMethod extends Mage_Payment_Model_Method_Cc
3
{
4
+ protected $_code = 'pis_cc';
5
protected $_canSaveCc = true;
6
+ protected $_formBlockType = 'pis_payment/form_pis';
7
+ protected $_infoBlockType = 'pis_payment/info_pis';
8
protected $_canAuthorize = true;
9
protected $_canCapture = true;
10
protected $_canCapturePartial = false;
164
'Email' => $order->getCustomerEmail(),
165
'AvsAddress' => $address,
166
'AvsZip' => $billingaddress->getData('postcode'),
167
+ 'CountryId' => $this->getCountryCodePIS($billingaddress->getCountryId()),
168
'AmountBeforeFees' => $amount,
169
'CardHolder' => $billingaddress->getData('firstname')
170
. ' ' . $billingaddress->getData('lastname'),
228
return $this->getConfigData('api_url');
229
}
230
231
+ public function getCountryCodePIS($countryCode)
232
+ {
233
+ $countryIds = array(
234
+ 'AF' => 4,'AX' => 248,'AL' => 8,'DZ' => 12,'AS' => 16,'AD' => 20,'AO' => 24,'AI' => 660,'AQ' => 10,'AG' => 28,'AR' => 32,
235
+ 'AM' => 51,'AW' => 533,'AU' => 36,'AT' => 40,'AZ' => 31,'BS' => 44,'BH' => 48,'BD' => 50,'BB' => 52,'BY' => 112,'BE' => 56,
236
+ 'BZ' => 84,'BJ' => 204,'BM' => 60,'BT' => 64,'BO' => 68,'BA' => 70,'BW' => 72,'BV' => 74,'BR' => 76,'IO' => 86,'VG' => 92,
237
+ 'BN' => 96,'BG' => 100,'BF' => 854,'BI' => 108,'KH' => 116,'CM' => 120,'CA' => 124,'CV' => 132,'KY' => 136,'CF' => 140,
238
+ 'TD' => 148,'CL' => 152,'CN' => 156,'CX' => 162,'CC' => 166,'CO' => 170,'KM' => 174,'CG' => 180,'CD' => 178,'CK' => 184,
239
+ 'CR' => 188,'CI' => 384,'HR' => 191,'CU' => 192,'CY' => 196,'CZ' => 203,'DK' => 208,'DJ' => 262,'DM' => 212,'DO' => 214,
240
+ 'EC' => 218,'EG' => 818,'SV' => 222,'GQ' => 226,'ER' => 232,'EE' => 233,'ET' => 231,'FK' => 238,'FO' => 234,'FJ' => 242,
241
+ 'FI' => 246,'FR' => 250,'GF' => 254,'PF' => 258,'TF' => 260,'GA' => 266,'GM' => 270,'GE' => 268,'DE' => 276,'GH' => 288,
242
+ 'GI' => 292,'GR' => 300,'GL' => 304,'GD' => 308,'GP' => 312,'GU' => 316,'GT' => 320,'GG' => 831,'GN' => 324,'GW' => 624,
243
+ 'GY' => 328,'HT' => 332,'HM' => 334,'HN' => 340,'HK' => 344,'HU' => 348,'IS' => 352,'IN' => 356,'ID' => 360,'IR' => 364,
244
+ 'IQ' => 368,'IE' => 372,'IM' => 833,'IL' => 376,'IT' => 380,'JM' => 388,'JP' => 392,'JE' => 832,'JO' => 400,'KZ' => 398,
245
+ 'KE' => 404,'KI' => 296,'KW' => 414,'KG' => 417,'LA' => 418,'LV' => 428,'LB' => 422,'LS' => 426,'LR' => 430,'LY' => 434,
246
+ 'LI' => 438,'LT' => 440,'LU' => 442,'MO' => 446,'MK' => 807,'MG' => 450,'MW' => 454,'MY' => 458,'MV' => 462,'ML' => 466,
247
+ 'MT' => 470,'MH' => 584,'MQ' => 474,'MR' => 478,'MU' => 480,'YT' => 175,'MX' => 484,'FM' => 583,'MD' => 498,'MC' => 492,
248
+ 'MN' => 496,'ME' => 499,'MS' => 500,'MA' => 504,'MZ' => 508,'MM' => 104,'NA' => 516,'NR' => 520,'NP' => 524,'NL' => 528,
249
+ 'AN' => 530,'NC' => 540,'NZ' => 554,'NI' => 558,'NE' => 562,'NG' => 566,'NU' => 570,'NF' => 574,'MP' => 580,'KP' => 408,
250
+ 'NO' => 578,'OM' => 512,'PK' => 586,'PW' => 585,'PS' => 275,'PA' => 591,'PG' => 598,'PY' => 600,'PE' => 604,'PH' => 608,
251
+ 'PN' => 612,'PL' => 616,'PT' => 620,'PR' => 630,'QA' => 634,'RE' => 638,'RO' => 642,'RU' => 643,'RW' => 646,'BL' => '',
252
+ 'SH' => 654,'KN' => 659,'LC' => 662,'MF' => '','PM' => 666,'WS' => 882,'SM' => 674,'ST' => 678,'SA' => 682,'SN' => 686,
253
+ 'RS' => 688,'SC' => 690,'SL' => 694,'SG' => 702,'SK' => 703,'SI' => 705,'SB' => 90,'SO' => 706,'ZA' => 710,'GS' => 239,
254
+ 'KR' => 410,'ES' => 724,'LK' => 144,'VC' => 670,'SD' => 736,'SR' => 740,'SJ' => 744,'SZ' => 748,'SE' => 754,'CH' => 756,
255
+ 'SY' => 760,'TW' => 158,'TJ' => 762,'TZ' => 834,'TH' => 764,'TL' => 626,'TG' => 768,'TK' => 772,'TO' => 776,'TT' => 780,
256
+ 'TN' => 788,'TR' => 792,'TM' => 795,'TC' => 796,'TV' => 798,'UG' => 800,'UA' => 804,'AE' => 784,'GB' => 826,'US' => 840,
257
+ 'UY' => 858,'UM' => 581,'VI' => 850,'UZ' => 860,'VU' => 548,'VA' => 336,'VE' => 862,'VN' => 704,'WF' => 876,'EH' => 732,
258
+ 'YE' => 887,'ZM' => 894,'ZW' => 716,
259
+ );
260
+ return ($countryIds[$countryCode]) ? $countryIds[$countryCode] : 0;
261
+ }
262
}
app/code/community/PayItSimple/Payment/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
<config>
3
<modules>
4
<PayItSimple_Payment>
5
- <version>1.0.5</version>
6
</PayItSimple_Payment>
7
</modules>
8
<frontend>
@@ -111,7 +111,7 @@
111
<sandbox_flag>0</sandbox_flag>
112
<debug>0</debug>
113
<cctypes>MC,VI</cctypes>
114
- <allowspecific>1</allowspecific>
115
<specificcountry>US</specificcountry>
116
<centinel>0</centinel>
117
<useccv>1</useccv>
2
<config>
3
<modules>
4
<PayItSimple_Payment>
5
+ <version>1.1.0</version>
6
</PayItSimple_Payment>
7
</modules>
8
<frontend>
111
<sandbox_flag>0</sandbox_flag>
112
<debug>0</debug>
113
<cctypes>MC,VI</cctypes>
114
+ <allowspecific>0</allowspecific>
115
<specificcountry>US</specificcountry>
116
<centinel>0</centinel>
117
<useccv>1</useccv>
app/code/community/PayItSimple/Payment/etc/system.xml CHANGED
@@ -20,6 +20,25 @@
20
<show_in_website>1</show_in_website>
21
<show_in_store>1</show_in_store>
22
</active>
23
<title translate="label">
24
<label>Title</label>
25
<frontend_type>text</frontend_type>
20
<show_in_website>1</show_in_website>
21
<show_in_store>1</show_in_store>
22
</active>
23
+ <allowspecific translate="label">
24
+ <label>Payment from Applicable Countries</label>
25
+ <frontend_type>allowspecific</frontend_type>
26
+ <sort_order>5</sort_order>
27
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
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
+ </allowspecific>
32
+ <specificcountry translate="label">
33
+ <label>Payment from Specific Countries</label>
34
+ <frontend_type>multiselect</frontend_type>
35
+ <sort_order>6</sort_order>
36
+ <source_model>adminhtml/system_config_source_country</source_model>
37
+ <show_in_default>1</show_in_default>
38
+ <show_in_website>1</show_in_website>
39
+ <show_in_store>0</show_in_store>
40
+ <can_be_empty>1</can_be_empty>
41
+ </specificcountry>
42
<title translate="label">
43
<label>Title</label>
44
<frontend_type>text</frontend_type>
package.xml CHANGED
@@ -1,6 +1,6 @@
1
<?xml version="1.0"?>
2
- <package><name>payitsimplepayment</name><version>1.0.5</version><stability>stable</stability><license>OSL</license><channel>community</channel><extends></extends><summary>Offer your customers interest-free credit card installment payments. Official extension.</summary><description>This extension allows ecommerce merchants to add an additional payment method to your checkout process. A PayItSimple button is added to your website for fast and easy checkout.&lt;br /&gt;
3
It was carefully designed to meet all Magento best development practices and is compatible with all other extensions. This extension is free of charge.&lt;br /&gt;&lt;br /&gt;
4
5
&lt;h3&gt;Signup for FREE&lt;/h3&gt;
6
- &lt;a href="http://payitsimple.com/register/"&gt;Signup with PayItSimple for FREE and start offering your customers interest-free installment payments on their existing credit cards.&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;</description><notes>Some text changes.</notes><authors><author><name>Eric Benayoun</name><user>ericbena</user><email>ericb@payitsimple.com</email></author></authors><date>2015-01-30</date><time>13:41:04</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="PayItSimple"><dir name="Payment"><dir name="etc"><file name="config.xml" hash="d19997589ae50751e8725f05255b7b3d"/><file name="system.xml" hash="c8afdb5921e81f4c4b70146b6d00cab1"/></dir><dir name="sql"><dir name="pis_payment_setup"><file name="mysql4-install-1.0.0.php" hash="8a7677c4ec0aa7906fabbba92efe1eed"/></dir></dir><dir name="Model"><file name="Api.php" hash="70ff5eac35f63af69678a31033b3c341"/><file name="PisMethod.php" hash="521455c095a9c4c34459ca862e822395"/><dir name="Source"><file name="Action.php" hash="1390fb3dce78cf8eff1118df2ee5b997"/><file name="Cctype.php" hash="7f77a0c6729d0896c8ec250bb7f4fd49"/><file name="Installments.php" hash="65b727e639308cba4241662a2040d6f3"/></dir></dir><dir name="Block"><dir name="Form"><file name="Pis.php" hash="1b7804b11f2119ddd64a464ddd882a41"/></dir><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Notification.php" hash="27ac86d84fe3927c28abc6da018736cd"/><dir name="Form"><file name="Button.php" hash="1d46f9171f8b9017aff4bda66c23f160"/></dir></dir></dir></dir><dir name="Info"><file name="Pis.php" hash="42cb4edb5ff208a1a3ee7612579a6165"/></dir></dir><dir name="controllers"><file name="PaymentController.php" hash="598f81b5afec4b73d2d14bf4a309e848"/><dir name="Adminhtml"><file name="PayitsimpleController.php" hash="4e7a1a3d4dfca38656aa32da9ef70df8"/></dir></dir><dir name="Helper"><file name="Data.php" hash="1fba2ce41eb4f554e365d82424323ccd"/></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="PayItSimple_Payment.xml" hash="608e164d747a215efa2cf4d062693236"/></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="payitsimple"><file name="help.phtml" hash="78a8c27a89e6a64c2b4a8222ccbc0349"/><file name="terms.phtml" hash="6dd4a1a66a29edbb6deaede13c3f159e"/><dir name="form"><file name="method_faq.phtml" hash="6d64f3be6f4a8bd8c3e84a0977b46705"/><file name="pis.phtml" hash="e6d8fda242efbb2874a28b720696af4e"/></dir></dir></dir><dir name="layout"><file name="pis_payment.xml" hash="9f0521aea108f9e3f9b9c777c6aefee3"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="payitsimple"><dir name="system"><dir name="config"><file name="button.phtml" hash="b59617f95422a9db03aa410055066df3"/><file name="notification.phtml" hash="27ef3ed68855ba5cd8736df38229e5bf"/></dir></dir></dir></dir><dir name="layout"><file name="payitsimple_notification.xml" hash="4ace8359849725965c7ad2e13bf64f07"/></dir></dir></dir></dir></dir></dir></target></contents></package>
1
<?xml version="1.0"?>
2
+ <package><name>payitsimplepayment</name><version>1.1.0</version><stability>stable</stability><license>OSL</license><channel>community</channel><extends></extends><summary>Offer your customers interest-free credit card installment payments. Official extension.</summary><description>This extension allows ecommerce merchants to add an additional payment method to your checkout process. A PayItSimple button is added to your website for fast and easy checkout.&lt;br /&gt;
3
It was carefully designed to meet all Magento best development practices and is compatible with all other extensions. This extension is free of charge.&lt;br /&gt;&lt;br /&gt;
4
5
&lt;h3&gt;Signup for FREE&lt;/h3&gt;
6
+ &lt;a href="http://payitsimple.com/register/"&gt;Signup with PayItSimple for FREE and start offering your customers interest-free installment payments on their existing credit cards.&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;</description><notes>Added allowed countries configuration, added new error codes and extended information about them.</notes><authors><author><name>Eric Benayoun</name><user>ericbena</user><email>ericb@payitsimple.com</email></author></authors><date>2015-07-29</date><time>6:40:09</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="payitsimple"><dir name="system"><dir name="config"><file name="button.phtml" hash="b59617f95422a9db03aa410055066df3"/><file name="notification.phtml" hash="27ef3ed68855ba5cd8736df38229e5bf"/></dir></dir></dir></dir><dir name="layout"><file name="payitsimple_notification.xml" hash="4ace8359849725965c7ad2e13bf64f07"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="payitsimple"><file name="help.phtml" hash="78a8c27a89e6a64c2b4a8222ccbc0349"/><file name="terms.phtml" hash="6dd4a1a66a29edbb6deaede13c3f159e"/><dir name="form"><file name="method_faq.phtml" hash="6d64f3be6f4a8bd8c3e84a0977b46705"/><file name="pis.phtml" hash="e6d8fda242efbb2874a28b720696af4e"/></dir></dir></dir><dir name="layout"><file name="pis_payment.xml" hash="9f0521aea108f9e3f9b9c777c6aefee3"/></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="PayItSimple_Payment.xml" hash="608e164d747a215efa2cf4d062693236"/></dir></dir><dir name="code"><dir name="community"><dir name="PayItSimple"><dir name="Payment"><dir name="sql"><dir name="pis_payment_setup"><file name="mysql4-install-1.0.0.php" hash="8a7677c4ec0aa7906fabbba92efe1eed"/></dir></dir><dir name="Block"><dir name="Info"><file name="Pis.php" hash="42cb4edb5ff208a1a3ee7612579a6165"/></dir><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Notification.php" hash="27ac86d84fe3927c28abc6da018736cd"/><dir name="Form"><file name="Button.php" hash="1d46f9171f8b9017aff4bda66c23f160"/></dir></dir></dir></dir><dir name="Form"><file name="Pis.php" hash="1b7804b11f2119ddd64a464ddd882a41"/></dir></dir><dir name="Helper"><file name="Data.php" hash="1fba2ce41eb4f554e365d82424323ccd"/></dir><dir name="etc"><file name="config.xml" hash="1f09389b3a71e3e8e9c270abcdac7e5e"/><file name="system.xml" hash="b9a2f781c10464acfb3cbc48f86aaa5d"/></dir><dir name="controllers"><file name="PaymentController.php" hash="598f81b5afec4b73d2d14bf4a309e848"/><dir name="Adminhtml"><file name="PayitsimpleController.php" hash="4e7a1a3d4dfca38656aa32da9ef70df8"/></dir></dir><dir name="Model"><file name="Api.php" hash="51bd012b7d576fb782727662ac532ec8"/><file name="PisMethod.php" hash="9f2265397225368969926d73d7d6617a"/><dir name="Source"><file name="Action.php" hash="1390fb3dce78cf8eff1118df2ee5b997"/><file name="Cctype.php" hash="7f77a0c6729d0896c8ec250bb7f4fd49"/><file name="Installments.php" hash="65b727e639308cba4241662a2040d6f3"/></dir></dir></dir></dir></dir></dir></dir></target></contents></package>