Example #1
0
<?php

// Llamar al método como si fuera del cliente
$cliente = new SoapClient(null, array('location' => 'http://localhost/users/ws/service.php', 'uri' => 'urn:webservices'));
if ($_POST["option"] == "insert") {
    echo $cliente->insert($_POST);
} else {
    if ($_POST["option"] == "list") {
        echo $cliente->listUser();
    } else {
        if ($_POST["option"] == "delete") {
            echo $cliente->delete($_POST);
        } else {
            if ($_POST["option"] == "select") {
                echo $cliente->select($_POST);
            } else {
                if ($_POST["option"] == "update") {
                    echo $cliente->update($_POST);
                }
            }
        }
    }
}
<?php

$soapURL = "http://localhost:8080/ws/services/AssetOperationService?wsdl";
$client = new SoapClient($soapURL, array('trace' => 1, 'location' => str_replace('?wsdl', '', $soapURL)));
$auth = array('username' => 'admin', 'password' => 'admin');
$identifier = array('path' => array('path' => '/my-xml-block', 'siteName' => 'nameOfSite'), 'type' => 'block');
$deleteParams = array('authentication' => $auth, 'identifier' => $identifier);
$reply = $client->delete($deleteParams);
if ($reply->deleteReturn->success == 'true') {
    echo "Success.";
} else {
    echo "Error occurred when deleting: " . $reply->deleteReturn->message;
}
Example #3
0
 public function cancel(Varien_Object $payment)
 {
     $session = Mage::getSingleton('adminhtml/session');
     if (Mage::app()->getRequest()->getActionName() == 'save') {
         $order = $payment->getOrder();
         $_totalDatas = $order->getData();
         $childOrder = Mage::getModel('sales/order')->loadByIncrementId($_totalDatas['relation_child_real_id']);
         if ($childOrder->getBaseGrandTotal() <= $order->getBaseGrandTotal()) {
             $childPayment = $childOrder->getPayment();
             $write = Mage::getSingleton('core/resource')->getConnection('core_write');
             $write->query('update epay_order_status set orderid = "' . $_totalDatas['relation_child_real_id'] . '" WHERE orderid = "' . $order->getIncrementId() . '"');
             $transactionId = $payment->getParentTransactionId();
             $childPayment->setTransactionId($transactionId)->setIsTransactionClosed(0);
             $transaction = $childPayment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH);
             $transaction->setAdditionalInformation("Transaction ID", $transactionId);
             $transaction->save();
         } else {
             $session->addError("The transaction could not be moved because the amount of the edited order exceeds the transaction amount - Go to the ePay administration to handle the payment manually.");
         }
         return;
     }
     //
     // Verify if remote interface is enabled
     //
     if ((int) $this->getConfigData('remoteinterface', $payment->getOrder() ? $payment->getOrder()->getStoreId() : null) != 1) {
         $this->addOrderComment($payment->getOrder(), Mage::helper('epay')->__('EPAY_LABEL_75'));
         return;
     }
     try {
         //
         // Read info directly from the database
         //
         $read = Mage::getSingleton('core/resource')->getConnection('core_read');
         $row = $read->fetchRow("select * from epay_order_status where orderid = '" . $payment->getOrder()->getIncrementId() . "'");
         if ($row["status"] == '1') {
             $tid = $row["tid"];
             $param = array('merchantnumber' => $this->getConfigData('merchantnumber', $payment->getOrder() ? $payment->getOrder()->getStoreId() : null), 'transactionid' => $tid, 'group' => '', 'epayresponse' => 0, 'pwd' => $this->getConfigData('remoteinterfacepassword', $payment->getOrder() ? $payment->getOrder()->getStoreId() : null));
             $client = new SoapClient('https://ssl.ditonlinebetalingssystem.dk/remote/payment.asmx?WSDL');
             $result = $client->delete($param);
             if ($result->deleteResult == 1) {
                 //
                 // Success - transaction deleted!
                 //
                 $this->addOrderComment($payment->getOrder(), "Transaction deleted with transaction id: " . $tid);
                 $payment->getOrder()->save();
             } else {
                 if ($result->epayresponse != -1) {
                     if ($result->epayresponse == -1002) {
                         $this->addOrderComment($payment->getOrder(), "Transaction could not be deleted by ePay: " . $result->epayresponse . ". Forretningsnummeret findes ikke.");
                         throw new Exception("Transaction could not be deleted by ePay: " . $result->epayresponse . ". Forretningsnummeret findes ikke.");
                     } elseif ($result->epayresponse == -1003 || $result->epayresponse == -1006) {
                         $this->addOrderComment($payment->getOrder(), "Transaction could not be captured by ePay: " . $result->epayresponse . ". Der er ikke adgang til denne funktion (API / Remote Interface).");
                         throw new Exception("Transaction could not be deleted by ePay: " . $result->epayresponse . ". Der er ikke adgang til denne funktion (API / Remote Interface).");
                     } else {
                         $this->addOrderComment($payment->getOrder(), 'Transaction could not be deleted by ePay: ' . $result->epayresponse . '. ' . $this->getEpayErrorText($result->epayresponse));
                         throw new Exception('Transaction could not be deleted by ePay: ' . $result->epayresponse . '. ' . $this->getEpayErrorText($result->epayresponse));
                     }
                 } else {
                     throw new Exception('Unknown response from ePay: ' . $result->epayresponse);
                 }
             }
         } elseif ($row["status"] == '0') {
             //
             // Do nothing - the order is to be canceled without any communication to ePay
             //
         } else {
             //
             // Somehow the order was not found - this must be an error!
             //
             throw new Exception("Order not found - please check the epay_order_status table!");
         }
     } catch (Exception $e) {
         $session->addException($e, $e->getMessage() . " - Go to the ePay administration to credit the payment manually.");
     }
 }
Example #4
0
 public function cancel(Varien_Object $payment)
 {
     $session = Mage::getSingleton('adminhtml/session');
     if (Mage::app()->getRequest()->getActionName() == 'save') {
         return;
     }
     //
     // Verify if remote interface is enabled
     //
     if ((int) $this->getConfigData('remoteinterface', $payment->getOrder() ? $payment->getOrder()->getStoreId() : null) != 1) {
         $this->addOrderComment($payment->getOrder(), Mage::helper('epay')->__('EPAY_LABEL_75'));
         return;
     }
     try {
         //
         // Read info directly from the database
         //
         $read = Mage::getSingleton('core/resource')->getConnection('core_read');
         $row = $read->fetchRow("select * from epay_order_status where orderid = '" . $payment->getOrder()->getIncrementId() . "'");
         if ($row["status"] == '1') {
             $tid = $row["tid"];
             $param = array('merchantnumber' => $this->getConfigData('merchantnumber', $payment->getOrder() ? $payment->getOrder()->getStoreId() : null), 'transactionid' => $tid, 'group' => '', 'epayresponse' => 0, 'pwd' => $this->getConfigData('remoteinterfacepassword', $payment->getOrder() ? $payment->getOrder()->getStoreId() : null));
             $client = new SoapClient('https://ssl.ditonlinebetalingssystem.dk/remote/payment.asmx?WSDL');
             $result = $client->delete($param);
             if ($result->deleteResult == 1) {
                 //
                 // Success - transaction deleted!
                 //
                 $this->addOrderComment($payment->getOrder(), "Transaction deleted with transaction id: " . $tid);
                 $payment->getOrder()->save();
             } else {
                 if ($result->epayresponse != -1) {
                     if ($result->epayresponse == -1002) {
                         $this->addOrderComment($payment->getOrder(), "Transaction could not be deleted by ePay: " . $result->epayresponse . ". Forretningsnummeret findes ikke.");
                         throw new Exception("Transaction could not be deleted by ePay: " . $result->epayresponse . ". Forretningsnummeret findes ikke.");
                     } elseif ($result->epayresponse == -1003 || $result->epayresponse == -1006) {
                         $this->addOrderComment($payment->getOrder(), "Transaction could not be captured by ePay: " . $result->epayresponse . ". Der er ikke adgang til denne funktion (API / Remote Interface).");
                         throw new Exception("Transaction could not be deleted by ePay: " . $result->epayresponse . ". Der er ikke adgang til denne funktion (API / Remote Interface).");
                     } else {
                         $this->addOrderComment($payment->getOrder(), 'Transaction could not be deleted by ePay: ' . $result->epayresponse . '. ' . $this->getEpayErrorText($result->epayresponse));
                         throw new Exception('Transaction could not be deleted by ePay: ' . $result->epayresponse . '. ' . $this->getEpayErrorText($result->epayresponse));
                     }
                 } else {
                     throw new Exception('Unknown response from ePay: ' . $result->epayresponse);
                 }
             }
         } elseif ($row["status"] == '0') {
             //
             // Do nothing - the order is to be canceled without any communication to ePay
             //
         } else {
             //
             // Somehow the order was not found - this must be an error!
             //
             throw new Exception("Order not found - please check the epay_order_status table!");
         }
     } catch (Exception $e) {
         $session->addException($e, $e->getMessage() . " - Go to the ePay administration to credit the payment manually.");
     }
 }