MediaWiki fundraising/REL1_35
PayPalCountry.php
Go to the documentation of this file.
1<?php
2
3class PayPalCountry implements UnstagingHelper {
4
6 private static $nonStandardCodes = [
7 'C2' => 'CN', // mutant China code for merchants outside of Chine
8 'AN' => 'NL', // Netherlands Antilles is part of Netherlands since 2010
9 ];
10
11 public function unstage( GatewayType $adapter, $stagedData, &$unstagedData ) {
12 if ( empty( $stagedData['country'] ) ) {
13 return;
14 }
15 $country = $stagedData['country'];
16
17 if ( array_key_exists( $country, self::$nonStandardCodes ) ) {
18 $country = self::$nonStandardCodes[$country];
19 }
20 if ( CountryValidation::isValidIsoCode( $country ) ) {
21 $unstagedData['country'] = $country;
22 }
23 }
24}
static isValidIsoCode( $country)
Checks to see if $country is a valid iso 3166-1 country code.
static string[] $nonStandardCodes
unstage(GatewayType $adapter, $stagedData, &$unstagedData)
GatewayType Interface.
Used to mark any class which implements an unstaging method, for transforming data returned by a paym...