Skip to content

Commit

Permalink
Merge pull request #15 from magently/master
Browse files Browse the repository at this point in the history
New version: 0.7.4
  • Loading branch information
nicklloyd committed Nov 24, 2015
2 parents 017732d + 3211807 commit f251484
Show file tree
Hide file tree
Showing 12 changed files with 478 additions and 267 deletions.
12 changes: 12 additions & 0 deletions app/code/community/Sign2pay/Payment/Block/Form/Sign2pay.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ protected function _construct()
{
parent::_construct();
$this->setTemplate('sign2pay/form/sign2pay.phtml');

if (Mage::getStoreConfig('payment/sign2pay/logo_enabled', Mage::app()->getStore())) {
$this
->setMethodLabelAfterHtml($this->_getMarkHtml())
->setMethodTitle(' ' . Mage::getStoreConfig('payment/sign2pay/title', Mage::app()->getStore()));
}
}

protected function _prepareLayout()
Expand All @@ -21,6 +27,12 @@ protected function _prepareLayout()
}
}

protected function _getMarkHtml()
{
$height = Mage::getStoreConfig('payment/sign2pay/logo_width', Mage::app()->getStore());
return '<img id="sign2pay-mark" src="' . Mage::helper('sign2pay')->getPaymentLogoUrl() . '" height="' . $height . '" />';
}

public function getOrderId()
{
$lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
Expand Down
4 changes: 1 addition & 3 deletions app/code/community/Sign2pay/Payment/Block/Redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ protected function _prepareLayout()
parent::_prepareLayout();

$this->setTemplate('sign2pay/redirect.phtml');
Mage::helper('sign2pay')->attachPaymentScripts(array(
'initialize' => true
));
Mage::helper('sign2pay')->attachPaymentScripts();

return $this;
}
Expand Down
269 changes: 269 additions & 0 deletions app/code/community/Sign2pay/Payment/Helper/CountryCodes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
<?php

class Sign2pay_Payment_Helper_CountryCodes extends Mage_Core_Helper_Abstract
{
/**
* Get calling code for specified country
*
* @param string containing two-digit country code
*
* @return calling code number or null
*/
public function getCountryCallingCode($country)
{
$country_codes = array(
'AF' => '93',
'AX' => '35818',
'NL' => '31',
'AN' => '599',
'AL' => '355',
'DZ' => '213',
'AS' => '685',
'AD' => '376',
'AO' => '244',
'AI' => '1264',
'AQ' => '672',
'AG' => '1268',
'AE' => '971',
'AR' => '54',
'AM' => '374',
'AW' => '297',
'AU' => '61',
'AZ' => '994',
'BS' => '1242',
'BH' => '973',
'BD' => '880',
'BB' => '1242',
'BE' => '32',
'BZ' => '501',
'BJ' => '229',
'BM' => '1441',
'BT' => '975',
'BO' => '591',
'BA' => '387',
'BW' => '267',
'BV' => '47',
'BR' => '55',
'GB' => '44',
'IO' => '246',
'VG' => '1284',
'BN' => '673',
'BG' => '359',
'BF' => '226',
'BI' => '257',
'KY' => '1345',
'CL' => '56',
'CK' => '682',
'CR' => '506',
'DJ' => '253',
'DM' => '1767',
'DO' => '1809',
'EC' => '593',
'EG' => '20',
'SV' => '503',
'ER' => '291',
'ES' => '34',
'ZA' => '27',
'GS' => '500',
'KR' => '82',
'ET' => '251',
'FK' => '500',
'FJ' => '679',
'PH' => '63',
'FO' => '298',
'GA' => '241',
'GM' => '220',
'GE' => '995',
'GH' => '233',
'GI' => '350',
'GD' => '1473',
'GL' => '299',
'GP' => '590',
'GU' => '1671',
'GT' => '502',
'GG' => '44',
'GN' => '224',
'GW' => '245',
'GY' => '592',
'HT' => '509',
'HM' => '61',
'HN' => '504',
'HK' => '852',
'SJ' => '47',
'ID' => '62',
'IN' => '91',
'IQ' => '964',
'IR' => '98',
'IE' => '353',
'IS' => '354',
'IL' => '972',
'IT' => '39',
'TL' => '670',
'AT' => '43',
'JM' => '1876',
'JP' => '81',
'YE' => '967',
'JE' => '44',
'JO' => '962',
'CX' => '61',
'KH' => '855',
'CM' => '237',
'CA' => '1',
'CV' => '238',
'KZ' => '7',
'KE' => '254',
'CF' => '236',
'CN' => '86',
'KG' => '996',
'KI' => '686',
'CO' => '57',
'KM' => '269',
'CG' => '242',
'CD' => '243',
'CC' => '61',
'GR' => '30',
'HR' => '385',
'CU' => '53',
'KW' => '965',
'CY' => '357',
'LA' => '856',
'LV' => '371',
'LS' => '266',
'LB' => '961',
'LR' => '231',
'LY' => '218',
'LI' => '423',
'LT' => '370',
'LU' => '352',
'EH' => '21228',
'MO' => '853',
'MG' => '261',
'MK' => '389',
'MW' => '265',
'MV' => '960',
'MY' => '60',
'ML' => '223',
'MT' => '356',
'IM' => '44',
'MA' => '212',
'MH' => '692',
'MQ' => '596',
'MR' => '222',
'MU' => '230',
'YT' => '262',
'MX' => '52',
'FM' => '691',
'MD' => '373',
'MC' => '377',
'MN' => '976',
'ME' => '382',
'MS' => '1664',
'MZ' => '258',
'MM' => '95',
'NA' => '264',
'NR' => '674',
'NP' => '977',
'NI' => '505',
'NE' => '227',
'NG' => '234',
'NU' => '683',
'NF' => '672',
'NO' => '47',
'CI' => '255',
'OM' => '968',
'PK' => '92',
'PW' => '680',
'PS' => '970',
'PA' => '507',
'PG' => '675',
'PY' => '595',
'PE' => '51',
'PN' => '870',
'KP' => '850',
'MP' => '1670',
'PT' => '351',
'PR' => '1',
'PL' => '48',
'GQ' => '240',
'QA' => '974',
'FR' => '33',
'GF' => '594',
'PF' => '689',
'TF' => '33',
'RO' => '40',
'RW' => '250',
'SE' => '46',
'RE' => '262',
'SH' => '290',
'KN' => '1869',
'LC' => '1758',
'VC' => '1784',
'BL' => '590',
'MF' => '1599',
'PM' => '508',
'DE' => '49',
'SB' => '677',
'ZM' => '260',
'WS' => '685',
'SM' => '378',
'SA' => '966',
'SN' => '221',
'RS' => '381',
'SC' => '248',
'SL' => '232',
'SG' => '65',
'SK' => '421',
'SI' => '386',
'SO' => '252',
'LK' => '94',
'SD' => '249',
'FI' => '358',
'SR' => '594',
'CH' => '41',
'SZ' => '268',
'SY' => '963',
'ST' => '239',
'TJ' => '992',
'TW' => '886',
'TZ' => '255',
'DK' => '45',
'TH' => '66',
'TG' => '228',
'TK' => '690',
'TO' => '676',
'TT' => '1868',
'TN' => '216',
'TR' => '90',
'TM' => '993',
'TC' => '1649',
'TV' => '688',
'TD' => '235',
'CZ' => '420',
'UG' => '256',
'UA' => '380',
'HU' => '36',
'UY' => '598',
'NC' => '687',
'NZ' => '64',
'UZ' => '998',
'BY' => '375',
'VU' => '678',
'VA' => '39',
'VE' => '58',
'RU' => '7',
'VN' => '84',
'EE' => '372',
'WF' => '681',
'US' => '1',
'VI' => '1340',
'UM' => '1',
'ZW' => '263'
);

$country = strtoupper($country);
if (array_key_exists($country, $country_codes)) {
return $country_codes[$country];
}
return null;
}
}
Loading

0 comments on commit f251484

Please sign in to comment.