setSelectedPaymentMethod method

void setSelectedPaymentMethod(
  1. IPaymentMethod paymentMethod
)

Implementation

void setSelectedPaymentMethod(IPaymentMethod paymentMethod) {
  // debugPrint("paymentMethod : $paymentMethod");
  // Get the current value of the stream
  var currentValue = _paymentProcessInfoController.value;
  // Create a new map for paymentInfo by copying the current paymentInfo and updating the selectedPaymentMethod
  IBinoxusPaymentResponse updatedPaymentInfo = IBinoxusPaymentResponse(
      companyInfo: currentValue.paymentInfo.companyInfo,
      paymentInfo: IPaymentInfo(
          amount: currentValue.paymentInfo.paymentInfo.amount,
          currency: currentValue.paymentInfo.paymentInfo.currency,
          listOfPaymentMethods:
              currentValue.paymentInfo.paymentInfo.listOfPaymentMethods,
          customerUrlToListenTo:
              currentValue.paymentInfo.paymentInfo.customerUrlToListenTo,
          description: currentValue.paymentInfo.paymentInfo.description,
          id: currentValue.paymentInfo.paymentInfo.id,
          directPayRedirectUrl:
              currentValue.paymentInfo.paymentInfo.directPayRedirectUrl,
          eChannel: currentValue.paymentInfo.paymentInfo.eChannel,
          fee: currentValue.paymentInfo.paymentInfo.fee,
          fillingInfo: currentValue.paymentInfo.paymentInfo.fillingInfo,
          listOfMobileMoneyPhoneCodes: currentValue
              .paymentInfo.paymentInfo.listOfMobileMoneyPhoneCodes,
          systemUrlToListenTo:
              currentValue.paymentInfo.paymentInfo.systemUrlToListenTo,
          selectedPaymentMethod: paymentMethod));

  // Update the entire _paymentProcessInfoController with the new value
  _paymentProcessInfoController.add(IBinoxusRequestResponse(
    binStatus: currentValue.binStatus,
    message: currentValue.message,
    paymentInfo: updatedPaymentInfo, // Set the updated paymentInfo map
  ));
}