From 303b3e94f8543e3e7c0463c61d1d990b111eb2a3 Mon Sep 17 00:00:00 2001 From: Jeremi Bergman Date: Thu, 25 Jul 2013 12:41:47 +0300 Subject: [PATCH] Fixing certification, adding acceptOrderTOS to shopper which is now apparantly requried. Enhancing error reporting --- certifications/tests/test-2.php | 21 +++++++++++++-------- certifications/tests/test-3.php | 1 + certifications/tests/test-6.php | 1 + certifications/tests/test-7.php | 1 + library/WildWest/Reseller/Client.php | 10 ++++++++-- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/certifications/tests/test-2.php b/certifications/tests/test-2.php index a2f0b23..a350569 100644 --- a/certifications/tests/test-2.php +++ b/certifications/tests/test-2.php @@ -101,15 +101,20 @@ $shopper->user = 'createNew'; $shopper->pwd = 'abcde'; $shopper->phone = '+18885551212'; +$shopper->acceptOrderTOS = 'agree'; -$details = $client->OrderDomains($shopper, array($registration, $registration2)); +try { + $details = $client->OrderDomains($shopper, array($registration, $registration2)); -$_SESSION['userid'] = $details['user']; -$_SESSION['orderid'] = $details['orderid']; + $_SESSION['userid'] = $details['user']; + $_SESSION['orderid'] = $details['orderid']; -$messages = $client->Poll(); -$_SESSION['resources']['example.biz'] = $messages[0]['resourceid']; -$_SESSION['resources']['example.us'] = $messages[1]['resourceid']; + $messages = $client->Poll(); + $_SESSION['resources']['example.biz'] = $messages[0]['resourceid']; + $_SESSION['resources']['example.us'] = $messages[1]['resourceid']; -$_SESSION['complete'][2] = true; -echo json_encode(array('success' => true)); + $_SESSION['complete'][2] = true; + echo json_encode(array('success' => true)); +} catch (Exception $ex) { + echo json_encode(array('success' => false, 'message' => $ex->getMessage())); +} diff --git a/certifications/tests/test-3.php b/certifications/tests/test-3.php index 1968ae9..182910d 100644 --- a/certifications/tests/test-3.php +++ b/certifications/tests/test-3.php @@ -51,6 +51,7 @@ $shopper->dbpuser = 'createNew'; $shopper->dbppwd = 'defgh'; $shopper->dbpemail = 'info@example.biz'; +$shopper->acceptOrderTOS = 'agree'; $order = new WildWest_Reseller_OrderItem(); $order->productid = '377001'; diff --git a/certifications/tests/test-6.php b/certifications/tests/test-6.php index cab8a05..0f2156b 100644 --- a/certifications/tests/test-6.php +++ b/certifications/tests/test-6.php @@ -101,6 +101,7 @@ $shopper->pwd = 'abcde'; $shopper->dbpuser = $_SESSION['dbpuser']; $shopper->dbppwd = 'defgh'; +$shopper->acceptOrderTOS = 'agree'; try { $result = $client->OrderPrivateDomainRenewals($shopper, array($item, $item2), array($item3)); diff --git a/certifications/tests/test-7.php b/certifications/tests/test-7.php index bd5de2c..3179239 100644 --- a/certifications/tests/test-7.php +++ b/certifications/tests/test-7.php @@ -78,6 +78,7 @@ $shopper->phone = '+1.7775551212'; $shopper->pwd = 'ghijk'; $shopper->user = 'createNew'; +$shopper->acceptOrderTOS = 'agree'; $order = new WildWest_Reseller_OrderItem(); $order->productid = '350011'; diff --git a/library/WildWest/Reseller/Client.php b/library/WildWest/Reseller/Client.php index 08e3039..16fcd9d 100644 --- a/library/WildWest/Reseller/Client.php +++ b/library/WildWest/Reseller/Client.php @@ -84,6 +84,10 @@ public function OrderDomains(WildWest_Reseller_Shopper $shopper, array $items) $response = $this->__call('OrderDomains', array($data)); $xml = new SimpleXMLElement($response->OrderDomainsResult); $path = $xml->xpath('/response/resdata/orderid'); + + if (empty($xml->resdata)) { + throw new WildWest_Reseller_Exception((string)$xml->result->msg->error); + } if (empty($path)) { throw new RuntimeException( @@ -189,7 +193,9 @@ public function OrderDomainPrivacy(WildWest_Reseller_Shopper $shopper, array $db $xml = new SimpleXMLElement($response->OrderDomainPrivacyResult); - if (empty($xml->resdata) || empty($xml->resdata->orderid)) { + if (empty($xml->resdata)) { + throw new WildWest_Reseller_Exception((string)$xml->result->msg->error); + } elseif( empty($xml->resdata->orderid) ) { throw new WildWest_Reseller_Exception ( 'Did not receive an orderid from order domain with privacy' ); @@ -294,7 +300,7 @@ public function OrderDomainTransfers(WildWest_Reseller_Shopper $shopper, array $ $xml = new SimpleXMLElement($response->OrderDomainTransfersResult); if (empty($xml->resdata)) { - throw new WildWest_Reseller_Exception($xml->response->msg->error, $xml->response['code']); + throw new WildWest_Reseller_Exception((string)$xml->result->msg->error); } return array(