import{n as N}from"./chunk-2EIV44V5.js";import{a as S,b as y}from"./chunk-R5ZNL6WY.js";import{p as d}from"./chunk-7WGMNLRJ.js";import{$ as b,D as h,K as s,ga as f,h as l,l as p,la as a,q as m}from"./chunk-I3FGJX2C.js";import{a as u,b as c}from"./chunk-B7YGBANW.js";var x=(()=>{let r=class r{constructor(t){this.tokens=t}};r.type="[TrinityAuth] Set TrinityTokens";let o=r;return o})(),v=(()=>{let r=class r{};r.type="[TrinityAuth] TrinityLogout";let o=r;return o})();var C=(()=>{let r=class r{constructor(t,e,n,i){this._trinityServiceApi=t,this._sellDocumentsServiceApi=e,this._returnDocumentsServiceApi=n,this._store=i,this.requestNumber$$=new l(null)}signIn(t,e,n){return this._trinityServiceApi.signIn(t,e).pipe(b(i=>{this._store.dispatch(new x(c(u({},i.data),{cashboxId:n})))}),s(1))}refreshToken(t){return this._trinityServiceApi.refreshToken(t).pipe(s(1))}bankCenterCreditTerminalSetup(){return this._trinityServiceApi.bankCenterCreditTerminalSetup().pipe(s(1))}forteTerminalSetup(){return this._trinityServiceApi.forteTerminalSetup().pipe(s(1))}kaspiTerminalSetup(t=!1){return this._trinityServiceApi.kaspiTerminalSetup(t).pipe(s(1))}closeTrinityShift(t={}){return this._trinityServiceApi.closeShift(t).pipe(s(1))}getTrinityXReport(){return this._trinityServiceApi.getXReport().pipe(s(1))}trinityMoneyOperation(t){return this._trinityServiceApi.moneyOperation(t).pipe(s(1))}checkOperation(t,e=!1){return this._trinityServiceApi.checkOperation(t,e?this.requestNumber$$.value:null).pipe(m(n=>n.body),h(n=>(this.requestNumber$$.next(n.headers.get("Request-Number")),p(()=>n))))}externalFiscalizeSellDocument(t,e,n){let i=this._toExternalFiscalizeModel(t,e,n);return this._sellDocumentsServiceApi.externalFiscalize(i).pipe(s(1))}externalFiscalizeReturnDocument(t,e,n){let i=this._toExternalFiscalizeModel(t,e,n);return this._returnDocumentsServiceApi.externalFiscalize(i).pipe(s(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,n){let{data:i}=t;return{documentId:e,trinityCardPaymentDetails:n,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}}}};r.\u0275fac=function(e){return new(e||r)(a(N),a(S),a(y),a(d))},r.\u0275prov=f({token:r,factory:r.\u0275fac});let o=r;return o})();export{x as a,v as b,C as c};
//# sourceMappingURL=chunk-4VQI34SA.js.map
