-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ft(notifications):add logic to insert notifications on every booking
- Loading branch information
1 parent
7a1d280
commit d2405c8
Showing
2 changed files
with
27 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import React from 'react'; | ||
import { View, TouchableOpacity, StyleSheet } from 'react-native'; | ||
import { FlutterwaveInit } from 'flutterwave-react-native'; | ||
import React from "react"; | ||
import { View, TouchableOpacity, StyleSheet } from "react-native"; | ||
import { FlutterwaveInit } from "flutterwave-react-native"; | ||
|
||
interface MyCartState { | ||
isPending: boolean; | ||
|
@@ -35,21 +35,22 @@ class MyCart extends React.Component<{}, MyCartState> { | |
const paymentLink = await FlutterwaveInit( | ||
{ | ||
tx_ref: generateTransactionRef(), | ||
authorization: '[merchant public key]', | ||
authorization: "[merchant public key]", | ||
amount: 100, | ||
currency: 'USD', | ||
currency: "USD", | ||
customer: { | ||
email: '[email protected]', | ||
email: "[email protected]", | ||
}, | ||
payment_options: 'card', | ||
payment_options: "card", | ||
}, | ||
this.abortController.signal | ||
); | ||
// use payment link | ||
|
||
this.usePaymentLink(paymentLink); | ||
} catch (error: any) { | ||
// do nothing if our payment initialization was aborted | ||
if (error.code === 'ABORTERROR') { | ||
if (error.code === "ABORTERROR") { | ||
return; | ||
} | ||
// handle other errors | ||
|
@@ -61,17 +62,17 @@ class MyCart extends React.Component<{}, MyCartState> { | |
|
||
generateTransactionRef = (): string => { | ||
// Generate a transaction reference | ||
return 'unique_transaction_ref'; | ||
return "unique_transaction_ref"; | ||
}; | ||
|
||
usePaymentLink = (link: string) => { | ||
// Use the payment link (navigate to a webview or open in browser) | ||
console.log('Payment link:', link); | ||
console.log("Payment link:", link); | ||
}; | ||
|
||
displayErrorMessage = (message: string) => { | ||
// Display error message to the user | ||
console.error('Error:', message); | ||
console.error("Error:", message); | ||
}; | ||
|
||
render() { | ||
|