This commit is contained in:
Hamza-Ayed
2023-11-11 23:02:56 +03:00
parent e4292198c1
commit 8d405c5381
10 changed files with 193 additions and 239 deletions

View File

@@ -318,105 +318,7 @@ class PassengerWallet extends StatelessWidget {
title: 'Pay with Your PayPal'.tr,
onPressed: () {
if (controller.selectedAmount != 0) {
print(controller.selectedAmount);
controller.changePromoSheetDialogue();
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) =>
UsePaypal(
sandboxMode: true,
clientId:
"AW1TdvpSGbIM5iP4HJNI5TyTmwpY9Gv9dYw8_8yW5lYIbCqf326vrkrp0ce9TAqjEGMHiV3OqJM_aRT0",
secretKey:
"EHHtTDjnmTZATYBPiGzZC_AZUfMpMAzj2VZUeqlFUrRJA_C0pQNCxDccB5qoRQSEdcOnnKQhycuOWdP9",
returnURL:
"https://samplesite.com/return",
cancelURL:
"https://samplesite.com/cancel",
transactions: [
{
"amount": {
//sb-opsju26682403@personal.example.com
"total":
'${controller.selectedAmount}',
"currency": "USD",
"details": {
"subtotal":
'${controller.selectedAmount}',
"shipping": '0',
"shipping_discount": 0
}
},
"description":
"The payment transaction description.",
"payment_options": const {
"allowed_payment_method":
"INSTANT_FUNDING_SOURCE"
},
"item_list": {
"items": [
{
"name":
"${AppInformation.appName} Wallet ",
"quantity": 1,
"price":
'${controller.selectedAmount}',
"currency": "USD"
}
],
// shipping address is not required though
"shipping_address": const {
"recipient_name":
"${AppInformation.appName} Wallet",
"line1": "Shafa Badran",
"line2": "",
"city": "Amman",
"country_code": "JO",
"postal_code": "13112",
"phone": "+962798583052",
"state": "Amman"
},
}
}
],
note:
"Contact us for any questions on your order.",
onSuccess: (Map params) async {
print("onSuccess: $params");
await CRUD().post(
link: AppLink
.addPassengersWallet,
payload: {
'passenger_id': box
.read(BoxName
.passengerID)
.toString(),
'balance': controller
.selectedAmount
.toString()
});
controller
.changePromoSheetDialogue();
await controller
.getPassengerWallet();
},
onError: (error) {
print("onError: $error");
Toast.show(
context,
' $error'.tr,
AppColor.redColor);
},
onCancel: (params) {
print('cancelled: $params');
Toast.show(
context,
'Pyament Cancelled .'.tr,
AppColor.yellowColor);
}),
),
);
controller.makePaymentPayPal(context);
} else {
Toast.show(
context,
@@ -427,9 +329,9 @@ class PassengerWallet extends StatelessWidget {
),
MyElevatedButton(
title: 'Pay with Credit Card'.tr,
onPressed: () => controller.makePayment(
onPressed: () => controller.makePaymentStripe(
controller.selectedAmount as int,
'JOD',
'USD',
() => Get.snackbar('Hi', '')),
),
MyElevatedButton(