confirmOrder method Null safety

  1. @override
Future<PaymentFrameModel> confirmOrder(
  1. {required int customerId,
  2. int? paymentOptionId,
  3. int? addressId,
  4. required int loyaltyPoints,
  5. required double finalAmount,
  6. int? storeId}
)
override

It's used to confirm the order if the payment is Credit card.

It will return the data of the payment gatway.

Implementation

@override
Future<PaymentFrameModel> confirmOrder(
    {required int customerId,
    int? paymentOptionId,
    int? addressId,
    required int loyaltyPoints,
    required double finalAmount,
    int? storeId}) async {
  final response = await postData(
    path: 'checkout/confirmorder',
    queryParameters: {
      "PaymentOptionID": paymentOptionId,
      "CustomerID": customerId,
      "AddressID": addressId,
      "PickStoreID": storeId,
      "LoyaltyPointsRedeemed": loyaltyPoints,
      "FinalAmount": paymentOptionId,
    },
  );
  final result = ApiReturnResult.fromJSON(response.data);
  if (result.code == 200) {
    return PaymentFrameModel.fromJson(result.data);
  } else {
    throw ExceptionApi(code: result.code, message: result.error?.first);
  }
}