Guest User

Untitled

a guest
Aug 7th, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.46 KB | None | 0 0
  1. var card = {
  2. 'contentType': 'application/vnd.microsoft.card.adaptive',
  3. 'content': {
  4. "$schema": "http://adaptivecards.io/schemas/adaptive-
  5. card.json",
  6. "type": "AdaptiveCard",
  7. "version": "1.0",
  8. "body": [{
  9. "type": "ColumnSet",
  10. "columns": [{
  11. "type": "Column",
  12. "width": 2,
  13. "items": [{
  14. "type": "TextBlock",
  15. "text": "Sign-in",
  16. "weight": "bolder",
  17. "size": "medium",
  18. "horizontalAlignment": "center"
  19. },
  20. {
  21. "type": "TextBlock",
  22. "text": "Don't worry, we'll never share or sell your information.",
  23. "isSubtle": true,
  24. "wrap": true,
  25. "size": "small"
  26. },
  27. {
  28. "type": "TextBlock",
  29. "text": "Username",
  30. "wrap": true
  31. },
  32. {
  33. "type": "Input.Text",
  34. "id": "Username",
  35. "placeholder": "Username"
  36. },
  37. {
  38. "type": "TextBlock",
  39. "text": "Password",
  40. "wrap": true
  41. },
  42. {
  43. "type": "Input.Text",
  44. "id": "Password",
  45. "placeholder": "********",
  46. "style": "password"
  47. }
  48. ]
  49. },
  50. ]
  51. }],
  52. "actions": [{
  53. "type": "Action.Submit",
  54. "title": "Submit",
  55. "data":{
  56. "x":13
  57. }
  58. }]
  59. }
  60. };
  61.  
  62. var msg = new builder.Message(session)
  63. .addAttachment(card);
  64. session.send(msg);
  65. console.log("raw body212", card["content"]["actions"][0]["data"]);
  66. {
  67. var Username = card["content"]["actions"][0]["data"]["Username"];
  68. var Password = card["content"]["actions"][0]["data"]["Password"];
  69. if (Username = "abhishak" && (Password = "abhishak")) {
  70. console.log("raw body21", body);
  71.  
  72.  
  73. var purchase_payload = {
  74. .............................
  75. };
  76.  
  77. ticket_purchase(purchase_payload, function (body) {
  78. console.log("raw body", body);
  79. session.send(
  80. "Your ticket has been purchased.Your available balance is " + body["data"]["availableBal"] + " and your ticket number is " + body["data"]["ticketData"]["ticketNumber"]
  81. );
  82.  
  83. function createReceiptCard(session) {
  84. return new builder.ReceiptCard(session)
  85. .title(body["data"]["ticketData"]["gameName"], 'Game')
  86. .facts([
  87. builder.Fact.create(session, body["data"]["ticketData"]["ticketNumber"], 'Ticket Number'),
  88. builder.Fact.create(session, body["data"]["ticketData"]["playerPurchaseAmount"], 'Ticket Cost'),
  89. builder.Fact.create(session, body["data"]["saleTransId"], 'Sale Transaction Id'),
  90. builder.Fact.create(session, body["data"]["ticketData"]["purchaseTime"], 'Purchase Time'),
  91. builder.Fact.create(session, body["data"]["ticketData"]["gameName"], 'Game'),
  92. builder.Fact.create(session, body["data"]["ticketData"]["drawData"][0]["drawId"], 'Draw Id'),
  93. builder.Fact.create(session, body["data"]["ticketData"]["drawData"][0]["drawName"], 'Draw Name'),
  94. builder.Fact.create(session, body["data"]["ticketData"]["drawData"][0]["drawDate"], 'Draw Date'),
  95. builder.Fact.create(session, body["data"]["ticketData"]["drawData"][0]["drawTime"], 'Draw Time')
  96. ])
  97. .total(body["data"]["availableBal"], "Available Balance")
  98. }
  99. var card = createReceiptCard(session);
  100. console.log("aka2", card);
  101. var msg = new builder.Message(session).addAttachment(card);
  102. session.send(msg);
  103.  
  104. });
  105. } else {
  106. session.send("Invalid Username/Password.");
  107. }
  108. }
Add Comment
Please, Sign In to add comment