Skip to content

Commit

Permalink
Bugfix for get_balance
Browse files Browse the repository at this point in the history
SRS was not accepting empty attributes as an array.  Updated the to xml
conversion process to use an associated array instead.

Moved GetBalance outside of domains/lookup to a more appropriate accounts
namespace.  Preserved existing lookupGetBalance function name for backwards
compatability.
  • Loading branch information
Colin Campbell committed Feb 25, 2016
1 parent c0d370b commit b85152c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
3 changes: 1 addition & 2 deletions demo/GetBalance.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

$callArray = array(
'func' => 'lookupGetBalance',

'func' => 'accountGetBalance',
'data' => array(),
);

Expand Down
8 changes: 8 additions & 0 deletions opensrs/Ops.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,14 @@ public function _quoteXMLChars($string)
*/
public function _is_assoc(&$array)
{
/*
* Empty array should default to associative
* SRS was having issues with empty attribute arrays
*/
if (empty($array)) {
return true;
}

if (is_array($array)) {
foreach ($array as $k => $v) {
if (!is_int($k)) {
Expand Down
3 changes: 2 additions & 1 deletion opensrs/RequestFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class RequestFactory
'premiumdomain' => 'domains\lookup\PremiumDomain',
'lookupdomain' => 'domains\lookup\LookupDomain',
'lookupgetdomain' => 'domains\lookup\GetDomain',
'lookupgetbalance' => 'domains\lookup\GetBalance',
'lookupgetbalance' => 'account\GetBalance',
'lookupgetdeleteddomains' => 'domains\lookup\GetDeletedDomains',
'lookupgetdomansbyexpiry' => 'domains\lookup\GetDomansByExpiry',
'lookupgetdomainscontacts' => 'domains\lookup\GetDomainsContacts',
Expand Down Expand Up @@ -131,6 +131,7 @@ class RequestFactory
'mailsetdomainblocklist' => 'mail\SetDomainBlockList',
'mailsetdomaindisabledstatus' => 'mail\SetDomainDisabledStatus',
'mailsetdomainmailboxlimits' => 'mail\SetDomainMailboxLimits',
'accountgetbalance' => 'account\GetBalance'
);

public static function build($func, $type, $dataObject)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace opensrs\domains\lookup;
namespace opensrs\account;

use opensrs\Base;

Expand Down

0 comments on commit b85152c

Please sign in to comment.