format sender address as integer
This commit is contained in:
parent
81236bcf2c
commit
81b20fc979
@ -162,7 +162,7 @@ abstract class Request implements RequestInterface
|
|||||||
'priority' => $this->getPriority(),
|
'priority' => $this->getPriority(),
|
||||||
'recipientAddressList' => $this->getRecipientsList()->getRecipients(),
|
'recipientAddressList' => $this->getRecipientsList()->getRecipients(),
|
||||||
'sendAsFlashSms' => $this->doSendAsFlashSms(),
|
'sendAsFlashSms' => $this->doSendAsFlashSms(),
|
||||||
'senderAddress' => $this->getSenderAddress() ? $this->getSenderAddress()->get() : null,
|
'senderAddress' => $this->getSenderAddress() ? $this->getSenderAddress()->getFormatted() : null,
|
||||||
'senderAddressType' => $this->getSenderAddressType(),
|
'senderAddressType' => $this->getSenderAddressType(),
|
||||||
'test' => $this->getTestMode(),
|
'test' => $this->getTestMode(),
|
||||||
'validityPeriode' => $this->getValidityPeriode()
|
'validityPeriode' => $this->getValidityPeriode()
|
||||||
|
@ -27,7 +27,7 @@ class Sender extends StringValueObject
|
|||||||
$phoneUtil = $this->getPhoneNumberUtil();
|
$phoneUtil = $this->getPhoneNumberUtil();
|
||||||
|
|
||||||
$phoneNumber = $phoneUtil->parse( $number, strtoupper($iso2CountryCode) );
|
$phoneNumber = $phoneUtil->parse( $number, strtoupper($iso2CountryCode) );
|
||||||
$number = $phoneUtil->format( $phoneNumber, PhoneNumberFormat::E164 );
|
$number = ltrim($phoneUtil->format($phoneNumber, PhoneNumberFormat::E164), '+');
|
||||||
|
|
||||||
if (false === $phoneUtil->isValidNumber($phoneNumber)) {
|
if (false === $phoneUtil->isValidNumber($phoneNumber)) {
|
||||||
throw new RecipientException( ExceptionMessages::INVALID_SENDER );
|
throw new RecipientException( ExceptionMessages::INVALID_SENDER );
|
||||||
@ -43,4 +43,12 @@ class Sender extends StringValueObject
|
|||||||
{
|
{
|
||||||
return PhoneNumberUtil::getInstance();
|
return PhoneNumberUtil::getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getFormatted()
|
||||||
|
{
|
||||||
|
return (int) parent::getFormatted();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,4 +24,9 @@ abstract class StringValueObject extends ValueObject
|
|||||||
{
|
{
|
||||||
return $this->value;
|
return $this->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFormatted()
|
||||||
|
{
|
||||||
|
return $this->get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user