/**
  * Constructor
  * @param \SimpleXMLElement $response
  */
 public function __construct(\SimpleXMLElement $response)
 {
     $this->code_service = XmlHelper::getAsBoolean($response, 'CODService');
     $this->dimensions_required = XmlHelper::getAsBoolean($response, 'DimensionsRequired');
     $this->expedited_service = XmlHelper::getAsBoolean($response, 'ExpeditedService');
     $this->international_service = XmlHelper::getAsBoolean($response, 'InternationalService');
     $this->surcharge_applicable = XmlHelper::getAsBoolean($response, 'SurchargeApplicable');
     $this->valid_for_selling_flow = XmlHelper::getAsBoolean($response, 'ValidForSellingFlow');
     $this->weight_required = XmlHelper::getAsBoolean($response, 'WeightRequired');
     $this->service_type = XmlHelper::getArrayAsStrings($response, 'ServiceType');
     $this->shipping_carrier = XmlHelper::getArrayAsStrings($response, 'ShippingCarrier');
     $this->shipping_package = XmlHelper::getArrayAsStrings($response, 'ShippingPackage');
     if (isset($response->ShippingServicePackageDetails)) {
         $this->shipping_service_package_details = array();
         foreach ($response->ShippingServicePackageDetails as $item) {
             $this->shipping_service_package_details[] = array('dimensions_required' => XmlHelper::normalizeBoolean($item->DimensionsRequired), 'name' => (string) $item->Name);
         }
     }
     if (isset($response->DeprecationDetails)) {
         $this->deprecation_details = array();
         foreach ($response->DeprecationDetails as $item) {
             $this->deprecation_details[] = array('announcement_start_time' => isset($item->AnnouncementStartTime) ? $item->AnnouncementStartTime : null, 'event_time' => isset($item->EventTime) ? $item->EventTime : null, 'message_type' => isset($item->MessageType) ? $item->MessageType : null);
         }
     }
     if (isset($response->SiteID)) {
         $this->site_id = $response->SiteID;
     }
     $this->cost_group_flat = XmlHelper::getAsString($response, 'CostGroupFlat', '');
     $this->description = XmlHelper::getAsString($response, 'Description', '');
     $this->mapped_to_shipping_service_id = XmlHelper::getAsString($response, 'MappedToShippingServiceID', '');
     $this->shipping_category = XmlHelper::getAsString($response, 'ShippingCategory', '');
     $this->shipping_service = XmlHelper::getAsString($response, 'ShippingService', '');
     $this->shipping_service_id = XmlHelper::getAsString($response, 'ShippingServiceID', '');
     $this->shipping_time_max = XmlHelper::getAsString($response, 'ShippingTimeMax', '');
     $this->shipping_time_min = XmlHelper::getAsString($response, 'ShippingTimeMin', '');
     $this->detail_version = XmlHelper::getAsString($response, 'DetailVersion', '');
     $this->update_time = XmlHelper::getAsString($response, 'UpdateTime', '');
 }
 /**
  * Return payment methods list
  * @return array
  */
 public function getPaymentMethods()
 {
     /** @var \SimpleXMLElement $category */
     $category = $this->response->Category;
     /** @var \SimpleXMLElement $site */
     $site = $this->response->SiteDefaults;
     $result = XmlHelper::getArrayAsStrings($site, 'PaymentMethod');
     return fn_array_merge($result, XmlHelper::getArrayAsStrings($category, 'PaymentMethod'));
 }