/** * Redirect user to gateway payment form, using HTTP 'Location:' header or UI::RedirectPOST($host, $values); * * @param float $amount Purchase amount * @param Order $order Order object * @param array $post_values Array of fields, posted back by your payment form. Array keys are equal to field names you returned in IPaymentModule::GetPaymentForm() * @return void */ public function RedirectToGateway(Order $order, $post_values = array()) { $host = "https://merchant.webmoney.ru/lmi/payment.asp"; $params = array('LMI_PAYMENT_NO' => $order->ID, 'LMI_PAYEE_PURSE' => $this->Config->GetFieldByName('Purse')->Value, 'LMI_PAYMENT_AMOUNT' => number_format($order->GetBillingTotal(), 2, '.', ''), 'LMI_PAYMENT_DESC' => $order->Description, 'LMI_SIM_MODE' => $this->Config->GetFieldByName('TestPaymentSuccess')->Value ? '0' : '1', 'LMI_RESULT_URL' => CONFIG::$IPNURL); if ($post_values['return_url']) { $params['LMI_SUCCESS_URL'] = $post_values['return_url']; } UI::RedirectPOST($host, $params); exit; }
/** * Send postback to PayPal server * @return string $res */ private final function PostBack($request) { $params = array( "Method" => "order_synchro", "Identifier" => $this->Config->GetFieldByName("MerchantIdentifier")->Value, "Usrname" => $this->Config->GetFieldByName("Username")->Value, "Pwd" => $this->Config->GetFieldByName("Password")->Value, "tnxid" => $request['tnxid'], "checksum" => $request['checksum'], "parity" => $request['parity'] ); $req = http_build_query($params); $postback_url = "https://www.monsterpay.com/secure/components/synchro.cfc?wsdl&{$req}"; Log::Log(sprintf("Sending Postback: %s", $postback_url), E_USER_NOTICE); return @file_get_contents($postback_url); }
/** * Redirect user to gateway payment form, using HTTP 'Location:' header or UI::RedirectPOST($host, $values); * * @param float $amount Purchase amount * @param int $orderid Order ID. Can be used as an unique identifier. * @param string $payment_for Human-readable description of the payment * @param array $post_values Array of fields, posted back by your payment form. Array keys are equal to field names you returned in IPaymentModule::GetPaymentForm() * @return void */ public final function RedirectToGateway(Order $order, $post_values = array()) { $host = ($this->Config->GetFieldByName("isdemo")->Value == 1) ? "www.ips.net.cn/ipay/test_ipayment.asp" : "www.ips.com.cn/ipay/ipayment.asp"; $data = array( "mer_code" => $this->Config->GetFieldByName("merch_code")->Value, "billno" => $this->Config->GetFieldByName("merch_code")->Value.substr(time(), -6), "amount" => number_format($order->GetBillingTotal(), 2, '.', ''), "date" => date("Ymd"), "currency" => $post_values["Currency"], "merchanturl" => CONFIG::$IPNURL, "lang" => $post_values["Lang"], "attach" => $order->ID, "retencodetype" => 2, "orderencodetype" => 1, "rettype" => 0 ); $data["signmd5"] = md5($data["billno"].$data["amount"].$data["date"].$this->Config->GetFieldByName("password")->Value); UI::RedirectPOST("http://{$host}", $data); exit(); }
/** * Send postback to PayPal server * @return string $res */ private final function PostBack($request) { // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; foreach ($request as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&{$key}={$value}"; } // post back to PayPal system to validate $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; // open socket $host = ($this->Config->GetFieldByName("isdemo")->Value == 1) ? "www.sandbox.paypal.com" : "www.paypal.com"; $fp = @fsockopen($host, 80, $errno, $errstr, 30); if (!$fp) return false; else { //Push response @fputs($fp, $header . $req); // Read response from server while (!feof($fp)) $res = @fgets($fp, 128); // Close pointer @fclose ($fp); return $res; } }
function deleteContact () { $title = 'Delete one of your contacts.'; try { $dataTemplate = array( 'name' => 'Harald Frøland', 'street1' => 'Rådhusgata 1-3', 'street2' => 'Akersgaten 42 (H-blokk)', 'pc' => 'NO-8005', 'city' => 'Bodø', 'sp' => 'Nordland', 'cc' => 'NO', 'email' => $this->testConf->GetFieldByName('RealEmail')->Value, 'voice' => '+22.123456', 'fax' => '+22.123457' ); $contact = $this->registry->NewContactInstanceByGroup('generic'); $contact->SetFieldList($dataTemplate); $resp = $this->module->CreateContact($contact); $contact->CLID = $resp->CLID; $resp = $this->module->DeleteContact($contact); $this->assertTrue($resp->Succeed(), $title); } catch (RegistryException $e) { $this->fail($title); } }
/** * This method is called when user submits a payment form. * @param float $amount Purchase amount * @param int $orderid Order ID. Can be used as an unique identifier. * @param string $payment_for Human-readable description of the payment * @param array $post_values Array of fields, posted back by your payment form. Array keys are equal to field names you returned in IPaymentModule::GetPaymentForm() * @return bool True if payment succeed or false if failed. If payment is failed and you return false, $this->GetFailureReason() will also be called. */ public final function ProcessPayment(Order $order, $post_values = array()) { $this->OrderID = $order->ID; // Generate Merchant Reference $merchant_reference = "REF ".implode("", explode(" ", microtime())); // Amount in cents. $amount = (int)($order->GetBillingTotal()*100); // Generate Request. $request = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <JProxyPayLink> <Message> <Type>PreAuth</Type> <Authentication> <MerchantID>{$this->Config->GetFieldByName("merchantID")->Value}</MerchantID> <Password>{$this->Config->GetFieldByName("password")->Value}</Password> </Authentication> <OrderInfo> <Amount>{$amount}</Amount> <MerchantRef>{$merchant_reference}</MerchantRef> <MerchantDesc>".htmlspecialchars($order->Description)."</MerchantDesc> <Currency>{$this->Config->GetFieldByName("csymbol")->Value}</Currency> <CustomerEmail>{$post_values["email"]}</CustomerEmail> <Var1>InvoiceID: {$order->ID}</Var1> <Var2 /> <Var3 /> <Var4 /> <Var5 /> <Var6 /> <Var7 /> <Var8 /> <Var9 /> </OrderInfo> <PaymentInfo> <CCN>{$post_values["ccn"]}</CCN> <Expdate>{$post_values["Expdate_m"]}{$post_values["Expdate_Y"]}</Expdate> <CVCCVV>{$post_values["cvv"]}</CVCCVV> <InstallmentOffset>0</InstallmentOffset> <InstallmentPeriod>0</InstallmentPeriod> </PaymentInfo> </Message> </JProxyPayLink> "; Log::Log("ProxyPay3 request: " . $request, E_USER_NOTICE); if ($this->Config->GetFieldByName("isdemo")->Value == 1) $URL = "https://eptest.eurocommerce.gr/proxypay/apacsonline"; else $URL = "https://ep.eurocommerce.gr/proxypay/apacsonline"; try { $ch = curl_init(); // Enable SSL curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,1); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, $URL); curl_setopt($ch, CURLOPT_HEADER, 0); $params = array("APACScommand" => "NewRequest", "Data" => $request); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); $error = curl_error($ch); curl_close($ch); if (!$error) { Log::Log(sprintf(_("ProxyPay3 response: %s"), $response), E_USER_NOTICE); $response = simplexml_load_string($response); if (!$response || intval($response->ERRORCODE) != 0) $this->FailureReason = sprintf(_("Cannot proceed request. Error code: %s. Please contact Administrator."), $response->ERRORCODE); else $result = true; } else $this->FailureReason = sprintf(_("Request to ProxyPay3 failed: %s"), $error); } catch (Exception $e) { $this->FailureReason = sprintf(_("Request to ProxyPay3 failed: %s"), $e->getMessage()); } if ($result) return true; else return false; }
function SetUp(DataForm $DF) { // User input and initialized by EPP-DRS in real test $TestConf = AfiliasRegistryModule::GetTestConfigurationForm(); $test_conf = $TestConf->ListFields(); $test_conf['RegistrarID']->Value = '5080-BD'; $test_conf['ServerHost']->Value = 'inforfcote2.afilias.net'; $test_conf['ServerPort']->Value = '700'; $test_conf['Login-1']->Value = 'ClientB'; $test_conf['Password-1']->Value = 'foo-BAR2'; $test_conf['Password-1n']->Value = 'bar-FOO2'; // New password // Initialize registry $ModuleConf = AfiliasRegistryModule::GetConfigurationForm(); $module_conf = $ModuleConf->ListFields(); $module_conf['RegistrarID']->Value = $test_conf['RegistrarID']->Value; $module_conf['ServerHost']->Value = $test_conf['ServerHost']->Value; $module_conf['ServerPort']->Value = $test_conf['ServerPort']->Value; $module_conf['Login']->Value = $test_conf['Login-1']->Value; $module_conf['Password']->Value = $test_conf['Password-1']->Value; $module_conf['SSLCertPath']->Value = $DF->GetFieldByName('SSLCertPath')->Value; $module_conf['SSLCertPass']->Value = $DF->GetFieldByName('SSLCertPass')->Value; $manifest_path = MODULES_PATH . "/registries/Afilias/module.xml"; $this->Module = new AfiliasRegistryModule(new RegistryManifest($manifest_path)); $this->Module->InitializeModule("info", $ModuleConf); $this->Registry = new Registry($this->Module); $this->module_conf = $module_conf; $this->test_conf = $test_conf; $this->C2 = $this->Registry->NewContactInstance(CONTACT_TYPE::REGISTRANT); $this->C2->CLID = 'EPPOTE-C2'; $this->C3 = $this->Registry->NewContactInstance(CONTACT_TYPE::ADMIN); $this->C3->CLID = 'EPPOTE-C3'; $this->C4 = $this->Registry->NewContactInstance(CONTACT_TYPE::BILLING); $this->C4->CLID = 'EPPOTE-C4'; $this->C5 = $this->Registry->NewContactInstance(CONTACT_TYPE::TECH); $this->C5->CLID = 'EPPOTE-C5'; $this->NSList = array(new Nameserver('ns1.eppvalid.info'), new Nameserver('ns2.eppvalid.info')); }
/** * Enter description here... */ public function RunTest(DataForm $DF) { $filename = '/tmp/eppdrs-verisign-certtest-' . date('YmdHis') . '.log'; Log::RegisterLogger("File", "Verisign", $filename); Log::SetDefaultLogger("Verisign"); // Build dataforms for modules $DF1 = self::GetConfigurationForm(); $DF1->GetFieldByName('Login')->Value = $DF->GetFieldByName('Login_1')->Value; $DF1->GetFieldByName('Password')->Value = $DF->GetFieldByName('Password_1')->Value; $DF1->GetFieldByName('ServerHost')->Value = $DF->GetFieldByName('ServerHost')->Value; $DF1->GetFieldByName('ServerPort')->Value = $DF->GetFieldByName('ServerPort')->Value; $DF1->GetFieldByName('SSLCertPath')->Value = $DF->GetFieldByName('SSLCertPath')->Value; $DF1->GetFieldByName('SSLCertPass')->Value = $DF->GetFieldByName('SSLCertPass')->Value; $DF2 = self::GetConfigurationForm(); $DF2->GetFieldByName('Login')->Value = $DF->GetFieldByName('Login_2')->Value; $DF2->GetFieldByName('Password')->Value = $DF->GetFieldByName('Password_2')->Value; $DF2->GetFieldByName('ServerHost')->Value = $DF->GetFieldByName('ServerHost')->Value; $DF2->GetFieldByName('ServerPort')->Value = $DF->GetFieldByName('ServerPort')->Value; $DF2->GetFieldByName('SSLCertPath')->Value = $DF->GetFieldByName('SSLCertPath')->Value; $DF2->GetFieldByName('SSLCertPass')->Value = $DF->GetFieldByName('SSLCertPass')->Value; // Initialize modules $Module = new VerisignRegistryModule(new RegistryManifest(MODULES_PATH . "/registries/Verisign/module.xml")); $Module->InitializeModule('com', $DF1); $Registry = new Registry($Module); $Module2 = new VerisignRegistryModule(new RegistryManifest(MODULES_PATH . "/registries/Verisign/module.xml")); $Module2->InitializeModule('com', $DF2); $Registry2 = new Registry($Module2); // The subject domain $Domain = $this->RegistryAccessible->NewDomainInstance(); $Domain->Name = 'webta' . rand(1000, 9999); $Domain->UserID = 1; //// // 1. Using your OT&E1 account perform a CHECK command on domain name(s) until you // receive domain available response $oplog = array(); $op = array('title' => 'Perform a CHECK command on domain name(s)'); try { $ok = $Registry->DomainCanBeRegistered($Domain)->Result; $op['ok'] = (bool) $ok; } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; //// // 2. CREATE the Domain name using the CREATE command, term of registration should be // 2 years $op = array('title' => "CREATE the Domain name using the CREATE command"); try { $Contact = $Registry->NewContactInstanceByGroup('generic'); $Domain->SetContact($Contact, CONTACT_TYPE::REGISTRANT); $Domain->SetContact($Contact, CONTACT_TYPE::BILLING); $Domain->SetContact($Contact, CONTACT_TYPE::TECH); $Domain->SetContact($Contact, CONTACT_TYPE::ADMIN); $Registry->CreateDomain($Domain, 2); $op['ok'] = true; } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; //// // 3. CREATE 2 child name servers of newly created domain // $op = array('title' => "CREATE 2 child name servers of newly created domain"); try { $ns1 = new NameserverHost('ns1.' . $Domain->GetHostName(), gethostbyname('hostdad.com')); $ns2 = new NameserverHost('ns2.' . $Domain->GetHostName(), gethostbyname('hostdad.com')); $Registry->CreateNameserverHost($ns1); $Registry->CreateNameserverHost($ns2); $op['ok'] = true; } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; //// // 4. UPDATE Domain to attach child name servers to domain // $op = array('title' => "UPDATE Domain to attach child name servers to domain"); try { $nslist = $Domain->GetNameserverChangelist(); $nslist->Add($ns1); $nslist->Add($ns2); $Registry->UpdateDomainNameservers($Domain, $nslist); $op['ok'] = count($Domain->GetNameserverList()) == 2; } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; //// // 5. UPDATE Domain's status to // clientHold, clientUpdateProhibited, clientDeleteProhibited, and clientTransferProhibited // within one command $op = array('title' => "UPDATE Domain's status"); try { $flag_list = $Domain->GetFlagChangelist(); $flag_list->SetChangedList(array('clientHold', 'clientUpdateProhibited', 'clientDeleteProhibited', 'clientTransferProhibited')); $Registry->UpdateDomainFlags($Domain, $flag_list); $op['ok'] = count($Domain->GetFlagList()) == count($flag_list->GetList()); } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; //// // 6. Perform an INFO command on the domain to verify update // $op = array('title' => "Perform an INFO command on the domain to verify update"); try { $RDomain = $Registry->NewDomainInstance(); $RDomain->Name = $Domain->Name; $RDomain = $Registry->GetRemoteDomain($RDomain); $flags = $Domain->GetFlagList(); $rflags = $RDomain->GetFlagList(); sort($flags); sort($rflags); $op['ok'] = $RDomain->Name == $Domain->Name && date('Ymd', $RDomain->CreateDate) == date('Ymd', $Domain->CreateDate) && date('Ymd', $RDomain->ExpireDate) == date('Ymd', $Domain->ExpireDate) && $rflags == $flags; } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; //// // 7. UPDATE Domain's status to OK // $op = array('title' => "UPDATE Domain's status to OK"); try { $changes = $Domain->GetFlagChangelist(); foreach ($RDomain->GetFlagList() as $flag) { $changes->Remove($flag); } $Registry->UpdateDomainFlags($Domain, $changes); //$changes = $Domain->GetFlagChangelist(); //$changes->Add('ok'); //$this->Registry->UpdateDomainFlags($Domain, $changes); $op['ok'] = $Domain->GetFlagList() == array(); $Domain->SetFlagList(array('ok')); // ok flag set automatical when all other were removed } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; //// // 8. Perform an INFO command on the domain to verify update // $op = array('title' => "Perform an INFO command on the domain to verify update"); try { $RDomain = $Registry->NewDomainInstance(); $RDomain->Name = $Domain->Name; $RDomain = $Registry->GetRemoteDomain($RDomain); $op['ok'] = $RDomain->Name == $Domain->Name && date('Ymd', $RDomain->CreateDate) == date('Ymd', $Domain->CreateDate) && date('Ymd', $RDomain->ExpireDate) == date('Ymd', $Domain->ExpireDate) && $RDomain->GetFlagList() == array('ok'); } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; //// // 9. UPDATE Domain's AUTH INFO Code // $op = array('title' => "UPDATE Domain's AUTH INFO Code"); try { // ���������� AUTH ����������� �������������� � �����-�������� API $VerisignModule = $Registry->GetModule(); $Domain->AuthCode = "ae2Yo&#YARR1"; $params = array('name' => $Domain->GetHostName(), 'subproduct' => 'dot' . strtoupper($Domain->Extension), 'add' => '', 'remove' => '', 'change' => "<domain:chg><domain:authInfo><domain:pw>{$Domain->AuthCode}</domain:pw></domain:authInfo></domain:chg>"); $Resp = $VerisignModule->Request('domain-update', $params); $success = $Resp->Succeed || $Resp->Code == RFC3730_RESULT_CODE::OK_PENDING; $op['ok'] = $success; } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; //// // 10. UPDATE one of the name server's IP Address // $op = array('title' => "UPDATE one of the name server's IP Address"); try { $ns1->IPAddr = gethostbyname('ns.hostdad.com'); $Resp = $Module->UpdateNameserverHost($ns1); $op['ok'] = $Resp->Result; } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; //// // 11. Perform a HELLO command // $op = array('title' => "Perform a HELLO command"); try { $VerisignModule = $Registry->GetModule(); $Resp = $VerisignModule->Request('hello', $params = array()); $op['ok'] = $Resp == true; } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; //// // 12. Renew Domain for 2 years // $op = array('title' => "Renew Domain for 2 years"); try { $old_expire_date = $Domain->ExpireDate; $Registry->RenewDomain($Domain, $extra = array('period' => 2)); $op['ok'] = date('Ymd', $Domain->ExpireDate) == date('Ymd', strtotime('+2 year', $old_expire_date)); } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; //// // 13. Open Second Session using the OT&E2 account logon // $op = array('title' => "Open Second Session using the OT&E2 account logon"); $op['ok'] = true; // It will be done automatical in next command //// // 14. Perform INFO command on the newly created domain from step 1 using the AUTH // INFO code populated in step 9 to get INFO results // $op = array('title' => "Perform INFO command on the newly created domain from step 1"); try { $RDomain = $Registry2->NewDomainInstance(); $RDomain->Name = $Domain->Name; $RDomain->AuthCode = $Domain->AuthCode; $RDomain = $Registry2->GetRemoteDomain($RDomain); $flags = $Domain->GetFlagList(); $rflags = $RDomain->GetFlagList(); sort($flags); sort($rflags); $op['ok'] = $RDomain->Name == $Domain->Name && date('Ymd', $RDomain->CreateDate) == date('Ymd', $Domain->CreateDate) && date('Ymd', $RDomain->ExpireDate) == date('Ymd', $Domain->ExpireDate) && $rflags == $flags; } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; //// // 15. Initiate Transfer domain command using your OT&E2 account // $op = array('title' => "Initiate Transfer domain command using your OT&E2 account"); try { $ok = $Registry2->TransferRequest($Domain, array('pw' => $Domain->AuthCode)); $op['ok'] = $ok; } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; //// // 16. Perform a Transfer Query command using your OT&E2 account // $op = array('title' => "Perform a Transfer Query command using your OT&E2 account"); try { // Not implemented in cross-registry API $VerisignModule2 = $Registry2->GetModule(); $params = array('name' => $Domain->GetHostName(), 'pw' => $Domain->AuthCode, 'subproduct' => 'dot' . strtoupper($Domain->Extension)); $Resp = $VerisignModule2->Request('domain-trans-query', $params); $op['ok'] = $Resp->Succeed; } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; //// // 17. Approve the Transfer using your OT&E1 account // $op = array('title' => "Approve the Transfer using your OT&E1 account"); try { $ok = $Registry->TransferApprove($Domain); $op['ok'] = $ok; } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; //// // 18. Perform a Poll Command to check for messages in poll queue, ACK first poll message // // not works $op = array('title' => "Perform a Poll Command to check for messages in poll queue"); try { $VerisignModule2 = $Registry->GetModule(); $max_iter = 5; $i = 0; while ($i < $max_iter && ($Mess = $VerisignModule2->ReadMessage()) === false) { sleep(1); $i++; } $op['ok'] = true; } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; //// // 19. Initiate the Transfer again using your OT&E1 account // $op = array('title' => "Initiate the Transfer again using your OT&E1 account"); try { $ok = $Registry->TransferRequest($Domain, array('pw' => $Domain->AuthCode)); $op['ok'] = $ok; } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; //// // 20. Perform a Transfer Query command using your OT&E2 account // $op = array('title' => "Perform a Transfer Query command using your OT&E2 account"); try { // Not implemented in cross-registry API $VerisignModule2 = $Registry2->GetModule(); $params = array('name' => $Domain->GetHostName(), 'pw' => $Domain->AuthCode, 'subproduct' => 'dot' . strtoupper($Domain->Extension)); $Resp = $VerisignModule2->Request('domain-trans-query', $params); $op['ok'] = $Resp->Succeed; } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; //// // 21. Reject the Transfer using your OT&E2 account // $op = array('title' => "Reject the Transfer using your OT&E2 account"); try { $ok = $Registry2->TransferReject($Domain); $op['ok'] = $ok; } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; //// // 22. From OT&E2 sync the domain to the 15th day of the next month // $op = array('title' => "From OT&E2 sync the domain to the 15th day of the next month"); try { $m = (int) date('n') + 1; $ok = $VerisignModule2->UpdateDomainConsoliDate($Domain, array('expMonth' => $m, 'expDay' => 15)); $op['ok'] = $ok; } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; //// // 23. Exit Gracefully from both sessions by issuing the LOGOUT command // $op = array('title' => "Exit Gracefully from both sessions by issuing the LOGOUT command"); try { $VerisignModule->Request('logout', $params = array()); $VerisignModule2->Request('logout', $params = array()); $op['ok'] = true; } catch (Exception $e) { $op['ok'] = false; $op['fail_reason'] = $e->getMessage(); } $oplog[] = $op; $passed = true; foreach ($oplog as $op) { $passed = $passed && $op['ok']; } $out_filename = sprintf('eppdrs-verisign-certtest-%s.log', $passed ? 'passed' : 'failed'); header('Content-type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . $out_filename . '"'); foreach ($oplog as $i => $op) { $n = $i + 1; print str_pad("{$n}. {$op['title']}", 100, ' ', STR_PAD_RIGHT); printf("[%s]\n", $op['ok'] ? 'OK' : 'FAIL'); if (!$op['ok']) { print "fail reason: {$op['fail_reason']}\n"; } } print "\n\n"; print file_get_contents($filename); unlink($filename); die; }