diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 57c360d..86b8f7b 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -491,7 +491,7 @@ PODS: - RNSVG (14.1.0): - React-Core - SocketRocket (0.6.1) - - tyro-pay-api-react-native (0.0.1-alpha.1): + - tyro-pay-api-react-native (0.0.1-alpha.2): - RCT-Folly (= 2021.07.22.00) - React-Core - Yoga (1.14.0) @@ -724,10 +724,10 @@ SPEC CHECKSUMS: ReactCommon: 5f704096ccf7733b390f59043b6fa9cc180ee4f6 RNSVG: ba3e7232f45e34b7b47e74472386cf4e1a676d0a SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 - tyro-pay-api-react-native: 6300368a6f854e02059a4bf1c298150944c04aab + tyro-pay-api-react-native: e9ccad89ca70def21c2f3231af42701250dee86f Yoga: 4c3aa327e4a6a23eeacd71f61c81df1bcdf677d5 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a PODFILE CHECKSUM: 18fd48e808e852bd26c1f45356abe046e8173b89 -COCOAPODS: 1.14.3 +COCOAPODS: 1.15.2 diff --git a/package-lock.json b/package-lock.json index 6306dea..e66af4a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "name": "@tyro/tyro-pay-api-react-native-example-app", "version": "0.0.1", "dependencies": { - "@tyro/tyro-pay-api-react-native": "0.0.1-alpha.1", + "@tyro/tyro-pay-api-react-native": "^0.0.1-alpha.2", "react": "18.2.0", "react-native": "0.72.7", "react-native-svg": "^14.1.0", @@ -4780,9 +4780,9 @@ } }, "node_modules/@tyro/tyro-pay-api-react-native": { - "version": "0.0.1-alpha.1", - "resolved": "https://npm.pkg.github.com/download/@tyro/tyro-pay-api-react-native/0.0.1-alpha.1/6241a366472ee5d2aee22a816bbb0e1481d7c34f", - "integrity": "sha512-PX96OZ96xX7o2K+lfJwXOHEgPYDTHZLy5g/zuQJKLgCoAJyU1GXqRPS4qXkaEGTeIatZGQUUqk3qK2LHEaJXsA==", + "version": "0.0.1-alpha.2", + "resolved": "https://npm.pkg.github.com/download/@tyro/tyro-pay-api-react-native/0.0.1-alpha.2/9eab9ec03f2b9d3e62bb723166cd6c5850007779", + "integrity": "sha512-c+uSrKIB1426GzsregsAh+Mb8WGhkuRR/NuyzCWpGWi+CqFtyi+Mwpq2yYX2kont/xcw/QesUTVP283OdJZoBw==", "peerDependencies": { "react": "*", "react-native": "*", diff --git a/package.json b/package.json index 225a157..6e1175a 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "gradlew:build:sdk": "cd android && chmod +x ./gradlew && ./gradlew --no-daemon -S -Dorg.gradle.dependency.verification=off clean build" }, "dependencies": { - "@tyro/tyro-pay-api-react-native": "0.0.1-alpha.1", + "@tyro/tyro-pay-api-react-native": "^0.0.1-alpha.2", "react": "18.2.0", "react-native": "0.72.7", "react-native-svg": "^14.1.0", diff --git a/src/App.tsx b/src/App.tsx index fd6b6b9..d620e42 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -54,14 +54,10 @@ function App(): JSX.Element { googlePay: { enabled: true, merchantName: 'Example Merchant', - supportedNetworks: ['mastercard'], }, - }, - styleProps: { - googlePayButton: { - buttonColor: 'black', - buttonType: 'pay', - buttonBorderRadius: 4, + applePay: { + enabled: true, + merchantIdentifier: 'The merchant name', }, }, }} diff --git a/src/CheckoutPage.tsx b/src/CheckoutPage.tsx index eaaf07d..cf4b94c 100644 --- a/src/CheckoutPage.tsx +++ b/src/CheckoutPage.tsx @@ -6,6 +6,7 @@ import { useTyro, PaySheet } from '@tyro/tyro-pay-api-react-native'; import React, { useEffect } from 'react'; import { ActivityIndicator, Button, StyleSheet, Text, View } from 'react-native'; import ErrorHandler from 'Error'; +import PayButton from 'PayButton'; interface CheckoutPageProps { paySecret: string; @@ -13,7 +14,16 @@ interface CheckoutPageProps { } const CheckoutPage = ({ paySecret, resetPaySecret }: CheckoutPageProps): JSX.Element => { - const { initPaySheet, initialised, payRequest, isPayRequestReady, isPayRequestLoading, tyroError } = useTyro(); + const { + initPaySheet, + initialised, + payRequest, + isPayRequestReady, + isPayRequestLoading, + tyroError, + isSubmitting, + submitPayForm, + } = useTyro(); useEffect(() => { if (initialised === true && paySecret) { @@ -41,6 +51,7 @@ const CheckoutPage = ({ paySecret, resetPaySecret }: CheckoutPageProps): JSX.Ele <> {isPayRequestReady && } + {isPayRequestReady && } {isPayRequestLoading && } ); diff --git a/src/PayButton.tsx b/src/PayButton.tsx new file mode 100644 index 0000000..9fb8848 --- /dev/null +++ b/src/PayButton.tsx @@ -0,0 +1,48 @@ +import React from 'react'; +import { ActivityIndicator, TouchableOpacity, View, StyleSheet, Text } from 'react-native'; + +type PayButtonProps = { + onSubmit: () => Promise; + loading: boolean; + title: string; +}; + +const PayButton = ({ onSubmit, loading, title }: PayButtonProps): JSX.Element => { + return ( + + {loading ? ( + + ) : ( + + {title} + + )} + + ); +}; + +const styles = StyleSheet.create({ + container: { + display: 'flex', + justifyContent: 'center', + alignItems: 'center', + marginVertical: 10, + }, + button: { + borderRadius: 5, + height: 40, + width: '100%', + backgroundColor: 'blue', + }, + buttonText: { + color: 'white', + }, +}); + +export default PayButton; diff --git a/src/tests/integration/subflows/wallets/assert-gpay.yml b/src/tests/integration/subflows/wallets/assert-gpay.yml index 0546d68..6372717 100644 --- a/src/tests/integration/subflows/wallets/assert-gpay.yml +++ b/src/tests/integration/subflows/wallets/assert-gpay.yml @@ -1,4 +1,4 @@ appId: com.exampleapp --- - assertVisible: - id: "com.exampleapp:id/pay_button_logo" \ No newline at end of file + id: "google-pay-button" \ No newline at end of file