confirm method Null safety

  1. @override
Future<String> confirm(
  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 Cash on delivery.

It will return the Order Code.

Implementation

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