Example #1
0
     $fee_values["newitemtaxed"] = array("0");
     $fee_result = localAPI("updateinvoice", $fee_values, null);
 }
 //Add payment to invoice
 addInvoicePayment($invoiceid, $transid, $amount + $fee, $fee, "epay");
 logTransaction($gateway["name"], $_GET, "Successful");
 //Save subscription information
 if ($_GET["subscriptionid"]) {
     //Get client
     $client_query = mysql_query("SELECT gatewayid FROM tblclients WHERE id = " . $invoice_result['userid']);
     $client_result = mysql_fetch_array($client_query);
     //Set subscription ID
     $subscriptionid = $client_result['gatewayid'];
     //Get expire date
     $soap = new SoapClient("https://ssl.ditonlinebetalingssystem.dk/remote/subscription.asmx?wsdl");
     $soap_subscription_result = $soap->getsubscriptions(array("merchantnumber" => $gateway["merchantnumber"], "subscriptionid" => $_GET["subscriptionid"], "epayresponse" => -1));
     if ($soap_subscription_result->getsubscriptionsResult == true) {
         $expmonth = $soap_subscription_result->subscriptionAry->SubscriptionInformationType->expmonth;
         $expyear = $soap_subscription_result->subscriptionAry->SubscriptionInformationType->expyear;
         full_query("UPDATE tblclients set cardtype = 'Payment card', cardnum = AES_ENCRYPT('" . $_GET['cardno'] . "', MD5('" . $cc_encryption_hash . $_GET["clientid"] . "')), expdate = AES_ENCRYPT('" . $expmonth . $expyear . "', MD5('" . $cc_encryption_hash . $_GET["clientid"] . "')) WHERE id = " . $_GET["clientid"]);
     }
     //Save subscriptionid
     update_query("tblclients", array("gatewayid" => $_GET["subscriptionid"]), array("id" => $_GET["clientid"]));
     if ($client_result['gatewayid'] != "") {
         try {
             $soap->deletesubscription(array("merchantnumber" => $gateway["merchantnumber"], "subscriptionid" => $_GET["subscriptionid"], "epayresponse" => -1));
         } catch (Exception $e) {
             logActivity("epay_daily_cron_job: " . $e->getMessage());
         }
     }
 }