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ewayName","Issuer","IsDefault","static","o","hasUnionKeys","BillingPaymentDetailVM","Type","BillingBankCard","Reason","ReasonCode","CreatedOn","CreatedBy","LastUpdatedOn","LastUpdatedBy","__decorate","Property","Date","BillingPaymentProductDetailVM","Count","Price","Amount","Measure","ProductType","BillingPaymentVM","Number","TotalAmount","InvoiceId","TransactionId","StorageId","Company","PaymentDate","Status","BillingPaymentDetails","BillingPaymentProductDetails","BillingPaymentApiService","SwaggerApiService","http","baseUrl","super","Get_by$select_by$expand_by$filter_by$orderby_by$top_by$skip_by$count","queryParams","requestHeaders","params","$MapParams","request","headers","responseType","pipe","eitherify","mapRight","response","OdataModel","mapLeft","ex","core","BASE_URL","factory","BusinessServerApiRootModule","PaymentsHistoryService","Disposable","paymentsHistory","_paymentsHistory","asObservable","billingPaymentApi","paymentService","ReplaySubject","PaginatorConfig","getData","count","_this","next","skip","paginator","pageSize","pageIndex","res","$orderby","$top","$skip","$count","takeUntil","destroyed","apiResponseErrorHandler","showNotification","toPromise","isLeft","payments","value","length","paymentsHistoryInfos","map","p","sortedDetails","filter","notNull","sort","billingPaymentDetailComparer","details","PaymentsHistoryInfo","moment","utc","local","toDate","CompanyId","PaymentType","PaymentStatus","a","b","getTime","valueOf","payByCard","model","_this2","selectCard","pageChanged","$event","_this3","createErrorNotification","extendWith","error","NotificationConfiguration","color","duration","title","Header","content","Description","exception","Exception","BillingReportApiService","GetPaymentReportFile_byId","id","_angular_core__WEBPACK_IMPORTED_MODULE_4__","i0","BillingBlockConfig","hasButton","BillingBlockComponent","BaseComponent","EventEmitter","ngOnInit","t","selectors","MatPaginatorIntlRu","MatPaginatorIntl","page","startIndex","Math","max","min","PaginatorModule","provide","useClass","MAT_DATE_LOCALE","useValue","imports","CommonModule","MatPaginatorModule"],"sourceRoot":"webpack:///","sources":["./libraries/api/src/business/models/BillingBankCardVM.model.ts","./libraries/api/src/business/models/BillingPaymentDetailVM.model.ts","./libraries/api/src/business/models/BillingPaymentProductDetailVM.model.ts","./libraries/api/src/business/models/BillingPaymentVM.model.ts","./libraries/api/src/business/services/BillingPayment.api-service.ts","./applications/billing/src/app/services/billing/payments-history.service.ts","./applications/identity/src/app/utils/api-error-handler.ts","./libraries/api/src/business/services/BillingReport.api-service.ts","./libraries/ui/billing-ui/src/lib/components/billing-block/billing-block.component.html","./libraries/ui/billing-ui/src/lib/components/billing-block/billing-block.component.ts","./libraries/ui/shared-ui/src/lib/paginator/mat-paginator-intl-ru.ts","./libraries/ui/shared-ui/src/lib/paginator/paginator.module.ts"],"sourcesContent":["import { BaseModel, StrictBaseModelPart, hasUnionKeys } from '@dev-stream/utils';\n\nexport class BillingBankCardVM extends BaseModel {\n protected BASE_TYPE = BillingBankCardVM;\n 'Id'!: string | null;\n 'CardMask'!: string | null;\n 'ExpirationMonthYear'!: string | null;\n 'CardType'!: string | null;\n 'Name'!: string | null;\n 'GatewayName'!: string | null;\n 'Issuer'!: string | null;\n 'IsDefault'!: boolean | null;\n\n public GetDefaultValue(): StrictBaseModelPart {\n return {\n Id: null,\n CardMask: null,\n ExpirationMonthYear: null,\n CardType: null,\n Name: null,\n GatewayName: null,\n Issuer: null,\n IsDefault: null,\n };\n }\n\n public static isBillingBankCardVM(o: any): o is BillingBankCardVM {\n return (\n o instanceof BillingBankCardVM ||\n hasUnionKeys(o, [\n 'Id',\n 'CardMask',\n 'ExpirationMonthYear',\n 'CardType',\n 'Name',\n 'GatewayName',\n 'Issuer',\n 'IsDefault',\n ])\n );\n }\n}\n","import { BillingBankCardVM } from './BillingBankCardVM.model';\nimport { BaseModel, StrictBaseModelPart, Property, hasUnionKeys } from '@dev-stream/utils';\n\nexport class BillingPaymentDetailVM extends BaseModel {\n protected BASE_TYPE = BillingPaymentDetailVM;\n 'Id'!: string | null;\n 'Type'!: number | null;\n @Property(() => BillingBankCardVM)\n 'BillingBankCard'!: BillingBankCardVM | null;\n 'Reason'!: string | null;\n 'ReasonCode'!: number | null;\n @Property(() => Date)\n 'CreatedOn'!: Date | null;\n 'CreatedBy'!: string | null;\n @Property(() => Date)\n 'LastUpdatedOn'!: Date | null;\n 'LastUpdatedBy'!: string | null;\n\n public GetDefaultValue(): StrictBaseModelPart {\n return {\n Id: null,\n Type: null,\n BillingBankCard: null,\n Reason: null,\n ReasonCode: null,\n CreatedOn: null,\n CreatedBy: null,\n LastUpdatedOn: null,\n LastUpdatedBy: null,\n };\n }\n\n public static isBillingPaymentDetailVM(o: any): o is BillingPaymentDetailVM {\n return (\n o instanceof BillingPaymentDetailVM ||\n hasUnionKeys(o, [\n 'Id',\n 'Type',\n 'BillingBankCard',\n 'Reason',\n 'ReasonCode',\n 'CreatedOn',\n 'CreatedBy',\n 'LastUpdatedOn',\n 'LastUpdatedBy',\n ])\n );\n }\n}\n","import { BaseModel, StrictBaseModelPart, Property, hasUnionKeys } from '@dev-stream/utils';\n\nexport class BillingPaymentProductDetailVM extends BaseModel {\n protected BASE_TYPE = BillingPaymentProductDetailVM;\n 'Id'!: string | null;\n 'Name'!: string | null;\n 'Count'!: number | null;\n 'Price'!: number | null;\n 'Amount'!: number | null;\n 'Measure'!: string | null;\n 'ProductType'!: number | null;\n @Property(() => Date)\n 'CreatedOn'!: Date | null;\n 'CreatedBy'!: string | null;\n @Property(() => Date)\n 'LastUpdatedOn'!: Date | null;\n 'LastUpdatedBy'!: string | null;\n\n public GetDefaultValue(): StrictBaseModelPart {\n return {\n Id: null,\n Name: null,\n Count: null,\n Price: null,\n Amount: null,\n Measure: null,\n ProductType: null,\n CreatedOn: null,\n CreatedBy: null,\n LastUpdatedOn: null,\n LastUpdatedBy: null,\n };\n }\n\n public static isBillingPaymentProductDetailVM(o: any): o is BillingPaymentProductDetailVM {\n return (\n o instanceof BillingPaymentProductDetailVM ||\n hasUnionKeys(o, [\n 'Id',\n 'Name',\n 'Count',\n 'Price',\n 'Amount',\n 'Measure',\n 'ProductType',\n 'CreatedOn',\n 'CreatedBy',\n 'LastUpdatedOn',\n 'LastUpdatedBy',\n ])\n );\n }\n}\n","import { Company } from './Company.model';\nimport { BillingPaymentDetailVM } from './BillingPaymentDetailVM.model';\nimport { BillingPaymentProductDetailVM } from './BillingPaymentProductDetailVM.model';\nimport { BaseModel, StrictBaseModelPart, Property, hasUnionKeys } from '@dev-stream/utils';\n\nexport class BillingPaymentVM extends BaseModel {\n protected BASE_TYPE = BillingPaymentVM;\n 'Id'!: string | null;\n 'Name'!: string | null;\n 'Number'!: number | null;\n 'TotalAmount'!: number | null;\n 'InvoiceId'!: string | null;\n 'TransactionId'!: number | null;\n 'StorageId'!: string | null;\n @Property(() => Company)\n 'Company'!: Company | null;\n @Property(() => Date)\n 'PaymentDate'!: Date | null;\n 'Status'!: number | null;\n @Property(() => Date)\n 'CreatedOn'!: Date | null;\n @Property(() => BillingPaymentDetailVM)\n 'BillingPaymentDetails'!: Array;\n @Property(() => BillingPaymentProductDetailVM)\n 'BillingPaymentProductDetails'!: Array;\n\n public GetDefaultValue(): StrictBaseModelPart {\n return {\n Id: null,\n Name: null,\n Number: null,\n TotalAmount: null,\n InvoiceId: null,\n TransactionId: null,\n StorageId: null,\n Company: null,\n PaymentDate: null,\n Status: null,\n CreatedOn: null,\n BillingPaymentDetails: [],\n BillingPaymentProductDetails: [],\n };\n }\n\n public static isBillingPaymentVM(o: any): o is BillingPaymentVM {\n return (\n o instanceof BillingPaymentVM ||\n hasUnionKeys(o, [\n 'Id',\n 'Name',\n 'Number',\n 'TotalAmount',\n 'InvoiceId',\n 'TransactionId',\n 'StorageId',\n 'Company',\n 'PaymentDate',\n 'Status',\n 'CreatedOn',\n 'BillingPaymentDetails',\n 'BillingPaymentProductDetails',\n ])\n );\n }\n}\n","import { SwaggerApiService } from './SwaggerApiService.service';\nimport { SwaggerApiRequestHeaders } from './SwaggerApiService.service';\nimport { eitherify, mapLeft, mapRight } from '@dev-stream/utils';\nimport { Inject, Optional, Injectable } from '@angular/core';\nimport { HttpClient, HttpErrorResponse } from '@angular/common/http';\nimport { BASE_URL, BusinessServerApiRootModule } from './BusinessServerApi.module';\nimport { OdataModel } from '@idocs-kz/swagger-schemas';\nimport { OdataPrimitive } from '@idocs-kz/swagger-schemas';\nimport { BillingPaymentVM } from '../models/BillingPaymentVM.model';\n\n@Injectable({ providedIn: BusinessServerApiRootModule })\nexport class BillingPaymentApiService extends SwaggerApiService {\n public constructor(http: HttpClient, @Optional() @Inject(BASE_URL) baseUrl: string) {\n super(http, baseUrl);\n }\n\n public Get_by$select_by$expand_by$filter_by$orderby_by$top_by$skip_by$count>(\n queryParams: IGet_by$select_by$expand_by$filter_by$orderby_by$top_by$skip_by$count_Params,\n requestHeaders?: SwaggerApiRequestHeaders\n ) {\n const params = this.$MapParams(queryParams);\n const response = this.http.request('get', `${this.baseUrl}/api/v2/reference/billing-payments`, {\n headers: requestHeaders,\n params,\n responseType: 'json',\n });\n\n return response.pipe(\n eitherify(),\n mapRight((response) => new OdataModel(BillingPaymentVM, response)),\n mapLeft((ex) => (ex instanceof HttpErrorResponse ? ex : ex))\n );\n }\n}\n\ninterface IGet_by$select_by$expand_by$filter_by$orderby_by$top_by$skip_by$count_Params {\n $select?: string | null;\n $expand?: string | null;\n $filter?: string | null;\n $orderby?: string | null;\n $top?: number | null;\n $skip?: number | null;\n $count?: boolean | null;\n}\n","import { Injectable } from '@angular/core';\nimport { PageEvent } from '@angular/material/paginator';\nimport { mapLeft } from '@dev-stream/utils';\nimport { BillingPaymentDetailVM } from '@idocs/api/business/models/BillingPaymentDetailVM.model';\nimport { BillingPaymentApiService } from '@idocs/api/business/services/BillingPayment.api-service';\nimport { Disposable } from '@idocs/shared-logic';\nimport { showNotification } from '@idocs/shared-ui/notification';\nimport { PaginatorConfig } from '@idocs/shared-ui/paginator/paginator/paginator.component';\nimport {\n PaymentsHistoryInfo,\n PaymentStatus,\n PaymentType,\n} from 'libraries/ui/billing-ui/src/lib/components/payments-history/payments-history.component';\nimport * as moment from 'moment';\nimport { notNull } from 'ng-utils/utils';\nimport { ReplaySubject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\nimport { apiResponseErrorHandler } from '../../utils/handlers/api-error-handler';\nimport { PaymentService } from './payment.service';\n\n@Injectable({ providedIn: 'root' })\nexport class PaymentsHistoryService extends Disposable {\n private _paymentsHistory = new ReplaySubject();\n\n description =\n 'Счета со статусом “Ожидает оплаты” возможно оплатить карточкой, нажав на кнопку “Оплатить картой”. Для оплаты счетов через банковский перевод скачайте счет, нажав на название счета.';\n paginator = new PaginatorConfig();\n\n get paymentsHistory() {\n return this._paymentsHistory.asObservable();\n }\n\n constructor(private billingPaymentApi: BillingPaymentApiService, private paymentService: PaymentService) {\n super();\n }\n\n async getData(count: number | null = null) {\n this._paymentsHistory.next(null);\n\n const skip = this.paginator.pageSize * this.paginator.pageIndex;\n\n const res = await this.billingPaymentApi\n .Get_by$select_by$expand_by$filter_by$orderby_by$top_by$skip_by$count({\n $orderby: 'PaymentDate desc, Status desc',\n ...(!count\n ? {\n $top: this.paginator.pageSize,\n $skip: skip,\n $count: true,\n }\n : {\n $top: count,\n }),\n })\n .pipe(takeUntil(this.destroyed), mapLeft(apiResponseErrorHandler), mapLeft(showNotification))\n .toPromise();\n\n if (res.isLeft()) {\n return;\n }\n\n const payments = res.value.value;\n\n if (payments && payments.length > 0) {\n const paymentsHistoryInfos = payments.map((p) => {\n const sortedDetails = p.BillingPaymentDetails.filter(notNull).sort(this.billingPaymentDetailComparer);\n let details = null;\n if (sortedDetails && sortedDetails.length > 0) {\n details = sortedDetails[0];\n }\n\n return new PaymentsHistoryInfo({\n Id: p.Id,\n Name: p.Name,\n PaymentDate: moment(moment(p.CreatedOn).utc()).local(true).toDate(),\n Status: p.Status,\n TotalAmount: p.TotalAmount,\n CompanyId: p.Company?.Id,\n InvoiceId: p.InvoiceId,\n PaymentType: p.Status != PaymentStatus.NEW ? details?.Type : null,\n CardMask:\n p.Status != PaymentStatus.NEW\n ? details?.Type == PaymentType.CARD\n ? details?.BillingBankCard?.CardMask\n : null\n : null,\n });\n });\n\n this._paymentsHistory.next(paymentsHistoryInfos);\n\n if (!count) {\n this.paginator.length = res.value['@odata.count'] || 0;\n }\n } else {\n this._paymentsHistory.next([]);\n this.paginator.length = 0;\n }\n }\n\n private billingPaymentDetailComparer(a: BillingPaymentDetailVM, b: BillingPaymentDetailVM): number {\n return (b.CreatedOn || new Date()).getTime() - (a.CreatedOn || new Date()).valueOf();\n }\n\n async payByCard(model: PaymentsHistoryInfo) {\n return await this.paymentService.selectCard(model);\n }\n\n async pageChanged($event: PageEvent) {\n this.paginator.pageIndex = $event.pageIndex;\n this.paginator.pageSize = $event.pageSize;\n await this.getData();\n }\n}\n","import {\n mapToApiFailureResponseModel,\n SharedApiFailureResponseModel,\n} from '@idocs/api';\nimport { NotificationConfiguration } from '@idocs/shared-ui/notification';\nimport { BaseModelPart } from '@dev-stream/utils';\n\nconst apiResponseErrorHandlerImpl = (\n err: Error,\n parseErrorAsJson = false\n): NotificationConfiguration | null => {\n const error = mapToApiFailureResponseModel(err, parseErrorAsJson);\n return error\n ? new NotificationConfiguration({\n color: 'danger',\n duration: 5000,\n title: error.Header,\n content: error.Description ?? 'Ошибка',\n exception: err,\n })\n : null;\n};\n\nexport const apiResponseErrorHandler = (err: Error) =>\n apiResponseErrorHandlerImpl(err, false);\nexport const apiResponseErrorHandlerWithParsedError = (err: Error) =>\n apiResponseErrorHandlerImpl(err, true);\n\nexport function createErrorNotification(\n extendWith?: BaseModelPart\n) {\n return (error: SharedApiFailureResponseModel | null) =>\n error\n ? new NotificationConfiguration(\n {\n color: 'danger',\n duration: 5000,\n title: error.Header,\n content: error.Description ?? 'Ошибка',\n exception: error.Exception,\n },\n extendWith ?? {}\n )\n : null;\n}\n","import { SwaggerApiService } from './SwaggerApiService.service';\nimport { SwaggerApiRequestHeaders } from './SwaggerApiService.service';\nimport { eitherify, mapLeft, mapRight } from '@dev-stream/utils';\nimport { Inject, Optional, Injectable } from '@angular/core';\nimport { HttpClient, HttpErrorResponse } from '@angular/common/http';\nimport { BASE_URL, BusinessServerApiRootModule } from './BusinessServerApi.module';\n\n@Injectable({ providedIn: BusinessServerApiRootModule })\nexport class BillingReportApiService extends SwaggerApiService {\n public constructor(http: HttpClient, @Optional() @Inject(BASE_URL) baseUrl: string) {\n super(http, baseUrl);\n }\n\n public GetPaymentReportFile_byId(id: string, requestHeaders?: SwaggerApiRequestHeaders) {\n const response = this.http.request('get', `${this.baseUrl}/api/v2/BillingReport/payment(id=${id})`, {\n headers: requestHeaders,\n responseType: 'blob',\n });\n\n return response.pipe(\n eitherify(),\n\n mapLeft((ex) => (ex instanceof HttpErrorResponse ? ex : ex))\n );\n }\n}\n","
\n
\n
\n
\n {{ config?.title }}\n
\n
\n
\n
{{ config?.label }}
\n
\n
\n
\n
\n \n {{ config?.buttonText }}\n \n
\n
\n\n
\n \n
\n
\n","import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core';\nimport { BaseModel, StrictBaseModelPart } from '@dev-stream/utils';\nimport { BaseComponent } from '@idocs/shared-ui/core';\n\nexport class BillingBlockConfig extends BaseModel> {\n GetDefaultValue(): StrictBaseModelPart, never> {\n return {\n hasButton: true,\n };\n }\n protected BASE_TYPE = BillingBlockConfig;\n title?: string;\n label?: string;\n buttonText?: string;\n hasButton!: boolean;\n showTitleLoader?: boolean;\n data?: T;\n}\n\n@Component({\n selector: 'billing-ui-billing-block',\n templateUrl: './billing-block.component.html',\n styleUrls: ['./billing-block.component.scss'],\n})\nexport class BillingBlockComponent extends BaseComponent implements OnInit {\n @Input() config?: BillingBlockConfig;\n\n @Output() btnClick = new EventEmitter();\n\n \n\n ngOnInit(): void {}\n}\n","import { MatPaginatorIntl } from '@angular/material/paginator';\nimport { Injectable } from '@angular/core';\n\n@Injectable()\nexport class MatPaginatorIntlRu extends MatPaginatorIntl {\n itemsPerPageLabel = 'Отображать в количестве';\n nextPageLabel = 'Следующая страница';\n previousPageLabel = 'Предыдущая страница';\n lastPageLabel = 'Последняя страница';\n firstPageLabel = 'Первая страница';\n\n getRangeLabel = (page: number, pageSize: number, length: number) => {\n if (length === 0 || pageSize === 0) {\n return '0 из ' + length;\n }\n length = Math.max(length, 0);\n const startIndex = page * pageSize;\n // If the start index exceeds the list length, do not try and fix the end index to the end.\n const endIndex = startIndex < length ? Math.min(startIndex + pageSize, length) : startIndex + pageSize;\n return startIndex + 1 + ' - ' + endIndex + ' из ' + length;\n };\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { PaginatorComponent } from './paginator/paginator.component';\nimport { MatPaginatorIntl, MatPaginatorModule } from '@angular/material/paginator';\nimport { MatPaginatorIntlRu } from './mat-paginator-intl-ru';\nimport { MAT_DATE_LOCALE } from '@angular/material/core';\n\n@NgModule({\n declarations: [PaginatorComponent],\n imports: [CommonModule, MatPaginatorModule],\n exports: [PaginatorComponent],\n providers: [\n { provide: MatPaginatorIntl, useClass: MatPaginatorIntlRu },\n { provide: MAT_DATE_LOCALE, useValue: 'ru-RU' },\n ],\n})\nexport class PaginatorModule {}\n"],"x_google_ignoreList":[]}