Skip to content

Commit

Permalink
unserializeRoamingStatus moved to DataConnectionProfileClient
Browse files Browse the repository at this point in the history
  • Loading branch information
tkrajina committed Aug 20, 2012
1 parent 5706b5d commit 0b74319
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/on_hlr_event.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require_once 'oneapi/client.php';

# example:on-roaming-status
$result = SmsClient::unserializeRoamingStatus();
$result = DataConnectionProfileClient::unserializeRoamingStatus();
# ----------------------------------------------------------------------------------------------------

// Process $result here
18 changes: 11 additions & 7 deletions oneapi/client.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,6 @@ public static function unserializeDeliveryStatus($json) {
return Conversions::createFromJSON('DeliveryInfoNotification', $json);
}

public static function unserializeRoamingStatus($json=null) {
if($json === null)
$json = file_get_contents("php://input");

return Conversions::createFromJSON('TerminalRoamingStatusNotification', $json);
}

public static function unserializeInboundMessages($json=null) {
if($json === null)
$json = file_get_contents("php://input");
Expand Down Expand Up @@ -441,6 +434,17 @@ public function retrieveDeliveryNotificationsSubscriptions() {

class DataConnectionProfileClient extends AbstractOneApiClient {

public function __construct($username = null, $password = null, $baseUrl = null) {
parent::__construct($username, $password, $baseUrl);
}

public static function unserializeRoamingStatus($json=null) {
if($json === null)
$json = file_get_contents("php://input");

return Conversions::createFromJSON('TerminalRoamingStatusNotification', $json);
}

/**
* Retrieve asynchronously the customer’s roaming status for a single network-connected mobile device (HLR)
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/terminal_roaming_status_unserialize.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

$string = '{"terminalRoamingStatusList":{"roaming":{"address":"38598123456","currentRoaming":"NotRoaming","servingMccMnc":{"mcc":"219","mnc":"01"},"resourceURL":null,"retrievalStatus":"Retrieved","extendedData":{"destinationAddress":"38598123456","statusId":5,"doneTime":1345454221270,"pricePerMessage":5.0,"mccMnc":"21901","servingMsc":"38598042001","censoredServingMsc":"3859804","gsmErrorCode":0,"originalNetworkName":"T-Mobile HR","portedNetworkName":"T-Mobile HR","servingHlr":"3859812005","imsi":"219014100019459","originalNetworkPrefix":"98","originalCountryPrefix":"385","originalCountryName":"Croatia","isNumberPorted":false,"portedNetworkPrefix":"97","portedCountryPrefix":"385","portedCountryName":"Croatia","numberInRoaming":false},"callbackData":"test"}}}';

$status = SmsClient::unserializeRoamingStatus($string);
$status = DataConnectionProfileClient::unserializeRoamingStatus($string);

assert($status->terminalRoamingStatus->extendedData->destinationAddress == '38598123456');
assert($status->callbackData == "test");

0 comments on commit 0b74319

Please sign in to comment.