public function testImportOrgData()
 {
     $this->markTestIncomplete();
     $org = new Organization\OrgCustomerModel();
     $org->importData($this->_data);
     $this->checkModelAgainstStruct($org, 'import with importData');
     $this->assertNotNull($org);
     $this->assertInstanceOf('\\Application\\Model\\Organization\\OrgCustomerModel', $org);
     // or
     $org = new Organization\OrgCustomerModel($this->_data);
     $this->checkModelAgainstStruct($org, 'import with constructor');
     $this->assertNotNull($org);
     $this->assertInstanceOf('\\Application\\Model\\Organization\\OrgCustomerModel', $org);
     // or
     $org = \Application\Model\OrgModelFactory::factory($this->_data);
     $this->checkModelAgainstStruct($org, 'import with factory');
     $this->assertNotNull($org);
     $this->assertInstanceOf('\\Application\\Model\\Organization\\OrgCustomerModel', $org);
 }
 protected function _updateOrgBillingAccounts()
 {
     // Check permissions
     $this->_helper->allowed('update_field_defaultBillingAccount', $this->_org);
     $this->_helper->allowed('update_field_billingAccounts', $this->_org);
     $filterHelper = $this->_helper->getHelper('filterNotAllowedFilters');
     $filterHelper->setThrowExOnNotAllowed(true);
     $filterHelper->direct('update_field', $this->_org);
     // Make a copy
     $billings = $this->_billings;
     // Set default one
     $default = array_shift($billings);
     $this->_org->setDefaultBillingAccount($default);
     //Workaround... ericsson fails them don't exist
     if (!$this->_org->getTaxes()) {
         $this->_org->setTaxes(array());
     }
     if (!$this->_org->getDiscounts()) {
         $this->_org->setDiscounts(array());
     }
     // Set other billings
     $this->_org->importData(array('billingAccounts' => $billings));
     return $this->_orgSrv->update($this->_org);
 }
 public function setUp()
 {
     $this->_mapper = OrgCustomerMapper::getInstance();
     $this->_org = new OrgCustomerModel();
     $data = '
         {
             "type": "customer",
             "name": "M2M_CUSTOMER_' . microtime(true) . '",
             "description": "Description",
             "status": 1,
             "defaultLanguage": "es",
             "billingCycleStart": {
                 "dayOfMonth": 13,
                 "timezone": "Europe/Madrid"
             },
             "currency": "978",
             "companyType": "1",
             "sector": "1",
             "companyAddress": {
                 "line1": "cfsfsvsa",
                 "line2": "Telefónica",
                 "city": "Barcelona",
                 "state": "Catalunya",
                 "country": "ES",
                 "postalCode": "5"
             },
             "primaryContact": {
                 "firstName": "Alberto",
                 "lastName": "Pastor",
                 "phone": "931233372",
                 "email": "*****@*****.**",
                 "mobile": "653229800",
                 "fax": "898989898"
             },
             "primaryContactAddressIsCompanyAddress": true,
             "primaryContactAddress": {
                 "line1": "cfsfsvsa",
                 "line2": "Telefónica",
                 "city": "Barcelona",
                 "state": "Catalunya",
                 "country": "ES",
                 "postalCode": "5"
             },
             "billingContactIsPrimaryContact": true,
             "billingContact": {
                 "firstName": "Alberto",
                 "lastName": "Pastor",
                 "phone": "931233372",
                 "email": "*****@*****.**",
                 "mobile": "653229800",
                 "fax": "898989898"
             },
             "billingContactAddressIsCompanyAddress": true,
             "billingContactAddress": {
                 "line1": "cfsfsvsa",
                 "line2": "Telefónica",
                 "city": "Barcelona",
                 "state": "Catalunya",
                 "country": "ES",
                 "postalCode": "5"
             },
             "shippingAddressIsCompanyAddress": true,
             "shippingAddress": {
                 "line1": "cfsfsvsa",
                 "line2": "Telefónica",
                 "city": "Barcelona",
                 "state": "Catalunya",
                 "country": "ES",
                 "postalCode": "76854"
             },
             "defaultBillingAccount": {
                 "billingAccountName": "Default billing account",
                 "billingAccountId": "",
                 "fiscalNumber": "B244235457",
                 "billable": true,
                 "automaticPrebill": true,
                 "crmBillingAccountId": "1",
                 "addressIsCompanyAddress": true,
                 "address": {
                     "line1": "cfsfsvsa",
                     "line2": "Telefónica",
                     "city": "Barcelona",
                     "state": "Catalunya",
                     "country": "ES",
                     "postalCode": "ES"
                 },
                 "contactIsPrimaryContact": true,
                 "contact": {
                     "firstName": "Alberto",
                     "lastName": "Pastor",
                     "phone": "931233372",
                     "email": "*****@*****.**",
                     "mobile": "653229800",
                     "fax": "898989898"
                 },
                 "commercialGroups": [
                     ""
                 ],
                 "numSubscriptions": 0,
                 "taxes": {
                     "tax": [
                         {
                             "name": "tax1",
                             "value": 100
                         },
                         {
                             "name": "tax2",
                             "value": 200
                         }
                     ]
                 },
                 "discounts": {
                     "discount": [
                         {
                             "name": "discount1",
                             "steps": [
                                 {
                                     "threshold": 20,
                                     "value": 300
                                 },
                                 {
                                     "threshold": 20,
                                     "value": 300
                                 }
                             ]
                         },
                         {
                             "name": "discount2",
                             "steps": [
                                 {
                                     "threshold": 60,
                                     "value": 300
                                 },
                                 {
                                     "threshold": 70,
                                     "value": 300
                                 }
                             ]
                         }
                     ]
                 },
                 "paymentMethod": "visa",
                 "paymentRelatedData": "1306101600"
             },
             "billingAccounts": {
                 "billingAccount": [
                     {
                         "billingAccountName": "default",
                         "billingAccountId": "",
                         "fiscalNumber": "B244235457",
                         "billable": true,
                         "automaticPrebill": true,
                         "crmBillingAccountId": "1",
                         "addressIsCompanyAddress": true,
                         "address": {
                             "line1": "cfsfsvsa",
                             "line2": "Telefónica",
                             "city": "Barcelona",
                             "state": "Catalunya",
                             "country": "ES",
                             "postalCode": "ES"
                         },
                         "contactIsPrimaryContact": false,
                         "contact": {
                             "firstName": "Alberto",
                             "lastName": "Pastor",
                             "phone": "931233372",
                             "email": "*****@*****.**",
                             "mobile": "653229800",
                             "fax": "898989898"
                         },
                         "commercialGroups": [
                             ""
                         ],
                         "numSubscriptions": 0,
                         "taxes": {
                             "tax": [
                                 {
                                     "name": "tax1",
                                     "value": 100
                                 },
                                 {
                                     "name": "tax2",
                                     "value": 200
                                 }
                             ]
                         },
                         "discounts": {
                             "discount": [
                                 {
                                     "name": "discount1",
                                     "steps": [
                                         {
                                             "threshold": 20,
                                             "value": 300
                                         },
                                         {
                                             "threshold": 20,
                                             "value": 300
                                         }
                                     ]
                                 },
                                 {
                                     "name": "discount2",
                                     "steps": [
                                         {
                                             "threshold": 60,
                                             "value": 300
                                         },
                                         {
                                             "threshold": 70,
                                             "value": 300
                                         }
                                     ]
                                 }
                             ]
                         },
                         "paymentMethod": "visa",
                         "paymentRelatedData": "1306101600"
                     },
                     {
                         "billingAccountName": "default",
                         "billingAccountId": "",
                         "fiscalNumber": "B244235457",
                         "billable": true,
                         "automaticPrebill": true,
                         "crmBillingAccountId": "1",
                         "addressIsCompanyAddress": true,
                         "address": {
                             "line1": "cfsfsvsa",
                             "line2": "Telefónica",
                             "city": "Barcelona",
                             "state": "Catalunya",
                             "country": "ES",
                             "postalCode": "ES"
                         },
                         "contactIsPrimaryContact": true,
                         "contact": {
                             "firstName": "Alberto",
                             "lastName": "Pastor",
                             "phone": "931233372",
                             "email": "*****@*****.**",
                             "mobile": "653229800",
                             "fax": "898989898"
                         },
                         "commercialGroups": [
                             ""
                         ],
                         "numSubscriptions": 0,
                         "taxes": {
                             "tax": [
                                 {
                                     "name": "tax1",
                                     "value": 100
                                 },
                                 {
                                     "name": "tax2",
                                     "value": 200
                                 }
                             ]
                         },
                         "discounts": {
                             "discount": [
                                 {
                                     "name": "discount1",
                                     "steps": [
                                         {
                                             "threshold": 20,
                                             "value": 300
                                         },
                                         {
                                             "threshold": 20,
                                             "value": 300
                                         }
                                     ]
                                 },
                                 {
                                     "name": "discount2",
                                     "steps": [
                                         {
                                             "threshold": 60,
                                             "value": 300
                                         },
                                         {
                                             "threshold": 70,
                                             "value": 300
                                         }
                                     ]
                                 }
                             ]
                         },
                         "paymentMethod": "visa",
                         "paymentRelatedData": "1306101600"
                     }
                 ]
             },
             "customFieldName_1": "custom_field_name_cust_1",
             "customFieldName_2": "custom_field_name_cust_2",
             "customFieldName_3": "custom_field_name_cust_3",
             "customFieldName_4": "custom_field_name_cust_4",
             "crmId_1": "crm1",
             "crmId_2": "crm2",
             "taxes": {
                 "tax": [
                     {
                         "name": "tax1",
                         "value": 100
                     },
                     {
                         "name": "tax2",
                         "value": 200
                     }
                 ]
             },
             "discounts": {
                 "discount": [
                     {
                         "name": "discount1",
                         "value": 300
                     },
                     {
                         "name": "discount2",
                         "value": 120
                     }
                 ]
             },
             "vpns": {
                 "vpn": [
                     {
                         "name": "vpn1",
                         "apns": [
                             "2234",
                             "9382"
                         ],
                         "staticAddressing": true,
                         "network": "mask1",
                         "mask": "network1",
                         "ipType": "ipv4"
                     },
                     {
                         "name": "vpn2",
                         "apns": [
                             "3234",
                             "2382"
                         ],
                         "staticAddressing": true,
                         "network": "mask1",
                         "mask": "network1",
                         "ipType": "ipv4"
                     }
                 ]
             },
             "parentId": "' . self::PROVIDER_COMMERCIAL_ORG_ID . '"
         }
     ';
     $array = Zend_Json::decode($data);
     $this->_org->importData($array);
 }
 public function setUp()
 {
     $this->_mapper = OrgAggregatorMapper::getInstance();
     $this->_org = new OrgAggregatorModel();
     $data = '
     {
         "type": "aggregator",
         "id": "",
         "name": "M2M_AGGREGATOR_' . uniqid(null, true) . '",
         "description ": "Description",
         "status": "1",
         "defaultLanguage": "es",
         "customFieldName_1": "aaaa",
         "customFieldName_2": "ssss",
         "customFieldName_3": "eeee",
         "customFieldName_4": "qqqq",
         "primaryContact": {
             "firstName": "Alberto",
             "lastName": "Pastor",
             "phone": "931233372",
             "email": "*****@*****.**",
             "mobile": "653229800",
             "fax": "898989898"
         },
         "companyAddress": {
             "line1": "cfsfsvsa",
             "line2": "Telefónica",
             "city": "Barcelona",
             "state": "Catalunya",
             "country": "ES",
             "postalCode": "5"
         },
         "sector": "1",
         "companyType": "1",
         "otherContact_1": {
             "firstName": "Alberto",
             "lastName": "Pastor",
             "phone": "931233372",
             "email": "*****@*****.**",
             "mobile": "653229800",
             "fax": "898989898"
         },
         "otherContact_2": {
             "firstName": "Alberto",
             "lastName": "Pastor",
             "phone": "931233372",
             "email": "*****@*****.**",
             "mobile": "653229800",
             "fax": "898989898"
         },
         "otherContact_3": {
             "firstName": "Alberto",
             "lastName": "Pastor",
             "phone": "931233372",
             "email": "*****@*****.**",
             "mobile": "653229800",
             "fax": "898989898"
         },   
         "billingAddressIsCompanyAddress": false,
         "billingAddress": {
             "line1": "cfsfsvsa",
             "line2": "Telefónica",
             "city": "Barcelona",
             "state": "Catalunya",
             "country": "ES",
             "postalCode": "5"
         },   
         "shippingAddressIsCompanyAddress": false,
         "shippingAddress": {
             "line1": "cfsfsvsa",
             "line2": "Telefónica",
             "city": "Barcelona",
             "state": "Catalunya",
             "country": "ES",
             "postalCode": "5"
         }
     }
     ';
     $array = Zend_Json::decode($data);
     $this->_org->importData($array);
 }