node-red-contrib-alice 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -216,7 +216,6 @@ module.exports = function(RED) {
216
216
  capabIndex = cap.type+".";
217
217
  };
218
218
  const capId = capabilites[capabIndex];
219
- // console.log("Emit",capId);
220
219
  this.emit(capId,cap.state.value, cap.state);
221
220
  });
222
221
  })
@@ -87,7 +87,6 @@ module.exports = function(RED) {
87
87
  }
88
88
  };
89
89
  // если установлено требование немедленно отвечать, отвечаем
90
- console.log(this.response);
91
90
  if (this.response){
92
91
  this.device.updateCapabState(this.id,state)
93
92
  .then (res=>{
package/nodes/alice.html CHANGED
@@ -16,6 +16,8 @@
16
16
  return this.name || "Alice-Credentials";
17
17
  },
18
18
  oneditprepare:function(){
19
+ $('#dev-on-gate').text("checking ...");
20
+ $('#subscribe-status').text("checking ...");
19
21
  let em = $('#node-config-input-email').val();
20
22
  let idt = $('#node-config-input-id').val();
21
23
  getDeviceCount(idt,em,"dev-on-gate");
@@ -43,7 +45,7 @@
43
45
  format:"json"
44
46
  })
45
47
  .done(result=>{
46
- $('#'+contId).text(result.text);
48
+ $('#'+contId).text(result.data.text);
47
49
  })
48
50
  .fail(error=>{
49
51
  console.log(error)
@@ -69,7 +71,7 @@
69
71
  })
70
72
  .done(result=>{
71
73
  // console.log(result);
72
- $('#'+contId).text(result.text);
74
+ $('#'+contId).text(result.data.text);
73
75
  })
74
76
  .fail(error=>{
75
77
  console.log(error)
@@ -110,6 +112,7 @@
110
112
 
111
113
  };
112
114
  function pay(id, email) {
115
+ console.log("Start pay");
113
116
  if (!id || !email){
114
117
  RED.notify("Please authorize before purchasing a subscription", {type:"error"});
115
118
  return;
@@ -117,6 +120,7 @@
117
120
  $('#subscribe-button').prop('disabled', true);
118
121
  RED.notify("Request has been sent. Please, wait",{type:"compact"});
119
122
  let paymentWidget = new cp.CloudPayments();
123
+ console.log("Start get pay confi");
120
124
  $.ajax({
121
125
  url: "https://nodered-home.ru/payment/create",
122
126
  type:"POST",
@@ -133,12 +137,20 @@
133
137
  format:"json"
134
138
  })
135
139
  .done(paydata=>{
136
- console.log(paydata);
140
+ console.log("pay config done");
141
+ console.log("Start widget");
137
142
  paymentWidget.pay('auth', // или 'charge'
138
143
  paydata,
139
144
  {
140
145
  onSuccess: function (result) { // success
141
146
  //действие при успешной оплате
147
+ let em = $('#node-config-input-email').val();
148
+ let idt = $('#node-config-input-id').val();
149
+ $('#subscribe-status').text("checking ...");
150
+ setTimeout(() => {
151
+ getSubscribeStatus(idt,em,"subscribe-status");
152
+ }, 2000);
153
+
142
154
  },
143
155
  onFail: function (reason, options) { // fail
144
156
  //действие при неуспешной оплате
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-alice",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "",
5
5
  "main": "alice.js",
6
6
  "scripts": {