validateGiftCertificate

validateGiftCertificate

The purpose of this method is to given visual feedback to a customer on the status of a gift certificate.

Method Signature

[String] validateGiftCertificate(giftCertificateCode, opts);

v2 Usage

void ultraCart.validateGiftCertificate(giftCertificateCode, opts);

Description

Validates a gift certificate

Parameter

String giftCertificateCode the gift certificate code.

Parameter

opts - see XHR Issues and the Relay Script

Result

an array of strings showing the status of the gift certificate. this will contain both good and bad news. So just display the results to the user.

Synchronously

var result = ultraCart.validateGiftCertificate('mycode');
showCertStatus(result);


function showCertStatus(messages){
    var div = jQuery('#someDiv');
    var html ='';
    for(var i = 0; i < messages.length; i++){
         html += messages[i] + '<br />';
    }
    div.html(html);
}

Asynchronously

function showCertStatus(messages){
    var div = jQuery('#someDiv');
    var html ='';
    for(var i = 0; i < messages.length; i++){
         html += messages[i] + '<br />';
    }
    div.html(html);
}

ultraCart.validateGiftCertificate('mycode', {async:true, onComplete:showCertStatus);