demon |
Moderator |
|
|
Joined: Sep 22, 2010 |
Posts: 485 |
|
|
|
|
|
|
|
Code: | <?php
function paypalnofees_activate()
{
defineGatewayField("paypalnofees", "text", "comerciopaypal", "", "Merchant account ID", "30", "See README.txt tutorial to how to get this data");
defineGatewayField("paypalnofees", "text", "emailpaypal", "", "Your Paypal e-Mail", "", "Ej.: sales@mycompany.com");
defineGatewayField("paypalnofees", "text", "comision", "4", "Fee ( % ) to charge to customer", "4", "This is % to be charged ");
defineGatewayField("paypalnofees", "text", "fijo", "4", "Fee (fixed )to charge to customer", "4", "Fixed number to add to total");
defineGatewayField("paypalnofees", "yesno", "overridetax", "", "Which tax to apply", "", "Checked: Comision= % + Fixed - Not Checked: see readme.txt");
defineGatewayField("paypalnofees", "yesno", "typeoffee", "", "Not show fees as tax", "", "Checked: Fee is included in invoice - Not Checked: It will be showed as Tax - in developement");
defineGatewayField("paypalnofees", "text", "shipping", "4", "Shipping-Handling Fee", "4", "Fixed number to add to total as shipping ");
defineGatewayField("paypalnofees", "yesno", "shippingesporcentaje", "", "Shipping-Handling is %", "", "Checked: is fixed number - Not Checked: is % of total invoice");
defineGatewayField("paypalnofees", "text", "comment", "", "Extra Field to show inside inv", "30", "Ej.: A tax fee of 4% will be charged to your invoice (simple html tags allowed) ");
defineGatewayField("paypalnofees", "text", "imagenpaypalremta", "", "Paypalbutton", "20", "Please enter Paypal buttonimage if you like like http://there.com/bttn.gif");
}
function paypalnofees_link($params)
{
$gatewaycomerciopaypal = $params['comerciopaypal'];
$gatewayemailpaypal = $params['emailpaypal'];
$gatewaycomment = $params['comment'];
$gatewaycomision = $params['comision'];
$gatewaycomisionoverridetax = $params['overridetax'];
$gatewaycomisionfijo = $params['fijo'];
$gatewaytipodecomision = $params['typeoffee'];
$gatewayshippingesporcentaje = $params['shippingesporcentaje'];
$gatewayshipping = $params['shipping'];
$gatewayimagepaypal = $params['imagenpaypalremta'];
$invoiceid = $params['invoiceid'];
$description = $params['description'];
$amount = $params['amount'];
$duedate = $params['duedate'];
$date = $params['date'];
$firstname = $params['clientdetails']['firstname'];
$lastname = $params['clientdetails']['lastname'];
$email = $params['clientdetails']['email'];
$address1 = $params['clientdetails']['address1'];
$address2 = $params['clientdetails']['address2'];
$city = $params['clientdetails']['city'];
$state = $params['clientdetails']['state'];
$postcode = $params['clientdetails']['postcode'];
$country = $params['clientdetails']['country'];
$phone = $params['clientdetails']['phone'];
$companyname = $params['companyname'];
$systemurl = $params['systemurl'];
$currency = $params['currency'];
$notify_url = $params['systemurl'];
if ($gatewayimagepaypal != "") {
$imagenpaypal = $gatewayimagepaypal;
} else {
$imagenpaypal = "https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif";
}
if ($gatewaycomerciopaypal != "") {
echo "";
} else {
$gatewaycomerciopaypal = $gatewayemailpaypal;
}
if ($gatewaycomisionoverridetax != "on") {
echo "";
} else {
$cuantoesdecomision = $amount * $gatewaycomision / 100;
$cuentaoverride = $cuantoesdecomision + $gatewaycomisionfijo;
$gatewaycomisionfijo = $cuentaoverride;
$gatewaycomision = "";
}
$montofinal = $amount;
if ($gatewayshippingesporcentaje != "on") {
$shippingmedio = $amount * $gatewayshipping / 100;
$shippingfinal = $shippingmedio;
} else {
$shippingfinal = $gatewayshipping;
}
$code = "<br><p>" . $gatewaycomment . "</p>\n\n\t<form method=\"post\" action=\"https://www.paypal.com/cgi-bin/webscr\">\n\t<input type=\"hidden\" value=\"_xclick\" name=\"cmd\">\n<input type=\"hidden\" name=\"business\" value=\"" . $gatewaycomerciopaypal . "\">\n<input type=\"hidden\" name=\"lc\" value=\"" . $country . "\">\n\t<input type=\"hidden\" name=\"item_name\" value=\"" . $description . "\">\n\t<input type=\"hidden\" name=\"item_number\" value=\"" . $invoiceid . "\">\n\t<input type=\"hidden\" name=\"amount\" value=\"" . $montofinal . "\">\n<input type=\"hidden\" name=\"currency_code\" value=\"" . $currency . "\">\n<input type=\"hidden\" name=\"cn\" value=\"" . $gatewaycomment . "\">\n<input type=\"hidden\" name=\"tax_rate\" value=\"" . $gatewaycomision . "\">\n<input type=\"hidden\" name=\"tax\" value=\"" . $gatewaycomisionfijo . "\">\n<input type=\"hidden\" name=\"notify_url\" value=\"" . $notify_url . "\">\n<input type=\"hidden\" name=\"shipping\" value=\"" . $shippingfinal . "\"> \n<input type=\"hidden\" name=\"bn\" value=\"PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted\">\n<input type=\"image\" src=\"" . $imagenpaypal . "\" border=\"0\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online!\">\n<img alt=\"\" border=\"0\" src=\"https://www.paypalobjects.com/es_XC/i/scr/pixel.gif\" width=\"1\" height=\"1\">\n</form>\n";
return $code;
}
$GATEWAYMODULE['paypalnofeesname'] = "paypalnofees";
$GATEWAYMODULE['paypalnofeesvisiblename'] = "Paypal No Fees";
$GATEWAYMODULE['paypalnofeestype'] = "Invoices";
?>
|
|
|