Nilesh Nilesh - 6 months ago 36
Swift Question

Issue in setting card type in CitrusPay gateway swift ios

I am trying to set card type in CitrusPay in Swift

I need help converting following Objective-C line to Swift

CTSElectronicCardUpdate *debitCard = [[CTSElectronicCardUpdate alloc] initDebitCard];


This is what compiler suggested me:

let debitCard: CTSElectronicCardUpdate = CTSElectronicCardUpdate.init(debitCard: ())


so the debitCard is expecting function type

Answer

This works for me

 let debitCard = CTSElectronicCardUpdate(debitCard: ())
 debitCard.number = cardNumber.
 debitCard.expiryDate = formatted; //only mm/yyyy format
 debitCard.scheme = CTSUtility.fetchCardSchemeForCardNumber(number Here)
 debitCard.ownerName = userName.value; // no special characters here
 debitCard.cvv = cvv.value;
Comments