I am working on MeteorJS(nodeJS). Trying to integrate payUMoney on localhost. I am having live credentials and forwarding my HTTP call to :
POST URL: https://secure.payu.in/_payment.
On console I am getting status code as 200. But not directing to payu.com But on console I am able to see "checksum failed" error. I tried to packages:
1.jparker:crypto-sha256
2.johnschult:crypto-sha512
This is my piece of code:
var string = key +'|' +txnid+ '|' +amount+'|'+productinfo+'|'+firstname+'|'+email+'|||||||||||'+salt;
var SHA = CryptoJS.SHA256(string);
Also tried like this:
var string = key +'|' +txnid+ '|' +amount+'|'+productinfo+'|'+firstname+'|'+email+'|'+'|'+'|'+'|'+'|'+'|'+'|'+'|'+'|'+'|'+'|'+salt;
var SHA = CryptoJS.SHA256(string);
console.log("SHA :" + SHA);
this.unblock();
var payUMoneyInput = {
"key" : key,
"txnid" : txnid,
"amount" : amount,
"productinfo" : productinfo,
"firstname" : firstname,
"email" : email,
"phone" : phone,
"surl" "http://localhost:3000/onlinePaymentSuccess",
"furl" : "http://localhost:3000/onlinePaymentSuccess",
"hash" : SHA,
"service_provider" : "payu_paisa",
};
try {
if (Meteor.isServer) {
var result = HTTP.call("POST", "https://secure.payu.in/_payment",
{params: payUMoneyInput});
console.log(result);
return result;
}else{
return false;
}
}
} catch (err) {
console.log('range error');
console.log(err)
// Got a network error, time-out or HTTP error in the 400 or 500 range.
return false;
}
My console looks like below:
0427-12:52:44.069(5.5)? SHA :f071c643368745b38f8b41851d6500743190aa79426e931a28ccfd65135d94ed
I20170427-12:52:44.237(5.5)? { statusCode: 200,
I20170427-12:52:44.237(5.5)? content: '<!DOCTYPE html>\n<!--[if lt IE 7 ]> <html lang="en" class="no-js oldie ie6"> <![endif]-->\n<!--[if IE 7 ]> <html lang="en" class="no-js oldie ie7"> <![endif]-->\n<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->\n<!--[if (gte IE 9)|!(IE)]><!--> <html class="no-js" lang="en"> <!--<![endif]-->\n\n\n<!-- Custom Modernizr build (should always be on the top) -->\n<script src="js/modernizr-2.0.6.min.js"></script>\n <script language="javascript">\n document.title = "Transaction Error";\n </script>\n\n<style>\n body {font-family: \'Arial\'}\n .container {width: 960px; margin: 0 auto; padding: 15px 0;}\n\n #header {border-bottom: 1px solid #ccc;}\n #content {padding: 100px;}\n #content h1 {font-size: 70px; color: #358DCB; margin-bottom: 0; margin-top: 0; text-align: center}\n #content h2 {font-size: 16px; margin-top: 0; text-align: center}\n #content p {font-size: 14px; margin-top: 30px; line-height: 24px; padding: 0 150px;}\n\n #footer {border-top: 1px solid #ddd; font-size: 12px;}\n #footer p {margin-top: 0;}\n\n #footer a {text-decoration: underline}\n</style>\n\n<div id="header">\n <div class="container">\n <img src="https://static.payu.in/images/payu_logo.png">\n </div>\n</div>\n<div id="content" >\n <div class="container">\n <h1>SORRY!</h1>\n <h2>We were unable to process your payment</h2>\n <p style=\'text-align: center;font-size:13px;\'><br>Checksum Failed</p> </div>\n\n </div>\n\n<div id="footer">\n <div class="container">\n <!--<p style="float:left">© 2015 PayUBiz. All rights reserved.</p>\n <p style="float:right"><a target="_blank" href=https://www.payubiz.in/privacyPolicy >Privacy Policy</a></p>\n <p style="clear:both"></p>-->\n <p style="text-align: center">© 2015 PayUBiz. All rights reserved.</p>\n </div>\n</div>\n\n<script src="js/libs/jquery-custom.min.js"></script>\n<!-- <script src="./_js/plugins.js"></script> -->\n<script src="js/script.js?version=v2.0.10"></script>\n\n',
I20170427-12:52:44.237(5.5)? headers:
I20170427-12:52:44.238(5.5)? { date: 'Thu, 27 Apr 2017 07:22:44 GMT',
I20170427-12:52:44.238(5.5)? 'content-type': 'text/html',
I20170427-12:52:44.238(5.5)? 'transfer-encoding': 'chunked',
I20170427-12:52:44.238(5.5)? connection: 'close',
I20170427-12:52:44.239(5.5)? vary: 'Accept-Encoding, Accept-Encoding',
I20170427-12:52:44.239(5.5)? 'set-cookie': [ 'PHPSESSID=bpgqhvng7blpk1fltvrohle0j0; path=/; secure' ],
I20170427-12:52:44.239(5.5)? p3p: 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"',
I20170427-12:52:44.239(5.5)? expires: 'Thu, 19 Nov 1981 08:52:00 GMT',
I20170427-12:52:44.240(5.5)? 'cache-control': 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0',
I20170427-12:52:44.241(5.5)? pragma: 'no-cache',
I20170427-12:52:44.241(5.5)? server: 'Payubiz',
I20170427-12:52:44.242(5.5)? 'x-xss-protection': '1; mode=block' },
I20170427-12:52:44.244(5.5)? data: null }
Unable to track the problem. Thanks in advance!
According to payu integration document and formula at there your hash should be :
var sha=sha512(key +'|' +txnid+ '|' +amount+'|'+productinfo+'|'+firstname+'|'+email+'|||||||||||' + salt+'|');
var hash=CryptoJS.enc.Hex.stringify(sha);
Related
I have created one AngularJs directive to clear the input field. I want the "close" icon to be placed inside the respective input element. But its going out of input field.
Here is the plnkr -
https://plnkr.co/edit/WHjRviyuYfFVfg2TnVUP?p=preview
Note: Please check the plnkr preview by resizing it.
var app = angular.module("myApp", []);
app.controller("MyController", function($scope) {
$scope.fname = "Hello!!"
$scope.lname = "World";
})
.directive('clearField', function($compile) {
return {
restrict: 'A',
scope: {
model: '=ngModel'
},
link: function(scope, element, attr) {
// Add wrapper to the element
scope.model = (scope.model == undefined) ? "" : scope.model;
element.wrap('<span class="wrapper"></span>')
.addClass('pr14')
.after('<span class="clear">×</span>');
var clearInputElement = angular.element(element.next());
clearInputElement.bind('click', function() {
scope.$apply(scope.model = "");
});
scope.$watch('model', function() {
if (scope.model.length > 0) {
clearInputElement.css("visibility", "visible");
} else {
clearInputElement.css("visibility", "hidden");
}
});
}
}
});
.wrapper {
position: relative;
display: inline-block
}
.pr14 {
padding-right: 17px;
}
.clear {
position: absolute;
right: 7px;
color: grey;
font-size: 17px;
}
.clear:hover {
cursor: pointer;
color: blue;
}
<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
<meta charset="UTF-8" />
<title>Document</title>
<script data-require="angularjs#1.5.8" data-semver="1.5.8" src="https://opensource.keycdn.com/angularjs/1.5.8/angular.min.js"></script>
<script src="script.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body ng-controller="MyController">
<label>Name: </label>
<input type="text" ng-model="fname" clear-field>
<textarea ng-model="lname" id="" cols="30" rows="10" clear-field></textarea>
</body>
</html>
As input tags are not container tag, you need to wrap input tag and close tag in a div.
var app = angular.module("myApp", []);
app.controller("MyController", function($scope) {
$scope.fname = "Hello!!"
$scope.lname = "World";
})
.directive('clearField', function($compile) {
return {
restrict: 'A',
scope: {
model: '=ngModel'
},
link: function(scope, element, attr) {
// Add wrapper to the element
scope.model = (scope.model == undefined) ? "" : scope.model;
element.wrap('<span class="wrapper"></span>')
.addClass('pr14')
.after('<span class="clear">×</span>');
var clearInputElement = angular.element(element.next());
clearInputElement.bind('click', function() {
scope.$apply(scope.model = "");
});
scope.$watch('model', function() {
if (scope.model.length > 0) {
clearInputElement.css("visibility", "visible");
} else {
clearInputElement.css("visibility", "hidden");
}
});
}
}
});
.wrapper {
position: relative;
}
.pr14 {
padding-right: 17px;
}
.clear {
position: absolute;
right: 7px;
color: grey;
font-size: 17px;
}
.clear:hover {
cursor: pointer;
color: blue;
}
.wrap{position:relative;}
<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
<meta charset="UTF-8" />
<title>Document</title>
<script data-require="angularjs#1.5.8" data-semver="1.5.8" src="https://opensource.keycdn.com/angularjs/1.5.8/angular.min.js"></script>
<script src="script.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body ng-controller="MyController">
<div class="wrap">
<label>Name: </label>
<input type="text" ng-model="fname" clear-field>
</div>
<br>
<div class="wrap">
<textarea ng-model="lname" id="" cols="30" rows="10" clear-field></textarea>
</div>
</body>
</html>
Change your .wrapper class like this:
.wrapper {
position: relative;
display: inline-block;
}
I'm not at all familiar with handlebars.js but I'd like to customize the directory index template that comes with Shiny Server. Specifically, what I'm looking to do is render a page of thumbnails of the different apps.
The file /opt/shiny-server/templates/directorIndex.html comes with the code below which reference a number of expressions including {{title}}, references to apps, dirs and files.
<!DOCTYPE html>
<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{{title}}</title>
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro' rel='stylesheet' type='text/css'>
<style type="text/css">
body {
font-family: Helvetica, Arial, sans-serif;
background-color: #F5F5F5;
}
pre, tt, code, .code, #detail {
font-family: 'Consolas', 'Courier New', 'Courier', monospace;
}
h1 {
font-size: 40px;
}
a {
text-decoration: none;
}
</style>
</head>
<body>
<h1>{{title}}</h1>
<ul>
{{#each apps}}
<li><a class="code" href="{{this.url}}">{{this.name}}</a> (application)</li>
{{/each}}
{{#each dirs}}
<li><a class="code" href="{{this.url}}/">{{this.name}}</a></li>
{{/each}}
{{#each files}}
<li><a class="code" href="{{this.url}}">{{this.name}}</a></li>
{{/each}}
</ul>
</body>
</html>
So I have two questions.
First - how can I know what expressions are available to call?
Second - give that I just have this one html page (as far as I can tell) how do I register a helper, e.g.
Handlebars.registerHelper('splitURL', function(url) {
var t = url.split("/");
return t[1];
});
I had the same desire to customize the directoryIndex.html template and enjoyed the same lack of documentation about what handlebars expressions could be used. I'm not a web developer so the code here is probably rubbish, but it works well enough. It sounds like you already solved your issue, but others may find some use in this approach. Images for each app are saved in site_dir/images.
screenshot of end result
directoryIndex.html:
<!DOCTYPE html>
<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{{title}}</title>
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro' rel='stylesheet' type='text/css'>
<link href="main.css" rel="stylesheet">
<script type='text/javascript'>
function include(arr,obj) {
return(arr.indexOf(obj) != -1);
}
function updateView(data) {
//update title and heading
if ("title" in data) {
var host = document.location.hostname;
if (host in data.title) {
document.title = data.title[host];
document.getElementById("title").innerHTML = data.title[host];
} else if ("default" in data.title) {
document.title = data.title.default;
document.getElementById("title").innerHTML = data.title.default;
}
}
//hide cards (for directories like /images)
if ("ignore" in data) {
var element;
for (var i in data.ignore) {
if (element = document.getElementById("card_"+data.ignore[i])) {
element.parentNode.removeChild(element);
}
}
}
//update each shiny app if it has JSON data
if ("apps" in data) {
for (var item in data.apps) {
if (document.getElementById("card_"+item)) {
if ("img" in data.apps[item])
document.getElementById("img_"+item).src = "/images/" + data.apps[item].img;
if ("name" in data.apps[item])
document.getElementById("name_"+item).innerHTML = data.apps[item].name;
if ("desc" in data.apps[item])
document.getElementById("desc_"+item).innerHTML = data.apps[item].desc;
}
}
}
}
function loadJSON(url) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var data = JSON.parse(this.responseText);
updateView(data)
}
}
xmlhttp.open("GET", url, true);
xmlhttp.send();
}
document.addEventListener("DOMContentLoaded", function() {
loadJSON("data.json");
});
</script>
</head>
<body>
<div id="title_bar">
<h1 id="title"></h1>
</div>
<div id="apps">
{{#each dirs}}
<div id="card_{{name}}" class="card" onclick="location.href='{{url}}';" style="cursor: pointer;">
<img id="img_{{name}}" src="" alt="{{name}}" onerror="if (this.src != '/images/missing.png') this.src = '/images/missing.png';">
<div class="container">
<h4 id="name_{{name}}">{{name}}</h4>
<p id="desc_{{name}}"></p>
</div>
</div>
{{/each}}
</div>
</body>
</html>
data.json (located in the site_dir root location):
{
"title": {
"default": "Shiny Server",
"dev_host": "Shiny Server (Development)",
"accp_host": "Shiny Server (Acceptance)",
"prod_host": "Shiny Server",
"dev_host.fully.qualified.name": "Shiny Server (Development)",
"accp_host.fully.qualified.name": "Shiny Server (Acceptance)",
"prod_host.fully.qualified.name": "Shiny Server"
},
"ignore": [ "app_4", "app_5", "images" ],
"apps": {
"app_1": {
"name": "app 1 name goes here",
"desc": "app 1 description goes here",
"img": "app1.png"
},
"app_2": {
"name": "app 2 name",
"desc": "app 2 desc",
"img": "app2.png"
},
"app_3": {
"name": "app 3 name",
"desc": "",
"img": "app3.png"
}
}
}
main.css (located in the site_dir root location):
body, html {
font-family: Helvetica, Arial, sans-serif;
background-color: #F5F5F5;
color: #114;
margin: 0;
padding: 0;
}
#title_bar {
height: 80px;
background-color: #3475b4;
overflow: hidden;
border-bottom: 1px solid #3475b3;
-moz-box-shadow: 0px 0px 10px 3px #BBC;
-webkit-box-shadow: 0px 0px 10px 3px #BBC;
box-shadow: 0px 0px 10px 3px #BBC;
}
#title_bar h1 {
margin: 14px auto .5em auto;
padding: .2em;
color: #EEE;
text-align: center;
}
#apps {
margin-top: 14px;
}
.card {
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
transition: 0.3s;
border-radius: 5px;
width: 300px;
margin: 10px;
display: inline-block;
vertical-align: top;
}
.card:hover {
box-shadow: 0 12px 24px 0 rgba(0,0,0,0.2);
}
.card img {
display: block;
margin: 0 auto;
max-width: 300px;
max-height: 250px;
}
.container {
padding: 2px 16px;
}
I tried to install less, but it's not working.
Firebug report this error :
Component returned failure code: 0x80004005 (NS_ERROR_FAILURE)
My code :
<link type="text/css" href="http://static.mydomain.com/css/colors.less" rel="stylesheet/less" />
<script type="text/javascript" src="http://static.mydomain.com/js/less-1.2.2.min.js" ></script>
Header of .less file :
Accept-Ranges bytes
Connection Keep-Alive
Content-Length 889
Content-Type text/css
Date Thu, 10 May 2012 16:56:51 GMT
Etag "5cbb93-379-4bedaed496200"
Keep-Alive timeout=5, max=100
Last-Modified Mon, 30 Apr 2012 00:56:40 GMT
Server Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8r DAV/2 PHP/5.3.6
And its content :
#overflow {
.a { color: #111111 - #444444; } // #000000
.b { color: #eee + #fff; } // #ffffff
.c { color: #aaa * 3; } // #ffffff
.d { color: #00ee00 + #009900; } // #00ff00
}
Is someone has an idea ?
Ok, I found. just had this into your httpd.conf apache file :
Header set Access-Control-Allow-Origin "*"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>My Videos</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<script type="text/javascript">
function loadVideo(playerUrl, autoplay) {
swfobject.embedSWF(
playerUrl + '&rel=1&border=0&fs=1&autoplay=' +
(autoplay?1:0)+'&version=3', 'player', '585', '355', '9.0.0', false,
false, {allowfullscreen: 'true'});
/*Parse the facebook like button*/
$('#like').html('<fb:like href="'+playerUrl+'" layout="button_count" show_faces="false" width="65" action="like" font="segoe ui" colorscheme="light" />')
if (typeof FB != "undefined"){
FB.XFBML.parse(document.getElementById('like'))
}
}
function showMyVideos(data) {
var feed = data.feed;
var entries = feed.entry || [];
var html = ['<ul class="videos">'];
for (var i = 0; i < entries.length; i++) {
var entry = entries[i];
var title = entry.title.$t.substr(0, 20);
var thumbnailUrl = entries[i].media$group.media$thumbnail[0].url;
var playerUrl = entries[i].media$group.media$content[0].url;
var videoId = playerUrl.substr(playerUrl.indexOf('v/')+2, 11);
playerUrl = "http://www.youtube.com/v/" + videoId;
html.push('<li onclick="loadVideo(\'', playerUrl, '\', true)">',
'<img src="',
thumbnailUrl, '" width="94" height="58"/> </span>', title, '</li>');
}
html.push('</ul>');
document.getElementById('videos').innerHTML = html.join('');
if (entries.length > 0) {
loadVideo(entries[0].media$group.media$content[0].url, false);
}
}
$(function(){
$.ajax({
type: "GET",
url: "http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed_Autos?time=today&alt=json-in-script&max-results=5&format=5",
cache: false,
dataType:'jsonp',
success: function(data){
showMyVideos(data);
},
error: function(XMLHttpRequest, textStatus, errorThrown, data){
alert("Not able to fetch the data due to feed unavailability!!!");
}
});
})
</script>
<style>
body {
background:#fff;
color:silver;
font-family:Arial, Helvetica, sans-serif;
font-size:100%;
line-height:1.125em;
}
#videoContainer {
font-size:.75em;
overflow:hidden;
position:absolute;
left:0;
top:0;
margin-left:40px;
margin-top:5px;
}
#like {
height:15px;
margin-top:10px;
text-align:right;
}
object {
-moz-box-shadow:5px 5px 5px #ccc;
-webkit-box-shadow:5px 5px 5px #ccc;
box-shadow:5px 5px 5px #ccc;
}
ul.videos {
list-style:none;
margin-bottom:1em;
margin-left:0;
padding-left:0;
}
ul.videos li {
cursor:pointer;
display:inline;
margin-bottom:1em;
padding-right:28px;
color:blue;
}
</style>
</head>
<body>
<div id="videoContainer">
<div id="playerContainer">
<div id="player">
</div>
<div id="like">
</div>
<div id="videos">
</div>
</div>
</div>
</body>
</html>
Can someone please tell me how to position the title of the small thumbnails.
Thank's
Seems like you have a closing span tag in your output, but no starting span tag.
I have made a PHP script with fullcalendar, It works fine with Chrome,But not in IE6 and Firefox, actually I just follow the documents and demo, I'm puzzled what's wrong ?
The page's URL is http://jiangzuokong.com/cal.php
script like follows:
<script type='text/javascript'>
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay'
},
editable: false,
events: [
{
title : '资本主义作为一种历史现象',
start : '2011-3-7',
url : 'http://jiangzuokong.com/forum.php?mod=viewthread&tid=80&from=portal'
},
title : '【在文学馆听讲座】关仁山:乡村社会转型中的文学[北京]',
start : '2011-3-13',
url : 'http://jiangzuokong.com/forum.php?mod=viewthread&tid=104&from=portal'
}, {
title : 'Survival Chinese:Ordering Food[北京]',
start : '2011-3-13',
url : 'http://jiangzuokong.com/forum.php?mod=viewthread&tid=105&from=portal'
}, {
title : '',
start : '',
url : ''
} ]
});
});
</script>
<style type='text/css'>
body {
margin-top: 40px;
text-align: center;
font-size: 14px;
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
}
#calendar {
width: 900px;
margin: 0 auto;
}
</style>
</head>