public static function setUpBeforeClass() { $mock = new MockHandler([new Response(200, [], "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><LnpOrderResponse><OrderId>d28b36f7-fa96-49eb-9556-a40fca49f7c6</OrderId><Status><Code>201</Code><Description>Order request received. Please use the order id to check the status of your order later.</Description></Status><ProcessingStatus>PENDING_DOCUMENTS</ProcessingStatus><LoaAuthorizingPerson>John Doe</LoaAuthorizingPerson><Subscriber><SubscriberType>BUSINESS</SubscriberType><BusinessName>Acme Corporation</BusinessName><ServiceAddress><HouseNumber>1623</HouseNumber><StreetName>Brockton Ave #1</StreetName><City>Los Angeles</City><StateCode>CA</StateCode><Zip>90025</Zip><Country>USA</Country></ServiceAddress></Subscriber><BillingTelephoneNumber>6882015002</BillingTelephoneNumber><ListOfPhoneNumbers><PhoneNumber>6882015025</PhoneNumber><PhoneNumber>6882015026</PhoneNumber></ListOfPhoneNumbers><Triggered>false</Triggered><BillingType>PORTIN</BillingType></LnpOrderResponse>"), new Response(200), new Response(200, [], "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><FileMetaData><DocumentName>test.txt</DocumentName><DocumentType>LOA</DocumentType></FileMetaData>"), new Response(200), new Response(200), new Response(200, [], "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?> <fileListResponse> <fileCount>0</fileCount> <resultCode>0</resultCode> <resultMessage>No LOA files found for order</resultMessage> </fileListResponse>"), new Response(200), new Response(200, [], "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><ActivationStatusResponse> <ActivationStatus> <AutoActivationDate>2014-08-29T18:30:00+03:00</AutoActivationDate> <ActivatedTelephoneNumbersList> <TelephoneNumber>6052609021</TelephoneNumber> <TelephoneNumber>6052609021</TelephoneNumber> </ActivatedTelephoneNumbersList> <NotYetActivatedTelephoneNumbersList/> </ActivationStatus></ActivationStatusResponse>"), new Response(200, [], "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><ActivationStatusResponse> <ActivationStatus> <AutoActivationDate>2014-08-29T18:30:00+03:00</AutoActivationDate> <ActivatedTelephoneNumbersList> <TelephoneNumber>6052609021</TelephoneNumber> <TelephoneNumber>6052609021</TelephoneNumber> </ActivatedTelephoneNumbersList> <NotYetActivatedTelephoneNumbersList/> </ActivationStatus></ActivationStatusResponse>"), new Response(200, [], "<?xml version=\"1.0\"?> <LnpOrderResponse><OrderId>0fe651a2-6ffc-4758-b7b7-e3eed66409ec</OrderId> <Status><Code>200</Code><Description>Supp request received. Please use the order id to check the status of your order later.</Description></Status><ProcessingStatus>REQUESTED_SUPP</ProcessingStatus><RequestedFocDate>2012-08-30T00:00:00Z</RequestedFocDate> </LnpOrderResponse>"), new Response(200, [], "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><LNPResponseWrapper> <TotalCount>2</TotalCount> <Links> <first>Link=<https://api.test.inetwork.com:443/v1.0/accounts/9500249/portins?page=1&size=300>;rel=\"first\";</first> </Links> <lnpPortInfoForGivenStatus> <CountOfTNs>1</CountOfTNs> <userId>System</userId> <lastModifiedDate>2015-06-03T15:06:36.234Z</lastModifiedDate> <OrderDate>2015-06-03T15:06:35.533Z</OrderDate> <OrderId>535ba91e-5363-474e-8c97-c374a4aa6a02</OrderId> <OrderType>port_in</OrderType> <BillingTelephoneNumber>9193491234</BillingTelephoneNumber> <LNPLosingCarrierId>1537</LNPLosingCarrierId> <LNPLosingCarrierName>Test Losing Carrier L3</LNPLosingCarrierName> <ProcessingStatus>SUBMITTED</ProcessingStatus> <RequestedFOCDate>2015-06-03T15:30:00.000Z</RequestedFOCDate> <VendorId>49</VendorId> <VendorName>Bandwidth CLEC</VendorName> <PON>BWC1433343996123</PON> </lnpPortInfoForGivenStatus> <lnpPortInfoForGivenStatus> <CountOfTNs>1</CountOfTNs> <userId>byo_dev</userId> <lastModifiedDate>2015-06-03T15:10:13.384Z</lastModifiedDate> <OrderDate>2015-06-03T15:10:12.808Z</OrderDate> <OrderId>98939562-90b0-40e9-8335-5526432d9741</OrderId> <OrderType>port_in</OrderType> <BillingTelephoneNumber>7576768750</BillingTelephoneNumber> <LNPLosingCarrierId>1537</LNPLosingCarrierId> <LNPLosingCarrierName>Test Losing Carrier L3</LNPLosingCarrierName> <ProcessingStatus>SUBMITTED</ProcessingStatus> <RequestedFOCDate>2015-06-03T15:30:00.000Z</RequestedFOCDate> <VendorId>49</VendorId> <VendorName>Bandwidth CLEC</VendorName> <PON>BWC1433344213212</PON> </lnpPortInfoForGivenStatus></LNPResponseWrapper>"), new Response(200, [], "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><LnpOrderResponse> <ProcessingStatus>SUBMITTED</ProcessingStatus> <RequestedFocDate>2015-06-03T15:30:00Z</RequestedFocDate> <LoaAuthorizingPerson>Joe Blow</LoaAuthorizingPerson> <Subscriber> <SubscriberType>BUSINESS</SubscriberType> <BusinessName>Company</BusinessName> <ServiceAddress> <HouseNumber>123</HouseNumber> <StreetName>EZ Street</StreetName> <City>Raleigh</City> <StateCode>NC</StateCode> <Zip>27615</Zip> <County>Wake</County> <Country>United States</Country> <AddressType>Service</AddressType> </ServiceAddress> </Subscriber> <BillingTelephoneNumber>9193491234</BillingTelephoneNumber> <ListOfPhoneNumbers> <PhoneNumber>9193491234</PhoneNumber> </ListOfPhoneNumbers> <PON>BWC1433343996123</PON> <AccountId>9500249</AccountId> <SiteId>2297</SiteId> <PeerId>500655</PeerId> <LosingCarrierName>Test Losing Carrier L3</LosingCarrierName> <VendorName>Bandwidth CLEC</VendorName> <OrderCreateDate>2015-06-03T15:06:35.533Z</OrderCreateDate> <LastModifiedDate>2015-06-03T15:06:36.234Z</LastModifiedDate> <userId>System</userId> <LastModifiedBy>System</LastModifiedBy> <PartialPort>false</PartialPort> <Immediately>false</Immediately> <Triggered>false</Triggered></LnpOrderResponse>"), new Response(200, [], "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><OrderHistoryWrapper> <OrderHistory> <OrderDate>2015-06-03T15:06:35.765Z</OrderDate> <Note>LOA required</Note> <Author>byo_dev</Author> <Status>PENDING_DOCUMENTS</Status> </OrderHistory> <OrderHistory> <OrderDate>2015-06-03T15:06:36.234Z</OrderDate> <Note>Order has been created</Note> <Author>System</Author> <Status>SUBMITTED</Status> <Difference>LoaDate : \"\" --> Wed Jun 03 15:06:35 UTC 2015</Difference> </OrderHistory></OrderHistoryWrapper>"), new Response(200, [], "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Quantity><Count>4</Count></Quantity>")]); self::$container = []; $history = Middleware::history(self::$container); $handler = HandlerStack::create($mock); $handler->push($history); $client = new Iris\Client("test", "test", array('url' => 'https://api.test.inetwork.com/v1.0', 'handler' => $handler)); $account = new Iris\Account(9500249, $client); self::$portins = $account->portins(); }
<?php require_once "./vendor/autoload.php"; require_once "./config.php"; if (count($argv) < 2) { die("usage: php portin-sample.php [tn] e.g. php portin-sample.php 8183386247"); } if (empty(Config::SITE) || empty(Config::SIPPEER)) { die("You must configure a site and sip peer for this demo in your config file"); } $client = new Iris\Client(Config::LOGIN, Config::PASSWORD); $account = new Iris\Account(Config::ACCOUNT, $client); $number = $argv[1]; $res = $account->lnpChecker([$number], "true"); if ($res->PortableNumbers->Tn == $number) { echo "Your number is portable. Creating PortIn Order"; $portin = $account->portins()->create(array("BillingTelephoneNumber" => $number, "Subscriber" => array("SubscriberType" => "BUSINESS", "BusinessName" => "Acme Corporation", "ServiceAddress" => array("HouseNumber" => "1623", "StreetName" => "Brockton Ave", "City" => "Los Angeles", "StateCode" => "CA", "Zip" => "90025", "Country" => "USA")), "LoaAuthorizingPerson" => "John Doe", "ListOfPhoneNumbers" => array("PhoneNumber" => [$number]), "SiteId" => CONFIG::SITE, "Triggered" => "false")); $filename = $portin->loas_send(__DIR__ . "/loa.pdf", array("Content-Type" => "application/pdf")); echo "\nSuccessfully uploaded LOA: "; echo $filename; $portin->loas_update(__DIR__ . "/loa.pdf", $filename, array("Content-Type" => "application/pdf")); echo "Successfully updated"; }