init
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
/**
|
||||
* Class Base_Constant
|
||||
*
|
||||
* @package WooCommerce\Payments
|
||||
*/
|
||||
|
||||
namespace WCPay\Constants;
|
||||
|
||||
use ReflectionClass;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Base constant class to hold common logic for all constants.
|
||||
*/
|
||||
abstract class Base_Constant implements \JsonSerializable {
|
||||
|
||||
/**
|
||||
* Enum value
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $value;
|
||||
|
||||
/**
|
||||
* Static objects cache.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $object_cache = [];
|
||||
|
||||
/**
|
||||
* Class constructor. Keep it private to only allow initializing from __callStatic()
|
||||
*
|
||||
* @param string $value Constant from class.
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
private function __construct( string $value ) {
|
||||
if ( $value instanceof static ) {
|
||||
$value = $value->get_value();
|
||||
} elseif ( ! defined( static::class . "::$value" ) ) {
|
||||
throw new \InvalidArgumentException( "Constant with name '$value' does not exist." );
|
||||
}
|
||||
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get enum class value.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_value() {
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare to enums.
|
||||
*
|
||||
* @param mixed $variable Constant object to compare.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
final public function equals( $variable = null ): bool {
|
||||
return $this === $variable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find constant in class by value.
|
||||
*
|
||||
* @param string $value Value to find.
|
||||
*
|
||||
* @return int|string
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function search( string $value ) {
|
||||
$class = new ReflectionClass( static::class );
|
||||
$key = array_search( $value, $class->getConstants(), true );
|
||||
if ( false === $key ) {
|
||||
throw new \InvalidArgumentException( "Constant with value '$value' does not exist." );
|
||||
}
|
||||
|
||||
return $key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to created enum from constant names like CLASS::ConstantName().
|
||||
*
|
||||
* @param string $name Name of property or function.
|
||||
* @param array $arguments Arguments of static call.
|
||||
*
|
||||
* @return static
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function __callStatic( $name, $arguments ) {
|
||||
if ( ! isset( static::$object_cache[ $name ] ) ) {
|
||||
// Instantiating constants by class name using the 'new static($name)' approach is integral to this method's functionality.
|
||||
// @phpstan-ignore-next-line.
|
||||
static::$object_cache[ $name ] = new static( $name );
|
||||
}
|
||||
return static::$object_cache[ $name ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get real enum value.
|
||||
*
|
||||
* @return mixed|string
|
||||
*/
|
||||
public function __toString() {
|
||||
return constant( \get_class( $this ) . '::' . $this->get_value() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the value which should be serialized to JSON.
|
||||
*
|
||||
* @return mixed|string
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize() {
|
||||
return $this->__toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
<?php
|
||||
/**
|
||||
* Class Country_Code
|
||||
*
|
||||
* @package WooCommerce\Payments
|
||||
*/
|
||||
|
||||
namespace WCPay\Constants;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Country Code constants
|
||||
*
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class Country_Code extends Base_Constant {
|
||||
const AFGHANISTAN = 'AF';
|
||||
const ALAND_ISLANDS = 'AX';
|
||||
const ALBANIA = 'AL';
|
||||
const ALGERIA = 'DZ';
|
||||
const AMERICAN_SAMOA = 'AS';
|
||||
const ANDORRA = 'AD';
|
||||
const ANGOLA = 'AO';
|
||||
const ANGUILLA = 'AI';
|
||||
const ANTARCTICA = 'AQ';
|
||||
const ANTIGUA_AND_BARBUDA = 'AG';
|
||||
const ARGENTINA = 'AR';
|
||||
const ARMENIA = 'AM';
|
||||
const ARUBA = 'AW';
|
||||
const AUSTRALIA = 'AU';
|
||||
const AUSTRIA = 'AT';
|
||||
const AZERBAIJAN = 'AZ';
|
||||
const BAHAMAS = 'BS';
|
||||
const BAHRAIN = 'BH';
|
||||
const BANGLADESH = 'BD';
|
||||
const BARBADOS = 'BB';
|
||||
const BELARUS = 'BY';
|
||||
const BELGIUM = 'BE';
|
||||
const BELIZE = 'BZ';
|
||||
const BENIN = 'BJ';
|
||||
const BERMUDA = 'BM';
|
||||
const BHUTAN = 'BT';
|
||||
const BOLIVIA = 'BO';
|
||||
const BOSNIA_AND_HERZEGOVINA = 'BA';
|
||||
const BOTSWANA = 'BW';
|
||||
const BOUVET_ISLAND = 'BV';
|
||||
const BRAZIL = 'BR';
|
||||
const BRITISH_INDIAN_OCEAN_TERRITORY = 'IO';
|
||||
const BRUNEI = 'BN';
|
||||
const BULGARIA = 'BG';
|
||||
const BURKINA_FASO = 'BF';
|
||||
const BURUNDI = 'BI';
|
||||
const CABO_VERDE = 'CV';
|
||||
const CAMBODIA = 'KH';
|
||||
const CAMEROON = 'CM';
|
||||
const CANADA = 'CA';
|
||||
const CARIBBEAN_NETHERLANDS = 'BQ';
|
||||
const CENTRAL_AFRICAN_REPUBLIC = 'CF';
|
||||
const CHAD = 'TD';
|
||||
const CHILE = 'CL';
|
||||
const CHINA = 'CN';
|
||||
const COCOS_KEELING_ISLANDS = 'CC';
|
||||
const COLOMBIA = 'CO';
|
||||
const COOK_ISLANDS = 'CK';
|
||||
const COMOROS = 'KM';
|
||||
const CONGO = 'CG';
|
||||
const COSTA_RICA = 'CR';
|
||||
const CROATIA = 'HR';
|
||||
const CUBA = 'CU';
|
||||
const CYPRUS = 'CY';
|
||||
const CZECHIA = 'CZ';
|
||||
const DEMOCRATIC_REPUBLIC_OF_THE_CONGO = 'CD';
|
||||
const DENMARK = 'DK';
|
||||
const DJIBOUTI = 'DJ';
|
||||
const DOMINICA = 'DM';
|
||||
const DOMINICAN_REPUBLIC = 'DO';
|
||||
const EAST_TIMOR = 'TL';
|
||||
const ECUADOR = 'EC';
|
||||
const EGYPT = 'EG';
|
||||
const EL_SALVADOR = 'SV';
|
||||
const EQUATORIAL_GUINEA = 'GQ';
|
||||
const ERITREA = 'ER';
|
||||
const ESTONIA = 'EE';
|
||||
const ESWATINI = 'SZ';
|
||||
const ETHIOPIA = 'ET';
|
||||
const FIJI = 'FJ';
|
||||
const FINLAND = 'FI';
|
||||
const FRANCE = 'FR';
|
||||
const GABON = 'GA';
|
||||
const GAMBIA = 'GM';
|
||||
const GEORGIA = 'GE';
|
||||
const GERMANY = 'DE';
|
||||
const GIBRALTAR = 'GI';
|
||||
const GHANA = 'GH';
|
||||
const GREECE = 'GR';
|
||||
const GRENADA = 'GD';
|
||||
const GUATEMALA = 'GT';
|
||||
const GUINEA = 'GN';
|
||||
const GUINEA_BISSAU = 'GW';
|
||||
const GUYANA = 'GY';
|
||||
const HAITI = 'HT';
|
||||
const HONDURAS = 'HN';
|
||||
const HONG_KONG = 'HK';
|
||||
const HUNGARY = 'HU';
|
||||
const ICELAND = 'IS';
|
||||
const INDIA = 'IN';
|
||||
const INDONESIA = 'ID';
|
||||
const IRAN = 'IR';
|
||||
const IRAQ = 'IQ';
|
||||
const IRELAND = 'IE';
|
||||
const ISRAEL = 'IL';
|
||||
const ITALY = 'IT';
|
||||
const IVORY_COAST = 'CI';
|
||||
const JAMAICA = 'JM';
|
||||
const JAPAN = 'JP';
|
||||
const JORDAN = 'JO';
|
||||
const KAZAKHSTAN = 'KZ';
|
||||
const KENYA = 'KE';
|
||||
const KIRIBATI = 'KI';
|
||||
const KOSOVO = 'XK';
|
||||
const KUWAIT = 'KW';
|
||||
const KYRGYZSTAN = 'KG';
|
||||
const LAOS = 'LA';
|
||||
const LATVIA = 'LV';
|
||||
const LEBANON = 'LB';
|
||||
const LESOTHO = 'LS';
|
||||
const LIBERIA = 'LR';
|
||||
const LIBYA = 'LY';
|
||||
const LIECHTENSTEIN = 'LI';
|
||||
const LITHUANIA = 'LT';
|
||||
const LUXEMBOURG = 'LU';
|
||||
const MADAGASCAR = 'MG';
|
||||
const MALAWI = 'MW';
|
||||
const MALAYSIA = 'MY';
|
||||
const MALDIVES = 'MV';
|
||||
const MALI = 'ML';
|
||||
const MALTA = 'MT';
|
||||
const MARSHALL_ISLANDS = 'MH';
|
||||
const MAURITANIA = 'MR';
|
||||
const MAURITIUS = 'MU';
|
||||
const MEXICO = 'MX';
|
||||
const MICRONESIA = 'FM';
|
||||
const MOLDOVA = 'MD';
|
||||
const MONACO = 'MC';
|
||||
const MONGOLIA = 'MN';
|
||||
const MONTENEGRO = 'ME';
|
||||
const MOROCCO = 'MA';
|
||||
const MOZAMBIQUE = 'MZ';
|
||||
const MYANMAR = 'MM';
|
||||
const NAMIBIA = 'NA';
|
||||
const NAURU = 'NR';
|
||||
const NEPAL = 'NP';
|
||||
const NETHERLANDS = 'NL';
|
||||
const NEW_ZEALAND = 'NZ';
|
||||
const NICARAGUA = 'NI';
|
||||
const NIGER = 'NE';
|
||||
const NIGERIA = 'NG';
|
||||
const NORTH_KOREA = 'KP';
|
||||
const NORTH_MACEDONIA = 'MK';
|
||||
const NORWAY = 'NO';
|
||||
const OMAN = 'OM';
|
||||
const PAKISTAN = 'PK';
|
||||
const PALAU = 'PW';
|
||||
const PALESTINE = 'PS';
|
||||
const PANAMA = 'PA';
|
||||
const PAPUA_NEW_GUINEA = 'PG';
|
||||
const PARAGUAY = 'PY';
|
||||
const PERU = 'PE';
|
||||
const PHILIPPINES = 'PH';
|
||||
const POLAND = 'PL';
|
||||
const PORTUGAL = 'PT';
|
||||
const PUERTO_RICO = 'PR';
|
||||
const QATAR = 'QA';
|
||||
const ROMANIA = 'RO';
|
||||
const RUSSIA = 'RU';
|
||||
const RWANDA = 'RW';
|
||||
const SAINT_BARTHELEMY = 'BL';
|
||||
const SAINT_KITTS_AND_NEVIS = 'KN';
|
||||
const SAINT_LUCIA = 'LC';
|
||||
const SAINT_VINCENT_AND_THE_GRENADINES = 'VC';
|
||||
const SAMOA = 'WS';
|
||||
const SAN_MARINO = 'SM';
|
||||
const SAO_TOME_AND_PRINCIPE = 'ST';
|
||||
const SAUDI_ARABIA = 'SA';
|
||||
const SENEGAL = 'SN';
|
||||
const SERBIA = 'RS';
|
||||
const SEYCHELLES = 'SC';
|
||||
const SIERRA_LEONE = 'SL';
|
||||
const SINGAPORE = 'SG';
|
||||
const SLOVAKIA = 'SK';
|
||||
const SLOVENIA = 'SI';
|
||||
const SOLOMON_ISLANDS = 'SB';
|
||||
const SOMALIA = 'SO';
|
||||
const SOUTH_AFRICA = 'ZA';
|
||||
const SOUTH_KOREA = 'KR';
|
||||
const SOUTH_SUDAN = 'SS';
|
||||
const SPAIN = 'ES';
|
||||
const SRI_LANKA = 'LK';
|
||||
const SUDAN = 'SD';
|
||||
const SURINAME = 'SR';
|
||||
const SWEDEN = 'SE';
|
||||
const SWITZERLAND = 'CH';
|
||||
const SYRIA = 'SY';
|
||||
const TAIWAN = 'TW';
|
||||
const TAJIKISTAN = 'TJ';
|
||||
const TANZANIA = 'TZ';
|
||||
const THAILAND = 'TH';
|
||||
const TOGO = 'TG';
|
||||
const TONGA = 'TO';
|
||||
const TRINIDAD_AND_TOBAGO = 'TT';
|
||||
const TUNISIA = 'TN';
|
||||
const TURKEY = 'TR';
|
||||
const TURKMENISTAN = 'TM';
|
||||
const TUVALU = 'TV';
|
||||
const UGANDA = 'UG';
|
||||
const UKRAINE = 'UA';
|
||||
const UNITED_ARAB_EMIRATES = 'AE';
|
||||
const UNITED_KINGDOM = 'GB';
|
||||
const UNITED_STATES = 'US';
|
||||
const URUGUAY = 'UY';
|
||||
const UZBEKISTAN = 'UZ';
|
||||
const VANUATU = 'VU';
|
||||
const VATICAN_CITY = 'VA';
|
||||
const VENEZUELA = 'VE';
|
||||
const VIETNAM = 'VN';
|
||||
const YEMEN = 'YE';
|
||||
const ZAMBIA = 'ZM';
|
||||
const ZIMBABWE = 'ZW';
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/**
|
||||
* Class Country_Test_Cards
|
||||
*
|
||||
* @package WooCommerce\Payments
|
||||
*/
|
||||
|
||||
namespace WCPay\Constants;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class handling country-specific test card numbers for WooPayments
|
||||
*/
|
||||
class Country_Test_Cards extends Base_Constant {
|
||||
/**
|
||||
* Map of country codes to their test card numbers
|
||||
* Source: https://docs.stripe.com/testing?testing-method=card-numbers#international-cards
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $country_test_cards = [
|
||||
Country_Code::UNITED_STATES => '4242 4242 4242 4242',
|
||||
Country_Code::ARGENTINA => '4000 0003 2000 0021',
|
||||
Country_Code::BRAZIL => '4000 0007 6000 0002',
|
||||
Country_Code::CANADA => '4000 0012 4000 0000',
|
||||
Country_Code::CHILE => '4000 0015 2000 0001',
|
||||
Country_Code::COLOMBIA => '4000 0017 0000 0003',
|
||||
Country_Code::COSTA_RICA => '4000 0018 8000 0005',
|
||||
Country_Code::ECUADOR => '4000 0021 8000 0000',
|
||||
Country_Code::MEXICO => '4000 0048 4000 8001',
|
||||
Country_Code::PANAMA => '4000 0059 1000 0000',
|
||||
Country_Code::PARAGUAY => '4000 0060 0000 0066',
|
||||
Country_Code::PERU => '4000 0060 4000 0068',
|
||||
Country_Code::URUGUAY => '4000 0085 8000 0003',
|
||||
Country_Code::UNITED_ARAB_EMIRATES => '4000 0078 4000 0001',
|
||||
Country_Code::AUSTRIA => '4000 0004 0000 0008',
|
||||
Country_Code::BELGIUM => '4000 0005 6000 0004',
|
||||
Country_Code::BULGARIA => '4000 0010 0000 0000',
|
||||
Country_Code::BELARUS => '4000 0011 2000 0005',
|
||||
Country_Code::CROATIA => '4000 0019 1000 0009',
|
||||
Country_Code::CYPRUS => '4000 0019 6000 0008',
|
||||
Country_Code::CZECHIA => '4000 0020 3000 0002',
|
||||
Country_Code::DENMARK => '4000 0020 8000 0001',
|
||||
Country_Code::ESTONIA => '4000 0023 3000 0009',
|
||||
Country_Code::FINLAND => '4000 0024 6000 0001',
|
||||
Country_Code::FRANCE => '4000 0025 0000 0003',
|
||||
Country_Code::GERMANY => '4000 0027 6000 0016',
|
||||
Country_Code::GIBRALTAR => '4000 0029 2000 0005',
|
||||
Country_Code::GREECE => '4000 0030 0000 0030',
|
||||
Country_Code::HUNGARY => '4000 0034 8000 0005',
|
||||
Country_Code::IRELAND => '4000 0037 2000 0005',
|
||||
Country_Code::ITALY => '4000 0038 0000 0008',
|
||||
Country_Code::LATVIA => '4000 0042 8000 0005',
|
||||
Country_Code::LIECHTENSTEIN => '4000 0043 8000 0004',
|
||||
Country_Code::LITHUANIA => '4000 0044 0000 0000',
|
||||
Country_Code::LUXEMBOURG => '4000 0044 2000 0006',
|
||||
Country_Code::MALTA => '4000 0047 0000 0007',
|
||||
Country_Code::NETHERLANDS => '4000 0052 8000 0002',
|
||||
Country_Code::NORWAY => '4000 0057 8000 0007',
|
||||
Country_Code::POLAND => '4000 0061 6000 0005',
|
||||
Country_Code::PORTUGAL => '4000 0062 0000 0007',
|
||||
Country_Code::ROMANIA => '4000 0064 2000 0001',
|
||||
Country_Code::SAUDI_ARABIA => '4000 0068 2000 0007',
|
||||
Country_Code::SLOVENIA => '4000 0070 5000 0006',
|
||||
Country_Code::SLOVAKIA => '4000 0070 3000 0001',
|
||||
Country_Code::SPAIN => '4000 0072 4000 0007',
|
||||
Country_Code::SWEDEN => '4000 0075 2000 0008',
|
||||
Country_Code::SWITZERLAND => '4000 0075 6000 0009',
|
||||
Country_Code::UNITED_KINGDOM => '4000 0082 6000 0000',
|
||||
Country_Code::AUSTRALIA => '4000 0003 6000 0006',
|
||||
Country_Code::CHINA => '4000 0015 6000 0002',
|
||||
Country_Code::HONG_KONG => '4000 0034 4000 0004',
|
||||
Country_Code::INDIA => '4000 0035 6000 0008',
|
||||
Country_Code::JAPAN => '4000 0039 2000 0003',
|
||||
Country_Code::MALAYSIA => '4000 0045 8000 0002',
|
||||
Country_Code::NEW_ZEALAND => '4000 0055 4000 0008',
|
||||
Country_Code::SINGAPORE => '4000 0070 2000 0003',
|
||||
Country_Code::TAIWAN => '4000 0015 8000 0008',
|
||||
Country_Code::THAILAND => '4000 0076 4000 0003',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get test card number for a specific country.
|
||||
*
|
||||
* @param string $country_code Two-letter country code.
|
||||
* @return string Test card number
|
||||
*/
|
||||
public static function get_test_card_for_country( string $country_code ) {
|
||||
return self::$country_test_cards[ $country_code ] ?? self::$country_test_cards[ Country_Code::UNITED_STATES ];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
/**
|
||||
* Class Currency_Code
|
||||
*
|
||||
* @package WooCommerce\Payments
|
||||
*/
|
||||
|
||||
namespace WCPay\Constants;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Currency Code constants
|
||||
*
|
||||
* @psalm-immutale
|
||||
*/
|
||||
class Currency_Code extends Base_Constant {
|
||||
const UNITED_STATES_DOLLAR = 'USD'; // United States Dollar.
|
||||
const UNITED_ARAB_EMIRATES_DIRHAM = 'AED'; // United Arab Emirates dirham.
|
||||
const AFGHAN_AFGHANI = 'AFN'; // Afghan afghani.
|
||||
const ALBANIAN_LEK = 'ALL'; // Albanian lek.
|
||||
const ARMENIAN_DRAM = 'AMD'; // Armenian dram.
|
||||
const NETHERLANDS_ANTILLEAN_GUILDER = 'ANG'; // Netherlands Antillean guilder.
|
||||
const ANGOLAN_KWANZA = 'AOA'; // Angolan kwanza.
|
||||
const ARGENTINE_PESO = 'ARS'; // Argentine peso.
|
||||
const AUSTRALIAN_DOLLAR = 'AUD'; // Australian dollar.
|
||||
const ARUBAN_FLORIN = 'AWG'; // Aruban florin.
|
||||
const AZERBAIJANI_MANAT = 'AZN'; // Azerbaijani manat.
|
||||
const BOSNIA_AND_HERZEGOVINA_CONVERTIBLE_MARK = 'BAM'; // Bosnia and Herzegovina convertible mark.
|
||||
const BARBADOS_DOLLAR = 'BBD'; // Barbados dollar.
|
||||
const BANGLADESHI_TAKA = 'BDT'; // Bangladeshi taka.
|
||||
const BULGARIAN_LEV = 'BGN'; // Bulgarian lev.
|
||||
const BURUNDIAN_FRANC = 'BIF'; // Burundian franc.
|
||||
const BERMUDIAN_DOLLAR = 'BMD'; // Bermudian dollar.
|
||||
const BRUNEI_DOLLAR = 'BND'; // Brunei dollar.
|
||||
const BOLIVIANO = 'BOB'; // Boliviano.
|
||||
const BRAZILIAN_REAL = 'BRL'; // Brazilian real.
|
||||
const BAHAMIAN_DOLLAR = 'BSD'; // Bahamian dollar.
|
||||
const BOTSWANA_PULA = 'BWP'; // Botswana pula.
|
||||
const NEW_BELARUSIAN_RUBLE = 'BYN'; // New Belarusian ruble.
|
||||
const BELIZE_DOLLAR = 'BZD'; // Belize dollar.
|
||||
const CANADIAN_DOLLAR = 'CAD'; // Canadian dollar.
|
||||
const CONGOLESE_FRANC = 'CDF'; // Congolese franc.
|
||||
const SWISS_FRANC = 'CHF'; // Swiss franc.
|
||||
const CHILEAN_PESO = 'CLP'; // Chilean peso.
|
||||
const CHINESE_YUAN = 'CNY'; // Renminbi (Chinese yuan).
|
||||
const COLOMBIAN_PESO = 'COP'; // Colombian peso.
|
||||
const COSTA_RICAN_COLON = 'CRC'; // Costa Rican colon.
|
||||
const CAPE_VERDE_ESCUDO = 'CVE'; // Cape Verde escudo.
|
||||
const CZECH_KORUNA = 'CZK'; // Czech koruna.
|
||||
const DJIBOUTIAN_FRANC = 'DJF'; // Djiboutian franc.
|
||||
const DANISH_KRONE = 'DKK'; // Danish krone.
|
||||
const DOMINICAN_PESO = 'DOP'; // Dominican peso.
|
||||
const ALGERIAN_DINAR = 'DZD'; // Algerian dinar.
|
||||
const EGYPTIAN_POUND = 'EGP'; // Egyptian pound.
|
||||
const ETHIOPIAN_BIRR = 'ETB'; // Ethiopian birr.
|
||||
const EURO = 'EUR'; // Euro.
|
||||
const FIJI_DOLLAR = 'FJD'; // Fiji dollar.
|
||||
const FALKLAND_ISLANDS_POUND = 'FKP'; // Falkland Islands pound.
|
||||
const POUND_STERLING = 'GBP'; // Pound sterling.
|
||||
const GEORGIAN_LARI = 'GEL'; // Georgian lari.
|
||||
const GIBRALTAR_POUND = 'GIP'; // Gibraltar pound.
|
||||
const GAMBIAN_DALASI = 'GMD'; // Gambian dalasi.
|
||||
const GUINEAN_FRANC = 'GNF'; // Guinean franc.
|
||||
const GUATEMALAN_QUETZAL = 'GTQ'; // Guatemalan quetzal.
|
||||
const GUYANESE_DOLLAR = 'GYD'; // Guyanese dollar.
|
||||
const HONG_KONG_DOLLAR = 'HKD'; // Hong Kong dollar.
|
||||
const HONDURAN_LEMPIRA = 'HNL'; // Honduran lempira.
|
||||
const HAITIAN_GOURDE = 'HTG'; // Haitian gourde.
|
||||
const HUNGARIAN_FORINT = 'HUF'; // Hungarian forint.
|
||||
const INDONESIAN_RUPIAH = 'IDR'; // Indonesian rupiah.
|
||||
const ISRAELI_NEW_SHEKEL = 'ILS'; // Israeli new shekel.
|
||||
const INDIAN_RUPEE = 'INR'; // Indian rupee.
|
||||
const ICELANDIC_KRONA = 'ISK'; // Icelandic króna.
|
||||
const JAMAICAN_DOLLAR = 'JMD'; // Jamaican dollar.
|
||||
const JAPANESE_YEN = 'JPY'; // Japanese yen.
|
||||
const KENYAN_SHILLING = 'KES'; // Kenyan shilling.
|
||||
const KYRGYZSTANI_SOM = 'KGS'; // Kyrgyzstani som.
|
||||
const CAMBODIAN_RIEL = 'KHR'; // Cambodian riel.
|
||||
const COMORIAN_FRANC = 'KMF'; // Comorian franc.
|
||||
const SOUTH_KOREAN_WON = 'KRW'; // South Korean won.
|
||||
const CAYMAN_ISLANDS_DOLLAR = 'KYD'; // Cayman Islands dollar.
|
||||
const KAZAKHSTANI_TENGE = 'KZT'; // Kazakhstani tenge.
|
||||
const LAO_KIP = 'LAK'; // Lao kip.
|
||||
const LEBANESE_POUND = 'LBP'; // Lebanese pound.
|
||||
const SRI_LANKAN_RUPEE = 'LKR'; // Sri Lankan rupee.
|
||||
const LIBERIAN_DOLLAR = 'LRD'; // Liberian dollar.
|
||||
const LESOTHO_LOTI = 'LSL'; // Lesotho loti.
|
||||
const MOROCCAN_DIRHAM = 'MAD'; // Moroccan dirham.
|
||||
const MOLDOVAN_LEU = 'MDL'; // Moldovan leu.
|
||||
const MALAGASY_ARIARY = 'MGA'; // Malagasy ariary.
|
||||
const MACEDONIAN_DENAR = 'MKD'; // Macedonian denar.
|
||||
const MYANMAR_KYAT = 'MMK'; // Myanmar kyat.
|
||||
const MONGOLIAN_TOGROG = 'MNT'; // Mongolian tögrög.
|
||||
const MACANESE_PATACA = 'MOP'; // Macanese pataca.
|
||||
const MAURITIAN_RUPEE = 'MUR'; // Mauritian rupee.
|
||||
const MALDIVIAN_RUFIYAA = 'MVR'; // Maldivian rufiyaa.
|
||||
const MALAWIAN_KWACHA = 'MWK'; // Malawian kwacha.
|
||||
const MEXICAN_PESO = 'MXN'; // Mexican peso.
|
||||
const MALAYSIAN_RINGGIT = 'MYR'; // Malaysian ringgit.
|
||||
const MOZAMBICAN_METICAL = 'MZN'; // Mozambican metical.
|
||||
const NAMIBIAN_DOLLAR = 'NAD'; // Namibian dollar.
|
||||
const NIGERIAN_NAIRA = 'NGN'; // Nigerian naira.
|
||||
const NICARAGUAN_CORDOBA = 'NIO'; // Nicaraguan córdoba.
|
||||
const NORWEGIAN_KRONE = 'NOK'; // Norwegian krone.
|
||||
const NEPALESE_RUPEE = 'NPR'; // Nepalese rupee.
|
||||
const NEW_ZEALAND_DOLLAR = 'NZD'; // New Zealand dollar.
|
||||
const PANAMANIAN_BALBOA = 'PAB'; // Panamanian balboa.
|
||||
const PERUVIAN_SOL = 'PEN'; // Peruvian sol.
|
||||
const PAPUA_NEW_GUINEAN_KINA = 'PGK'; // Papua New Guinean kina.
|
||||
const PHILIPPINE_PESO = 'PHP'; // Philippine peso.
|
||||
const PAKISTANI_RUPEE = 'PKR'; // Pakistani rupee.
|
||||
const POLISH_ZLOTY = 'PLN'; // Polish złoty.
|
||||
const PARAGUAYAN_GUARANI = 'PYG'; // Paraguayan guaraní.
|
||||
const QATARI_RIYAL = 'QAR'; // Qatari riyal.
|
||||
const ROMANIAN_LEU = 'RON'; // Romanian leu.
|
||||
const SERBIAN_DINAR = 'RSD'; // Serbian dinar.
|
||||
const RUSSIAN_RUBLE = 'RUB'; // Russian ruble.
|
||||
const RWANDAN_FRANC = 'RWF'; // Rwandan franc.
|
||||
const SAUDI_RIYAL = 'SAR'; // Saudi riyal.
|
||||
const SOLOMON_ISLANDS_DOLLAR = 'SBD'; // Solomon Islands dollar.
|
||||
const SEYCHELLOIS_RUPEE = 'SCR'; // Seychellois rupee.
|
||||
const SWEDISH_KRONA = 'SEK'; // Swedish krona.
|
||||
const SINGAPORE_DOLLAR = 'SGD'; // Singapore dollar.
|
||||
const SAINT_HELENA_POUND = 'SHP'; // Saint Helena pound.
|
||||
const SIERRA_LEONEAN_LEONE = 'SLE'; // Sierra Leonean leone.
|
||||
const SOMALI_SHILLING = 'SOS'; // Somali shilling.
|
||||
const SURINAMESE_DOLLAR = 'SRD'; // Surinamese dollar.
|
||||
const SAO_TOME_AND_PRINCIPE_DOBRA = 'STD'; // São Tomé and Príncipe dobra.
|
||||
const SWAZI_LILANGENI = 'SZL'; // Swazi lilangeni.
|
||||
const THAI_BAHT = 'THB'; // Thai baht.
|
||||
const TAJIKISTANI_SOMONI = 'TJS'; // Tajikistani somoni.
|
||||
const TONGAN_PAANGA = 'TOP'; // Tongan paʻanga.
|
||||
const TURKISH_LIRA = 'TRY'; // Turkish lira.
|
||||
const TRINIDAD_AND_TOBAGO_DOLLAR = 'TTD'; // Trinidad and Tobago dollar.
|
||||
const NEW_TAIWAN_DOLLAR = 'TWD'; // New Taiwan dollar.
|
||||
const TANZANIAN_SHILLING = 'TZS'; // Tanzanian shilling.
|
||||
const UKRAINIAN_HRYVNIA = 'UAH'; // Ukrainian hryvnia.
|
||||
const UGANDAN_SHILLING = 'UGX'; // Ugandan shilling.
|
||||
const URUGUAYAN_PESO = 'UYU'; // Uruguayan peso.
|
||||
const UZBEKISTANI_SOM = 'UZS'; // Uzbekistani som.
|
||||
const VIETNAMESE_DONG = 'VND'; // Vietnamese đồng.
|
||||
const VANUATU_VATU = 'VUV'; // Vanuatu vatu.
|
||||
const SAMOAN_TALA = 'WST'; // Samoan tala.
|
||||
const CENTRAL_AFRICAN_CFA_FRANC = 'XAF'; // Central African CFA franc.
|
||||
const EAST_CARIBBEAN_DOLLAR = 'XCD'; // East Caribbean dollar.
|
||||
const WEST_AFRICAN_CFA_FRANC = 'XOF'; // West African CFA franc.
|
||||
const CFP_FRANC = 'XPF'; // CFP franc.
|
||||
const YEMENI_RIAL = 'YER'; // Yemeni rial.
|
||||
const SOUTH_AFRICAN_RAND = 'ZAR'; // South African rand.
|
||||
const ZAMBIAN_KWACHA = 'ZMW'; // Zambian kwacha.
|
||||
// ... add more currencies as needed.
|
||||
// crypto currencies.
|
||||
const BITCOIN = 'BTC'; // Bitcoin.
|
||||
}
|
||||
+1162
File diff suppressed because it is too large
Load Diff
+360
@@ -0,0 +1,360 @@
|
||||
<?php
|
||||
/**
|
||||
* Class Express_Checkout_Hong_Kong_States
|
||||
*
|
||||
* @package WooCommerce\Payments
|
||||
*/
|
||||
|
||||
namespace WCPay\Constants;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Express_Checkout_Hong_Kong_States
|
||||
*
|
||||
* Contains a list of districts (equivalent to WC states) in Hong Kong used for normalization and validation purposes.
|
||||
* This is necessary due to a bug in Apple Pay that's currently being worked on. Until
|
||||
* that bug is fixed this workaround will be necessary.
|
||||
*
|
||||
* More info in pc4etw-bY-p2.
|
||||
*
|
||||
* Note: The following code has been kindly sourced from the WooCommerce Stripe Payment Gateway implementation,
|
||||
* which addresses the same issue in that plugin. See https://github.com/woocommerce/woocommerce-gateway-stripe/pull/1593.
|
||||
*
|
||||
* @since x.x.x
|
||||
*/
|
||||
class Express_Checkout_Hong_Kong_States {
|
||||
// Source: https://www.rvd.gov.hk/doc/tc/hkpr13/06.pdf.
|
||||
const STATES = [
|
||||
'hong kong',
|
||||
'hong kong island',
|
||||
'港島',
|
||||
|
||||
'central and western',
|
||||
'中西區',
|
||||
|
||||
'kennedy town',
|
||||
'shek tong tsui',
|
||||
'sai ying pun',
|
||||
'sheung wan',
|
||||
'central',
|
||||
'admiralty',
|
||||
'mid-levels',
|
||||
'peak',
|
||||
'堅尼地城',
|
||||
'石塘咀',
|
||||
'西營盤',
|
||||
'上環',
|
||||
'中環',
|
||||
'金鐘',
|
||||
'半山區',
|
||||
'山頂',
|
||||
|
||||
'wan chai',
|
||||
'灣仔',
|
||||
|
||||
'causeway bay',
|
||||
'happy valley',
|
||||
'tai hang',
|
||||
'so kon po',
|
||||
"jardine's lookout",
|
||||
'灣仔',
|
||||
'銅鑼灣',
|
||||
'跑馬地',
|
||||
'大坑',
|
||||
'掃桿埔',
|
||||
'渣甸山',
|
||||
|
||||
'eastern',
|
||||
'東區',
|
||||
|
||||
'tin hau',
|
||||
'braemar hill',
|
||||
'north point',
|
||||
'quarry bay',
|
||||
'sai wan ho',
|
||||
'shau kei wan',
|
||||
'chai wan',
|
||||
'siu sai wan',
|
||||
'天后',
|
||||
'寶馬山',
|
||||
'北角',
|
||||
'鰂魚涌',
|
||||
'西灣河',
|
||||
'筲箕灣',
|
||||
'柴灣',
|
||||
'小西灣',
|
||||
|
||||
'southern',
|
||||
'南區',
|
||||
|
||||
'pok fu lam',
|
||||
'aberdeen',
|
||||
'ap lei chau',
|
||||
'wong chuk hang',
|
||||
'shouson hill',
|
||||
'repulse bay',
|
||||
'chung hom kok',
|
||||
'stanley',
|
||||
'tai tam',
|
||||
'shek o',
|
||||
'薄扶林',
|
||||
'香港仔',
|
||||
'鴨脷洲',
|
||||
'黃竹坑',
|
||||
'壽臣山',
|
||||
'淺水灣',
|
||||
'舂磡角',
|
||||
'赤柱',
|
||||
'大潭',
|
||||
'石澳',
|
||||
|
||||
'kowloon',
|
||||
'九龍',
|
||||
|
||||
'yau tsim mong',
|
||||
'油尖旺',
|
||||
|
||||
'tsim sha tsui',
|
||||
'yau ma tei',
|
||||
'west kowloon reclamation',
|
||||
"king's park, mong kok",
|
||||
'tai kok tsui',
|
||||
'尖沙咀',
|
||||
'油麻地',
|
||||
'西九龍填海區',
|
||||
'京士柏',
|
||||
'旺角',
|
||||
'大角咀',
|
||||
|
||||
'sham shui po',
|
||||
'深水埗',
|
||||
|
||||
'mei foo',
|
||||
'lai chi kok',
|
||||
'cheung sha wan',
|
||||
'shek kip mei',
|
||||
'yau yat tsuen',
|
||||
'tai wo ping',
|
||||
'stonecutters island',
|
||||
'美孚',
|
||||
'荔枝角',
|
||||
'長沙灣',
|
||||
'石硤尾',
|
||||
'又一村',
|
||||
'大窩坪',
|
||||
'昂船洲',
|
||||
|
||||
'kowloon city',
|
||||
'九龍城',
|
||||
|
||||
'hung hom',
|
||||
'to kwa wan',
|
||||
'ma tau kok',
|
||||
'ma tau wai',
|
||||
'kai tak',
|
||||
'ho man tin',
|
||||
'kowloon tong',
|
||||
'beacon hill',
|
||||
'紅磡',
|
||||
'土瓜灣',
|
||||
'馬頭角',
|
||||
'馬頭圍',
|
||||
'啟德',
|
||||
'何文田',
|
||||
'九龍塘',
|
||||
'筆架山',
|
||||
|
||||
'wong tai sin',
|
||||
'黃大仙',
|
||||
|
||||
'san po kong',
|
||||
'tung tau',
|
||||
'wang tau hom',
|
||||
'lok fu',
|
||||
'diamond hill',
|
||||
'tsz wan shan',
|
||||
'ngau chi wan',
|
||||
'新蒲崗',
|
||||
'東頭',
|
||||
'橫頭磡',
|
||||
'樂富',
|
||||
'鑽石山',
|
||||
'慈雲山',
|
||||
'牛池灣',
|
||||
|
||||
'kwun tong',
|
||||
'觀塘',
|
||||
|
||||
'ping shek',
|
||||
'kowloon bay',
|
||||
'ngau tau kok',
|
||||
'jordan valley',
|
||||
'kwun tong',
|
||||
'sau mau ping',
|
||||
'lam tin',
|
||||
'yau tong',
|
||||
'lei yue mun',
|
||||
'坪石',
|
||||
'九龍灣',
|
||||
'牛頭角',
|
||||
'佐敦谷',
|
||||
'觀塘',
|
||||
'秀茂坪',
|
||||
'藍田',
|
||||
'油塘',
|
||||
'鯉魚門',
|
||||
|
||||
'new territories',
|
||||
'新界',
|
||||
|
||||
'kwai tsing',
|
||||
'葵青',
|
||||
|
||||
'kwai chung',
|
||||
'tsing yi',
|
||||
'葵涌',
|
||||
'青衣',
|
||||
|
||||
'tsuen wan',
|
||||
'荃灣',
|
||||
|
||||
'lei muk shue',
|
||||
'ting kau',
|
||||
'sham tseng',
|
||||
'tsing lung tau',
|
||||
'ma wan',
|
||||
'sunny bay',
|
||||
'梨木樹',
|
||||
'汀九',
|
||||
'深井',
|
||||
'青龍頭',
|
||||
'馬灣',
|
||||
'欣澳',
|
||||
|
||||
'tuen mun',
|
||||
'屯門',
|
||||
|
||||
'tai lam chung',
|
||||
'so kwun wat',
|
||||
'tuen mun',
|
||||
'lam tei',
|
||||
'大欖涌',
|
||||
'掃管笏',
|
||||
'屯門',
|
||||
'藍地',
|
||||
|
||||
'yuen long',
|
||||
'元朗',
|
||||
|
||||
'hung shui kiu',
|
||||
'ha tsuen',
|
||||
'lau fau shan',
|
||||
'tin shui wai',
|
||||
'yuen long',
|
||||
'san tin',
|
||||
'lok ma chau',
|
||||
'kam tin',
|
||||
'shek kong',
|
||||
'pat heung',
|
||||
'洪水橋',
|
||||
'廈村',
|
||||
'流浮山',
|
||||
'天水圍',
|
||||
'元朗',
|
||||
'新田',
|
||||
'落馬洲',
|
||||
'錦田',
|
||||
'石崗',
|
||||
'八鄉',
|
||||
|
||||
'north',
|
||||
'北區',
|
||||
|
||||
'fanling',
|
||||
'luen wo hui',
|
||||
'sheung shui',
|
||||
'shek wu hui',
|
||||
'sha tau kok',
|
||||
'luk keng',
|
||||
'wu kau tang',
|
||||
'粉嶺',
|
||||
'聯和墟',
|
||||
'上水',
|
||||
'石湖墟',
|
||||
'沙頭角',
|
||||
'鹿頸',
|
||||
'烏蛟騰',
|
||||
|
||||
'tai po',
|
||||
'大埔',
|
||||
|
||||
'tai po market',
|
||||
'tai po kau',
|
||||
'tai mei tuk',
|
||||
'shuen wan',
|
||||
'cheung muk tau',
|
||||
'kei ling ha',
|
||||
'大埔墟',
|
||||
'大埔',
|
||||
'大埔滘',
|
||||
'大尾篤',
|
||||
'船灣',
|
||||
'樟木頭',
|
||||
'企嶺下',
|
||||
|
||||
'sha tin',
|
||||
'沙田',
|
||||
|
||||
'tai wai',
|
||||
'fo tan',
|
||||
'ma liu shui',
|
||||
'wu kai sha',
|
||||
'ma on shan',
|
||||
'大圍',
|
||||
'火炭',
|
||||
'馬料水',
|
||||
'烏溪沙',
|
||||
'馬鞍山',
|
||||
|
||||
'sai kung',
|
||||
'西貢',
|
||||
|
||||
'clear water bay',
|
||||
'tai mong tsai',
|
||||
'tseung kwan o',
|
||||
'hang hau',
|
||||
'tiu keng leng',
|
||||
'ma yau tong',
|
||||
'清水灣',
|
||||
'大網仔',
|
||||
'將軍澳',
|
||||
'坑口',
|
||||
'調景嶺',
|
||||
'馬游塘',
|
||||
|
||||
'islands',
|
||||
'離島',
|
||||
|
||||
'cheung chau',
|
||||
'peng chau',
|
||||
'lantau island (including tung chung)',
|
||||
'lamma island',
|
||||
'長洲',
|
||||
'坪洲',
|
||||
'大嶼山(包括東涌)',
|
||||
'南丫島',
|
||||
];
|
||||
|
||||
/**
|
||||
* Checks if the given state is a valid region (equivalent to WC state) in Hong Kong.
|
||||
*
|
||||
* @param string $state The state to be evaluated.
|
||||
* @return bool True if the provided state is valid, false otherwise.
|
||||
*/
|
||||
public static function is_valid_state( $state ) {
|
||||
return in_array( $state, self::STATES, true );
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Class Fraud_Meta_Box_Type
|
||||
*
|
||||
* @package WooCommerce\Payments
|
||||
*/
|
||||
|
||||
namespace WCPay\Constants;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* This class gives a list of all the possible fraud meta box type constants.
|
||||
*
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class Fraud_Meta_Box_Type extends Base_Constant {
|
||||
const ALLOW = 'allow';
|
||||
const BLOCK = 'block';
|
||||
const NOT_CARD = 'not_card';
|
||||
const NOT_WCPAY = 'not_wcpay';
|
||||
const PAYMENT_STARTED = 'payment_started';
|
||||
const REVIEW = 'review';
|
||||
const REVIEW_ALLOWED = 'review_allowed';
|
||||
const REVIEW_BLOCKED = 'review_blocked';
|
||||
const REVIEW_EXPIRED = 'review_expired';
|
||||
const REVIEW_FAILED = 'review_failed';
|
||||
const TERMINAL_PAYMENT = 'terminal_payment';
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Class Intent_Status
|
||||
*
|
||||
* @package WooCommerce\Payments
|
||||
*/
|
||||
|
||||
namespace WCPay\Constants;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* This class gives a list of all Payment and Setup Intent status name constants.
|
||||
* - https://stripe.com/docs/api/payment_intents/object#payment_intent_object-status
|
||||
* - https://stripe.com/docs/api/setup_intents/object#setup_intent_object-status
|
||||
*
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class Intent_Status extends Base_Constant {
|
||||
const REQUIRES_PAYMENT_METHOD = 'requires_payment_method';
|
||||
const REQUIRES_CONFIRMATION = 'requires_confirmation';
|
||||
const REQUIRES_ACTION = 'requires_action';
|
||||
const PROCESSING = 'processing';
|
||||
const REQUIRES_CAPTURE = 'requires_capture';
|
||||
const CANCELED = 'canceled';
|
||||
const SUCCEEDED = 'succeeded';
|
||||
|
||||
/**
|
||||
* Stripe intents that are treated as successfully created, i.e. authorized.
|
||||
*
|
||||
* @type array
|
||||
*/
|
||||
const AUTHORIZED_STATUSES = [
|
||||
self::SUCCEEDED,
|
||||
self::REQUIRES_CAPTURE,
|
||||
self::PROCESSING,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Class Order_Mode
|
||||
*
|
||||
* @package WooCommerce\Payments
|
||||
*/
|
||||
|
||||
namespace WCPay\Constants;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum saved in the order meta for the mode that the payment was processed in.
|
||||
*
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class Order_Mode extends Base_Constant {
|
||||
const TEST = 'test';
|
||||
const PRODUCTION = 'prod';
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Class Order_Status
|
||||
*
|
||||
* @package WooCommerce\Payments
|
||||
*/
|
||||
|
||||
namespace WCPay\Constants;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* This class gives a list of all the possible order status constants.
|
||||
*
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class Order_Status extends Base_Constant {
|
||||
const CANCELLED = 'cancelled';
|
||||
const COMPLETED = 'completed';
|
||||
const FAILED = 'failed';
|
||||
const ON_HOLD = 'on-hold';
|
||||
const PENDING = 'pending';
|
||||
const PROCESSING = 'processing';
|
||||
const REFUNDED = 'refunded';
|
||||
const TRASH = 'trash';
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Class Capture_Type
|
||||
*
|
||||
* @package WooCommerce\Payments
|
||||
*/
|
||||
|
||||
namespace WCPay\Constants;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum used in WCPay\Payment_Information to determine whether a payment was
|
||||
* initated by a merchant or a customer.
|
||||
*
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class Payment_Capture_Type extends Base_Constant {
|
||||
const AUTOMATIC = 'automatic_capture';
|
||||
const MANUAL = 'manual_capture';
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Class Payment_Information
|
||||
*
|
||||
* @package WooCommerce\Payments
|
||||
*/
|
||||
|
||||
namespace WCPay\Constants;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum used in WCPay\Payment_Information to determine whether a payment was
|
||||
* initated by a merchant or a customer.
|
||||
*
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class Payment_Initiated_By extends Base_Constant {
|
||||
const MERCHANT = 'initiated_by_merchant';
|
||||
const CUSTOMER = 'initiated_by_customer';
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* Class Payment_Intent_Status
|
||||
*
|
||||
* @package WooCommerce\Payments
|
||||
*/
|
||||
|
||||
namespace WCPay\Constants;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment_Intent_Status was deprecated in favor of Intent_Status.
|
||||
*
|
||||
* @deprecated 6.4.0
|
||||
* @see Intent_Status
|
||||
*
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class Payment_Intent_Status extends Intent_Status {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Class Payment_Method
|
||||
*
|
||||
* @package WooCommerce\Payments
|
||||
*/
|
||||
|
||||
namespace WCPay\Constants;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible enum values for the type of the PaymentMethod.
|
||||
* https://stripe.com/docs/api/payment_methods/object#payment_method_object-type
|
||||
*
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class Payment_Method extends Base_Constant {
|
||||
const BANCONTACT = 'bancontact';
|
||||
const BASC = 'bacs_debit';
|
||||
const BECS = 'au_becs_debit';
|
||||
const CARD = 'card';
|
||||
const CARD_PRESENT = 'card_present';
|
||||
const EPS = 'eps';
|
||||
const GIROPAY = 'giropay';
|
||||
const IDEAL = 'ideal';
|
||||
const INTERAC_PRESENT = 'interac_present';
|
||||
const LINK = 'link';
|
||||
const P24 = 'p24';
|
||||
const SEPA = 'sepa_debit';
|
||||
const SOFORT = 'sofort';
|
||||
const US_BANK_ACCOUNT = 'us_bank_account';
|
||||
const AFFIRM = 'affirm';
|
||||
const AFTERPAY = 'afterpay_clearpay';
|
||||
const KLARNA = 'klarna';
|
||||
|
||||
const IPP_ALLOWED_PAYMENT_METHODS = [
|
||||
self::CARD_PRESENT,
|
||||
self::INTERAC_PRESENT,
|
||||
];
|
||||
|
||||
const BNPL_PAYMENT_METHODS = [
|
||||
self::AFFIRM,
|
||||
self::AFTERPAY,
|
||||
self::KLARNA,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Class Payment_Type
|
||||
*
|
||||
* @package WooCommerce\Payments
|
||||
*/
|
||||
|
||||
namespace WCPay\Constants;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum used in WCPay\Payment_Information to determine whether a payment
|
||||
* is a single payment or a part of a recurring series.
|
||||
*
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class Payment_Type extends Base_Constant {
|
||||
const SINGLE = 'single';
|
||||
const RECURRING = 'recurring';
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Class Track_Events
|
||||
*
|
||||
* @package WooCommerce\Payments
|
||||
*/
|
||||
|
||||
namespace WCPay\Constants;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Event names for WooCommerce Analytics.
|
||||
*
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class Track_Events extends Base_Constant {
|
||||
// UPE toggle events.
|
||||
public const UPE_ENABLED = 'wcpay_upe_enabled';
|
||||
public const UPE_DISABLED = 'wcpay_upe_disabled';
|
||||
public const SPLIT_UPE_ENABLED = 'wcpay_split_upe_enabled';
|
||||
public const SPLIT_UPE_DISABLED = 'wcpay_split_upe_disabled';
|
||||
public const DEFERRED_INTENT_UPE_ENABLED = 'wcpay_deferred_intent_upe_enabled';
|
||||
public const DEFERRED_INTENT_UPE_DISABLED = 'wcpay_deferred_intent_upe_disabled';
|
||||
|
||||
// Payment method events.
|
||||
public const PAYMENT_METHOD_ENABLED = 'wcpay_payment_method_enabled';
|
||||
public const PAYMENT_METHOD_DISABLED = 'wcpay_payment_method_disabled';
|
||||
}
|
||||
Reference in New Issue
Block a user