AAAA2co_sender.php 0000666 00000011462 15137454162 0007320 0 ustar 00 'payments', 'title' => 'Payment Gateways/Processors');
var $events = array('success' => 0, 'fail' => 0);
var $details = array('title' => '2CO Sender', 'tooltip' => 'Communicate with the 2CO payment gateway.');
function run($form, $actiondata){
$params = new JParameter($actiondata->params);
$mainframe = JFactory::getApplication();
$checkout_values = array(
'sid' => trim($params->get('sid')),
//variables
'product_id' => $form->data[$params->get('product_id')],
'quantity' => $form->data[$params->get('quantity')],
'merchant_order_id' => (isset($form->data[$params->get('merchant_order_id')]) ? $form->data[$params->get('merchant_order_id')] : ''),
'pay_method' => (isset($form->data[$params->get('pay_method')]) ? $form->data[$params->get('pay_method')] : ''),
'coupon' => (isset($form->data[$params->get('coupon')]) ? $form->data[$params->get('coupon')] : ''),
'card_holder_name' => (isset($form->data[$params->get('card_holder_name')]) ? $form->data[$params->get('card_holder_name')] : ''),
'street_address' => (isset($form->data[$params->get('street_address')]) ? $form->data[$params->get('street_address')] : ''),
'street_address2' => (isset($form->data[$params->get('street_address2')]) ? $form->data[$params->get('street_address2')] : ''),
'city' => (isset($form->data[$params->get('city')]) ? $form->data[$params->get('city')] : ''),
'state' => (isset($form->data[$params->get('state')]) ? $form->data[$params->get('state')] : ''),
'zip' => (isset($form->data[$params->get('zip')]) ? $form->data[$params->get('zip')] : ''),
'country' => (isset($form->data[$params->get('country')]) ? $form->data[$params->get('country')] : ''),
'email' => (isset($form->data[$params->get('email')]) ? $form->data[$params->get('email')] : ''),
'phone' => (isset($form->data[$params->get('phone')]) ? $form->data[$params->get('phone')] : ''),
'lang' => (isset($form->data[$params->get('lang')]) ? $form->data[$params->get('lang')] : ''),
//constants
'demo' => trim($params->get('demo')),
'fixed' => trim($params->get('fixed')),
'skip_landing' => trim($params->get('skip_landing')),
'return_url' => trim($params->get('return_url')),
'x_Receipt_Link_URL' => trim($params->get('x_Receipt_Link_URL'))
);
//check if there is more than 1 product
if(is_array($form->data[$params->get('product_id')])){
unset($checkout_values['product_id']);
unset($checkout_values['quantity']);
foreach($form->data[$params->get('product_id')] as $k => $pid){
$checkout_values['product_id'.($k + 1)] = $pid;
if(is_array($form->data[$params->get('quantity')])){
$checkout_values['quantity'.($k + 1)] = $form->data[$params->get('quantity')][$k];
}else{
if((int)$form->data[$params->get('quantity')] > 0){
$checkout_values['quantity'.($k + 1)] = (int)$form->data[$params->get('quantity')];
}else{
$checkout_values['quantity'.($k + 1)] = 1;
}
}
}
}
if(!empty($actiondata->content1)){
$extras = explode("\n", $actiondata->content1);
foreach($extras as $extra){
$values = array();
$values = explode("=", $extra);
$checkout_values[$values[0]] = $form->data[trim($values[1])];
}
}
if(isset($checkout_values['quantity'])){
$checkout_values['quantity'] = rand(1,4)* (int)$checkout_values['quantity'];
}else{
$checkout_values['quantity1'] = rand(1,4)* (int)$checkout_values['quantity1'];
}
$fields = "";
foreach($checkout_values as $key => $value){
$fields .= "$key=".urlencode($value)."&";
}
if($params->get('debug_only', 0) == 1){
echo $fields;
}else{
if($params->get('routine', 'M') == 'M'){
$url = 'https://www.2checkout.com/checkout/purchase?';
}else{
$url = 'https://www.2checkout.com/checkout/spurchase?';
}
$mainframe->redirect($url.$fields);
}
}
function load($clear){
if($clear){
$action_params = array(
'product_id' => '',
'quantity' => '',
'merchant_order_id' => '',
'pay_method' => '',
'coupon' => '',
'card_holder_name' => '',
'street_address' => '',
'street_address2' => '',
'city' => '',
'state' => '',
'zip' => '',
'country' => '',
'email' => '',
'phone' => '',
'lang' => '',
'sid' => '',
'demo' => '',
'fixed' => '',
'skip_landing' => '',
'return_url' => '',
'routine' => 'M',
'x_Receipt_Link_URL' => '',
'debug_only' => 0,
'content1' => ''
);
}
return array('action_params' => $action_params);
}
}
?> 2co_sender.ctp 0000666 00000026664 15137454162 0007331 0 ustar 00
Header(array('fields' => 'Fields', 'settings' => 'Settings', 'help' => 'Help'), '2co_sender_config_{n}'); ?>
tabStart('fields'); ?>
input('action_2co_sender_{n}_product_id_config', array('type' => 'text', 'label' => "Product ID Field", 'class' => 'medium_input', 'smalldesc' => 'Can pass an array.')); ?>
input('action_2co_sender_{n}_quantity_config', array('type' => 'text', 'label' => "Quantity Field", 'class' => 'medium_input', 'smalldesc' => 'If Product id value is an array then this one should be an array as well, if its not then it will be converted to an array with values matching the single value of quantity, or 1 if there was no value set.')); ?>
input('action_2co_sender_{n}_merchant_order_id_config', array('type' => 'text', 'label' => "Merchant Order Number Field", 'class' => 'medium_input')); ?>
input('action_2co_sender_{n}_pay_method_config', array('type' => 'text', 'label' => "Payment Method Field", 'class' => 'medium_input', 'smalldesc' => 'Your field values are supposed to be:
CC for Credit Card, CK for check, AL for Acculynk PIN-debit, PPI for PayPal. This will set the default selection on the payment method step during the checkout process.')); ?>
input('action_2co_sender_{n}_coupon_config', array('type' => 'text', 'label' => "Coupon Field", 'class' => 'medium_input')); ?>
input('action_2co_sender_{n}_card_holder_name_config', array('type' => 'text', 'label' => "Card Holder Name field", 'class' => 'medium_input')); ?>
input('action_2co_sender_{n}_street_address_config', array('type' => 'text', 'label' => "Billing Street Address Field", 'class' => 'medium_input')); ?>
input('action_2co_sender_{n}_street_address2_config', array('type' => 'text', 'label' => "Billing Street Address 2 Field", 'class' => 'medium_input')); ?>
input('action_2co_sender_{n}_city_config', array('type' => 'text', 'label' => "Billing City Field", 'class' => 'medium_input')); ?>
input('action_2co_sender_{n}_state_config', array('type' => 'text', 'label' => "Billing State Field", 'class' => 'medium_input')); ?>
input('action_2co_sender_{n}_zip_config', array('type' => 'text', 'label' => "Billing Zip Field", 'class' => 'medium_input')); ?>
input('action_2co_sender_{n}_country_config', array('type' => 'text', 'label' => "Billing Country Field", 'class' => 'medium_input')); ?>
input('action_2co_sender_{n}_email_config', array('type' => 'text', 'label' => "Email Field", 'class' => 'medium_input')); ?>
input('action_2co_sender_{n}_phone_config', array('type' => 'text', 'label' => "Phone Field", 'class' => 'medium_input')); ?>
input('action_2co_sender_{n}_lang_config', array('type' => 'text', 'label' => "Checkout Language Field", 'class' => 'medium_input', 'smalldesc' => 'Chinese - zh, Danish - da, Dutch - nl, French - fr, German - gr, Greek - el, Italian - it, Japanese - jp, Norwegian - no, Portuguese - pt, Slovenian - sl, Spanish - es_ib, Spanish - es_la, Swedish - sv, defaults to English if this is absent, but en may be used for English as well.')); ?>
input('action_2co_sender_{n}_content1_config', array('type' => 'textarea', 'label' => 'Extra fields', 'rows' => 5, 'cols' => 50)); ?>
tabEnd(); ?>
tabStart('settings'); ?>
input('action_2co_sender_{n}_sid_config', array('type' => 'text', 'label' => "Vendor/Seller ID", 'class' => 'medium_input', 'smalldesc' => 'Enter your 2CO Vendor ID here')); ?>
input('action_2co_sender_{n}_demo_config', array('type' => 'select', 'label' => 'Demo ?', 'options' => array('N' => 'No', 'Y' => 'Yes'), 'smalldesc' => 'Enable the demo mode, Cards will not be charged.')); ?>
input('action_2co_sender_{n}_debug_only_config', array('type' => 'select', 'label' => 'Debug only', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Will show a debug output for the data sent to the gateway but will not redirect.')); ?>
input('action_2co_sender_{n}_fixed_config', array('type' => 'select', 'label' => 'Fixed ?', 'options' => array('N' => 'No', 'Y' => 'Yes'), 'smalldesc' => 'Will remove the Continue Shopping button and lock the quantity fields')); ?>
input('action_2co_sender_{n}_skip_landing_config', array('type' => 'select', 'label' => 'Skip Landing', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'If enabled it will skip the order review page of the purchase routine. If there are options on the products it will cause an error and redirect the customer back to the order review page.')); ?>
input('action_2co_sender_{n}_routine_config', array('type' => 'select', 'label' => 'Payment Routine', 'options' => array('M' => 'Multi Page (Default)', 'S' => 'Single Page'), 'smalldesc' => 'Choose weather you want to do a single or multi page checkout on 2co.com, single page checkout will allow CC payments only.')); ?>
input('action_2co_sender_{n}_return_url_config', array('type' => 'text', 'label' => "Return URL", 'class' => 'medium_input', 'smalldesc' => 'Used to control where the Continue Shopping button will send the customer when clicked. (255 characters max)')); ?>
input('action_2co_sender_{n}_x_Receipt_Link_URL_config', array('type' => 'text', 'label' => "Approved URL", 'class' => 'medium_input', 'smalldesc' => 'Used to specify an approved URL on-the-fly, but is limited to the same domain that is used for your 2Checkout account, otherwise it will fail.')); ?>
tabEnd(); ?>
tabStart('help'); ?>
- This plugin will communicate with the 2CO server, you must be a registered 2CO vendor in order to be able to use this one.
- Map your form fields names to the fields required by 2Checkout, no spaces should be in the fields name.
- You may map extra fields through the "Extra fields" box, use multi line format, each line should be in this form: 2co_field_name=form_field_name
- Enter your 2CO account settings.
- Once triggered, this action will redirect the user to the 2CO servers for payment.
- For more documentation about the 2CO parameters, please search the 2CO website for "Plugin n play parameters".
tabEnd(); ?>