This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getCardType(number) { | |
var res = { | |
id: null, | |
name: null | |
}; | |
if (number.length <= 2) return res; | |
var re = new RegExp("^4"); | |
if (number.match(re) != null) { | |
res.id = "visa"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function valid_card(value) { | |
// Accept only digits, dashes or spaces | |
if (/[^0-9-\s]+/.test(value)) return false; | |
// The Luhn Algorithm. It's so pretty. | |
let nCheck = 0, | |
bEven = false; | |
value = value.replace(/\D/g, ""); | |
for (var n = value.length - 1; n >= 0; n--) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function valid_upi(upiID){ | |
const upiRegex = /^[a-zA-Z0-9_\-\.]+@[a-zA-Z]{3,}$/; | |
return upiRegex.test(upiID) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
import CashfreePGCoreSDK | |
import CashfreePG | |
class YourViewController: UIViewController, CFCardPaymentDelegate, CFNetbankingPaymentDelegate, CFWalletPaymentDelegate, CFUPIPaymentDelegate, CFPaylaterPaymentDelegate { | |
private let cfPaymentGatewayService = CFPaymentGatewayService.getInstance() | |
override func viewDidLoad() { | |
self.cfPaymentGatewayService.setCallback(self) |