OPPCardPaymentParams
@objc
public final class OPPCardPaymentParams : OPPBaseCardPaymentParams, NSCopying
Class to represent a set of card parameters needed for performing an e-commerce card transaction.
It offers сonvenience methods for checking if the number is valid, i.e. if it passes the Luhn check and can be assigned to one of the major card companies.
After getting an authorization for the transaction the parameters are masked in accordance to PCI PA DSS requirements.
-
Holder of the card account. The length must be greater than 3 characters and less then 128 character.
Declaration
Swift
@objc public private(set) var holder: String? { get set }
-
The card number. It may contain spaces
" "
and dashes"-"
.Declaration
Swift
@objc public private(set) var number: String { get set }
-
The card expiry month in the format
MM
.Declaration
Swift
@objc public private(set) var expiryMonth: String? { get set }
-
The card expiry year in the format
YYYY
.Declaration
Swift
@objc public private(set) var expiryYear: String? { get set }
-
The customer’s country code.
Declaration
Swift
@objc public var countryCode: String? { get set }
-
The customer’s mobile number.
Declaration
Swift
@objc public var mobilePhone: String? { get set }
-
Default is
false
. Iftrue
, the payment information will be stored for future use.Declaration
Swift
@objc public var isTokenizationEnabled: Bool
-
The customer’s billing address.
Declaration
Swift
@objc public var address: OPPBillingAddress?
-
Creates an object representing a card transaction.
Throws
The error that occurred while validating payment parameters. See code attribute (OPPErrorCode
) andNSLocalizedDescription
to identify the reason of failure.Declaration
Swift
@objc public init(checkoutID: String, paymentBrand: String?, holder: String?, number: String, expiryMonth: String?, expiryYear: String?, cvv: String?) throws
Parameters
checkoutID
The checkout ID of the transaction. Must be not
nil
or empty.paymentBrand
The payment brand of the card.
holder
The name of the cardholder.
number
The card number of the transaction.
expiryYear
The expiration year. It is expected in the format
YYYY
.expiryMonth
The expiration month of the card. It is expected in the format
MM
.cvv
The cvv code associated with the card. Set to
nil
if CVV is not required. -
Creates an object representing a card transaction.
Throws
The error that occurred while validating payment parameters. See code attribute (OPPErrorCode
) andNSLocalizedDescription
to identify the reason of failure.Declaration
Swift
@objc public convenience init(checkoutID: String, holder: String?, number: String, expiryMonth: String?, expiryYear: String?, cvv: String?) throws
Parameters
checkoutID
The checkout ID of the transaction. Must be not
nil
or empty.holder
The name of the cardholder.
number
The card number of the transaction.
expiryYear
The expiration year. It is expected in the format
YYYY
.expiryMonth
The expiration month of the card. It is expected in the format
MM
.CVV
The CVV code associated with the card. Set to
nil
if CVV is not required. -
Creates an object representing a card transaction.
Throws
The error that occurred while validating payment parameters. See code attribute (OPPErrorCode
) andNSLocalizedDescription
to identify the reason of failure.Declaration
Swift
@objc public static func cardPaymentParams(checkoutID: String, paymentBrand: String?, holder: String?, number: String, expiryMonth: String?, expiryYear: String?, cvv: String?) throws -> OPPCardPaymentParams
Parameters
checkoutID
The checkout ID of the transaction. Must be not
nil
or empty.paymentBrand
The payment brand of the card.
holder
The name of the card holder.
number
The card number of the transaction.
expiryYear
The expiration year. It is expected in the format
YYYY
.expiryMonth
The expiration month of the card. It is expected in the format
MM
.cvv
The CVV code associated with the card. Set to
nil
if CVV is not required. -
Creates an object representing a card transaction without specifying a brand. Use it only with BIP settings ‘automatic brand detection’ activated.
Throws
The error that occurred while validating payment parameters. See code attribute (OPPErrorCode
) andNSLocalizedDescription
to identify the reason of failure.Declaration
Swift
@objc public static func cardPaymentParams(checkoutID: String, holder: String?, number: String, expiryMonth: String?, expiryYear: String?, cvv: String?) throws -> OPPCardPaymentParams
Parameters
checkoutID
The checkout ID of the transaction. Must be not
nil
or empty.holder
The name of the card holder.
number
The card number of the transaction.
expiryYear
The expiration year. It is expected in the format
YYYY
.expiryMonth
The expiration month of the card. It is expected in the format
MM
.CVV
The CVV code associated with the card. Set to
nil
if CVV is not required.
-
Checks if the holder name is filled with sufficient data to perform a transaction.
Declaration
Swift
@objc public static func isHolderValid(_ holder: String) -> Bool
Parameters
holder
Holder of the card account.
Return Value
true
if the holder name length greater than 3 characters and less than 128 character. -
Checks if the card number is filled with sufficient data to perform a transaction.
Declaration
Swift
@objc public static func isNumberValid(_ number: String, luhnCheck: Bool) -> Bool
Parameters
number
Card number.
luhnCheck
Set to
true
if number should pass Luhn test http://en.wikipedia.org/wiki/Luhn_algorithm.Return Value
true
if the number consists of 10-19 digits and passes luhn test,false
if it doesn’t. -
Checks if the card expiry month is filled with sufficient data to perform a transaction.
Declaration
Swift
@objc public static func isExpiryMonthValid(_ expiryMonth: String) -> Bool
Parameters
expiryMonth
The expiry month of the card.
Return Value
true
if the card expiry month is in the formatMM
. -
Checks if the card expiry year is filled with sufficient data to perform a transaction.
Declaration
Swift
@objc public static func isExpiryYearValid(_ expiryYear: String) -> Bool
Parameters
expiryYear
The expiry year of the card.
Return Value
true
if the card expiry year is in the formatYYYY
. -
Checks if the country code is filled with sufficient data to perform a transaction.
Declaration
Swift
@objc public static func isCountryCodeValid(_ countryCode: String) -> Bool
Return Value
true
if the country code contains digits only. -
Checks if the mobile phone is filled with sufficient data to perform a transaction.
Declaration
Swift
@objc public static func isMobilePhoneValid(_ mobilePhone: String) -> Bool
Return Value
true
if the mobile phone number contains digits only. -
Checks if the month and year have been set and whether or not card is expired.
Declaration
Swift
@objc public static func isExpired(_ month: String, and year: String) -> Bool
Parameters
month
The expiry month of the card.
year
The expiry year of the card.
Return Value
true
if the month or the year is expired.NO
if the card is not expired yet.