Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by Hackforums.al
- * @ Decoder (PHP5 Decoder for ionCube Encoder)
- *
- * @ Version : v2@ Albanian
- * @ Author : hackforums.al
- * @ Release on : 10.07.2012
- * @ Official site : http://hackforums.al
- *
- */
- function paypal_config() {
- global $CONFIG;
- $configarray = array( 'FriendlyName' => array( 'Type' => 'System', 'Value' => 'PayPal' ), 'UsageNotes' => array( 'Type' => 'System', 'Value' => 'You must enable IPN inside your PayPal account and set the URL to ' . $CONFIG['SystemURL'] ), 'email' => array( 'FriendlyName' => 'PayPal Email', 'Type' => 'text', 'Size' => '40' ), 'forceonetime' => array( 'FriendlyName' => 'Force One Time Payments', 'Type' => 'yesno', 'Description' => 'Never show the subscription payment button' ), 'forcesubscriptions' => array( 'FriendlyName' => 'Force Subscriptions', 'Type' => 'yesno', 'Description' => 'Hide the one time payment button when a subscription can be created' ), 'requireshipping' => array( 'FriendlyName' => 'Require Shipping Address', 'Type' => 'yesno', 'Description' => 'Tick this box to request a shipping address from a user on PayPal\'s site' ), 'overrideaddress' => array( 'FriendlyName' => 'Client Address Matching', 'Type' => 'yesno', 'Description' => 'Tick this box to force using client profile information entered into WHMCS at PayPal' ), 'apiusername' => array( 'FriendlyName' => 'API Username', 'Type' => 'text', 'Size' => '40', 'Description' => 'API fields only required for refunds' ), 'apipassword' => array( 'FriendlyName' => 'API Password', 'Type' => 'text', 'Size' => '40' ), 'apisignature' => array( 'FriendlyName' => 'API Signature', 'Type' => 'text', 'Size' => '70' ) );
- return $configarray;
- }
- function paypal_link($params) {
- global $CONFIG;
- $params['invoiceid'];
- $invoiceid = ;
- $params['email'];
- $paypalemails = ;
- explode( ',', $paypalemails );
- $paypalemails = ;
- trim( $paypalemails[0] );
- $paypalemail = ;
- getRecurringBillingValues( $invoiceid );
- $recurrings = ;
- $recurrings['primaryserviceid'];
- $primaryserviceid = ;
- $recurrings['firstpaymentamount'];
- $firstpaymentamount = ;
- $recurrings['firstcycleperiod'];
- $firstcycleperiod = ;
- strtoupper( substr( $recurrings['firstcycleunits'], 0, 1 ) );
- $firstcycleunits = ;
- $recurrings['recurringamount'];
- $recurringamount = ;
- $recurrings['recurringcycleperiod'];
- $recurringcycleperiod = ;
- strtoupper( substr( $recurrings['recurringcycleunits'], 0, 1 ) );
- $recurringcycleunits = ;
- if (( $params['clientdetails']['country'] == 'US' || $params['clientdetails']['country'] == 'CA' )) {
- preg_replace( '/[^0-9]/', '', $params['clientdetails']['phonenumber'] );
- $phonenumber = ;
- substr( $phonenumber, 0, 3 );
- $phone1 = ;
- substr( $phonenumber, 3, 3 );
- $phone2 = ;
- substr( $phonenumber, 6 );
- $phone3 = ;
- }
- else {
- $params['clientdetails']['phonecc'];
- $phone1 = ;
- $params['clientdetails']['phonenumber'];
- $phone2 = ;
- }
- $subnotpossible = false;
- if (!$recurrings) {
- $subnotpossible = true;
- }
- if ($recurrings['overdue']) {
- $subnotpossible = true;
- }
- if ($params['forceonetime']) {
- $subnotpossible = true;
- }
- if ($recurringamount <= 0) {
- $subnotpossible = true;
- }
- if (( 90 < $firstcycleperiod && $firstcycleunits == 'D' )) {
- $subnotpossible = true;
- }
- if (( 24 < $firstcycleperiod && $firstcycleunits == 'M' )) {
- $subnotpossible = true;
- }
- if (( 5 < $firstcycleperiod && $firstcycleunits == 'Y' )) {
- $subnotpossible = true;
- }
- $code = '<table><tr>';
- if (!$subnotpossible) {
- $code .= '<td><form action="https://www.paypal.com/cgi-bin/webscr" method="post" name="paymentfrm">
- <input type="hidden" name="cmd" value="_xclick-subscriptions">
- <input type="hidden" name="business" value="' . $paypalemail . '">
- <input type="hidden" name="item_name" value="' . $params['description'] . '">
- <input type="hidden" name="no_shipping" value="' . ($params['requireshipping'] ? '2' : '1') . '">
- <input type="hidden" name="address_override" value="' . ($params['overrideaddress'] ? '1' : '0') . '">
- <input type="hidden" name="first_name" value="' . $params['clientdetails']['firstname'] . '">
- <input type="hidden" name="last_name" value="' . $params['clientdetails']['lastname'] . '">
- <input type="hidden" name="address1" value="' . $params['clientdetails']['address1'] . '">
- <input type="hidden" name="city" value="' . $params['clientdetails']['city'] . '">
- <input type="hidden" name="state" value="' . $params['clientdetails']['state'] . '">
- <input type="hidden" name="zip" value="' . $params['clientdetails']['postcode'] . '">
- <input type="hidden" name="country" value="' . $params['clientdetails']['country'] . '">
- <input type="hidden" name="night_phone_a" value="' . $phone1 . '">
- <input type="hidden" name="night_phone_b" value="' . $phone2 . '">';
- if ($phone3) {
- $code .= '<input type="hidden" name="night_phone_c" value="' . $phone3 . '">';
- }
- $code .= '<input type="hidden" name="no_note" value="1">
- <input type="hidden" name="currency_code" value="' . $params['currency'] . '">
- <input type="hidden" name="bn" value="WHMCS_ST">';
- if ($firstpaymentamount) {
- $code .= '
- <input type="hidden" name="a1" value="' . $firstpaymentamount . '">
- <input type="hidden" name="p1" value="' . $firstcycleperiod . '">
- <input type="hidden" name="t1" value="' . $firstcycleunits . '">';
- }
- $code .= '
- <input type="hidden" name="a3" value="' . $recurringamount . '">
- <input type="hidden" name="p3" value="' . $recurringcycleperiod . '">
- <input type="hidden" name="t3" value="' . $recurringcycleunits . '">
- <input type="hidden" name="src" value="1">
- <input type="hidden" name="sra" value="1">
- <input type="hidden" name="charset" value="' . $CONFIG['Charset'] . '">
- <input type="hidden" name="custom" value="' . $primaryserviceid . '">
- <input type="hidden" name="return" value="' . $params['returnurl'] . '&paymentsuccess=true">
- <input type="hidden" name="cancel_return" value="' . $params['returnurl'] . '&paymentfailed=true">
- <input type="hidden" name="notify_url" value="' . $params['systemurl'] . '/modules/gateways/callback/paypal.php">
- <input type="hidden" name="rm" value="2">';
- if (( !$firstpaymentamount && $params['modifysubscriptions'] )) {
- $code .= '
- <input type="hidden" name="modify" value="1">';
- }
- $code .= '
- <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but20.gif" border="0" name="submit" alt="Subscribe with PayPal for Automatic Payments">
- </form></td>';
- }
- if (( ( !$subnotpossible && $params['forcesubscriptions'] ) && !$params['forceonetime'] )) {
- }
- else {
- $code .= '<td><form action="https://www.paypal.com/cgi-bin/webscr" method="post">
- <input type="hidden" name="cmd" value="_xclick">
- <input type="hidden" name="business" value="' . $paypalemail . '">';
- if ($params['style']) {
- $code .= '<input type="hidden" name="page_style" value="' . $params['style'] . '">';
- }
- $code .= '<input type="hidden" name="item_name" value="' . $params['description'] . '">
- <input type="hidden" name="amount" value="' . $params['amount'] . '">
- <input type="hidden" name="tax" value="0.00">
- <input type="hidden" name="no_note" value="1">
- <input type="hidden" name="no_shipping" value="' . ($params['requireshipping'] ? '2' : '1') . '">
- <input type="hidden" name="address_override" value="' . ($params['overrideaddress'] ? '1' : '0') . '">
- <input type="hidden" name="first_name" value="' . $params['clientdetails']['firstname'] . '">
- <input type="hidden" name="last_name" value="' . $params['clientdetails']['lastname'] . '">
- <input type="hidden" name="address1" value="' . $params['clientdetails']['address1'] . '">
- <input type="hidden" name="city" value="' . $params['clientdetails']['city'] . '">
- <input type="hidden" name="state" value="' . $params['clientdetails']['state'] . '">
- <input type="hidden" name="zip" value="' . $params['clientdetails']['postcode'] . '">
- <input type="hidden" name="country" value="' . $params['clientdetails']['country'] . '">
- <input type="hidden" name="night_phone_a" value="' . $phone1 . '">
- <input type="hidden" name="night_phone_b" value="' . $phone2 . '">';
- if ($phone3) {
- $code .= '<input type="hidden" name="night_phone_c" value="' . $phone3 . '">';
- }
- $code .= '<input type="hidden" name="charset" value="' . $CONFIG['Charset'] . '">
- <input type="hidden" name="currency_code" value="' . $params['currency'] . '">
- <input type="hidden" name="custom" value="' . $params['invoiceid'] . '">
- <input type="hidden" name="return" value="' . $params['returnurl'] . '&paymentsuccess=true">
- <input type="hidden" name="cancel_return" value="' . $params['returnurl'] . '&paymentfailed=true">
- <input type="hidden" name="notify_url" value="' . $params['systemurl'] . '/modules/gateways/callback/paypal.php">
- <input type="hidden" name="bn" value="WHMCS_ST">
- <input type="hidden" name="rm" value="2">
- <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but03.gif" border="0" name="submit" alt="Make a one time payment with PayPal">
- </form></td>';
- }
- $code .= '</tr></table>';
- return $code;
- }
- function paypal_refund($params) {
- if ($params['sandbox']) {
- $url = 'https://api-3t.sandbox.paypal.com/nvp';
- }
- else {
- $url = 'https://api-3t.paypal.com/nvp';
- }
- $postfields = array( );
- $postfields['VERSION'] = '3.0';
- $postfields['METHOD'] = 'RefundTransaction';
- $postfields['BUTTONSOURCE'] = 'WHMCS_WPP_DP';
- $postfields['USER'] = $params['apiusername'];
- $postfields['PWD'] = $params['apipassword'];
- $postfields['SIGNATURE'] = $params['apisignature'];
- $postfields['TRANSACTIONID'] = $params['transid'];
- $postfields['REFUNDTYPE'] = 'Partial';
- $postfields['AMT'] = $params['amount'];
- $postfields['CURRENCYCODE'] = $params['currency'];
- curlCall( $url, $postfields );
- $result = ;
- explode( '&', $result );
- $resultsarray2 = ;
- foreach ($resultsarray2 as ) {
- [0];
- $line = ;
- explode( '=', $line );
- $line = ;
- $resultsarray[$line[0]] = urldecode( $line[1] );
- }
- if (strtoupper( $resultsarray['ACK'] ) == 'SUCCESS') {
- return array( 'status' => 'success', 'rawdata' => $resultsarray, 'transid' => $resultsarray['REFUNDTRANSACTIONID'], 'fees' => $resultsarray['FEEREFUNDAMT'] );
- }
- return array( 'status' => 'error', 'rawdata' => $resultsarray );
- }
- ?>
Add Comment
Please, Sign In to add comment