Skip to content

Commit

Permalink
Default to IBAN pointer. #7
Browse files Browse the repository at this point in the history
  • Loading branch information
JordyHeemskerk committed Mar 22, 2018
1 parent 40ff29d commit 13f005f
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/BunqLib.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class BunqLib
*/
const ERROR_USER_TYPE_UNEXPECTED = 'User of type "%s" is unexpected';
const ERROR_COULD_NOT_DETERMINE_ALIAS_OF_TYPE_IBAN = 'Could not find alias with type IBAN for monetary account "%s';
const ERROR_COULD_NOT_DETERMINE_RECIPIENT_TYPE = 'Could not determine recipient type of "%s".';
/**
* Config file name constants.
*/
Expand Down Expand Up @@ -62,7 +61,6 @@ class BunqLib
* Regex constants.
*/
const REGEX_E164_PHONE = '/^\+\d{3,15}$/';
const REGEX_SIMPLE_IBAN_NL = '^NL\d{2}[A-Z]{4}\d{10}$';

/**
* @var UserCompany|UserPerson|UserLight
Expand Down Expand Up @@ -265,10 +263,8 @@ public function determinePointerFromRecipient(string $recipient): Pointer
$pointerType = self::POINTER_TYPE_EMAIL;
} elseif (preg_match(self::REGEX_E164_PHONE, $recipient)) {
$pointerType = self::POINTER_TYPE_PHONE_NUMBER;
} elseif (preg_match(self::REGEX_SIMPLE_IBAN_NL, $recipient)) {
$pointerType = self::POINTER_TYPE_IBAN;
} else {
throw new BunqException(vsprintf(self::ERROR_COULD_NOT_DETERMINE_RECIPIENT_TYPE, [$recipient]));
$pointerType = self::POINTER_TYPE_IBAN;
}

return new Pointer($pointerType, $recipient);
Expand Down

0 comments on commit 13f005f

Please sign in to comment.