From 2b72e1bd5c75f63e79c355c970c3045a5d41fc59 Mon Sep 17 00:00:00 2001 From: "hentrymartin.p" Date: Fri, 22 Jul 2022 00:51:54 +0200 Subject: [PATCH 1/5] PROD-2450 #comment payment logic and activate challenge on successful payment #time 4h --- src-ts/lib/button/Button.tsx | 2 +- .../lib/payment-form/PaymentForm.module.scss | 6 + src-ts/lib/payment-form/PaymentForm.tsx | 13 ++ src-ts/lib/styles/_buttons.scss | 15 ++ .../work-provider/work-functions/index.ts | 2 + .../work-factory/work.factory.ts | 2 +- .../work-store/challenge.model.ts | 1 + .../work-functions/work-store/index.ts | 2 + .../work-store/work-customer-payment.model.ts | 5 + .../work-store/work-url.config.ts | 9 + .../work-functions/work-store/work.store.ts | 11 +- .../work-functions/work.functions.ts | 11 + .../bug-hunt/bug-hunt.form.config.tsx | 2 +- .../intake-forms/review/Review.module.scss | 4 + .../intake-forms/review/Review.tsx | 208 ++++++++++++++++-- 15 files changed, 267 insertions(+), 26 deletions(-) create mode 100644 src-ts/tools/work/work-lib/work-provider/work-functions/work-store/work-customer-payment.model.ts diff --git a/src-ts/lib/button/Button.tsx b/src-ts/lib/button/Button.tsx index 35594f5dd..0c66d6958 100644 --- a/src-ts/lib/button/Button.tsx +++ b/src-ts/lib/button/Button.tsx @@ -6,7 +6,7 @@ import '../styles/index.scss' import { IconOutline } from '../svgs' export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' -export type ButtonStyle = 'icon' | 'link' | 'primary' | 'secondary' | 'tertiary' | 'text' +export type ButtonStyle = 'icon' | 'icon-bordered' | 'link' | 'primary' | 'secondary' | 'tertiary' | 'text' export type ButtonType = 'button' | 'submit' export interface ButtonProps { diff --git a/src-ts/lib/payment-form/PaymentForm.module.scss b/src-ts/lib/payment-form/PaymentForm.module.scss index bcaea22f9..0b3dcf4c4 100644 --- a/src-ts/lib/payment-form/PaymentForm.module.scss +++ b/src-ts/lib/payment-form/PaymentForm.module.scss @@ -60,4 +60,10 @@ .pay-button { width: 100%; } + + .error { + @extend .body-small; + color: $red-120; + margin-bottom: $pad-lg; + } } \ No newline at end of file diff --git a/src-ts/lib/payment-form/PaymentForm.tsx b/src-ts/lib/payment-form/PaymentForm.tsx index 404c172fc..ca998724b 100644 --- a/src-ts/lib/payment-form/PaymentForm.tsx +++ b/src-ts/lib/payment-form/PaymentForm.tsx @@ -31,8 +31,10 @@ interface FieldDirtyState { } interface PaymentFormProps { + error: boolean formData: PaymentFormData isFormValid: boolean + onPay: () => void onUpdateField: (fieldName: string, value: string | boolean) => void } @@ -84,6 +86,8 @@ const PaymentForm: React.FC = (props: PaymentFormProps) => { }) } + console.log(props.formData) + return (
= (props: PaymentFormProps) => { A hold will be placed on your card for the full amount of the project. Once your work is live on the Topcoder platform, you will be charged.
+ { + props.error && ( +
+ Your card was declined. Please try a different card. +
+ ) + } +