CardState
-> VGSCardState
SSNState
-> VGSSSNState
Use VGSCollectSDK/CardIO
or VGSCollectSDK/BlinkCard
as card scan solution instead.
HTTPMethod
-> VGSCollectHTTPMethod
Bin length expanded from 6 to 8 digits for Visa, MasterCard, Maestro card brands.
For SDK integration with Swift Package Manager you don't need to import VGSPaymentCards
module.
Before:
import VGSCollectSDK
import VGSPaymentCards
...
VGSPaymentCards.visa.regex = "\\d*$"
Now:
import VGSCollectSDK
...
VGSPaymentCards.visa.regex = "\\d*$"
CardExpDateFormat
-> VGSCardExpDateFormat
If you use CardIO and integrate with Carthage, from now it's required to import VGSCardIOCollector.framework
build in your application Target Build Phases
and Linkend Frameworks
settings.
Before:
Input Files
$(SRCROOT)/Carthage/Build/iOS/VGSCollectSDK.framework
$(SRCROOT)/Carthage/Build/iOS/CardIO.framework
Now:
$(SRCROOT)/Carthage/Build/iOS/VGSCollectSDK.framework
$(SRCROOT)/Carthage/Build/iOS/CardIO.framework
$(SRCROOT)/Carthage/Build/iOS/VGSCardIOCollector.framework
Same updates should be made for Output Files
Also in you project file where you use CardIO, you should import VGSCardIOCollector
module:
import VGSCollectSDK
import VGSCardIOCollector
SwiftLuhn
-> VGSPaymentCards
SwiftLuhn.CardType
-> VGSPaymentCards.CardBrand
From now .formatPattern
that was defined through VGSConfiguration
will be ignored for fields with type .cardNumber
. To be more flexible we released dynamic format patterns for each Payment Card Brand. Check our default format patterns in VGSPaymentCards.swift
file, and update it if needed for each specific Card Model:
Before:
let cardConfiguration = VGSConfiguration(collector: vgsCollect, fieldName: "card_number")
cardConfiguration.type = .cardNumber
cardConfiguration.formatPattern = "#### #### #### ####"
Now:
VGSPaymentCards.amex.formatPattern = "#### ###### #####"
VGSPaymentCards.visa.formatPattern = "#### #### #### ####"
Now default .isSecureTextEntry
value for .cvc
field type is false
. If you need secure entry, you can set it via VGSTextField
attribute:
cvcTextField.isSecureTextEntry = true
Alamofire
networking manager removed from the SDK and related API methods removed too.
You should update vgsCollect.submit(_:)
& vgsCollect.submitFile(_:)
methods to vgsCollect.sendData(_:)
& vgsCollect.sendFile(_:)
accordingly. If you preferre to see new and old methods available together in same version, check v1.4.2
.
Before:
vgsCollect.submit(path: "/post", method: .post, extraData: extraData, completion: { [weak self] (result, error) in
if let data = result as? [String: Any] {
//...
}
})
Now:
vgsCollect.sendData(path: "/post", method: .post, extraData: extraData) { [weak self](result) in
switch result {
case .success(let code, let data, let response):
if let data = data, let jsonData = try? JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] {
//...
}
break
case .failure(let code, let data, let response, let error):
//...
break
}
}
Note that completion block also changed. Before v1.5.0
you could get response data from result field in format [String: Any]?
. Now response data is in Data?
format, so you should convert it manually to the format you need. This allows us to handle any data type in response.
Before you could get some error objects as Alamofire's AFError
type. Now you could get similar error types under the NSURLErrorDomain
as NSError
.
Cocoapods and Carthage cache project dependencies, so probably you will get errors when try to update VGSCollectSDK
to the current version. Check the fix recommendations:
Try to clean DerivedData
folder for your project.
The location should look like: ~/Library/Developer/Xcode/DerivedData/your-project-id
.
Carthage Caches usually stay at ~/Library/Caches/org.carthage.CarthageKit/dependencies/foobar
. You can remove Alamofire
dependencies there or follow the solution here.
Also remove Alamofire
dependencies from your project's Target
. Check targets’ Build Phases/Run Scripts
and General/Frameworks, Libraries, and Emdedded Content
tabs.
We add divider "/"
to input data by default when sending it to your vault from VGSTextField
with FieldType.expDate
Before:
/// request body format example
{
"customExpirationDateKey" : "0122"
}
Now:
/// request body format example
{
"customExpirationDateKey" : "01/22"
}
Devider will be added by default. If you preferre to send data without divider, you can update textfield's VGSConfiguration.divider
attribute.
Send expiration date input without divider:
let expDateConfiguration = VGSConfiguration(collector: vgsCollect, fieldName: "customExpirationDateKey")
expDateConfiguration.type = .expDate
expDateConfiguration.divider = ""