Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php |
— | — | @@ -50,47 +50,20 @@ |
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
54 | | - * Define error_map |
| 54 | + * Define dataConstraints |
55 | 55 | * |
56 | 56 | * @todo |
57 | | - * - Add: Error messages |
58 | | - */ |
59 | | - public function defineErrorMap() { |
60 | | - |
61 | | - $this->error_map = array( |
62 | | - 0 => 'globalcollect_gateway-response-default', |
63 | | - 430452 => 'globalcollect_gateway-response-default', // Not authorised :: This message was generated when trying to attempt a direct debit transaction from Belgium. |
64 | | - 430900 => 'globalcollect_gateway-response-default', // NO VALID PROVIDERS FOUND FOR COMBINATION MERCHANTID: NNNN, PAYMENTPRODUCT: NNN, COUNTRYCODE: XX, CURRENCYCODE: XXX |
65 | | - |
66 | | - // Internal messages |
67 | | - 'internal-0000' => 'donate_interface-processing-error', // Failed failed pre-process checks. |
68 | | - 'internal-0001' => 'donate_interface-processing-error', // Transaction could not be processed due to an internal error. |
69 | | - 'internal-0002' => 'donate_interface-processing-error', // Communication failure |
70 | | - |
71 | | - // Do bank validation messages |
72 | | - //'dbv-50' => 'globalcollect_gateway-response-dbv-50', // Account number format incorrect |
73 | | - //'dbv-80' => 'globalcollect_gateway-response-dbv-80', // Account details missing |
74 | | - //'dbv-330' => 'globalcollect_gateway-response-dbv-330', // Check digit format is incorrect |
75 | | - //'dbv-340' => 'globalcollect_gateway-response-dbv-340', // Branch code not submitted |
76 | | - |
77 | | - ); |
78 | | - } |
79 | | - |
80 | | - /** |
81 | | - * Define data_constraints |
82 | | - * |
83 | | - * @todo |
84 | 57 | * - card_type: what do we do about this one? It is also payment_product. |
85 | 58 | * |
86 | 59 | */ |
87 | 60 | public function defineDataConstraints() { |
88 | 61 | |
89 | | - $this->data_constraints = array( |
| 62 | + $this->dataConstraints = array( |
90 | 63 | |
91 | 64 | // General fields |
92 | 65 | |
93 | 66 | //'ACCOUNTHOLDER' => 'account_holder', AN50 |
94 | | - 'account_holder' => array('type' => 'alphanumeric', 'length' => 50, ), |
| 67 | + 'account_holder' => array( 'type' => 'alphanumeric', 'length' => 50, ), |
95 | 68 | |
96 | 69 | //'ACCOUNTNAME' => 'account_name' AN35 |
97 | 70 | 'account_name' => array( 'type' => 'alphanumeric', 'length' => 35, ), |
— | — | @@ -141,8 +114,8 @@ |
142 | 115 | //'BRANCHCODE' => 'branch_code' N5 |
143 | 116 | 'branch_code' => array( 'type' => 'numeric', 'length' => 5, ), |
144 | 117 | |
145 | | - //'CITY' => 'city' AN50 |
146 | | - 'city' => array( 'type' => 'alphanumeric', 'length' => 50, ), |
| 118 | + //'CITY' => 'city' AN40 |
| 119 | + 'city' => array( 'type' => 'alphanumeric', 'length' => 40, ), |
147 | 120 | |
148 | 121 | //'COUNTRYCODE' => 'country' AN2 |
149 | 122 | 'country' => array( 'type' => 'alphanumeric', 'length' => 2, ), |
— | — | @@ -251,6 +224,33 @@ |
252 | 225 | 'zip' => array( 'type' => 'alphanumeric', 'length' => 10, ), |
253 | 226 | ); |
254 | 227 | } |
| 228 | + |
| 229 | + /** |
| 230 | + * Define error_map |
| 231 | + * |
| 232 | + * @todo |
| 233 | + * - Add: Error messages |
| 234 | + */ |
| 235 | + public function defineErrorMap() { |
| 236 | + |
| 237 | + $this->error_map = array( |
| 238 | + 0 => 'globalcollect_gateway-response-default', |
| 239 | + 430452 => 'globalcollect_gateway-response-default', // Not authorised :: This message was generated when trying to attempt a direct debit transaction from Belgium. |
| 240 | + 430900 => 'globalcollect_gateway-response-default', // NO VALID PROVIDERS FOUND FOR COMBINATION MERCHANTID: NNNN, PAYMENTPRODUCT: NNN, COUNTRYCODE: XX, CURRENCYCODE: XXX |
| 241 | + |
| 242 | + // Internal messages |
| 243 | + 'internal-0000' => 'donate_interface-processing-error', // Failed failed pre-process checks. |
| 244 | + 'internal-0001' => 'donate_interface-processing-error', // Transaction could not be processed due to an internal error. |
| 245 | + 'internal-0002' => 'donate_interface-processing-error', // Communication failure |
| 246 | + |
| 247 | + // Do bank validation messages |
| 248 | + //'dbv-50' => 'globalcollect_gateway-response-dbv-50', // Account number format incorrect |
| 249 | + //'dbv-80' => 'globalcollect_gateway-response-dbv-80', // Account details missing |
| 250 | + //'dbv-330' => 'globalcollect_gateway-response-dbv-330', // Check digit format is incorrect |
| 251 | + //'dbv-340' => 'globalcollect_gateway-response-dbv-340', // Branch code not submitted |
| 252 | + |
| 253 | + ); |
| 254 | + } |
255 | 255 | |
256 | 256 | /** |
257 | 257 | * Define var_map |
— | — | @@ -1538,12 +1538,6 @@ |
1539 | 1539 | public function defineStagedVars() { |
1540 | 1540 | //OUR field names. |
1541 | 1541 | $this->staged_vars = array( |
1542 | | - 'fname', |
1543 | | - 'lname', |
1544 | | - 'street', |
1545 | | - 'city', |
1546 | | - 'state', |
1547 | | - 'email', |
1548 | 1542 | 'amount', |
1549 | 1543 | 'card_type', |
1550 | 1544 | //'card_num', |
— | — | @@ -1556,36 +1550,6 @@ |
1557 | 1551 | ); |
1558 | 1552 | } |
1559 | 1553 | |
1560 | | - protected function stage_fname( $type = 'request' ) { |
1561 | | - // Truncate to 15 characters due to GlobalCollect's field length limit |
1562 | | - $this->staged_data['fname'] = substr( $this->staged_data['fname'], 0, 15 ); |
1563 | | - } |
1564 | | - |
1565 | | - protected function stage_lname( $type = 'request' ) { |
1566 | | - // Truncate to 35 characters due to GlobalCollect's field length limit |
1567 | | - $this->staged_data['lname'] = substr( $this->staged_data['lname'], 0, 35 ); |
1568 | | - } |
1569 | | - |
1570 | | - protected function stage_street( $type = 'request' ) { |
1571 | | - // Truncate to 50 characters due to GlobalCollect's field length limit |
1572 | | - $this->staged_data['street'] = substr( $this->staged_data['street'], 0, 50 ); |
1573 | | - } |
1574 | | - |
1575 | | - protected function stage_city( $type = 'request' ) { |
1576 | | - // Truncate to 40 characters due to GlobalCollect's field length limit |
1577 | | - $this->staged_data['city'] = substr( $this->staged_data['city'], 0, 40 ); |
1578 | | - } |
1579 | | - |
1580 | | - protected function stage_state( $type = 'request' ) { |
1581 | | - // Truncate to 35 characters due to GlobalCollect's field length limit |
1582 | | - $this->staged_data['state'] = substr( $this->staged_data['state'], 0, 35 ); |
1583 | | - } |
1584 | | - |
1585 | | - protected function stage_email( $type = 'request' ) { |
1586 | | - // Truncate to 70 characters due to GlobalCollect's field length limit |
1587 | | - $this->staged_data['email'] = substr( $this->staged_data['email'], 0, 70 ); |
1588 | | - } |
1589 | | - |
1590 | 1554 | protected function stage_language( $type = 'request' ) { |
1591 | 1555 | $language = strtolower( $this->staged_data['language'] ); |
1592 | 1556 | |
— | — | @@ -1727,7 +1691,7 @@ |
1728 | 1692 | $this->var_map['PAYMENTPRODUCTID'] = 'payment_product'; |
1729 | 1693 | $this->var_map['COUNTRYCODEBANK'] = 'country'; |
1730 | 1694 | |
1731 | | - $this->data_constraints['iban']['length'] = 21; |
| 1695 | + $this->dataConstraints['iban']['length'] = 21; |
1732 | 1696 | |
1733 | 1697 | // Direct debit has different required fields for each paymentproductid. |
1734 | 1698 | $this->addKeysToTransactionForSubmethod( $payment_submethod ); |
— | — | @@ -1755,13 +1719,23 @@ |
1756 | 1720 | |
1757 | 1721 | /* Bank transfer */ |
1758 | 1722 | case 'bt': |
| 1723 | + |
| 1724 | + // Brazil |
| 1725 | + if ( $this->staged_data['country'] == 'BR' ) { |
| 1726 | + $this->dataConstraints['direct_debit_text']['city'] = 50; |
| 1727 | + } |
| 1728 | + |
| 1729 | + // Korea - Manual does not specify North or South |
| 1730 | + if ( $this->staged_data['country'] == 'KR' ) { |
| 1731 | + $this->dataConstraints['direct_debit_text']['city'] = 50; |
| 1732 | + } |
1759 | 1733 | $this->staged_data['payment_product'] = $this->payment_submethods[ $payment_submethod ]['paymentproductid']; |
1760 | 1734 | $this->var_map['PAYMENTPRODUCTID'] = 'payment_product'; |
1761 | 1735 | break; |
1762 | 1736 | |
1763 | 1737 | /* Direct Debit */ |
1764 | 1738 | case 'dd_nl': |
1765 | | - $this->data_constraints['direct_debit_text']['length'] = 32; |
| 1739 | + $this->dataConstraints['direct_debit_text']['length'] = 32; |
1766 | 1740 | |
1767 | 1741 | $this->setupStagePaymentMethodForDirectDebit( $payment_submethod, $type); |
1768 | 1742 | break; |
— | — | @@ -1771,7 +1745,7 @@ |
1772 | 1746 | $this->setupStagePaymentMethodForDirectDebit( $payment_submethod, $type); |
1773 | 1747 | break; |
1774 | 1748 | case 'dd_at': |
1775 | | - $this->data_constraints['direct_debit_text']['length'] = 28; |
| 1749 | + $this->dataConstraints['direct_debit_text']['length'] = 28; |
1776 | 1750 | |
1777 | 1751 | $this->setupStagePaymentMethodForDirectDebit( $payment_submethod, $type); |
1778 | 1752 | break; |
— | — | @@ -1788,18 +1762,18 @@ |
1789 | 1763 | $this->setupStagePaymentMethodForDirectDebit( $payment_submethod, $type); |
1790 | 1764 | break; |
1791 | 1765 | case 'dd_es': |
1792 | | - $this->data_constraints['direct_debit_text']['length'] = 40; |
| 1766 | + $this->dataConstraints['direct_debit_text']['length'] = 40; |
1793 | 1767 | |
1794 | 1768 | $this->setupStagePaymentMethodForDirectDebit( $payment_submethod, $type); |
1795 | 1769 | break; |
1796 | 1770 | case 'dd_fr': |
1797 | | - $this->data_constraints['direct_debit_text']['length'] = 18; |
| 1771 | + $this->dataConstraints['direct_debit_text']['length'] = 18; |
1798 | 1772 | |
1799 | 1773 | $this->setupStagePaymentMethodForDirectDebit( $payment_submethod, $type); |
1800 | 1774 | break; |
1801 | 1775 | case 'dd_it': |
1802 | | - $this->data_constraints['bank_check_digit']['length'] = 1; |
1803 | | - $this->data_constraints['direct_debit_text']['length'] = 32; |
| 1776 | + $this->dataConstraints['bank_check_digit']['length'] = 1; |
| 1777 | + $this->dataConstraints['direct_debit_text']['length'] = 32; |
1804 | 1778 | |
1805 | 1779 | $this->setupStagePaymentMethodForDirectDebit( $payment_submethod, $type); |
1806 | 1780 | break; |