ng-easycommerce 0.0.490 → 0.0.492

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,7 @@
1
+ # version 0.0.492
2
+ - Se cambia de lugar el endpoint process-payment para que se ejecute cuando bamboo obtiene el token de usuario. **En desarrollo**
3
+ # version 0.0.491
4
+ - Se corrige el endpoint de procesamiento de bamboo asi como sus parametros tambien, estado **incompleto**.
1
5
  # version 0.0.490
2
6
  - Se agrega un nuevo servicio `currency.service` para manejar la funcionalidad con respecto a la moneda y su convertibilidad.
3
7
  - Se actualiza el pipe `ec-currency-symbol` para que muestre los cambios cuando se genera una convertibilidad moneda.
@@ -30,6 +30,8 @@
30
30
  $(document).ready(function() {
31
31
  let pwCheckoutProperties = JSON.parse(localStorage.getItem('pwCheckouProperties'))
32
32
 
33
+ const dataRedirect = localStorage.getItem('dataRedirect')
34
+
33
35
  PWCheckout.SetProperties(
34
36
  {
35
37
  "name": pwCheckoutProperties.name,
@@ -50,9 +52,46 @@
50
52
  function onTokenCreated(token) {
51
53
  //console.log(JSON.stringify(token));
52
54
  localStorage.setItem('data',JSON.stringify(token))
53
- localStorage.setItem('state', 'success')
54
- //window.close()
55
- //console.log('El token: ', token)
55
+
56
+ let data = {
57
+ tokenID: token.TokenId,
58
+ orderToken: pwCheckoutProperties.orderToken
59
+ }
60
+
61
+
62
+ try {
63
+ fetch(dataRedirect, {
64
+ method: 'POST',
65
+ body: JSON.stringify(data),
66
+ headers: {
67
+ 'Content-Type': 'application/json'
68
+ }
69
+ }).then(res => {
70
+ res.json()
71
+ console.log(res)
72
+ //localStorage.setItem('state', 'success')
73
+ }).catch(error => {
74
+ console.error('Error:', error)
75
+ //processError(response)
76
+ //localStorage.setItem('state', 'failure')
77
+ })
78
+ .then(response => {
79
+ console.log('Success:', response)
80
+ //localStorage.setItem('state', 'success')
81
+ /* setMessageInStore(response)
82
+ if (response.hasOwnProperty('status')) {
83
+ if (response.status == 'approved' || response.status == 'partially_authorized') {
84
+ processResponse(response)
85
+ } else {
86
+ processError(response)
87
+ }
88
+ } else {
89
+ processError(response)
90
+ } */
91
+ });
92
+ } catch (error) {
93
+ //processError(response)
94
+ }
56
95
  }
57
96
 
58
97
  function OpenIframe() {
@@ -16970,9 +16970,9 @@
16970
16970
  _this.ready = new core.EventEmitter();
16971
16971
  _this.loading = false;
16972
16972
  _this.closeModal = '';
16973
- _this.paymentNotification = function () { return 'shop-api/' + _this.consts.getChannel() + '/bamboo/payment-notification'; };
16973
+ //private paymentNotification = () => 'shop-api/' + this.consts.getChannel() + '/bamboo/payment-notification';
16974
16974
  /* endpoint para mandar datos: /bamboo/payment-notification */
16975
- _this.dataBambooApi = function () { return 'shop-api/' + _this.consts.getChannel() + '/bamboo/' + _this.cartService.cart_token + '/process-payment'; };
16975
+ _this.processPaymentApi = function () { return 'shop-api/' + _this.consts.getChannel() + '/bamboo/' + _this.cartService.cart_token + '/process-payment'; };
16976
16976
  _this.getCheckoutBamboo = function () {
16977
16977
  _this.loading = true;
16978
16978
  _this.dataBamboo = _this.method;
@@ -16992,6 +16992,7 @@
16992
16992
  localStorage.removeItem('dataDecidir');
16993
16993
  localStorage.removeItem('message');
16994
16994
  localStorage.removeItem('subMessage');
16995
+ localStorage.removeItem('pwCheckouProperties');
16995
16996
  };
16996
16997
  _this.clickClose = function () {
16997
16998
  _this.closeModal = 'cancel';
@@ -17018,10 +17019,14 @@
17018
17019
  console.log(JSON.parse(localStorage.getItem('data')));
17019
17020
  //this.ready.emit(true)
17020
17021
  var data = JSON.parse(localStorage.getItem('data'));
17021
- _this.connection.post(_this.paymentNotification(), {
17022
- dataBamboo: data,
17023
- cart: _this.cart
17024
- }).toPromise().then(function (res) { return console.log(res); }).catch(function (err) { return console.log(err); });
17022
+ /* this.connection.post(this.processPaymentApi(),{
17023
+ tokenID: data.TokenId,
17024
+ orderToken: this.cartService.cart_token
17025
+ }).toPromise().then(
17026
+ res => console.log(res)
17027
+ ).catch(
17028
+ err => console.log(err)
17029
+ ) */
17025
17030
  return;
17026
17031
  }
17027
17032
  if (state == 'pending') {
@@ -17055,13 +17060,15 @@
17055
17060
  return {
17056
17061
  name: window.location.hostname.split('.')[0],
17057
17062
  button_label: "Pagar",
17058
- currency: 'UYU'
17063
+ currency: 'UYU',
17064
+ orderToken: _this.cartService.cart_token
17059
17065
  };
17060
17066
  };
17061
17067
  _this.iniciar = function () {
17062
17068
  _this.closeModal = '';
17063
17069
  _this.clearStorageState();
17064
17070
  localStorage.setItem('pwCheckouProperties', JSON.stringify(_this.pwCheckoutProperties()));
17071
+ localStorage.setItem('dataRedirect', _this.processPaymentApi());
17065
17072
  _this.ventana = window.open('assets/bamboo.html', 'Bamboo', _this.popupSettings());
17066
17073
  _this.callState();
17067
17074
  };