Changeset 1024857
- Timestamp:
- 11/13/2014 05:59:50 AM (11 years ago)
- Location:
- woocommerce-fat-zebra-gateway/trunk
- Files:
-
- 5 edited
-
class-wc-fatzebra-masterpass.php (modified) (3 diffs)
-
class-wc-fatzebra-visacheckout.php (modified) (9 diffs)
-
class-wc-fatzebra.php (modified) (2 diffs)
-
images/fatzebra-visacheckout.js (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
woocommerce-fat-zebra-gateway/trunk/class-wc-fatzebra-masterpass.php
r1024852 r1024857 17 17 $this->live_paynow_url = "https://paynow.fatzebra.com.au/v2"; 18 18 19 $this->supports = array( 'subscriptions', 'products', ' products', 'subscription_cancellation', 'subscription_reactivation', 'subscription_suspension', 'subscription_amount_changes', 'subscription_payment_method_change', 'subscription_date_changes' );19 $this->supports = array( 'subscriptions', 'products', 'refunds', 'subscription_cancellation', 'subscription_reactivation', 'subscription_suspension', 'subscription_amount_changes', 'subscription_payment_method_change', 'subscription_date_changes' ); 20 20 $this->params = array(); 21 21 … … 201 201 } 202 202 203 public function process_refund( $order_id, $amount = null, $reason = '' ) { 204 $payment_gateways = WC()->payment_gateways->get_available_payment_gateways(); 205 if (!isset($payment_gateways['fatzebra'])) { 206 return false; 207 } 208 209 $gw = $payment_gateways['fatzebra']; 210 return $gw->process_refund($order_id, $amount, $reason); 211 } 212 203 213 /** 204 214 * … … 227 237 switch((int)$_GET['r']) { 228 238 case 1: 229 $order->payment_complete( );239 $order->payment_complete($_GET['id']); 230 240 $order->add_order_note("Payment via Fat Zebra (MasterPass) successful. Transaction ID: " . $_GET['id'] . ". Message: " . $_GET['message']); 231 241 $woocommerce->cart->empty_cart(); -
woocommerce-fat-zebra-gateway/trunk/class-wc-fatzebra-visacheckout.php
r1024852 r1024857 15 15 $this->sandbox_url = "https://gateway.sandbox.fatzebra.com.au/v{$this->api_version}/purchases"; 16 16 17 $this->supports = array( 'subscriptions', 'products', ' products', 'subscription_cancellation', 'subscription_reactivation', 'subscription_suspension', 'subscription_amount_changes', 'subscription_payment_method_change', 'subscription_date_changes' );17 $this->supports = array( 'subscriptions', 'products', 'refunds', 'subscription_cancellation', 'subscription_reactivation', 'subscription_suspension', 'subscription_amount_changes', 'subscription_payment_method_change', 'subscription_date_changes' ); 18 18 $this->params = array(); 19 19 20 20 // Define user set variables 21 $this->title = 'V ISACheckout';21 $this->title = 'Visa Checkout'; 22 22 $this->description = in_array("description", $this->settings) ? $this->settings['description'] : ""; 23 23 … … 105 105 With Visa Checkout, you now have an easier way to pay with your card online, from the company you know and trust. Create an account once and speed through your purchase without re-entering payment or shipping information wherever you see Visa Checkout. 106 106 </p> 107 108 <?php if (!empty($callid)) { ?> 109 <p style='font-weight: bold'>The following card has been selected via Visa Checkout:</p> 110 <p style='font-size: 20px; padding-left: 40px; margin-top: 20px; font-family: monospace;'> 111 <?php echo WC()->session->get('visa_wallet_masked_number'); ?> 112 </p> 113 114 <?php } ?> 115 116 <style type='text/css'> 117 #custom-visa-checkout-outer-container{ 118 float: right; 119 } 120 </style> 107 121 <?php 108 122 … … 125 139 'currency' => get_woocommerce_currency(), 126 140 'order_total' => $woocommerce->cart->total, 127 'visa_checkout_button' => "<img src='{$visa_base_url}/wallet-services-web/xo/button.png?locale=en_AU&card_brands=" . implode(",", $accepted_cards) . "&style=color&size=213' class='v-button' data-2x-image='{$visa_base_url}/wallet-services-web/xo/button.png?locale=en_AU&card_brands=" . implode(",", $accepted_cards) . "&style=color&size=425' width='213' height='47' role='button' style='float: right; width: auto; clear: both; border: none; background: none; box-shadow: none;'/>",141 'visa_checkout_button' => $this->get_visa_checkout_button($accepted_cards), 128 142 'button_text' => 'Pay', 129 143 'review_message' => 'Please select your card and click Pay to complete your order', … … 257 271 } 258 272 } 259 $order->payment_complete( );273 $order->payment_complete($result['transaction_id']); 260 274 261 275 // Clear the session values … … 273 287 ); 274 288 } 289 } 290 291 public function process_refund( $order_id, $amount = null, $reason = '' ) { 292 $payment_gateways = WC()->payment_gateways->get_available_payment_gateways(); 293 if (!isset($payment_gateways['fatzebra'])) { 294 return false; 295 } 296 297 $gw = $payment_gateways['fatzebra']; 298 return $gw->process_refund($order_id, $amount, $reason); 275 299 } 276 300 … … 490 514 endforeach; 491 515 } 516 517 function get_visa_checkout_button($accepted_cards) { 518 return "<style type='text/css'> 519 #custom-visa-checkout-outer-container{ 520 position:relative; 521 width: 213px; 522 display: inline-block; 523 margin-top: 5px; 524 } 525 #custom-visa-checkout-learn-more{ 526 width:210px; 527 text-align:right; 528 margin-top: -10px; 529 } 530 #custom-visa-checkout-learn-more-text{ 531 font:bold 8.5pt arial; 532 text-decoration: none; 533 color: #0044AA; 534 } 535 img#custom-visa-checkout { 536 max-width: inherit; 537 } 538 539 .v-button { 540 cursor: pointer; 541 width: 213px !important; 542 box-shadow: none !important; 543 border: none !important; 544 backgound: none !important; 545 } 546 </style> 547 <div id='custom-visa-checkout-outer-container'> 548 <img alt='Button' class='v-button' data-2x-image='https://secure.checkout.visa.com/wallet-services-web/xo/button.png?locale=en_AU&card_brands=VISA,MasterCard&style=color&size=425' height='47' id='v-checkout-button' role='button' src='https://secure.checkout.visa.com/wallet-services-web/xo/button.png?locale=en_AU&card_brands=VISA,MasterCard&style=color&size=213' width='213'> 549 <div id='custom-visa-checkout-learn-more'> 550 <a href='javascript:void(0)' id='custom-visa-checkout-learn-more-text' onclick=\"document.getElementById('custom-visa-checkout').style.display='block'\">Learn More</a> 551 </div> 552 <img alt='Cart_learnmore_pop-up_left' id='custom-visa-checkout' onclick=\"document.getElementById('custom-visa-checkout').style.display='none';\" src='https://sandbox-assets.secure.checkout.visa.com/VmeCardArts/partner/Cart_LearnMore_Pop-Up_left.png' style='display: none; z-index: 9999; position: absolute; top: -170px; left: 220px; box-shadow: none; width: auto;'> 553 </div>"; 554 } 492 555 } 493 556 … … 526 589 'currency' => get_woocommerce_currency(), 527 590 'order_total' => $amount, 528 'visa_checkout_button' => "<img src='{$visa_base_url}/wallet-services-web/xo/button.png?locale=en_AU&card_brands=" . implode(",", $accepted_cards) . "&style=color&size=213' class='v-button' data-2x-image='{$visa_base_url}/wallet-services-web/xo/button.png?locale=en_AU&card_brands=" . implode(",", $accepted_cards) . "&style=color&size=425' width='213' height='47' role='button' style='float: right; width: auto; clear: both; border: none; background: none; box-shadow: none;'/>",591 'visa_checkout_button' => $gw->get_visa_checkout_button($accepted_cards), 529 592 'inline' => true, 530 593 'shipping' => false, … … 535 598 wp_enqueue_script( 'fz-visacheckout' ); 536 599 wp_enqueue_script( 'visa-checkout' ); 537 538 // Visa Checkout Button539 // Visa Checkout INIT540 // Handler for callback (process payment, retrieve address details, update order)541 600 } 542 601 … … 583 642 WC()->session->set('visa_wallet_callid', $callid); 584 643 WC()->session->set('visa_wallet_token', $token_result['card_token']); 644 WC()->session->set('visa_wallet_masked_number', $token_result['card_number']); 585 645 586 646 wc_setcookie('fatzebra_visacheckout_callid', null, time() - 3600); -
woocommerce-fat-zebra-gateway/trunk/class-wc-fatzebra.php
r1024852 r1024857 368 368 } 369 369 370 $order->payment_complete( );370 $order->payment_complete($result['transaction_id']); 371 371 372 372 // Store the card token as post meta … … 398 398 $this->params["amount"] = (int)($amount * 100); 399 399 $this->params["reference"] = $order_id . "-" . time(); // It is not possible to simply refund against the order ID as multiple reunds are permitted... 400 $this->params["transaction_id"] = get_post_meta($order_id, ' Fat Zebra Transaction ID', true); // The original FZ transaction ID400 $this->params["transaction_id"] = get_post_meta($order_id, '_transaction_id', true); 401 401 if (empty($this->params['transaction_id'])) { 402 402 $this->params["transaction_id"] = $this->fetch_fatzebra_transaction_id($order_id); -
woocommerce-fat-zebra-gateway/trunk/images/fatzebra-visacheckout.js
r1024852 r1024857 1 // //Visa Checkout Handling2 //var visaCheckoutReady = false;3 //function onVmeReady() {4 //visaCheckoutReady = true;5 //}1 // Visa Checkout Handling 2 var visaCheckoutReady = false; 3 function onVmeReady() { 4 visaCheckoutReady = true; 5 } 6 6 7 //function initVisaCheckout() {8 //if (!visaCheckoutReady) { // Wait until Visa Checkout is ready to init...9 //setTimeout(initVisaCheckout, 500);10 //return false;11 //}7 function initVisaCheckout() { 8 if (!visaCheckoutReady) { // Wait until Visa Checkout is ready to init... 9 setTimeout(initVisaCheckout, 500); 10 return false; 11 } 12 12 13 //if (fzvisa.checkout_captured == 1) {14 //return false; // Visa Checkout has already been completed on the cart page.15 //} else {13 if (fzvisa.checkout_captured == 1) { 14 return false; // Visa Checkout has already been completed on the cart page. 15 } else { 16 16 17 //V.init({18 //apikey: fzvisa.api_key,19 //settings: {20 //dataLevel: "SUMMARY",21 //displayName: fzvisa.website_name,22 //logoUrl: fzvisa.logo_url23 //},24 //paymentRequest: {25 //currencyCode: fzvisa.currency,26 //total: fzvisa.order_total27 //},28 //shipping: {29 //collectShipping: fzvisa.shipping30 //},31 //review: {32 //buttonAction: fzvisa.button_text,33 //message: fzvisa.review_message34 //}35 //});17 V.init({ 18 apikey: fzvisa.api_key, 19 settings: { 20 dataLevel: "SUMMARY", 21 displayName: fzvisa.website_name, 22 logoUrl: fzvisa.logo_url 23 }, 24 paymentRequest: { 25 currencyCode: fzvisa.currency, 26 total: fzvisa.order_total 27 }, 28 shipping: { 29 collectShipping: fzvisa.shipping 30 }, 31 review: { 32 buttonAction: fzvisa.button_text, 33 message: fzvisa.review_message 34 } 35 }); 36 36 37 //V.on("payment.success", function(payment) {38 //jQuery('#callid').val(payment.callid);37 V.on("payment.success", function(payment) { 38 jQuery('#callid').val(payment.callid); 39 39 40 // if (fzvisa.inline) { 41 // // 'Post' form to wc-api call for processing.. prefill the form and then show the checkout page 42 // jQuery(".checkout-button").click(); 43 // } 40 if (fzvisa.inline) { 41 // 'Post' form to wc-api call for processing.. prefill the form and then show the checkout page 42 jQuery(".checkout-button").click(); 43 jQuery(".checkout-button").attr("disabled", true).val("Please wait..."); 44 } 44 45 45 //jQuery('#encKey').val(payment.encKey);46 //jQuery('#encPaymentData').val(payment.encPaymentData);46 jQuery('#encKey').val(payment.encKey); 47 jQuery('#encPaymentData').val(payment.encPaymentData); 47 48 48 49 49 //jQuery('#place_order').show();50 // jQuery('.v-button').remove();50 jQuery('#place_order').show(); 51 jQuery('#custom-visa-checkout-outer-container').remove(); 51 52 52 //$form = jQuery("form.checkout");53 //$form.submit();54 //});53 $form = jQuery("form.checkout"); 54 $form.submit(); 55 }); 55 56 56 //V.on("payment.cancel", function(payment) {57 //// Cancelled, but we don't need to do anything, the user just needs to choose an alternative58 //});59 //V.on("payment.error", function(payment, error) {60 //// Error - report to user, try again?61 //});62 //}63 //}57 V.on("payment.cancel", function(payment) { 58 // Cancelled, but we don't need to do anything, the user just needs to choose an alternative 59 }); 60 V.on("payment.error", function(payment, error) { 61 // Error - report to user, try again? 62 }); 63 } 64 } 64 65 65 //jQuery( '#order_review' ).on( 'click', '.payment_methods input.input-radio', function() {66 //if ( jQuery( '.payment_methods input.input-radio' ).length > 1 ) {67 //if (fzvisa.checkout_captured == 1) {68 //return;69 //}70 //var id = jQuery(this).val();71 //if (id == 'fatzebra_visacheckout') {72 // if (jQuery('.v-button').length !== 0) return;73 //jQuery('#place_order').hide();74 //jQuery('#place_order').after(fzvisa.visa_checkout_button);66 jQuery( '#order_review' ).on( 'click', '.payment_methods input.input-radio', function() { 67 if ( jQuery( '.payment_methods input.input-radio' ).length > 1 ) { 68 if (fzvisa.checkout_captured == 1) { 69 return; 70 } 71 var id = jQuery(this).val(); 72 if (id == 'fatzebra_visacheckout') { 73 if (jQuery('#custom-visa-checkout-outer-container').length !== 0) return; 74 jQuery('#place_order').hide(); 75 jQuery('#place_order').after(fzvisa.visa_checkout_button); 75 76 76 //setTimeout(initVisaCheckout, 500);77 //} else {78 //// Remove the visa button and show the place order button again79 // jQuery('.v-button').remove();80 //jQuery('#place_order').show();81 //}82 //}83 //});77 setTimeout(initVisaCheckout, 500); 78 } else { 79 // Remove the visa button and show the place order button again 80 jQuery('#custom-visa-checkout-outer-container').remove(); 81 jQuery('#place_order').show(); 82 } 83 } 84 }); 84 85 85 //if (fzvisa.inline) {86 //// Render the 'Checkout' button on the cart page87 //jQuery(".checkout-button").after("<br />").after(fzvisa.visa_checkout_button);88 //jQuery(".checkout-button").append("<input type='hidden' name='callid' id='callid' />");89 //setTimeout(initVisaCheckout, 500);90 //}86 if (fzvisa.inline) { 87 // Render the 'Checkout' button on the cart page 88 jQuery(".checkout-button").after("<br />").after(fzvisa.visa_checkout_button); 89 jQuery(".checkout-button").append("<input type='hidden' name='callid' id='callid' />"); 90 setTimeout(initVisaCheckout, 500); 91 } -
woocommerce-fat-zebra-gateway/trunk/readme.txt
r1024852 r1024857 3 3 Tags: ecommerce, woocommerce, fatzebra, payment gateway, australia, subscriptions, wcsubscriptions 4 4 Requires at least: 3.8 5 Tested up to: 3.8.15 Tested up to: 4.0 6 6 Stable tag: trunk 7 7
Note: See TracChangeset
for help on using the changeset viewer.