Exemple #1
0
 public function setAddressHandler($args)
 {
     $this->state->addressLine1 = $args['addressLine1'];
     $this->state->addressLine2 = $args['addressLine2'];
     $this->state->townOrCity = $args['townOrCity'];
     $this->state->stateOrRegion = $args['stateOrRegion'];
     $this->state->postCode = $args['postCode'];
     $this->state->countryCode = strtoupper($args['countryCode']);
     $this->state->countryString = $this->getCountriesByISO()[strtoupper($args['countryCode'])];
     foreach ($this->state->requiredFields as $req => $label) {
         if (!$args[$req]) {
             $this->setFlashError($label . " is a required field.");
             $this->parent->updateState();
             return $this->parent->render();
         }
     }
     $this->state->mode = 'view';
     $this->parent->setAddressStatus($this->isReady(), $this->state->countryCode, $this->state->__toString());
     $this->parent->updateState();
     return $this->parent->render();
 }