/**
  * Implements all 3 steps of the Direct Post Method for demonstration
  * purposes.
  */
 public static function directPostDemo($url, $api_login_id, $transaction_key, $amount = "0.00", $md5_setting = "")
 {
     // Step 1: Show checkout form to customer.
     if (!count($_POST) && !count($_GET)) {
         $fp_sequence = time();
         // Any sequential number like an invoice number.
         echo AuthorizeNetDPM::getCreditCardForm($amount, $fp_sequence, $url, $api_login_id, $transaction_key);
     } elseif (count($_POST)) {
         $response = new AuthorizeNetSIM($api_login_id, $md5_setting);
         if ($response->isAuthorizeNet()) {
             if ($response->approved) {
                 // Do your processing here.
                 $redirect_url = $url . '?response_code=1&transaction_id=' . $response->transaction_id;
             } else {
                 // Redirect to error page.
                 $redirect_url = $url . '?response_code=' . $response->response_code . '&response_reason_text=' . $response->response_reason_text;
             }
             // Send the Javascript back to AuthorizeNet, which will redirect user back to your site.
             echo AuthorizeNetDPM::getRelayResponseSnippet($redirect_url);
         } else {
             echo "Error -- not AuthorizeNet. Check your MD5 Setting.";
         }
     } elseif (!count($_POST) && count($_GET)) {
         if ($_GET['response_code'] == 1) {
             echo "Thank you for your purchase! Transaction id: " . htmlentities($_GET['transaction_id']);
         } else {
             echo "Sorry, an error occurred: " . htmlentities($_GET['response_reason_text']);
         }
     }
 }
Esempio n. 2
0
 function gdlr_get_authorize_form($option)
 {
     global $hotel_option;
     $test_mode = empty($hotel_option['authorize-live-mode']) || $hotel_option['authorize-live-mode'] == 'disable' ? true : false;
     $relay_response_url = plugin_dir_url(__FILE__) . 'authorize-payment.php?response=1&invoice=' . $option['invoice'];
     return AuthorizeNetDPM::getCreditCardForm($option['price'], $option['invoice'], $relay_response_url, $hotel_option['authorize-api-id'], $hotel_option['authorize-transaction-key'], $test_mode, $test_mode);
 }
Esempio n. 3
0
 /**
  * Implements all 3 steps of the Direct Post Method for demonstration
  * purposes.
  */
 public static function directPostDemo($url, $api_login_id, $transaction_key, $amount = "0.00", $md5_setting = "", $test_mode = true)
 {
     
     // Step 1: Show checkout form to customer.
     if (JRequest::getVar('task') == 'submit_order')
     {
         $fp_sequence = time(); // Any sequential number like an invoice number.
         echo AuthorizeNetDPM::getCreditCardForm($amount, $fp_sequence, $url, $api_login_id, $transaction_key, $test_mode, $test_mode);
     }
     // Step 2: Handle AuthorizeNet Transaction Result & return snippet.
     elseif (count($_POST)) 
     {
         $response = new AuthorizeNetSIM($api_login_id, $md5_setting);
         if ($response->isAuthorizeNet()) 
         {
             if ($response->approved) 
             {
                 // Do your processing here.
                 //$mainframe->redirect('index.php?option=com_docmanpaypal&task=ipn&merchant=authorize.net&response_code=1&transaction_id=' . $response->transaction_id); 
                 $redirect_url = JURI::base() . substr($_SERVER['REQUEST_URI'], 0) . '&response_code=1&transaction_id=' . $response->transaction_id;
             }
             else
             {
                 // Redirect to error page.
                 //$mainframe->redirect('index.php?option=com_docmanpaypal&task=ipn&merchant=authorize.net&response_code=' . $response->response_code . '&transaction_id=' . $response->transaction_id. '&response_reason_text=' . $response->response_reason_text);
                 $redirect_url = JURI::base() . substr($_SERVER['REQUEST_URI'], 0) . '&response_code='.$response->response_code . '&response_reason_text=' . $response->response_reason_text;
             	//$redirect_url = $url . '?response_code='.$response->response_code . '&response_reason_text=' . $response->response_reason_text;
             }
             // Send the Javascript back to AuthorizeNet, which will redirect user back to your site.
             echo AuthorizeNetDPM::getRelayResponseSnippet($redirect_url);
         }
         else
         {
             echo "Error -- not AuthorizeNet. Check your MD5 Setting.";
         }
     }
     // Step 3: Show receipt page to customer.
     elseif (!count($_POST) && count($_GET))
     {
         if ($_GET['response_code'] == 1)
         {
             echo "Thank you for your purchase! Transaction id: " . htmlentities($_GET['transaction_id']);
         }
         else
         {
           echo "Sorry, an error occurred: " . htmlentities($_GET['response_reason_text']);
         }
     }
 }
 /**
  * Implements all 3 steps of the Direct Post Method for demonstration
  * purposes.
  */
 public static function directPost($url, $price = "0.00", $rand = '', $nonce)
 {
     $api = get_option('mcs_authnet_api');
     $key = get_option('mcs_authnet_key');
     $hash = get_option('mcs_authnet_hash');
     // Step 1: Show checkout form to customer.
     if (isset($_POST['mcs_quantity']) || get_option('mcs_quantity') != 'true') {
         $fp_sequence = $rand;
         // Any sequential number like an invoice number.
         return AuthorizeNetDPM::getCreditCardForm($price, $fp_sequence, $url, $api, $key, $nonce);
     } else {
         if (!count($_POST) && count($_GET)) {
             if ($_GET['response_code'] == 1) {
                 $transaction_id = sanitize_text_field($_GET['transaction_id']);
                 $receipt = add_query_arg(array('mcs_receipt' => $transaction_id), home_url());
                 return sprintf(__('Thank you for your purchase! Your transaction id is: #%1$s. <a href="%2$s">View your receipt</a>', 'my-calendar-submissions'), $transaction_id, $receipt);
             } else {
                 return sprintf(__("Sorry, an error occurred: %s.", 'my-calendar-submissions'), "<strong>" . sanitize_text_field($_GET['response_reason_text']) . "</strong>");
             }
         }
     }
 }
 public function testGetCreditCardForm()
 {
     $fp_sequence = "12345";
     $this->assertContains('<input type="hidden" name="x_fp_sequence" value="' . $fp_sequence . '">', AuthorizeNetDPM::getCreditCardForm('2', $fp_sequence, 'ht', '2', '1', true));
 }
 function gdlrs_get_authorize_form($option)
 {
     global $hostel_option;
     $relay_response_url = plugin_dir_url(__FILE__) . '/gdlrs-authorize-payment.php?response=1&invoice=' . $option['invoice'];
     return AuthorizeNetDPM::getCreditCardForm($option['price'], $option['invoice'], $relay_response_url, $hostel_option['authorize-api-id'], $hostel_option['authorize-transaction-key']);
 }
			<?php 
if (!empty($_GET['response']) && $_GET['response'] == 2) {
    echo '<div class="gdlr-lms-error" style="margin-bottom: 0px;">';
    echo $_GET['response_code'] . ' : ' . $_GET['response_reason_text'];
    echo '</div>';
} else {
    if (!empty($_GET['invoice'])) {
        global $gdlr_lms_option, $wpdb;
        $relay_response_url = plugin_dir_url(__FILE__) . 'single-authorize.php?response=1&invoice=' . $_GET['invoice'];
        $api_login_id = $gdlr_lms_option['authorize-api-id'];
        $transaction_key = $gdlr_lms_option['authorize-transaction-key'];
        $temp_sql = "SELECT * FROM " . $wpdb->prefix . "gdlrpayment ";
        $temp_sql .= "WHERE id = " . $_GET['invoice'];
        $result = $wpdb->get_row($temp_sql);
        $fp_sequence = $_GET['invoice'];
        $amount = $result->price;
        echo AuthorizeNetDPM::getCreditCardForm($amount, $fp_sequence, $relay_response_url, $api_login_id, $transaction_key);
    }
}
?>
			</div>
		</div>
	</div>
</div>
</div>
<?php 
if (!empty($gdlr_lms_option['show-sidebar']) && $gdlr_lms_option['show-sidebar'] == 'enable') {
    get_sidebar('content');
    get_sidebar();
}
get_footer();