initiatePayment method

Future<Payment> initiatePayment(
  1. String orderId
)

Initiates a payment for given orderId and returns a paymentId for that instance. Also call the ttp app to perform card transaction.

Implementation

Future<Payment> initiatePayment(String orderId) async {
  await _httpService
      .callApi<PaymentInitiated>(
          routeValue: RouteMap().routeMapper[Route.initiatePayment]!,
          body: InitiatePaymentModel(
                  orderId: orderId, paymentMethod: PaymentMethod.card)
              .toMap())
      .then((value) {
    paymentId = value.data.paymentId;
    _callttpForPayment();
  });
  Constants.paymentId = paymentId;
  return this;
}