(function () {
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }

  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }

  function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }

  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

  (window["webpackJsonp"] = window["webpackJsonp"] || []).push([["default~add-money-add-money-module~dashboard-dashboard-module~service-wallet-recharge-service-wallet~05c51d99"], {
    /***/
    "vjAt":
    /*!****************************************!*\
      !*** ./src/services/wallet.service.ts ***!
      \****************************************/

    /*! exports provided: WalletService */

    /***/
    function vjAt(module, __webpack_exports__, __webpack_require__) {
      "use strict";

      __webpack_require__.r(__webpack_exports__);
      /* harmony export (binding) */


      __webpack_require__.d(__webpack_exports__, "WalletService", function () {
        return WalletService;
      });
      /* harmony import */


      var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
      /*! tslib */
      "mrSG");
      /* harmony import */


      var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
      /*! @angular/core */
      "fXoL");
      /* harmony import */


      var _angular_common_http__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
      /*! @angular/common/http */
      "tk/3");
      /* harmony import */


      var _base_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
      /*! ./base-service */
      "4YT6");
      /* harmony import */


      var _constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(
      /*! ./constants */
      "k8oS");
      /* harmony import */


      var _common_service__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(
      /*! ./common.service */
      "FBGF");
      /* harmony import */


      var _ionic_native_social_sharing_ngx__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(
      /*! @ionic-native/social-sharing/ngx */
      "/XPu");

      var WalletService = /*#__PURE__*/function (_base_service__WEBPAC) {
        _inherits(WalletService, _base_service__WEBPAC);

        var _super = _createSuper(WalletService);

        function WalletService(_httpClient, _commonService, _socialSharing) {
          var _this;

          _classCallCheck(this, WalletService);

          _this = _super.call(this);
          _this._httpClient = _httpClient;
          _this._commonService = _commonService;
          _this._socialSharing = _socialSharing;
          _this.paramName = "walletstmt";
          _this.fileName = 'wallet.service.ts';
          return _this;
        }

        _createClass(WalletService, [{
          key: "getAllStatement",
          value: function getAllStatement(obj) {
            try {
              var filterParamData = null;

              if (obj.vrn === undefined || obj.vrn == null) {
                filterParamData = [{
                  "name": "txn_date",
                  "params": [{
                    "name": "txn_date",
                    "value": obj.startDate + "T00:01Z"
                  }, {
                    "name": "txn_date",
                    "value": obj.endDate + "T23:59Z"
                  }]
                }];
              } else {
                filterParamData = [{
                  "name": "txn_date",
                  "params": [{
                    "name": "txn_date",
                    "value": obj.startDate + "T00:01Z"
                  }, {
                    "name": "txn_date",
                    "value": obj.endDate + "T23:59Z"
                  }]
                }, {
                  "name": "vehicle",
                  "params": [{
                    "name": "vehicle",
                    "value": obj.vrn
                  }]
                }];
              }

              var paramData = null;

              if (obj.shareVia !== undefined && obj.shareVia == 'csv') {
                paramData = {
                  "name": this.paramName,
                  "format": obj === null || obj === void 0 ? void 0 : obj.shareVia,
                  "row_offset": 0,
                  "sorting": {
                    "id": "desc"
                  },
                  "filters": filterParamData
                };
              } else {
                paramData = {
                  "name": this.paramName,
                  "row_count": _constants__WEBPACK_IMPORTED_MODULE_4__["CONSTANTS"].ROW_COUNT,
                  "row_offset": obj.offset,
                  "sorting": {
                    "id": "desc"
                  },
                  "filters": filterParamData
                };
              }

              var dataObj;
              dataObj = {
                offset: obj.offset,
                method: 'post',
                api_url: this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_4__["CONSTANTS"].WALLET_STATEMENT_API,
                local_json_file: 'local-wallet-statement',
                param_data: paramData,
                mapcol: true
              };
              return this._commonService.fetchData(dataObj);
            } catch (error) {
              var _obj = {
                fileName: this.fileName,
                functionName: 'getAllStatement(obj)',
                error: error
              };

              this._commonService.systemException(_obj);
            }
          }
        }, {
          key: "checkBalance",
          value: function checkBalance(obj) {
            try {
              var data = {
                "customer_id": this.getLocalUserId(),
                "amount": "0",
                "mode": obj.mode
              };
              var dataObj = {
                offset: 0,
                method: 'post',
                api_url: this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_4__["CONSTANTS"].WALLET_TOPUP_BAL_ENQ,
                local_json_file: '',
                param_data: data,
                mapcol: false
              };
              return this._commonService.fetchData(dataObj);
            } catch (error) {
              var _obj2 = {
                fileName: this.fileName,
                functionName: 'checkBalance(obj)',
                error: error
              };

              this._commonService.systemException(_obj2);
            }
          }
        }, {
          key: "beginPayment",
          value: function beginPayment(obj) {
            try {
              var data = {
                "customer_id": this.getLocalUserId(),
                "amount": obj.amount,
                "mode": obj.mode
              };
              var dataObj = {
                offset: 0,
                method: 'post',
                api_url: this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_4__["CONSTANTS"].WALLET_TOPUP_BEGIN,
                local_json_file: '',
                param_data: data,
                mapcol: false
              };
              return this._commonService.fetchData(dataObj);
            } catch (error) {
              var _obj3 = {
                fileName: this.fileName,
                functionName: 'beginPayment(obj)',
                error: error
              };

              this._commonService.systemException(_obj3);
            }
          }
        }, {
          key: "payment",
          value: function payment(obj) {
            try {
              var data = {
                "merchant_id": obj.merchant_id,
                "pg_request_enc": obj.pg_request_enc
              };
              var url = obj.pg_url;
              var dataObj = {
                offset: 0,
                method: 'post',
                api_url: url,
                local_json_file: '',
                param_data: data,
                mapcol: false
              };
              return this._commonService.fetchData(dataObj);
            } catch (error) {
              var _obj4 = {
                fileName: this.fileName,
                functionName: 'payment(obj)',
                error: error
              };

              this._commonService.systemException(_obj4);
            }
          }
        }, {
          key: "shareFunction",
          value: function shareFunction(messageObj) {
            return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
              var _this2 = this;

              var data, obj;
              return regeneratorRuntime.wrap(function _callee$(_context) {
                while (1) {
                  switch (_context.prev = _context.next) {
                    case 0:
                      _context.prev = 0;
                      _context.next = 3;
                      return this.shareMessageFormat(messageObj);

                    case 3:
                      data = _context.sent;

                      this._socialSharing.share(data.message, data.subject, data.file, data.url).then(function (res) {})["catch"](function (error) {
                        _this2.log('shared successfully');
                      });

                      _context.next = 11;
                      break;

                    case 7:
                      _context.prev = 7;
                      _context.t0 = _context["catch"](0);
                      obj = {
                        fileName: this.fileName,
                        functionName: 'shareFunction(messageObj)',
                        error: _context.t0
                      };

                      this._commonService.systemException(obj);

                    case 11:
                    case "end":
                      return _context.stop();
                  }
                }
              }, _callee, this, [[0, 7]]);
            }));
          }
        }, {
          key: "generateCSV",
          value: function generateCSV(obj) {
            try {
              var dataObj;
              dataObj = {
                offset: 0,
                method: 'post',
                api_url: this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_4__["CONSTANTS"].WALLET_STATEMENT_API,
                local_json_file: 'local-wallet-statement',
                param_data: {
                  "name": "walletstmt",
                  "format": "csv"
                },
                mapcol: true
              };
              return this._commonService.fetchData(dataObj);
            } catch (error) {
              var _obj5 = {
                fileName: this.fileName,
                functionName: 'generateCSV(obj)',
                error: error
              };

              this._commonService.systemException(_obj5);
            }
          }
        }, {
          key: "getTransactionStatus",
          value: function getTransactionStatus(obj) {
            try {
              var dataObj = {
                offset: 0,
                method: 'get',
                api_url: this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_4__["CONSTANTS"].PG_TRANSACTION_STATUS + '/' + obj.txt_id,
                local_json_file: '',
                param_data: {},
                mapcol: false
              };
              return this._commonService.fetchData(dataObj);
            } catch (error) {
              var _obj6 = {
                fileName: this.fileName,
                functionName: 'getTransactionStatus(obj)',
                error: error
              };

              this._commonService.systemException(_obj6);
            }
          }
        }, {
          key: "shareMessageFormat",
          value: function shareMessageFormat(messageObj) {
            return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
              var message, subject, file, url, tmp;
              return regeneratorRuntime.wrap(function _callee2$(_context2) {
                while (1) {
                  switch (_context2.prev = _context2.next) {
                    case 0:
                      _context2.prev = 0;
                      message = null;
                      subject = null;
                      file = null;
                      url = null;
                      tmp = '';
                      tmp = _constants__WEBPACK_IMPORTED_MODULE_4__["CONSTANTS"].SHARE_TOP_HEADER + '\n';
                      tmp += 'Transaction Date:' + this.getDisplayDtTm(messageObj.txn_date) + '\n';

                      if (messageObj.txn_type == 'DEBIT') {
                        tmp += 'Transaction Amount:' + this.currencyFormatter(messageObj.txn_amount, 'INR') + ' Dr\n';
                        tmp += 'VRN: ' + messageObj.udf5 + '\n';
                        tmp += 'Toll Plaza: ' + messageObj.udf4 + '\n';
                      } else {
                        tmp += 'Transaction Amount:' + this.currencyFormatter(messageObj.txn_amount, 'INR') + ' Cr\n';
                        tmp += 'Ref ID: ' + messageObj.partner_ref_no + '\n';
                      }

                      tmp += 'Security Deposit:' + this.currencyFormatter(messageObj.security_deposit, 'INR') + '\n';
                      tmp += 'Opening Balance:' + this.currencyFormatter(messageObj.opening_balance, 'INR') + '\n';
                      tmp += 'Closing Balance:' + this.currencyFormatter(messageObj.closing_balance, 'INR') + '\n';
                      tmp += 'Transaction ID: ' + messageObj.wallet_txn_id + '\n';
                      tmp += 'Narration: ' + messageObj.narration + '\n';
                      tmp += '\n' + _constants__WEBPACK_IMPORTED_MODULE_4__["CONSTANTS"].SHARE_FOOTER_NOTE + '\n';
                      message = tmp;
                      return _context2.abrupt("return", {
                        message: message,
                        subject: subject,
                        file: file,
                        url: url
                      });

                    case 19:
                      _context2.prev = 19;
                      _context2.t0 = _context2["catch"](0);
                      this.log('Error in messageGeneration ' + _context2.t0);

                    case 22:
                    case "end":
                      return _context2.stop();
                  }
                }
              }, _callee2, this, [[0, 19]]);
            }));
          }
        }, {
          key: "shareFILE",
          value: function shareFILE(obj) {
            var _this3 = this;

            console.log({
              obj: obj
            });

            try {
              // let blobObjVal = "data:application/csv;df:myOwnName.csv;base64,"+blobObj;
              this._socialSharing.share(null, null, obj.file, obj.url).then(function (res) {})["catch"](function (error) {
                _this3.log('shared successfully');
              });
            } catch (error) {
              var _obj7 = {
                fileName: this.fileName,
                functionName: 'shareFILE(messageObj)',
                error: error
              };

              this._commonService.systemException(_obj7);
            }
          }
        }]);

        return WalletService;
      }(_base_service__WEBPACK_IMPORTED_MODULE_3__["BaseService"]);

      WalletService.ctorParameters = function () {
        return [{
          type: _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpClient"]
        }, {
          type: _common_service__WEBPACK_IMPORTED_MODULE_5__["CommonService"]
        }, {
          type: _ionic_native_social_sharing_ngx__WEBPACK_IMPORTED_MODULE_6__["SocialSharing"]
        }];
      };

      WalletService = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])({
        providedIn: 'root'
      }), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [_angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpClient"], _common_service__WEBPACK_IMPORTED_MODULE_5__["CommonService"], _ionic_native_social_sharing_ngx__WEBPACK_IMPORTED_MODULE_6__["SocialSharing"]])], WalletService);
      /***/
    }
  }]);
})();
//# sourceMappingURL=default~add-money-add-money-module~dashboard-dashboard-module~service-wallet-recharge-service-wallet~05c51d99-es5.js.map