>>0?1:0);T=m.low=T+J;m.high=fa+W+(T>>>0>>0?1: 0);U=N.low=U+K;N.high=ga+X+(U>>>0>>0?1:0);V=c.low=V+L;c.high=ha+Z+(V>>>0>>0?1:0)},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,f=8*a.sigBytes;b[f>>>5]|=128<<24-f%32;b[(f+128>>>10<<5)+30]=Math.floor(c/4294967296);b[(f+128>>>10<<5)+31]=c;a.sigBytes=4*b.length;this._process();return this._hash.toX32()},clone:function(){var a=c.clone.call(this);a._hash=this._hash.clone();return a},blockSize:32});j.SHA512=c._createHelper(b);j.HmacSHA512=c._createHmacHelper(b)})(); (function(){var a=CryptoJS,j=a.enc.Utf8;a.algo.HMAC=a.lib.Base.extend({init:function(a,b){a=this._hasher=new a.init;"string"==typeof b&&(b=j.parse(b));var f=a.blockSize,l=4*f;b.sigBytes>l&&(b=a.finalize(b));b.clamp();for(var u=this._oKey=b.clone(),k=this._iKey=b.clone(),m=u.words,y=k.words,z=0;z>>2]>>>24-8*(a%4)&255)<<16|(e[a+1>>>2]>>>24-8*((a+1)%4)&255)<<8|e[a+2>>>2]>>>24-8*((a+2)%4)&255,g=0;4>g&&a+0.75*g>>6*(3-g)&63));if(e=c.charAt(64))for(;b.length%4;)b.push(e);return b.join("")},parse:function(b){var e=b.length,f=this._map,c=f.charAt(64);c&&(c=b.indexOf(c),-1!=c&&(e=c));for(var c=[],a=0,d=0;d< e;d++)if(d%4){var g=f.indexOf(b.charAt(d-1))<<2*(d%4),h=f.indexOf(b.charAt(d))>>>6-2*(d%4);c[a>>>2]|=(g|h)<<24-8*(a%4);a++}return j.create(c,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})(); var trackingUrl = "https://tracking.myunidays.com/perks/redemption/v1.1.js"; //var trackingUrl = "https://tracking.myunidays.com/perks/redemption/v1.1-test.js"; function signUrl(url, param, key){ var secret = CryptoJS.enc.Base64.parse(key); var hash = CryptoJS.HmacSHA512(url, secret); var sig = CryptoJS.enc.Base64.stringify(hash); return url + '&' + param + '=' + encode(sig); }; function generateQuery(customerId, transactionId, memberId, currency, orderTotal, itemsUNiDAYSDiscount, code, itemsTax, shippingGross, shippingDiscount, itemsGross, itemsOtherDiscount, UNiDAYSDiscountPercentage, newCustomer) { return '?CustomerId=' + (customerId != null ? encode(customerId) : '') + '&TransactionId=' + (transactionId != null ? encode(transactionId) : '') + '&MemberId=' + (memberId != null ? encode(memberId) : '') + '&Currency=' + (currency != null ? encode(currency) : '') + '&OrderTotal=' + (orderTotal != null ? (Math.round(orderTotal * 100) / 100).toFixed(2) : '') + '&ItemsUNiDAYSDiscount=' + (itemsUNiDAYSDiscount != null ? (Math.round(itemsUNiDAYSDiscount * 100) / 100).toFixed(2) : '') + '&Code=' + (code != null ? encode(code) : '') + '&ItemsTax=' + (itemsTax != null ? (Math.round(itemsTax * 100) / 100).toFixed(2) : '') + '&ShippingGross=' + (shippingGross != null ? (Math.round(shippingGross * 100) / 100).toFixed(2) : '') + '&ShippingDiscount=' + (shippingDiscount != null ? (Math.round(shippingDiscount * 100) / 100).toFixed(2) : '') + '&ItemsGross=' + (itemsGross != null ? (Math.round(itemsGross * 100) / 100).toFixed(2) : '') + '&ItemsOtherDiscount=' + (itemsOtherDiscount != null ? (Math.round(itemsOtherDiscount * 100) / 100).toFixed(2) : '') + '&UNiDAYSDiscountPercentage=' + (UNiDAYSDiscountPercentage != null ? (Math.round(UNiDAYSDiscountPercentage * 100) / 100).toFixed(2) : '') + '&NewCustomer=' + (newCustomer != null ? (Math.round(newCustomer * 100) / 100).toFixed(0) : ''); }; function encode(string){ return encodeURIComponent(string).replace(/(%[A-Z0-9]{2})/ig, function(s) { return s.toLowerCase(); }); } return function(customerId, key){ this.trackingUrl = function(transactionId, currency, memberId, orderTotal, itemsUNiDAYSDiscount, code, itemsTax, shippingGross, shippingDiscount, itemsGross, itemsOtherDiscount, UNiDAYSDiscountPercentage, newCustomer){ var query = generateQuery(customerId, transactionId, memberId, currency, orderTotal, itemsUNiDAYSDiscount, code, itemsTax, shippingGross, shippingDiscount, itemsGross, itemsOtherDiscount, UNiDAYSDiscountPercentage, newCustomer); var signed = signUrl(query, 'Signature', key); return trackingUrl + signed; }; }; })(window);

Loading
×
Shop Samsung App
Get exclusive offers, earn points, and use Samsung Pay.