Esempio n. 1
0
 public function transmitRequestXML($xml, $request)
 {
     require_once dirname(__FILE__) . '/lib/cls.ideal.php';
     $response = array();
     $response['valid'] = false;
     $description = substr(AECToolbox::rewriteEngineRQ($this->settings['description'], $request), 0, 29);
     $report_url = AECToolbox::deadsureURL("index.php?option=com_acctexp&task=mollie_idealnotification");
     $return_url = $request->int_var['return_url'];
     $amount = $request->int_var['amount'] * 100;
     $mollieIdeal = new iDEAL_Payment($this->settings['partner_id']);
     if ($this->settings['testmode']) {
         $mollieIdeal->setTestmode(true);
     } else {
         $mollieIdeal->setTestmode(false);
     }
     if ($mollieIdeal->createPayment($request->int_var['params']['bank_id'], $amount, $description, $return_url, $report_url)) {
         // ...Request valid transaction id from Mollie and store it...
         $request->invoice->secondary_ident = $mollieIdeal->getTransactionId();
         $request->invoice->storeload();
         // Redirect to issuer bank
         aecRedirect($mollieIdeal->getBankURL());
     } else {
         // error handling
         $this->___logError("iDEAL_Payment::createPayment failed", $mollieIdeal->getErrorCode(), $mollieIdeal->getErrorMessage());
         return $response;
     }
     return null;
 }
Esempio n. 2
0
 public function createRequestXML($request)
 {
     $vars['VPSProtocol'] = "2.23";
     $vars['TxType'] = "PAYMENT";
     // AUTHORISE
     $vars['Vendor'] = $this->settings['vid'];
     $vars['VendorTxCode'] = $request->invoice->invoice_number;
     $vars['Amount'] = number_format($request->items->total->cost['amount'], 2);
     $vars['Description'] = AECToolbox::rewriteEngineRQ($this->settings['item_name'], $request);
     $vars['RelatedSecurityKey'] = $this->settings['secret'];
     $vars['Currency'] = $this->settings['currency'];
     $vars['CardHolder'] = $request->int_var['params']['billFirstName'] . ' ' . $request->int_var['params']['billLastName'];
     $vars['CardNumber'] = $request->int_var['params']['cardNumber'];
     $vars['CardType'] = $this->translateCardType($request->int_var['params']['cardType']);
     $vars['ExpiryDate'] = $request->int_var['params']['expirationMonth'] . substr($request->int_var['params']['expirationYear'], -2);
     $vars['CV2'] = $request->int_var['params']['cardVV2'];
     $vars['ClientIPAddress'] = $_SERVER['REMOTE_ADDR'];
     $vars['Apply3DSecure'] = $this->settings['3dsecure'];
     $vars['BillingSurname'] = $request->int_var['params']['billLastName'];
     $vars['BillingFirstnames'] = $request->int_var['params']['billFirstName'];
     $vars['BillingAddress1'] = $request->int_var['params']['billAddress'];
     $vars['BillingCity'] = $request->int_var['params']['billCity'];
     $vars['BillingPostCode'] = $request->int_var['params']['billZip'];
     $vars['BillingState'] = $request->int_var['params']['billState'];
     $vars['BillingCountry'] = $request->int_var['params']['billCountry'];
     $vars['DeliverySurname'] = $request->int_var['params']['billLastName'];
     $vars['DeliveryFirstnames'] = $request->int_var['params']['billFirstName'];
     $vars['DeliveryAddress1'] = $request->int_var['params']['billAddress'];
     $vars['DeliveryCity'] = $request->int_var['params']['billCity'];
     $vars['DeliveryPostCode'] = $request->int_var['params']['billZip'];
     $vars['DeliveryState'] = $request->int_var['params']['billState'];
     $vars['DeliveryCountry'] = $request->int_var['params']['billCountry'];
     return $this->arrayToNVP($vars);
 }
Esempio n. 3
0
 public function createGatewayLink($request)
 {
     $var['post_url'] = 'https://select.worldpay.com/wcc/purchase';
     if ($this->settings['testmode']) {
         $var['testMode'] = '100';
     }
     $var['instId'] = $this->settings['instId'];
     $var['currency'] = $this->settings['currency'];
     $var['cartId'] = $request->invoice->invoice_number;
     $var['desc'] = AECToolbox::rewriteEngineRQ($this->settings['item_name'], $request);
     $var['futurePayType'] = 'regular';
     $var['option'] = '0';
     $units = array('D' => '1', 'W' => '2', 'M' => '3', 'Y' => '4');
     if (isset($units[$request->int_var['amount']['unit3']])) {
         $var['intervalUnit'] = $units[$request->int_var['amount']['unit3']];
     } else {
         $var['intervalUnit'] = '1';
     }
     $var['intervalMult'] = $request->int_var['amount']['period3'];
     if (isset($request->int_var['amount']['amount1'])) {
         $var['initialAmount'] = $request->int_var['amount']['amount1'];
     }
     $var['normalAmount'] = $request->int_var['amount']['amount1'];
     return $var;
 }
Esempio n. 4
0
 public function createGatewayLink($request)
 {
     $var['post_url'] = "https://www.alertpay.com/PayProcess.aspx";
     if ($this->settings['testmode']) {
         $var['ap_test'] = '1';
     }
     if (is_array($request->int_var['amount'])) {
         $var['ap_purchasetype'] = 'Subscription';
         if (isset($request->int_var['amount']['amount1'])) {
             $var['ap_trialamount'] = $request->int_var['amount']['amount1'];
             $put = $this->convertPeriodUnit($request->int_var['amount']['unit1'], $request->int_var['amount']['period1']);
             $var['ap_trialtimeunit'] = $put['unit'];
             $var['ap_trialperiodlength'] = $put['period'];
         }
         $var['ap_amount'] = $request->int_var['amount']['amount3'];
         $puf = $this->convertPeriodUnit($request->int_var['amount']['unit3'], $request->int_var['amount']['period3']);
         $var['ap_timeunit'] = $puf['unit'];
         $var['ap_periodlength'] = $puf['period'];
     } else {
         $var['ap_purchasetype'] = 'Item';
         $var['ap_amount'] = $request->int_var['amount'];
     }
     $var['ap_merchant'] = $this->settings['merchant'];
     $var['ap_itemname'] = $request->invoice->invoice_number;
     $var['ap_currency'] = $this->settings['currency'];
     $var['ap_returnurl'] = AECToolbox::deadsureURL("index.php?option=com_acctexp&task=thanks");
     $var['ap_description'] = AECToolbox::rewriteEngineRQ($this->settings['item_name'], $request);
     $var['ap_cancelurl'] = AECToolbox::deadsureURL("index.php?option=com_acctexp&task=cancel");
     $var['apc_1'] = $request->metaUser->cmsUser->id;
     $var['apc_2'] = AECToolbox::rewriteEngineRQ($this->settings['item_name'], $request);
     $var['apc_3'] = $request->int_var['usage'];
     return $var;
 }
Esempio n. 5
0
 public function action($request)
 {
     $db = JFactory::getDBO();
     $text = AECToolbox::rewriteEngineRQ($this->settings['text'], $request);
     $displaypipeline = new displayPipeline();
     $displaypipeline->create($request->metaUser->userid, $this->settings['only_user'], $this->settings['once_per_user'], $this->settings['expire'], $this->settings['expiration'], $this->settings['displaymax'], $text);
     return true;
 }
Esempio n. 6
0
 public function relayAction($request)
 {
     if (!isset($this->settings['url' . $request->area])) {
         return null;
     }
     $url = AECToolbox::rewriteEngineRQ($this->settings['url' . $request->area], $request);
     $query = AECToolbox::rewriteEngineRQ($this->settings['query' . $request->area], $request);
     return $this->fetchURL($this->createURL($url, $query));
 }
Esempio n. 7
0
 public function createGatewayLink($request)
 {
     //URL returned by eWay
     $return_url = AECToolbox::deadsureURL("index.php?option=com_acctexp&task=ewaynotification");
     //Genere un identifiant unique pour la transaction
     $my_trxn_number = uniqid("eway_");
     $order_total = $request->int_var['amount'] * 100;
     $var = array("post_url" => "https://www.eWAY.com.au/gateway/payment.asp", "ewayCustomerID" => $this->settings['custId'], "ewayTotalAmount" => $order_total, "ewayCustomerFirstName" => $request->metaUser->cmsUser->username, "ewayCustomerLastName" => $request->metaUser->cmsUser->name, "ewayCustomerInvoiceDescription" => AECToolbox::rewriteEngineRQ($this->settings['item_name'], $request), "ewayCustomerInvoiceRef" => $request->invoice->invoice_number, "ewayOption1" => $request->metaUser->cmsUser->id, "ewayOption2" => $request->invoice->invoice_number, "eWAYTrxnNumber" => $my_trxn_number, "eWAYAutoRedirect" => $this->settings['autoRedirect'], "eWAYSiteTitle" => $this->settings['SiteTitle'], "eWAYURL" => $return_url);
     return $var;
 }
Esempio n. 8
0
 public function createGatewayLink($request)
 {
     $var['post_url'] = 'https://payflowlink.paypal.com';
     $var['LOGIN'] = $this->settings['login'];
     $var['PARTNER'] = $this->settings['partner'];
     $var['AMOUNT'] = $request->int_var['amount'];
     $var['TYPE'] = "S";
     $var['INVOICE'] = $request->invoice->id;
     $var['DESCRIPTION'] = AECToolbox::rewriteEngineRQ($this->settings['item_name'], $request);
     return $var;
 }
Esempio n. 9
0
 public function makedir($path, $mode, $request)
 {
     if (empty($path) || empty($mode)) {
         return null;
     }
     $fullpath = AECToolbox::rewriteEngineRQ($path, $request);
     if (!file_exists($fullpath)) {
         return mkdir($fullpath, $mode);
     } else {
         return true;
     }
 }
Esempio n. 10
0
 public function relayAction($request)
 {
     if (!isset($this->settings['short' . $request->area])) {
         return null;
     }
     $db = JFactory::getDBO();
     $rewriting = array('short', 'tags', 'text', 'params');
     foreach ($rewriting as $rw_name) {
         $this->settings[$rw_name . $request->area] = AECToolbox::rewriteEngineRQ($this->settings[$rw_name . $request->area], $request);
     }
     $log_entry = new EventLog();
     $log_entry->issue($this->settings['short' . $request->area], $this->settings['tags' . $request->area], $this->settings['text' . $request->area], $this->settings['level' . $request->area], $this->settings['params' . $request->area], $this->settings['force_notify' . $request->area], $this->settings['force_email' . $request->area]);
 }
Esempio n. 11
0
 public function createGatewayLink($request)
 {
     $var['post_url'] = 'https://select.worldpay.com/wcc/purchase';
     if ($this->settings['testmode']) {
         $var['post_url'] = 'https://select-test.worldpay.com/wcc/purchase';
         $var['testMode'] = '100';
     }
     $var['instId'] = $this->settings['instId'];
     $var['currency'] = $this->settings['currency'];
     $var['cartId'] = $request->invoice->invoice_number;
     $var['amount'] = $request->int_var['amount'];
     $var['desc'] = AECToolbox::rewriteEngineRQ($this->settings['item_name'], $request);
     return $var;
 }
Esempio n. 12
0
 public function relayAction($request)
 {
     if (!isset($this->settings['path' . $request->area])) {
         return null;
     }
     $db = JFactory::getDBO();
     $rewriting = array('path', 'append', 'content');
     foreach ($rewriting as $rw) {
         $this->settings[$rw . $request->area] = AECToolbox::rewriteEngineRQ($this->settings[$rw . $request->area], $request);
     }
     if ($this->settings['append' . $request->area]) {
         $file = fopen($this->settings['path' . $request->area], "a");
     } else {
         $file = fopen($this->settings['path' . $request->area], "w");
     }
     fwrite($file, $this->settings['content' . $request->area]);
     return fclose($file);
 }
Esempio n. 13
0
 public function action($request)
 {
     $db = JFactory::getDBO();
     if (empty($this->settings['timestamp']) && empty($this->settings['time_mod'])) {
         return true;
     }
     if (!empty($this->settings['force_last_expiration'])) {
         $tstamp = strtotime($request->metaUser->focusSubscription->expiration);
     } elseif (!empty($this->settings['timestamp'])) {
         $tstamp = strtotime(AECToolbox::rewriteEngineRQ($this->settings['timestamp'], $request));
     } else {
         $tstamp = (int) gmdate('U');
     }
     $new_expiration = strtotime($this->settings['time_mod'], $tstamp);
     $request->metaUser->focusSubscription->expiration = date('Y-m-d H:i:s', $new_expiration);
     $request->metaUser->focusSubscription->storeload();
     return true;
 }
Esempio n. 14
0
 public function createGatewayLink($request)
 {
     if ($this->settings['testmode']) {
         $var['post_url'] = 'http://test.robokassa.ru/Index.aspx ';
     } else {
         $var['post_url'] = "https://merchant.roboxchange.com/Index.aspx";
     }
     $vars = array();
     $vars[] = trim($this->settings['login']);
     $vars[] = $request->invoice->amount;
     $vars[] = $request->invoice->id;
     $vars[] = trim($this->settings['pass']);
     $var['MrchLogin'] = trim($this->settings['login']);
     $var['OutSum'] = $request->int_var['amount'];
     $var['InvId'] = $request->invoice->id;
     $var['Desc'] = AECToolbox::rewriteEngineRQ($this->settings['item_name'], $request);
     $var['SignatureValue'] = $this->getHash($vars);
     $var['Culture'] = $this->settings['language'];
     return $var;
 }
Esempio n. 15
0
 public function relayAction($request)
 {
     if ($request->action == 'action') {
         if (!empty($this->settings['text_first'])) {
             if (empty($request->metaUser->objSubscription->previous_plan)) {
                 $request->area = '_first';
             }
         }
     }
     if (!isset($this->settings['text' . $request->area]) || !isset($this->settings['subject' . $request->area])) {
         return null;
     }
     $message = AECToolbox::rewriteEngineRQ($this->settings['text' . $request->area], $request);
     $subject = AECToolbox::rewriteEngineRQ($this->settings['subject' . $request->area], $request);
     if (empty($message)) {
         return null;
     }
     $recipient = $cc = $bcc = null;
     $rec_groups = array("recipient", "cc", "bcc");
     foreach ($rec_groups as $setting) {
         if (empty($this->settings[$setting])) {
             continue;
         }
         $list = AECToolbox::rewriteEngineRQ($this->settings[$setting], $request);
         $recipient_array = explode(',', $list);
         if (!empty($recipient_array)) {
             ${$setting} = array();
             foreach ($recipient_array as $k => $email) {
                 if (!empty($email)) {
                     ${$setting}[] = trim($email);
                 }
             }
         }
     }
     xJ::sendMail($this->settings['sender'], $this->settings['sender_name'], $recipient, $subject, $message, $this->settings['text' . $request->area . '_html'], $cc, $bcc);
     return true;
 }
Esempio n. 16
0
 public function invoiceCreationAction($objInvoice)
 {
     if ($this->settings['email_info']) {
         $metaUser = new metaUser($objInvoice->userid);
         $request = new stdClass();
         $request->metaUser =& $metaUser;
         $request->invoice =& $objInvoice;
         $request->plan =& $objInvoice->getObjUsage();
         $message = AECToolbox::rewriteEngineRQ($this->settings['text'], $request);
         $subject = AECToolbox::rewriteEngineRQ($this->settings['subject'], $request);
         if (!empty($message)) {
             $recipients = AECToolbox::rewriteEngineRQ($this->settings['recipient'], $request);
             $recips = explode(',', $recipients);
             $recipients2 = array();
             foreach ($recips as $k => $email) {
                 $recipients2[$k] = trim($email);
             }
             $recipients = $recipients2;
             $bccipients = AECToolbox::rewriteEngineRQ($this->settings['bcc'], $request);
             $bccips = explode(',', $bccipients);
             $bccipients2 = array();
             foreach ($bccips as $k => $email) {
                 $bccipients2[$k] = trim($email);
             }
             $bccipients = $bccipients2;
             if (!empty($bccipients2)) {
                 $bcc = $bccipients;
             } else {
                 $bcc = null;
             }
             xJ::sendMail($this->settings['sender'], $this->settings['sender_name'], $recipients, $subject, $message, $this->settings['text_html'], null, $bcc);
         }
     }
     if ($this->settings['waitingplan']) {
         $db = JFactory::getDBO();
         $metaUser = new metaUser($objInvoice->userid);
         if (!$metaUser->hasSubscription || in_array($metaUser->objSubscription->status, array('Expired', 'Closed'))) {
             if (!$metaUser->hasSubscription) {
                 $payment_plan = new SubscriptionPlan();
                 $payment_plan->load($this->settings['waitingplan']);
                 $metaUser->establishFocus($payment_plan, 'offline_payment3', false);
             }
             $metaUser->objSubscription->applyUsage($this->settings['waitingplan'], 'none', 0);
             $short = 'waiting plan';
             $event = 'Offline Payment waiting plan assigned for ' . $objInvoice->invoice_number;
             $tags = 'processor,waitingplan';
             $params = array('invoice_number' => $objInvoice->invoice_number);
             $eventlog = new eventLog();
             $eventlog->issue($short, $tags, $event, 2, $params);
         }
     }
 }
Esempio n. 17
0
 public function mailOut($request, $newcodes)
 {
     $codelist = "";
     if ($this->settings['text_html']) {
         foreach ($newcodes as $code) {
             $codelist .= "<p>" . $code . "</p>";
         }
     } else {
         $codelist = implode("\n", $newcodes);
     }
     $message = sprintf($this->settings['text'], $codelist);
     $message = AECToolbox::rewriteEngineRQ($message, $request);
     $subject = AECToolbox::rewriteEngineRQ($this->settings['subject'], $request);
     if (empty($message)) {
         return false;
     }
     $recipients = explode(',', $this->settings['recipient']);
     foreach ($recipients as $current => $email) {
         $recipients[$current] = AECToolbox::rewriteEngineRQ(trim($email), $request);
     }
     xJ::sendMail($this->settings['sender'], $this->settings['sender_name'], $recipients, $subject, $message, $this->settings['text_html']);
     return true;
 }
Esempio n. 18
0
 public function createGatewayLink($request)
 {
     $baseurl = AECToolbox::deadsureURL('index.php?option=com_acctexp&amp;task=payernotification', false, true);
     $Auth_url = $baseurl . '&action=authenticate';
     $Settle_url = $baseurl . '&action=settle';
     $Success_url = $request->int_var['return_url'];
     $Shop_url = JURI::root() . "index.php";
     // Explode Name
     $namearray = explode(" ", $request->metaUser->cmsUser->name);
     $firstfirstname = $namearray[0];
     $maxname = count($namearray) - 1;
     $lastname = $namearray[$maxname];
     unset($namearray[$maxname]);
     $firstname = implode(' ', $namearray);
     // Header
     $xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
     $xml .= "<payread_post_api_0_2 " . "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " . "xsi:noNamespaceSchemaLocation=\"payread_post_api_0_2.xsd\"" . ">";
     // Seller details
     $xml .= "<seller_details>" . "<agent_id>" . htmlspecialchars($this->settings['agentid']) . "</agent_id>" . "</seller_details>";
     // Buyer details
     $xml .= "<buyer_details>" . "<first_name>" . htmlspecialchars($firstname) . "</first_name>" . "<last_name>" . htmlspecialchars($lastname) . "</last_name>" . "<address_line_1>" . htmlspecialchars("AddressLine1") . "</address_line_1>" . "<address_line_2>" . htmlspecialchars("AddressLine2") . "</address_line_2>" . "<postal_code>" . htmlspecialchars("Postalcode") . "</postal_code>" . "<city>" . htmlspecialchars("City") . "</city>" . "<country_code>" . htmlspecialchars("CountryCode") . "</country_code>" . "<phone_home>" . htmlspecialchars("PhoneHome") . "</phone_home>" . "<phone_work>" . htmlspecialchars("PhoneWork") . "</phone_work>" . "<phone_mobile>" . htmlspecialchars("PhoneMobile") . "</phone_mobile>" . "<email>" . $request->metaUser->cmsUser->email . "</email>" . "</buyer_details>";
     // Purchase
     $xml .= "<purchase>" . "<currency>" . $this->settings['currency'] . "</currency>";
     // Add RefId if used
     $xml .= "<reference_id>" . $request->invoice->invoice_number . "</reference_id>";
     // Start the Purchase list
     $xml .= "<purchase_list>";
     $desc = AECToolbox::rewriteEngineRQ($this->settings['item_name'], $request);
     if (!empty($this->settings['invoice_tax'])) {
         foreach ($request->items->tax as $tax) {
             $tax += $tax['cost'];
         }
     } else {
         $tax = $this->settings['tax'];
     }
     $tax = AECToolbox::correctAmount($tax);
     // Purchase list (freeform purchases)
     $xml .= "<freeform_purchase>" . "<line_number>" . htmlspecialchars(1) . "</line_number>" . "<description>" . htmlspecialchars($desc) . "</description>" . "<price_including_vat>" . htmlspecialchars($request->int_var['amount']) . "</price_including_vat>" . "<vat_percentage>" . htmlspecialchars($tax) . "</vat_percentage>" . "<quantity>" . htmlspecialchars(1) . "</quantity>" . "</freeform_purchase>";
     $xml .= "</purchase_list>" . "</purchase>";
     //Processing control
     $xml .= "<processing_control>" . "<success_redirect_url>" . htmlspecialchars($this->mySuccessRedirectUrl) . "</success_redirect_url>" . "<authorize_notification_url>" . htmlspecialchars($this->myAuthorizeNotificationUrl) . "</authorize_notification_url>" . "<settle_notification_url>" . htmlspecialchars($this->mySettleNotificationUrl) . "</settle_notification_url>" . "<redirect_back_to_shop_url>" . htmlspecialchars($this->myRedirectBackToShopUrl) . "</redirect_back_to_shop_url>" . "</processing_control>";
     // Database overrides
     $xml .= "<database_overrides>";
     // Payment methods
     $xml .= "<accepted_payment_methods>";
     $methods = explode(';', $this->settings["payment_method"]);
     foreach ($methods as $method) {
         $xml .= "<payment_method>" . $method . "</payment_method>";
     }
     $xml .= "</accepted_payment_methods>";
     // Debug mode
     $xml .= "<debug_mode>" . $this->settings['debugmode'] . "</debug_mode>";
     // Test mode
     $xml .= "<test_mode>" . $this->settings['testmode'] . "</test_mode>";
     // Language
     $xml .= "<language>" . $this->settings['language'] . "</language>";
     $xml .= "</database_overrides>";
     // Footer
     $xml .= "</payread_post_api_0_2>";
     $var['post_url'] = "https://secure.pay-read.se/PostAPI_V1/InitPayFlow";
     $var['payread_agentid'] = $this->settings['agentid'];
     $var['payread_xml_writer'] = "payread_php_0_2";
     $var['payread_data'] = base64_encode($xml);
     $var['payread_checksum'] = md5($this->settings['key1'] . $xml . $this->settings['key2']);
     return $var;
 }
Esempio n. 19
0
 public function createGatewayLink($request)
 {
     if ($this->settings['alt2courl']) {
         $var['post_url'] = 'https://www2.2checkout.com/2co/buyer/purchase';
     } else {
         $var['post_url'] = 'https://www.2checkout.com/2co/buyer/purchase';
     }
     if ($this->settings['testmode']) {
         $var['testmode'] = 1;
         $var['demo'] = 'Y';
     }
     $var['sid'] = $this->settings['sid'];
     $var['invoice_number'] = $request->invoice->invoice_number;
     $var['merchant_order_id'] = $request->invoice->invoice_number;
     $var['x_invoice_num'] = $request->invoice->invoice_number;
     $var['fixed'] = 'Y';
     $var['total'] = $request->int_var['amount'];
     $var['cust_id'] = $request->metaUser->cmsUser->id;
     if (empty($request->int_var['planparams']['productid'])) {
         $var['cart_order_id'] = AECToolbox::rewriteEngineRQ($this->settings['item_name'], $request);
     }
     $var['username'] = $request->metaUser->cmsUser->username;
     $var['name'] = $request->metaUser->cmsUser->name;
     if (!empty($request->int_var['planparams']['productid'])) {
         $var['product_id'] = $request->int_var['planparams']['productid'];
         $var['quantity'] = 1;
     }
     $var['cart_brand_name'] = 'AEC';
     $var['cart_version_name'] = _AEC_VERSION . ' Revision ' . _AEC_REVISION;
     return $var;
 }
Esempio n. 20
0
 static function rewriteEngine($content, $metaUser = null, $subscriptionPlan = null, $invoice = null)
 {
     return AECToolbox::rewriteEngineRQ($content, null, $metaUser, $subscriptionPlan, $invoice);
 }
Esempio n. 21
0
 public function createGatewayLink($request)
 {
     if ($this->settings['testmode']) {
         $var['post_url'] = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
     } else {
         $var['post_url'] = 'https://www.paypal.com/cgi-bin/webscr';
     }
     $var['cmd'] = '_xclick-subscriptions';
     $var['src'] = "1";
     $var['sra'] = "1";
     if (isset($request->int_var['amount']['amount1'])) {
         $var['a1'] = $request->int_var['amount']['amount1'];
         $var['p1'] = $request->int_var['amount']['period1'];
         $var['t1'] = $request->int_var['amount']['unit1'];
     }
     if (isset($request->int_var['amount']['amount2'])) {
         $var['a2'] = $request->int_var['amount']['amount2'];
         $var['p2'] = $request->int_var['amount']['period2'];
         $var['t2'] = $request->int_var['amount']['unit2'];
     }
     $var['a3'] = $request->int_var['amount']['amount3'];
     $var['p3'] = $request->int_var['amount']['period3'];
     $var['t3'] = $request->int_var['amount']['unit3'];
     $var['business'] = $this->settings['business'];
     $var['invoice'] = $request->invoice->invoice_number;
     $var['cancel_return'] = AECToolbox::deadsureURL('index.php?option=com_acctexp&amp;task=cancel');
     if (strpos($this->settings['altipnurl'], 'http://') === 0) {
         $var['notify_url'] = $this->settings['altipnurl'] . 'index.php?option=com_acctexp&amp;task=paypal_subscriptionnotification';
     } else {
         $var['notify_url'] = AECToolbox::deadsureURL('index.php?option=com_acctexp&amp;task=paypal_subscriptionnotification');
     }
     $var['item_number'] = AECToolbox::rewriteEngineRQ($this->settings['item_number'], $request);
     $var['item_name'] = AECToolbox::rewriteEngineRQ($this->settings['item_name'], $request);
     $var['no_shipping'] = $this->settings['no_shipping'];
     $var['no_note'] = '1';
     $var['rm'] = '2';
     $var['return'] = $request->int_var['return_url'];
     $var['currency_code'] = $this->settings['currency'];
     $var['lc'] = $this->settings['lc'];
     if (!empty($this->settings['srt'])) {
         $var['srt'] = $this->settings['srt'];
     }
     // Customizations
     $customizations = array('cbt', 'cn', 'cpp_header_image', 'cpp_headerback_color', 'cpp_headerborder_color', 'cpp_payflow_color', 'image_url', 'page_style');
     foreach ($customizations as $cust) {
         if (!empty($this->settings[$cust])) {
             $var[$cust] = $this->settings[$cust];
         }
     }
     if (isset($this->settings['cs'])) {
         if ($this->settings['cs'] != 0) {
             $var['cs'] = $this->settings['cs'];
         }
     }
     return $var;
 }
Esempio n. 22
0
 public function rwrq($string, $request)
 {
     return AECToolbox::rewriteEngineRQ($string, $request);
 }
Esempio n. 23
0
 public function actionMembershipDetails()
 {
     $this->actionUserExists();
     $this->response->status = AECToolbox::VerifyMetaUser($this->metaUser);
     if ($this->response->status === true) {
         $this->response->status = $this->metaUser->objSubscription->status;
     }
     switch (strtolower($this->response->status)) {
         case 'active':
             $this->response->status_long = 'Account is fine.';
             break;
         case 'trial':
             $this->response->status_long = 'Account is fine (using a trial right now).';
             break;
         case 'expired':
             $this->response->status_long = 'Account has expired.';
             break;
         case 'pending':
             $this->response->status_long = 'Account is pending - awaiting payment for the last invoice to clear.';
             break;
         case 'open_invoice':
             $this->response->status_long = 'Account is pending - there is an open invoice waiting to be paid.';
             break;
         case 'hold':
             $this->response->status_long = 'Account is on manual hold.';
             break;
         default:
             $this->response->status_long = 'No long status explanation for this.';
             break;
     }
     if (!empty($this->request->details)) {
         if (!is_object($this->request->details)) {
             $this->error = 'details need to be an objects (with "key" and "value" as properties)';
         } else {
             $details = get_object_vars($this->request->details);
             foreach ($details as $k => $v) {
                 if (empty($k) || empty($v)) {
                     $this->error = 'one or more details empty or malformed';
                 } else {
                     $this->response->{$k} = AECToolbox::rewriteEngineRQ('{aecjson}' . json_encode($v) . '{/aecjson}', null, $this->metaUser);
                 }
             }
         }
     }
 }
Esempio n. 24
0
 public function invoiceprint($invoice_number, $standalone = true, $extradata = null, $forcecleared = false, $forcecounter = null)
 {
     $this->loadMetaUser();
     $this->touchInvoice($invoice_number, false, true);
     if ($this->invoice->invoice_number != $invoice_number) {
         return getView('access_denied');
     }
     $this->getInvoiceState(true);
     $this->invoice->formatInvoiceNumber();
     $data = $this->invoice->getPrintout($this, $forcecleared, $forcecounter);
     $data['standalone'] = $standalone;
     $exchange = $silent = null;
     if (!empty($extradata)) {
         foreach ($extradata as $k => $v) {
             $data[$k] = $v;
         }
     }
     $this->triggerMIs('invoice_printout', $exchange, $data, $silent);
     $data = AECToolbox::rewriteEngineRQ($data, $this);
     return getView('invoice', array('data' => $data, 'standalone' => $standalone, 'InvoiceFactory' => $this));
 }
Esempio n. 25
0
 public function createGatewayLink($request)
 {
     if ($this->settings['testmode']) {
         $var['post_url'] = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
     } else {
         $var['post_url'] = 'https://www.paypal.com/cgi-bin/webscr';
     }
     $var['cmd'] = '_xclick';
     if (!empty($this->settings['invoice_tax']) && isset($request->items->tax)) {
         $tax = 0;
         foreach ($request->items->tax as $itax) {
             $tax += $itax['cost'];
         }
         $var['tax'] = AECToolbox::correctAmount($tax);
         $var['amount'] = $request->items->total->cost['amount'];
     } elseif (!empty($this->settings['tax']) && $this->settings['tax'] > 0) {
         $amount = $request->int_var['amount'] / (100 + $this->settings['tax']) * 100;
         $var['tax'] = AECToolbox::correctAmount($request->int_var['amount'] - $amount, 2);
         $var['amount'] = AECToolbox::correctAmount($amount, 2);
     } else {
         $var['amount'] = $request->int_var['amount'];
     }
     $var['business'] = $this->settings['business'];
     $var['invoice'] = $request->invoice->invoice_number;
     $var['cancel_return'] = AECToolbox::deadsureURL('index.php?option=com_acctexp&amp;task=cancel');
     if (strpos($this->settings['altipnurl'], 'http://') === 0) {
         $var['notify_url'] = $this->settings['altipnurl'] . 'index.php?option=com_acctexp&amp;task=paypalnotification';
     } else {
         $var['notify_url'] = AECToolbox::deadsureURL('index.php?option=com_acctexp&amp;task=paypalnotification');
     }
     $var['item_number'] = AECToolbox::rewriteEngineRQ($this->settings['item_number'], $request);
     $var['item_name'] = AECToolbox::rewriteEngineRQ($this->settings['item_name'], $request);
     $var['no_shipping'] = $this->settings['no_shipping'];
     $var['no_note'] = '1';
     $var['rm'] = '2';
     $var['return'] = $request->int_var['return_url'];
     $var['currency_code'] = $this->settings['currency'];
     $var['lc'] = $this->settings['lc'];
     // Customizations
     $customizations = array('cbt', 'cn', 'cpp_header_image', 'cpp_headerback_color', 'cpp_headerborder_color', 'cpp_payflow_color', 'image_url', 'page_style');
     foreach ($customizations as $cust) {
         if (!empty($this->settings[$cust])) {
             $var[$cust] = $this->settings[$cust];
         }
     }
     if (isset($this->settings['cs'])) {
         if ($this->settings['cs'] != 0) {
             $var['cs'] = $this->settings['cs'];
         }
     }
     return $var;
 }
Esempio n. 26
0
 public function createGatewayLink($request)
 {
     $var['post_url'] = 'https://www.skrill.com/app/payment.pl';
     $var['pay_to_email'] = $this->settings['pay_to_email'];
     $var['recipient_description'] = $this->settings['recipient_description'];
     $var['logo_url'] = $this->settings['logo_url'];
     $var['transaction_id'] = $request->invoice->invoice_number;
     $var['return_url'] = $request->int_var['return_url'];
     $var['cancel_url'] = AECToolbox::deadsureURL('index.php?option=com_acctexp&amp;task=cancel');
     $var['status_url'] = AECToolbox::deadsureURL('index.php?option=com_acctexp&amp;task=skrillnotification');
     $var['language'] = $this->settings['language'];
     if (empty($this->settings['payment_methods'])) {
         $var['payment_methods'] = "";
     } else {
         $var['payment_methods'] = implode(',', $this->settings['payment_methods']);
     }
     $var['hide_login'] = $this->settings['hide_login'];
     $var['pay_from_email'] = $request->metaUser->cmsUser->email;
     if (is_array($request->int_var['amount'])) {
         $puf = $this->convertPeriodUnit($request->int_var['amount']['unit3'], $request->int_var['amount']['period3']);
         $var['rec_amount'] = $request->int_var['amount'];
         $var['rec_period'] = $puf['period'];
         $var['rec_cycle'] = $puf['unit'];
     } else {
         $var['amount'] = $request->int_var['amount'];
     }
     $var['detail1_description'] = AECToolbox::rewriteEngineRQ($this->settings['item_name'], $request);
     $var['detail1_text'] = $request->metaUser->cmsUser->id;
     $var['currency'] = $this->settings['currency'];
     $var['confirmation_note'] = $this->settings['confirmation_note'];
     return $var;
 }
Esempio n. 27
0
File: acl.php Progetto: Ibrahim1/aec
 public function gidRW($string, $request)
 {
     $id = AECToolbox::rewriteEngineRQ($string, $request);
     if (!is_numeric($id)) {
         $list = xJ::aclList();
         foreach ($list as $li) {
             if ($li->name == $id) {
                 return $li->group_id;
             }
         }
         return null;
     }
     return $id;
 }
Esempio n. 28
0
 public function setFields($request, $stage = "")
 {
     $db = JFactory::getDBO();
     $query = 'SELECT `profile_key`, `profile_value`' . ' FROM #__user_profiles' . ' WHERE `user_id` = \'' . $request->metaUser->userid . '\'';
     $db->setQuery($query);
     $objects = $db->loadObjectList();
     $changes = $additions = array();
     foreach ($this->settings as $k => $v) {
         if (strpos($k, 'jprofile_') !== false) {
             if ($stage == '_exp') {
                 if (strpos($k, '_exp') === false) {
                     continue;
                 }
             } else {
                 if (strpos($k, '_exp') !== false) {
                     continue;
                 }
             }
             if (empty($v)) {
                 continue;
             }
             if ($v === 0 || $v === "0") {
                 $v = '\'0\'';
             } elseif ($v === 1 || $v === "1") {
                 $v = '\'1\'';
             } elseif (strcmp($v, 'NULL') === 0) {
                 $v = 'NULL';
             } else {
                 $v = '\'' . AECToolbox::rewriteEngineRQ($v, $request) . '\'';
             }
             $f = false;
             foreach ($objects as $object) {
                 if ($k == 'jprofile_' . str_replace(".", "_", $object->profile_key) . $stage) {
                     $changes[$object->profile_key] = $v;
                     $f = true;
                 }
             }
             if (!$f) {
                 $key = str_replace(array("jprofile_", '_exp', "_"), array("", "", "."), $k);
                 $additions[$key] = $v;
             }
         }
     }
     if (!empty($changes)) {
         foreach ($changes as $name => $value) {
             $query = 'UPDATE #__user_profiles' . ' SET `profile_value` = ' . $value . ' WHERE `user_id` = \'' . (int) $request->metaUser->userid . '\'' . ' AND `profile_key` = \'' . $name . '\'';
             $db->setQuery($query);
             $db->query() or die($db->stderr());
         }
     }
     if (!empty($additions)) {
         $query = 'SELECT MAX(ordering)' . ' FROM #__user_profiles' . ' WHERE `user_id` = \'' . $request->metaUser->userid . '\'';
         $db->setQuery($query);
         $order = $db->loadResult();
         if (empty($order)) {
             $order = 0;
         }
         $values = array();
         foreach ($additions as $name => $value) {
             $values[] = '(' . (int) $request->metaUser->userid . ', ' . $db->quote($name) . ', ' . $value . ', ' . $order++ . ')';
         }
         $query = 'INSERT INTO #__user_profiles VALUES ' . implode(', ', $values);
         $db->setQuery($query);
         $db->query() or die($db->stderr());
     }
 }
Esempio n. 29
0
 public function getMIform($request, $checkout = true, $alwayspermit = false, $useredit = false)
 {
     global $aecConfig;
     $language_array = AECToolbox::getISO3166_1a2_codes();
     $language_code_list = array();
     foreach ($language_array as $language) {
         $language_code_list[] = JHTML::_('select.option', $language, JText::_('COUNTRYCODE_' . $language));
     }
     $settings = array();
     $lists = array();
     $hasregistration = true;
     if (!empty($request->metaUser->cmsUser)) {
         if (count($request->metaUser->cmsUser) < 4) {
             $hasregistration = false;
         }
     } else {
         $hasregistration = false;
     }
     $settings['validation'] = array();
     $settings['validation']['rules'] = array();
     $settings['formatting'] = array();
     if (!empty($this->settings['emulate_reg']) && (empty($request->metaUser->userid) && !$hasregistration || !$checkout)) {
         if (defined('JPATH_MANIFESTS')) {
             // Joomla 1.6+ Registration
             $lang = JFactory::getLanguage();
             $lang->load('com_users', JPATH_SITE, 'en-GB', true);
             $lang->load('com_users', JPATH_SITE, $lang->get('tag'), true);
             $settings['name'] = array('inputC', JText::_('COM_USERS_PROFILE_NAME_LABEL'), 'name', '');
             $settings['username'] = array('inputC', JText::_('COM_USERS_PROFILE_USERNAME_LABEL'), 'username', '');
             $settings['email'] = array('inputC', JText::_('COM_USERS_PROFILE_EMAIL1_LABEL'), 'email', '');
             $settings['email2'] = array('inputC', JText::_('COM_USERS_PROFILE_EMAIL2_LABEL'), 'email', '');
             $settings['password'] = array('password', JText::_('COM_USERS_REGISTER_PASSWORD1_LABEL'), 'password', '');
             $settings['password2'] = array('password', JText::_('COM_USERS_REGISTER_PASSWORD2_LABEL'), 'password2', '');
             $settings['validation']['rules']['name'] = array('minlength' => 2, 'required' => true);
             $settings['validation']['rules']['username'] = array('minlength' => 3, 'alphanumericwhitespace' => true, 'required' => true, 'remote' => "index.php?option=com_acctexp&task=usernameexists");
             $settings['validation']['rules']['email'] = array('nowhitespace' => true, 'email' => true, 'required' => true, 'remote' => "index.php?option=com_acctexp&task=emailexists");
             $settings['validation']['rules']['email2'] = array('nowhitespace' => true, 'email' => true, 'required' => true, 'equalTo' => '#mi_' . $this->id . '_email');
             $settings['validation']['rules']['password'] = array('minlength' => 6, 'maxlength' => 98, 'required' => true);
             $settings['validation']['rules']['password2'] = array('minlength' => 6, 'maxlength' => 98, 'required' => true, 'equalTo' => '#mi_' . $this->id . '_password');
         } else {
             // Joomla 1.5 Registration
             $settings['name'] = array('inputC', JText::_('Name'), 'name', '');
             $settings['username'] = array('inputC', JText::_('User name'), 'username', '');
             $settings['email'] = array('inputC', JText::_('Email'), 'email', '');
             $settings['password'] = array('password', JText::_('Password'), 'password', '');
             $settings['password2'] = array('password', JText::_('Verify Password'), 'password2', '');
             $settings['validation']['rules']['name'] = array('minlength' => 2, 'required' => true);
             $settings['validation']['rules']['username'] = array('minlength' => 3, 'required' => true, 'remote' => "index.php?option=com_acctexp&task=usernameexists");
             $settings['validation']['rules']['email'] = array('email' => true, 'required' => true, 'remote' => "index.php?option=com_acctexp&task=emailexists");
             $settings['validation']['rules']['password'] = array('minlength' => 2, 'required' => true);
             $settings['validation']['rules']['password2'] = array('minlength' => 2, 'required' => true, 'equalTo' => '#mi_' . $this->id . '_password');
         }
         if (!$checkout) {
             foreach ($settings as $s => $v) {
                 if ($s == 'validation' || strpos($s, 'password') !== false) {
                     continue;
                 }
                 $v[3] = $request->metaUser->cmsUser->{str_replace("2", "", $s)};
                 $settings[$s] = $v;
             }
         }
         if ($aecConfig->cfg['use_recaptcha'] && !empty($aecConfig->cfg['recaptcha_publickey']) && $checkout) {
             require_once JPATH_SITE . '/components/com_acctexp/lib/recaptcha/recaptchalib.php';
             $settings['recaptcha'] = array('passthrough', 'ReCAPTCHA', 'recaptcha', recaptcha_get_html($aecConfig->cfg['recaptcha_publickey']));
         }
     } elseif (!empty($this->settings['emulate_reg']) && !empty($this->settings['display_emul'])) {
         $settings['name'] = array('passthrough', JText::_('Name'), 'name', '<p><strong>' . $request->metaUser->cmsUser->name . '</strong></p>');
         $settings['username'] = array('passthrough', JText::_('User name'), 'username', '<p><strong>' . $request->metaUser->cmsUser->username . '</strong></p>');
         $settings['email'] = array('passthrough', JText::_('Email'), 'email', '<p><strong>' . $request->metaUser->cmsUser->email . '</strong></p>');
     }
     if (!empty($this->settings['settings'])) {
         for ($i = 0; $i < $this->settings['settings']; $i++) {
             $p = $i . '_';
             if (!isset($this->settings[$p . 'short'])) {
                 continue;
             }
             if (!empty($request->params[$this->settings[$p . 'short']])) {
                 $content = $request->params[$this->settings[$p . 'short']];
             } elseif (!empty($_POST['mi_' . $request->parent->id . '_' . $this->settings[$p . 'short']])) {
                 $content = aecGetParam('mi_' . $request->parent->id . '_' . $this->settings[$p . 'short'], true, array('string', 'badchars'));
             } else {
                 $content = AECToolbox::rewriteEngineRQ($this->settings[$p . 'default'], $request);
             }
             if (!empty($this->settings[$p . 'fixed']) && !$checkout && !$alwayspermit) {
                 $settings[$this->settings[$p . 'name']] = array('passthrough', $this->settings[$p . 'name'], $this->settings[$p . 'short'], '<p><strong>' . $content . '</strong></p>');
                 continue;
             }
             if (!empty($this->settings[$p . 'short'])) {
                 if ($this->settings[$p . 'type'] == 'list') {
                     $extra = explode("\n", $this->settings[$p . 'list']);
                     if (!count($extra)) {
                         continue;
                     }
                     $fields = array();
                     foreach ($extra as $ex) {
                         $fields[] = explode("|", $ex);
                     }
                     if ($this->settings[$p . 'ltype']) {
                         $settings[$this->settings[$p . 'short'] . '_desc'] = array('p', $this->settings[$p . 'name']);
                         $settings[$this->settings[$p . 'short']] = array('hidden', null, 'mi_' . $this->id . '_' . $this->settings[$p . 'short']);
                         foreach ($fields as $id => $field) {
                             if (!empty($field[1])) {
                                 $settings[$this->settings[$p . 'short'] . $id] = array('radio', 'mi_' . $this->id . '_' . $this->settings[$p . 'short'], trim($field[0]), true, trim($field[1]));
                             }
                         }
                         continue;
                     } else {
                         $options = array();
                         foreach ($fields as $field) {
                             if (!empty($field[1])) {
                                 $options[] = JHTML::_('select.option', trim($field[0]), trim($field[1]));
                             }
                         }
                         $lists[$this->settings[$p . 'short']] = JHTML::_('select.genericlist', $options, $this->settings[$p . 'short'], 'size="1"', 'value', 'text', 0);
                     }
                 }
                 if (!empty($this->settings[$p . 'mandatory'])) {
                     $settings['validation']['rules'][$this->settings[$p . 'short']] = array('required' => true);
                 }
                 if ($this->settings[$p . 'type'] == 'list_language') {
                     $lists[$this->settings[$p . 'short']] = JHTML::_('select.genericlist', $language_code_list, $this->settings[$p . 'short'], 'size="10"', 'value', 'text', $content);
                     $this->settings[$p . 'type'] = 'list';
                 }
                 if (!empty($this->settings[$p . 'formatting'])) {
                     $settings['formatting'][] = array('id' => 'mi_' . $this->id . '_' . $this->settings[$p . 'short'], 'pattern' => $this->settings[$p . 'formatting']);
                 }
                 if ($this->settings[$p . 'type'] == 'checkbox') {
                     $settings[$this->settings[$p . 'short']] = array($this->settings[$p . 'type'], $this->settings[$p . 'name'], $this->settings[$p . 'desc'], $content, $this->settings[$p . 'default']);
                 } elseif ($this->settings[$p . 'type'] == 'list') {
                     $settings[$this->settings[$p . 'short']] = array($this->settings[$p . 'type'], $this->settings[$p . 'name'], $this->settings[$p . 'name'], 'mi_' . $this->id . '_' . $this->settings[$p . 'short']);
                 } else {
                     $settings[$this->settings[$p . 'short']] = array($this->settings[$p . 'type'], $this->settings[$p . 'name'], $this->settings[$p . 'name'], $content);
                 }
                 if (!empty($this->settings[$p . 'validationtype'])) {
                     $settings['validation']['rules'][$this->settings[$p . 'short']] = array();
                     foreach ($this->settings[$p . 'validationtype'] as $vtype) {
                         $settings['validation']['rules'][$this->settings[$p . 'short']][$vtype] = true;
                     }
                 }
             }
         }
     }
     if ($useredit) {
         $unset = array('validation', 'username');
         foreach ($unset as $k) {
             if (isset($settings[$k])) {
                 unset($settings[$k]);
             }
         }
         $pref = 'mi_' . $this->id . '_';
         foreach ($settings as $k => $v) {
             $settings[$pref . $k] = $v;
             unset($settings[$k]);
         }
     }
     if (!empty($lists)) {
         $settings['lists'] = $lists;
     }
     return $settings;
 }
Esempio n. 30
0
 public function getInvoice($invoice)
 {
     ob_start();
     $iFactory = new InvoiceFactory($invoice->userid, null, null, null, null, null, false, true);
     $iFactory->invoiceprint($invoice->invoice_number, false, array('mi_aecinvoiceprintemail' => true), true);
     $content = AECToolbox::rewriteEngineRQ(ob_get_contents(), $iFactory);
     ob_end_clean();
     return $content;
 }