import { Entity , Reduces } from '@boostercloud/framework-core' ; import { UUID } from '@boostercloud/framework-types' ; import { CartPaid } from '../events/cart-paid' ; import { UserWithPhone } from '../roles' ; @ Entity ( { authorizeReadEvents : [ UserWithPhone ] , } ) export class Payment { public constructor ( readonly id , readonly cartId , readonly confirmationToken ) { } @ Reduces ( CartPaid ) public static payCart ( event , _currentPayment ) { return new Payment ( event . paymentId , event . cartId , event . confirmationToken ) ; } }