Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable backend PI creation toggle #821

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion dev-app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export type RouteParamList = {
CollectCardPayment: {
simulated: boolean;
discoveryMethod: Reader.DiscoveryMethod;
deviceType: Reader.DeviceType;
};
RefundPayment: {
simulated: boolean;
Expand Down
18 changes: 16 additions & 2 deletions dev-app/src/screens/CollectCardPaymentScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export default function CollectCardPaymentScreen() {
});
const [testCardNumber, setTestCardNumber] = useState('4242424242424242');
const [enableInterac, setEnableInterac] = useState(false);
const [enableBackendPI, setEnableBackendPI] = useState(false);
const [enableConnect, setEnableConnect] = useState(false);
const [skipTipping, setSkipTipping] = useState(false);
const [enableUpdatePaymentIntent, setEnableUpdatePaymentIntent] =
Expand All @@ -109,7 +110,7 @@ export default function CollectCardPaymentScreen() {
);
const { params } =
useRoute<RouteProp<RouteParamList, 'CollectCardPayment'>>();
const { simulated, discoveryMethod, deviceType } = params;
const { simulated, discoveryMethod } = params;
const { addLogs, clearLogs, setCancel } = useContext(LogContext);
const navigation = useNavigation();

Expand Down Expand Up @@ -193,7 +194,7 @@ export default function CollectCardPaymentScreen() {
let paymentIntent: PaymentIntent.Type | undefined;
let paymentIntentError: StripeError<CommonError> | undefined;

if (deviceType === 'verifoneP400') {
if (enableBackendPI) {
const resp = await api.createPaymentIntent({
amount: Number(inputValues.amount),
currency: inputValues.currency,
Expand Down Expand Up @@ -672,6 +673,19 @@ export default function CollectCardPaymentScreen() {
/>
</List>

<List bolded={false} topSpacing={false} title="BACKEND PI">
<ListItem
title="Create PI on the backend"
rightElement={
<Switch
testID="enable-backend-pi"
value={enableBackendPI}
onValueChange={(value) => setEnableBackendPI(value)}
/>
}
/>
</List>

<List bolded={false} topSpacing={false} title="ROUTING PRIORITY">
<Picker
selectedValue={inputValues?.requestedPriority}
Expand Down
1 change: 0 additions & 1 deletion dev-app/src/screens/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ export default function HomeScreen() {
navigation.navigate('CollectCardPaymentScreen', {
simulated,
discoveryMethod,
deviceType,
});
}}
/>
Expand Down