11import { PaymentMethodResult , Stripe , StripeCardNumberElement } from '@stripe/stripe-js'
22
3- import { Page , UserProfile } from '../../../../../lib'
3+ import { GenericDataObject , Page , UserProfile } from '../../../../../lib'
44
55import { WorkByStatus } from './work-by-status.model'
66import {
@@ -58,17 +58,14 @@ export async function createCustomerPaymentAsync(
5858
5959 // if we don't have the bare min, don't do anything
6060 if ( ! stripe || ! cardNumber || ! challenge ) {
61- return
61+ return undefined
6262 }
6363
6464 // initialize the payment method
6565 const payload : PaymentMethodResult = await stripe . createPaymentMethod ( {
6666 card : cardNumber ,
6767 type : 'card' ,
6868 } )
69- if ( ! payload ) {
70- return
71- }
7269
7370 // make the request to make the payment
7471 const paymentRequest : CustomerPaymentRequest = workFactoryBuildCustomerPaymentRequest (
@@ -122,8 +119,11 @@ export async function getByWorkIdAsync(workId: string): Promise<Challenge> {
122119export function getGroupedByStatus ( work : ReadonlyArray < Work > ) : { [ status : string ] : WorkByStatus } {
123120 const output : { [ status : string ] : WorkByStatus } = { }
124121 Object . entries ( WorkStatusFilter )
125- . forEach ( ( [ key , value ] ) => {
126- const results : ReadonlyArray < Work > = workStoreGetFilteredByStatus ( work , WorkStatusFilter [ key as keyof typeof WorkStatusFilter ] )
122+ . forEach ( ( [ key ] ) => {
123+ const results : ReadonlyArray < Work > = workStoreGetFilteredByStatus (
124+ work ,
125+ WorkStatusFilter [ key as keyof typeof WorkStatusFilter ] ,
126+ )
127127 output [ key ] = {
128128 count : results . length ,
129129 messageCount : results . reduce ( ( partialSum , a ) => partialSum + ( a . messageCount ?? 0 ) , 0 ) ,
@@ -147,15 +147,15 @@ export function getStatusFilter(filterKey?: string): WorkStatusFilter | undefine
147147
148148 // get the filter key from the passed in key
149149 const workStatusFilter : keyof typeof WorkStatusFilter | undefined = Object . entries ( WorkStatusFilter )
150- . find ( ( [ key , value ] ) => key === filterKey )
150+ . find ( ( [ key ] ) => key === filterKey )
151151 ?. [ 0 ] as keyof typeof WorkStatusFilter
152152
153153 // if the passed in key doesn't match any filter, return undefined;
154154 // otherwise, return the filter defined by the key
155155 return ! workStatusFilter ? undefined : WorkStatusFilter [ workStatusFilter ]
156156}
157157
158- export async function updateAsync ( type : WorkType , challenge : Challenge , intakeForm : any ) : Promise < void > {
158+ export async function updateAsync ( type : WorkType , challenge : Challenge , intakeForm : GenericDataObject ) : Promise < void > {
159159 const workConfig : WorkTypeConfig = WorkTypeConfigs [ type ]
160160 const body : UpdateWorkRequest = workFactoryBuildUpdateRequest ( workConfig , challenge , intakeForm )
161161 return workStoreUpdateAsync ( body )
0 commit comments