ng-easycommerce 0.0.495 → 0.0.496

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.
package/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ # version 0.0.496
2
+ - Se completa el método de pago bamboo, se parametriza la carga del script con los datos recibidos desde el backend. Se hace correciones visuales al formulario, el logo que se imprime en este siempre debe llamarse `logo_bamboo.png` y debe ir en ***assets/*** del frontend.
1
3
  # version 0.0.495
2
4
  - Se completa el circuito del método de pago de bamboo. Se continua trabajando en la parametrización.
3
5
  # version 0.0.494
@@ -13,9 +13,29 @@
13
13
  -->
14
14
  <!--Public Key
15
15
  Rohrq0RNz3sc0Ojn5BKxuW_I56ONV7HQ
16
+ Rohrq0RNz3sc0Ojn5BKxuW_I56ONV7HQ
16
17
  -->
17
- <script src="https://api.stage.bamboopayment.com/v1/Scripts/PWCheckout.js?key=Rohrq0RNz3sc0Ojn5BKxuW_I56ONV7HQ"
18
- type="text/javascript"></script>
18
+
19
+ <script type="text/javascript">
20
+ let dataBamboo = localStorage.getItem('dataBamboo') && JSON.parse(localStorage.getItem('dataBamboo'));
21
+
22
+ let baseUrl = 'https://api.stage.bamboopayment.com'
23
+ console.log(dataBamboo)
24
+ if (dataBamboo.config.public_environment) {
25
+ baseUrl = (dataBamboo.config.public_environment == 'staging') ? 'https://api.stage.bamboopayment.com' : 'https://api.bamboopayment.com'
26
+ }
27
+
28
+ let srcScript = baseUrl + '/v1/Scripts/PWCheckout.js?key=' + dataBamboo.config.public_bamboo_public_key || 'Rohrq0RNz3sc0Ojn5BKxuW_I56ONV7HQ';
29
+
30
+ let my_awesome_script = document.createElement('script');
31
+ my_awesome_script.setAttribute('defer', 'defer');
32
+ my_awesome_script.setAttribute('src', srcScript);
33
+ document.head.appendChild(my_awesome_script);
34
+
35
+ </script>
36
+
37
+ <!-- <script src="https://api.stage.bamboopayment.com/v1/Scripts/PWCheckout.js?key=Rohrq0RNz3sc0Ojn5BKxuW_I56ONV7HQ"
38
+ type="text/javascript"></script> -->
19
39
 
20
40
 
21
41
 
@@ -29,7 +49,7 @@
29
49
  </body>
30
50
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
31
51
  <script type="text/javascript">
32
- $(document).ready(function () {
52
+ window.onload = function () {
33
53
  let pwCheckoutProperties = JSON.parse(localStorage.getItem('pwCheckouProperties'))
34
54
 
35
55
  const dataRedirect = localStorage.getItem('dataRedirect')
@@ -37,12 +57,13 @@
37
57
  PWCheckout.SetProperties(
38
58
  {
39
59
  "name": pwCheckoutProperties.name,
40
- "email": "test@test.com",
60
+ "email": "",
41
61
  "button_label": pwCheckoutProperties.button_label,
42
62
  "description": "",
43
63
  "currency": pwCheckoutProperties.currency,
44
64
  "amount": "1",
45
65
  "lang": "ESP",
66
+ "image": window.location.origin + "/assets/logo_bamboo.png",
46
67
  "form_id": "commerce_form", "checkout_card": "0", "autoSubmit": "false",
47
68
  "iframeId": "custom_iframe"
48
69
  }
@@ -71,7 +92,7 @@
71
92
  }).then(res => {
72
93
  res.json()
73
94
  console.log(res)
74
- //localStorage.setItem('state', 'success')
95
+ localStorage.setItem('state', 'success')
75
96
  }).catch(error => {
76
97
  console.error('Error:', error)
77
98
  //processError(response)
@@ -92,6 +113,8 @@
92
113
  } */
93
114
  });
94
115
  } catch (error) {
116
+ console.error('Error:', error)
117
+ localStorage.setItem('state', 'failure')
95
118
  //processError(response)
96
119
  }
97
120
  }
@@ -117,7 +140,7 @@
117
140
  console.log(PWCheckout)
118
141
  PWCheckout.OpenIframeNormal();
119
142
  }
120
- });
143
+ };
121
144
  </script>
122
145
 
123
146
  </html>