Skip to content

Commit

Permalink
Update SendSmsChallengeType, Command to use Country.
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinier Kip committed Jun 3, 2015
1 parent 2394da9 commit 68c4000
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
8 changes: 4 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@

namespace Surfnet\StepupSelfService\SelfServiceBundle\Command;

use Surfnet\StepupBundle\Value\PhoneNumber\Country;
use Symfony\Component\Validator\Constraints as Assert;

class SendSmsChallengeCommand
{
/**
* @var string
* @var Country
*/
public $countryCode;
public $country;

/**
* @Assert\NotBlank(message="ss.send_sms_challenge_command.recipient.may_not_be_empty")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ class SendSmsChallengeType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('countryCode', 'choice', [
->add('country', 'choice', [
'label' => /** @Ignore */ 'country code',
'horizontal_label_class' => 'sr-only',
'required' => true,
'choice_list' => CountryCodeListing::asChoiceList(),
'preferred_choices' => [CountryCodeListing::PREFERRED_CHOICE],
'preferred_choices' =>
['Surfnet\StepupBundle\Value\PhoneNumber\CountryCodeListing', 'isPreferredChoice'],
'horizontal_input_wrapper_class' => 'foo',
])
->add('subscriber', 'text', [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<div class="row">
{{ form_errors(form) }}
<div class="col-xs-8">
{{ form_widget(form.countryCode) }}
{{ form_widget(form.country) }}
</div>
<div class="col-xs-4">
{{ form_widget(form.subscriber) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function clearSmsVerificationState()
public function sendChallenge(SendSmsChallengeCommand $command)
{
$phoneNumber = new InternationalPhoneNumber(
new CountryCode($command->countryCode),
$command->country->getCountryCode(),
new PhoneNumber($command->subscriber)
);

Expand Down

0 comments on commit 68c4000

Please sign in to comment.