import{n as d}from"./chunk-6WU6YPK5.js";import{a as y,b as S}from"./chunk-OTNTPU5O.js";import{m as f}from"./chunk-OWZ5YAMH.js";import{L as m,S as n,f as c,fa as h,la as b,pa as s,s as l,x as p}from"./chunk-ISMRT7VU.js";import{a,b as u}from"./chunk-M5TX2NVG.js";var N=(()=>{class o{static{this.type="[TrinityAuth] Set TrinityTokens"}constructor(t){this.tokens=t}}return o})(),T=(()=>{class o{static{this.type="[TrinityAuth] TrinityLogout"}}return o})();var C=(()=>{class o{constructor(t,e,r,i){this._trinityServiceApi=t,this._sellDocumentsServiceApi=e,this._returnDocumentsServiceApi=r,this._store=i,this.requestNumber$$=new c(null)}signIn(t,e,r){return this._trinityServiceApi.signIn(t,e).pipe(h(i=>{this._store.dispatch(new N(u(a({},i.data),{cashboxId:r})))}),n(1))}refreshToken(t){return this._trinityServiceApi.refreshToken(t).pipe(n(1))}bankCenterCreditTerminalSetup(){return this._trinityServiceApi.bankCenterCreditTerminalSetup().pipe(n(1))}forteTerminalSetup(){return this._trinityServiceApi.forteTerminalSetup().pipe(n(1))}kaspiTerminalSetup(t=!1){return this._trinityServiceApi.kaspiTerminalSetup(t).pipe(n(1))}closeTrinityShift(t={}){return this._trinityServiceApi.closeShift(t).pipe(n(1))}getTrinityXReport(){return this._trinityServiceApi.getXReport().pipe(n(1))}trinityMoneyOperation(t){return this._trinityServiceApi.moneyOperation(t).pipe(n(1))}checkOperation(t,e=!1){return this._trinityServiceApi.checkOperation(t,e?this.requestNumber$$.value:null).pipe(p(r=>r.body),m(r=>(this.requestNumber$$.next(r.headers.get("Request-Number")),l(()=>r))))}externalFiscalizeSellDocument(t,e,r){let i=this._toExternalFiscalizeModel(t,e,r);return this._sellDocumentsServiceApi.externalFiscalize(i).pipe(n(1))}externalFiscalizeReturnDocument(t,e,r){let i=this._toExternalFiscalizeModel(t,e,r);return this._returnDocumentsServiceApi.externalFiscalize(i).pipe(n(1))}toXReportModel(t){let{data:e}=t;return{shiftNumber:e.shiftNumber,reportNumber:e.reportNumber,startOn:e.startOn,reportOn:e.reportOn,closeOn:e.closeOn,documentCount:e.documentCount,putMoneySum:e.putMoneySum,takeMoneySum:e.takeMoneySum,sumInCashbox:e.sumInCashbox,cashierCode:e.cashierCode,offlineMode:!1,cashboxOffline:!1,sell:e.sell,buy:e.buy,returnSell:e.returnSell,returnBuy:e.returnBuy,startNonNullable:e.startNonNullable,endNonNullable:e.endNonNullable,organization:{name:"string",xin:"string",vat:!1,vatSeria:"string",vatNumber:"string"},cashbox:{uniqueNumber:e.cashboxSN,identificationNumber:e.cashboxIN.toString(),registrationNumber:e.cashboxRN},ofd:e.ofd,controlSum:e.controlSum}}_toExternalFiscalizeModel(t,e,r){let{data:i}=t;return{documentId:e,trinityCardPaymentDetails:r,fiscalizationData:{number:i.checkNumber,dateTime:i.dateTime,offlineMode:i.offlineMode,cashboxOfflineMode:i.cashboxOfflineMode,cashbox:{uniqueNumber:i.cashbox?.uniqueNumber,registrationNumber:i.cashbox?.registrationNumber,identityNumber:i.cashbox?.identityNumber,address:i.cashbox?.address,ofd:i.cashbox?.ofd},organization:{taxPayerName:i.organization?.name,taxPayerIn:i.organization?.xin},orderNumber:i.checkOrderNumber?.toString(),shiftNumber:i.shiftNumber,employeeName:i.employeeName,ticketUrl:i.ticketUrl,ticketPrintUrl:i.ticketPrintUrl}}}static{this.\u0275fac=function(e){return new(e||o)(s(d),s(y),s(S),s(f))}}static{this.\u0275prov=b({token:o,factory:o.\u0275fac})}}return o})();export{N as a,T as b,C as c};
//# sourceMappingURL=chunk-NAAA46YX.js.map
