Created
February 3, 2021 18:50
-
-
Save ologunB/289e5241474a605e85cbfcfa19a88f10 to your computer and use it in GitHub Desktop.
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
processTransaction(context) async { | |
var initializer = RavePayInitializer( | |
amount: double.parse(amountController.text), | |
publicKey: ravePublicKey, | |
encryptionKey: raveEncryptKey) | |
..country = "NG" | |
..currency = "NGN" | |
..email = mEmail | |
..fName = mName | |
..lName = "lName" | |
..narration = "FABAT MANAGEMENT" | |
..txRef = "SCH${DateTime.now().millisecondsSinceEpoch}" | |
..acceptAccountPayments = false | |
..acceptCardPayments = true | |
..acceptAchPayments = false | |
..acceptGHMobileMoneyPayments = false | |
..acceptUgMobileMoneyPayments = false | |
..staging = false | |
..isPreAuth = true | |
..displayFee = true; | |
RavePayManager() | |
.prompt(context: context, initializer: initializer) | |
.then((result) { | |
Toast.show("err", context, | |
gravity: Toast.TOP, duration: Toast.LENGTH_LONG); | |
if (result.status == RaveStatus.success) { | |
doAfterSuccess(result.message); | |
} else if (result.status == RaveStatus.cancelled) { | |
if (mounted) { | |
scaffoldKey.currentState.showSnackBar( | |
SnackBar( | |
content: Text( | |
"Closed!", | |
style: TextStyle(color: Colors.white, fontSize: 18), | |
), | |
backgroundColor: primaryColor, | |
duration: Duration(seconds: 3), | |
), | |
); | |
} | |
} else if (result.status == RaveStatus.error) { | |
showDialog( | |
context: context, | |
builder: (_) { | |
return AlertDialog( | |
title: Text( | |
"Error", | |
textAlign: TextAlign.center, | |
style: TextStyle(color: Colors.red, fontSize: 20), | |
), | |
content: Text( | |
"An error has occured ", | |
textAlign: TextAlign.center, | |
style: TextStyle(fontSize: 18), | |
), | |
); | |
}); | |
} | |
print(result); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment