Closed swartjie closed 5 years ago
Hey hey,
try this, these are old things but they didn't changed their epp since.
In a file zacrEppCheckBalanceRequest.php
namespace Metaregistrar\EPP;
class zacrEppCheckBalanceRequest extends eppRequest { function __construct($registrar_id) { parent::__construct(); $epp = $this->getEpp(); $epp->setAttribute('xmlns:epp','urn:ietf:params:xml:ns:epp-1.0');
$epp->setAttribute('xmlns:contact','urn:ietf:params:xml:ns:contact-1.0'); $epp->setAttribute('xmlns:cozacontact',' http://co.za/epp/extensions/cozacontact-1-0'); $info = $this->createElement('epp:info'); $infoc = $this->createElement('contact:info'); $id = $this->createElement('contact:id',$registrar_id); $infoc->appendChild($id); $info->appendChild($infoc); $this->getCommand()->appendChild($info);
$ext = $this->createElement('epp:extension');
$coza = $this->createElement('cozacontact:info');
$bal = $this->createElement('cozacontact:balance','true');
$coza->appendChild($bal);
$ext->appendChild($coza);
$this->getCommand()->appendChild($ext);
}
}
Another file zacrEppCheckBalanceResponse.php will have this :
namespace Metaregistrar\EPP;
class zacrEppCheckBalanceResponse extends eppResponse { function construct($originalrequest) { parent::construct($originalrequest); }
public function getBalanceAmount() {
$xpath = $this->xPath();
$result =
$xpath->query('/epp:epp/epp:response/epp:extension/cozacontact:infData/cozacontact:balance'); if (is_object($result) && ($result->length > 0)) { return trim($result->item(0)->nodeValue); } else { return null; } } }
Don't forget to register the call with ::addCommandResponse('Metaregistrar\EPP\zacrEppCheckBalanceRequest', 'Metaregistrar\EPP\zacrEppCheckBalanceResponse');
Then call...
$balance = new Metaregistrar\EPP\zacrEppCheckBalanceRequest(XXXREGISTRARACCOUNTXXX); print_r(htmlentities($balance->saveXML())); if ($response = $conn->writeandread($balance)) { print_r(htmlentities($response->saveXML())); }
Have fun ^^
Le sam. 9 févr. 2019 à 17:40, swartjie notifications@github.com a écrit :
Hey Guys,
I have a bit of an issue I am struggling to resolve... How can you pull the account balance @ the registry using this class?
I have a working XML version of it, but having a hard time figuring out how to do it with the API Class... Else the question is, how can I run a custom XML build using the class in cases like this?
<epp:epp xmlns:epp="urn:ietf:params:xml:ns:epp-1.0" xmlns:contact="urn:ietf:params:xml:ns:contact-1.0" xmlns:cozacontact="http://co.za/epp/extensions/cozacontact-1-0"> epp:command epp:info contact:info contact:id$RegistrarUsername</contact:id> </contact:info> </epp:info> epp:extension cozacontact:info cozacontact:balancetrue</cozacontact:balance> </cozacontact:info> </epp:extension> </epp:command> </epp:epp>
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/metaregistrar/php-epp-client/issues/177, or mute the thread https://github.com/notifications/unsubscribe-auth/AHF94hxb42yanFJ7e9RQQJ9gQka7ADlRks5vLvnkgaJpZM4aynrc .
I will give this a try in the morning. Thank you very much... On that note, I have 2 questions...
I know you're working on the premium domains, but that would at-least provide an interim solution to it I think? Unless there is a better way?
Hello,
In the latest DEV release, i have included all extra commands that the ZACR registry uses (https://www.registry.net.za/content.php?wiki=1&contentid=18&title=EPP%20Contact%20Extensions#balanceCom) including the Balance command.
How to use it:
$info = new cozaEppBalanceCheckRequest(new eppContactHandle($contactid));
if ($response = $conn->request($info)) {
/* @var $response cozaEppBalanceCheckResponse */
echo $response->getBalance();
return true;
}
return false;
All CO.ZA extensions can be found here: https://github.com/metaregistrar/php-epp-client/tree/master/Protocols/EPP/eppExtensions/cozacontact-1.0
Dude you are a legend!!! Thank you very much :)
I am getting an error. I am sure it's because I did not state the correct "use" clause... Can you please advise what it is? I tried a bit of thumb sucking but did not have success...
Error: Class 'Metaregistrar\EPP\cozaEppConnection' not found in
I encountered the same problem when using Composer to load the project. When i use my own autoload.php the class is found. I shall see where the problem lies and fix it.
Also, i will be working on the pricing extension, expect to have it ready later today.
Solved it with my composer setup. When updating composer to get the latest php-epp-client, i did not upload the whole 'vendor' directory to the testing server. When the whole directory is copied, it works.
Please make sure you have the latest (dev) version of php-epp-client, if you want to test the new features.
Hey Guys,
I have a bit of an issue I am struggling to resolve... How can you pull the account balance @ the registry using this class?
I have a working XML version of it, but having a hard time figuring out how to do it with the API Class... Else the question is, how can I run a custom XML build using the class in cases like this?
<epp:epp xmlns:epp="urn:ietf:params:xml:ns:epp-1.0" xmlns:contact="urn:ietf:params:xml:ns:contact-1.0" xmlns:cozacontact="http://co.za/epp/extensions/cozacontact-1-0">