node-red-contrib-alice 2.3.4 → 2.3.6

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.
@@ -92,7 +92,7 @@ module.exports = (RED) => {
92
92
  axios_1.default.request({
93
93
  timeout: 5000,
94
94
  method: 'POST',
95
- url: 'https://state.nodered-home.ru/gtw/device/state',
95
+ url: 'https://api.nodered-home.ru/gtw/device/state',
96
96
  headers: {
97
97
  'content-type': 'application/json',
98
98
  'Authorization': "Bearer " + service.getToken()
package/nodes/alice.html CHANGED
@@ -1,5 +1,4 @@
1
1
 
2
- <script src="https://widget.cloudpayments.ru/bundles/cloudpayments.js"></script>
3
2
  <script type="text/javascript">
4
3
  RED.nodes.registerType('alice-service',{
5
4
  category: 'config',
@@ -100,63 +99,11 @@
100
99
  })
101
100
  };
102
101
  function pay(id, email) {
103
- console.log("Start pay");
104
102
  if (!id || !email){
105
103
  RED.notify("Please authorize before purchasing a subscription", {type:"error"});
106
104
  return;
107
- };
108
- $('#subscribe-button').prop('disabled', true);
109
- RED.notify("Request has been sent. Please, wait",{type:"compact"});
110
- let paymentWidget = new cp.CloudPayments();
111
- console.log("Start get pay confi");
112
- $.ajax({
113
- url: "https://nodered-home.ru/payment/create",
114
- type:"POST",
115
- headers: {
116
- 'Content-Type':'application/json'
117
- },
118
- crossDomain: true,
119
- contentType:"application/json",
120
- data: JSON.stringify({
121
- id: id,
122
- email: email
123
- }),
124
- dataType: "json",
125
- format:"json"
126
- })
127
- .done(paydata=>{
128
- console.log("pay config done");
129
- console.log("Start widget");
130
- paymentWidget.pay('auth', // или 'charge'
131
- paydata,
132
- {
133
- onSuccess: function (result) { // success
134
- //действие при успешной оплате
135
- let em = $('#node-config-input-email').val();
136
- let idt = $('#node-config-input-id').val();
137
- $('#subscribe-status').text("checking ...");
138
- setTimeout(() => {
139
- getSubscribeStatus(idt,em,"subscribe-status");
140
- }, 2000);
141
-
142
- },
143
- onFail: function (reason, options) { // fail
144
- //действие при неуспешной оплате
145
- },
146
- onComplete: function (paymentResult, options) { //Вызывается как только виджет получает от api.cloudpayments ответ с результатом транзакции.
147
- //например вызов вашей аналитики Facebook Pixel
148
-
149
- }
150
- }
151
- );
152
- $('#subscribe-button').prop('disabled', false);
153
- })
154
- .fail(error=>{
155
- console.log(error)
156
- console.error(error.responseJSON);
157
- RED.notify("Error : "+error.responseJSON.message, {type:"error"});
158
- $('#subscribe-button').prop('disabled', false);
159
- })
105
+ }
106
+ window.open('https://nodered-home.ru/pay.html?id=' + encodeURIComponent(id) + '&email=' + encodeURIComponent(email));
160
107
  };
161
108
  </script>
162
109
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-alice",
3
- "version": "2.3.4",
3
+ "version": "2.3.6",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "start": "npm run build && node-red",
@@ -110,7 +110,7 @@ export = (RED: NodeAPI): void => {
110
110
  axios.request({
111
111
  timeout: 5000,
112
112
  method: 'POST',
113
- url: 'https://state.nodered-home.ru/gtw/device/state',
113
+ url: 'https://api.nodered-home.ru/gtw/device/state',
114
114
  headers: {
115
115
  'content-type': 'application/json',
116
116
  'Authorization': "Bearer " + service.getToken()
package/src/alice.html CHANGED
@@ -1,5 +1,4 @@
1
1
 
2
- <script src="https://widget.cloudpayments.ru/bundles/cloudpayments.js"></script>
3
2
  <script type="text/javascript">
4
3
  RED.nodes.registerType('alice-service',{
5
4
  category: 'config',
@@ -100,63 +99,11 @@
100
99
  })
101
100
  };
102
101
  function pay(id, email) {
103
- console.log("Start pay");
104
102
  if (!id || !email){
105
103
  RED.notify("Please authorize before purchasing a subscription", {type:"error"});
106
104
  return;
107
- };
108
- $('#subscribe-button').prop('disabled', true);
109
- RED.notify("Request has been sent. Please, wait",{type:"compact"});
110
- let paymentWidget = new cp.CloudPayments();
111
- console.log("Start get pay confi");
112
- $.ajax({
113
- url: "https://nodered-home.ru/payment/create",
114
- type:"POST",
115
- headers: {
116
- 'Content-Type':'application/json'
117
- },
118
- crossDomain: true,
119
- contentType:"application/json",
120
- data: JSON.stringify({
121
- id: id,
122
- email: email
123
- }),
124
- dataType: "json",
125
- format:"json"
126
- })
127
- .done(paydata=>{
128
- console.log("pay config done");
129
- console.log("Start widget");
130
- paymentWidget.pay('auth', // или 'charge'
131
- paydata,
132
- {
133
- onSuccess: function (result) { // success
134
- //действие при успешной оплате
135
- let em = $('#node-config-input-email').val();
136
- let idt = $('#node-config-input-id').val();
137
- $('#subscribe-status').text("checking ...");
138
- setTimeout(() => {
139
- getSubscribeStatus(idt,em,"subscribe-status");
140
- }, 2000);
141
-
142
- },
143
- onFail: function (reason, options) { // fail
144
- //действие при неуспешной оплате
145
- },
146
- onComplete: function (paymentResult, options) { //Вызывается как только виджет получает от api.cloudpayments ответ с результатом транзакции.
147
- //например вызов вашей аналитики Facebook Pixel
148
-
149
- }
150
- }
151
- );
152
- $('#subscribe-button').prop('disabled', false);
153
- })
154
- .fail(error=>{
155
- console.log(error)
156
- console.error(error.responseJSON);
157
- RED.notify("Error : "+error.responseJSON.message, {type:"error"});
158
- $('#subscribe-button').prop('disabled', false);
159
- })
105
+ }
106
+ window.open('https://nodered-home.ru/pay.html?id=' + encodeURIComponent(id) + '&email=' + encodeURIComponent(email));
160
107
  };
161
108
  </script>
162
109