Skip to content

Commit cf2bc94

Browse files
committed
fixup! Add support for MOTO in credit card payments extension schema
1 parent 2269a79 commit cf2bc94

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

packages/app/src/cli/models/extensions/specifications/payments_app_extension_schemas/credit_card_payments_app_extension_schema.test.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,46 @@ describe('CreditCardPaymentsAppExtensionSchema', () => {
173173
]),
174174
)
175175
})
176+
177+
test('returns an error if supports_moto is not a boolean', async () => {
178+
// When/Then
179+
expect(() =>
180+
CreditCardPaymentsAppExtensionSchema.parse({
181+
...config,
182+
supports_moto: 'true',
183+
}),
184+
).toThrowError(
185+
new zod.ZodError([
186+
{
187+
code: 'invalid_type',
188+
expected: 'boolean',
189+
received: 'string',
190+
path: ['supports_moto'],
191+
message: 'Value must be Boolean',
192+
},
193+
]),
194+
)
195+
})
196+
197+
test('returns an error if supports_moto is not present', async () => {
198+
// When/Then
199+
expect(() =>
200+
CreditCardPaymentsAppExtensionSchema.parse({
201+
...config,
202+
supports_moto: undefined,
203+
}),
204+
).toThrowError(
205+
new zod.ZodError([
206+
{
207+
code: 'invalid_type',
208+
expected: 'boolean',
209+
received: 'undefined',
210+
path: ['supports_moto'],
211+
message: 'supports_moto is required',
212+
},
213+
]),
214+
)
215+
})
176216
})
177217

178218
describe('creditCardPaymentsAppExtensionDeployConfig', () => {

packages/app/src/cli/models/extensions/specifications/payments_app_extension_schemas/credit_card_payments_app_extension_schema.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ export const CreditCardPaymentsAppExtensionSchema = BasePaymentsAppExtensionSche
2929
targeting: zod.array(zod.object({target: zod.literal(CREDIT_CARD_TARGET)})).length(1),
3030
verification_session_url: zod.string().url().optional(),
3131
ui_extension_handle: zod.string().optional(),
32-
supports_moto: zod.boolean(),
32+
supports_moto: zod.boolean({
33+
required_error: 'supports_moto is required',
34+
invalid_type_error: 'Value must be Boolean',
35+
}),
3336
encryption_certificate_fingerprint: zod
3437
.string()
3538
.min(1, {message: "Encryption certificate fingerprint can't be blank"}),

0 commit comments

Comments
 (0)