diff --git a/CHANGELOG.md b/CHANGELOG.md index c7bf42ba..82075f0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ ### NEXT_VERSION_DESCRIPTION_BEGIN ### NEXT_VERSION_DESCRIPTION_END +## [6.6.2] (04-03-2022) + +* Исправлен потенциальный крэш + +## [6.6.1] (24-02-2022) + +* правки для успешной сборки + ## [6.6.0] (29-12-2021) * Обновление метрик. Использование удалённого файла конфигурации. diff --git a/CardIO Integration as Development Pod.md b/CardIO Integration as Development Pod.md new file mode 100644 index 00000000..ccb84baa --- /dev/null +++ b/CardIO Integration as Development Pod.md @@ -0,0 +1,54 @@ +# CardIO и интеграция через dev pod + +Дано: CardIO не поддерживается уже долгое время, сам репозиторий заархивирован. В последнем релизе 5.4.1 присутсвует + проблема что при установке через cocoapods не генерируется modulemap файл и библиотеку приходится дополнительно + подключать через Bridging header. Это приводит к проблеме с которой мы столкнулись в Xcode 13 в наших проектах + на Swift. На некоторых машинах начала появлятся ошибка: +``` +error: using bridging headers with module interfaces is unsupported Command CompileSwiftSources failed with a nonzero exit code +``` + +Ошибка возникает независимо от настроек в подфайле или в конкретных подах. На некоторых машинах +был ограниченный успех при выставлении настройки BUILD_LIBRARY_FOR_DISTRIBUTION=NO в Podfile, в post_install фазе. + +Для решения проблемы есть несколько вариантов относительно архивного состояния исходного репозитория. + +1. Собрать CardIO.framework из исходников вручную и подключить в проект. +------ +Это решение может быть довольно накладным, так как сами архивные исходники требуют некоторой, пусть и минимальной, + настройки для того чтобы успешно собираться. Также требуется внести ручную линковку относительно некоторого набора + библиотек из IOS SDK в фазе Link Binary With Libraries. + +2. Подключение CardIO как development pod. +----- +Позволяет локально решить проблему генерации modulemap реализацией изменений из +https://github.com/card-io/card.io-iOS-SDK/pull/284 +Преимущество также состоит в минимальном количестве усилий для достижения результата. +Нетривиальные особенности решения: + 1) Добавление в исходники .m файлов активирует генерацию modulemap файла + ```spec.source_files = 'CardIO/*.{h,m}'``` + 2) Переименование libCardIO.a в libCardIOCore.a из-за конфликта линковки. + https://github.com/card-io/card.io-iOS-SDK/pull/284#issuecomment-377663436 + + + Альтернативный вариант: сделать свой форк https://github.com/card-io/ внести эти изменения и подключить его в Podfile. + + + Это конечно не решает ошибку `using bridging headers with module interfaces` в общем случае, так как всегда есть + вероятность наличия другого Objective-C кода подключенного напрямую в проект. Для этих случаев мы предлагаем + упаковать необходимый код в локальную зависимость любым удобным способом. + + В YooKassaPaymentsDemoApp мы приводим простой пример упаковки Objective-C кода в Swift Package. + + Если ваш проект использует другие зависимости которые необходимо подключать через Bridging Header, то надеемся что + пример с подключением CardIO окажется полезным и сэкономит вам время. + +На сегодняшний день мы не смогли найти непреодолимых причин подключения Objective-C кода через Briding Header. Если у + вас есть подобный пример, мы будем рады если вы с нами им поделитесь. + Мы продолжим исследование проблемы для более глубокого понимания её причин и разработки новых вариантов решения. + +Дополнительно о модулярных фреймворках можно найти информацию по следущим ссылкам: + +https://clang.llvm.org/docs/Modules.html +http://nsomar.io/modular-framework-creating-and-using-them/ +https://github.com/search?utf8=✓&q=modulemap+language%3Aswift&type= diff --git a/CardIO/CardIO.podspec b/CardIO/CardIO.podspec new file mode 100644 index 00000000..c4904803 --- /dev/null +++ b/CardIO/CardIO.podspec @@ -0,0 +1,18 @@ +Pod::Spec.new do |spec| + spec.name = 'CardIO' + spec.version = '5.4.1' + spec.license = { type: 'MIT', file: 'CardIO/LICENSE.md' } + spec.homepage = 'https://www.card.io' + spec.authors = { 'CardIO' => 'support@paypal.com' } + spec.summary = 'Credit card scanning for mobile apps' + spec.social_media_url = 'https://twitter.com/cardio' + spec.source = { :git => 'https://github.com/card-io/card.io-iOS-SDK.git', :tag => "#{spec.version}" } + spec.platform = :ios, '6.1' + spec.ios.deployment_target = '6.1' + spec.requires_arc = true + spec.source_files = 'CardIO/*.{h,m}' + spec.frameworks = 'Accelerate', 'AVFoundation', 'AudioToolbox', 'CoreGraphics', 'CoreMedia', 'CoreVideo', 'CoreServices', 'OpenGLES', 'QuartzCore', 'Security', 'UIKit' + spec.libraries = 'c++' + spec.vendored_libraries = 'CardIO/libCardIOCore.a', 'CardIO/libopencv_core.a', 'CardIO/libopencv_imgproc.a' + spec.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-ObjC' } +end diff --git a/CardIO/CardIO/CardIO.h b/CardIO/CardIO/CardIO.h new file mode 100644 index 00000000..0a2e0680 --- /dev/null +++ b/CardIO/CardIO/CardIO.h @@ -0,0 +1,16 @@ +// +// CardIO.h +// Version 5.4.1 +// +// See the file "LICENSE.md" for the full license governing this code. +// + +// All-in-one header file for card.io sdk. +#import "CardIOCreditCardInfo.h" +#import "CardIODetectionMode.h" +#import "CardIOView.h" +#import "CardIOViewDelegate.h" +#import "CardIOPaymentViewController.h" +#import "CardIOPaymentViewControllerDelegate.h" +#import "CardIOUtilities.h" + diff --git a/CardIO/CardIO/CardIO.m b/CardIO/CardIO/CardIO.m new file mode 100644 index 00000000..a75baf36 --- /dev/null +++ b/CardIO/CardIO/CardIO.m @@ -0,0 +1,7 @@ +// +// This file exists so that CocoaPods will generate a modulemap for CardIO +// +// See https://github.com/card-io/card.io-iOS-SDK/issues/115 +// and https://github.com/card-io/card.io-iOS-SDK/pull/126 +// for more details +// diff --git a/CardIO/CardIO/CardIOCreditCardInfo.h b/CardIO/CardIO/CardIOCreditCardInfo.h new file mode 100644 index 00000000..89de40e4 --- /dev/null +++ b/CardIO/CardIO/CardIOCreditCardInfo.h @@ -0,0 +1,85 @@ +// +// CardIOCreditCardInfo.h +// Version 5.4.1 +// +// See the file "LICENSE.md" for the full license governing this code. +// + +#import +#import + +/// CardIOCreditCardType Identifies type of card. +typedef NS_ENUM(NSInteger, CardIOCreditCardType) { + /// The card number does not correspond to any recognizable card type. + CardIOCreditCardTypeUnrecognized = 0, + /// The card number corresponds to multiple card types (e.g., when only a few digits have been entered). + CardIOCreditCardTypeAmbiguous = 1, + /// American Express + CardIOCreditCardTypeAmex = '3', + /// Japan Credit Bureau + CardIOCreditCardTypeJCB = 'J', + /// VISA + CardIOCreditCardTypeVisa = '4', + /// MasterCard + CardIOCreditCardTypeMastercard = '5', + /// Discover Card + CardIOCreditCardTypeDiscover = '6' +}; + + +/// Container for the information about a card. +@interface CardIOCreditCardInfo : NSObject + +/// Card number. +@property(nonatomic, copy, readwrite) NSString *cardNumber; + +/// Card number with all but the last four digits obfuscated. +@property(nonatomic, copy, readonly) NSString *redactedCardNumber; + +/// January == 1 +/// @note expiryMonth & expiryYear may be 0, if expiry information was not requested. +@property(nonatomic, assign, readwrite) NSUInteger expiryMonth; + +/// The full four digit year. +/// @note expiryMonth & expiryYear may be 0, if expiry information was not requested. +@property(nonatomic, assign, readwrite) NSUInteger expiryYear; + +/// Security code (aka CSC, CVV, CVV2, etc.) +/// @note May be nil, if security code was not requested. +@property(nonatomic, copy, readwrite) NSString *cvv; + +/// Postal code. Format is country dependent. +/// @note May be nil, if postal code information was not requested. +@property(nonatomic, copy, readwrite) NSString *postalCode; + +/// Cardholder Name. +/// @note May be nil, if cardholder name was not requested. +@property(nonatomic, copy, readwrite) NSString *cardholderName; + +/// Was the card number scanned (as opposed to entered manually)? +@property(nonatomic, assign, readwrite) BOOL scanned; + +/// The rectified card image; usually 428x270. +@property(nonatomic, strong, readwrite) UIImage *cardImage; + +/// Derived from cardNumber. +/// @note CardIOCreditInfo objects returned by either of the delegate methods +/// userDidProvideCreditCardInfo:inPaymentViewController: +/// or cardIOView:didScanCard: +/// will never return a cardType of CardIOCreditCardTypeAmbiguous. +@property(nonatomic, assign, readonly) CardIOCreditCardType cardType; + +/// Convenience method which returns a card type string suitable for display (e.g. "Visa", "American Express", "JCB", "MasterCard", or "Discover"). +/// Where appropriate, this string will be translated into the language specified. +/// @param cardType The card type. +/// @param languageOrLocale See CardIOPaymentViewController.h for a detailed explanation of languageOrLocale. +/// @return Card type string suitable for display. ++ (NSString *)displayStringForCardType:(CardIOCreditCardType)cardType usingLanguageOrLocale:(NSString *)languageOrLocale; + +/// Returns a 36x25 credit card logo, at a resolution appropriate for the device. +/// @param cardType The card type. +/// @return 36x25 credit card logo. ++ (UIImage *)logoForCardType:(CardIOCreditCardType)cardType; + +@end + diff --git a/CardIO/CardIO/CardIODetectionMode.h b/CardIO/CardIO/CardIODetectionMode.h new file mode 100644 index 00000000..0132df80 --- /dev/null +++ b/CardIO/CardIO/CardIODetectionMode.h @@ -0,0 +1,19 @@ +// +// CardIODetectionMode.h +// Version 5.4.1 +// +// See the file "LICENSE.md" for the full license governing this code. +// +// + +#ifndef icc_CardIODetectionMode_h +#define icc_CardIODetectionMode_h + +typedef NS_ENUM(NSInteger, CardIODetectionMode) { + CardIODetectionModeCardImageAndNumber = 0, + CardIODetectionModeCardImageOnly, + CardIODetectionModeAutomatic +}; + +#endif + diff --git a/CardIO/CardIO/CardIOPaymentViewController.h b/CardIO/CardIO/CardIOPaymentViewController.h new file mode 100644 index 00000000..092d8f38 --- /dev/null +++ b/CardIO/CardIO/CardIOPaymentViewController.h @@ -0,0 +1,201 @@ +// +// CardIOPaymentViewController.h +// Version 5.4.1 +// +// See the file "LICENSE.md" for the full license governing this code. +// + +#import +#import "CardIOPaymentViewControllerDelegate.h" +#import "CardIODetectionMode.h" + +/// CardIOPaymentViewController is one of two main entry points into the card.io SDK. +/// @see CardIOView +@interface CardIOPaymentViewController : UINavigationController + +/// Initializer for scanning. +/// If scanning is not supported by the user's device, card.io will offer manual entry. +/// @param aDelegate Your CardIOPaymentViewControllerDelegate (typically a UIViewController). +/// @return Properly initialized CardIOPaymentViewController. +- (id)initWithPaymentDelegate:(id)aDelegate; + +/// Initializer for scanning, with extra hooks for controlling whether the camera will +/// be displayed (useful for testing). +/// @param aDelegate Your CardIOPaymentViewControllerDelegate (typically a UIViewController). +/// @param scanningEnabled If scanningEnabled is NO, card.io will offer manual entry, +/// regardless of whether scanning is supported by the user's device. +/// @return Properly initialized CardIOPaymentViewController. +- (id)initWithPaymentDelegate:(id)aDelegate scanningEnabled:(BOOL)scanningEnabled; + +/// The preferred language for all strings appearing in the user interface. +/// If not set, or if set to nil, defaults to the device's current language setting. +/// +/// Can be specified as a language code ("en", "fr", "zh-Hans", etc.) or as a locale ("en_AU", "fr_FR", "zh-Hant_HK", etc.). +/// If card.io does not contain localized strings for a specified locale, then it will fall back to the language. E.g., "es_CO" -> "es". +/// If card.io does not contain localized strings for a specified language, then it will fall back to American English. +/// +/// If you specify only a language code, and that code matches the device's currently preferred language, +/// then card.io will attempt to use the device's current region as well. +/// E.g., specifying "en" on a device set to "English" and "United Kingdom" will result in "en_GB". +/// +/// These localizations are currently included: +/// ar,da,de,en,en_AU,en_GB,es,es_MX,fr,he,is,it,ja,ko,ms,nb,nl,pl,pt,pt_BR,ru,sv,th,tr,zh-Hans,zh-Hant,zh-Hant_TW. +@property(nonatomic, copy, readwrite) NSString *languageOrLocale; + +/// @see keepStatusBarStyleForCardIO +@property(nonatomic, assign, readwrite) BOOL keepStatusBarStyle; +/// @see navigationBarStyleForCardIO +@property(nonatomic, assign, readwrite) UIBarStyle navigationBarStyle; +/// @see navigationBarTintColorForCardIO +@property(nonatomic, retain, readwrite) UIColor *navigationBarTintColor; + +/// Normally, card.io blurs the screen when the app is backgrounded, +/// to obscure card details in the iOS-saved screenshot. +/// If your app already does its own blurring upon backgrounding, +/// you might choose to disable this behavior. +/// Defaults to NO. +@property(nonatomic, assign, readwrite) BOOL disableBlurWhenBackgrounding; + +/// Alter the card guide (bracket) color. Opaque colors recommended. +/// Defaults to nil; if nil, will use card.io green. +@property(nonatomic, retain, readwrite) UIColor *guideColor; + +/// If YES, don't have the user confirm the scanned card, just return the results immediately. +/// Defaults to NO. +@property(nonatomic, assign, readwrite) BOOL suppressScanConfirmation; + +/// If YES, instead of displaying the image of the scanned card, +/// present the manual entry screen with the scanned card number prefilled. +/// Defaults to NO. +@property(nonatomic, assign, readwrite) BOOL suppressScannedCardImage; + +/// After a successful scan, card.io will display an image of the card with +/// the computed card number superimposed. This property controls how long (in seconds) +/// that image will be displayed. +/// Set this to 0.0 to suppress the display entirely. +/// Defaults to 0.1. +@property(nonatomic, assign, readwrite) CGFloat scannedImageDuration; + +/// Mask the card number digits as they are manually entered by the user. Defaults to NO. +@property(nonatomic, assign, readwrite) BOOL maskManualEntryDigits; + +/// Set the scan instruction text. If nil, use the default text. Defaults to nil. +/// Use newlines as desired to control the wrapping of text onto multiple lines. +@property(nonatomic, copy, readwrite) NSString *scanInstructions; + +/// Hide the PayPal or card.io logo in the scan view. Defaults to NO. +@property(nonatomic, assign, readwrite) BOOL hideCardIOLogo; + +/// A custom view that will be overlaid atop the entire scan view. Defaults to nil. +/// If you set a scanOverlayView, be sure to: +/// +/// * Consider rotation. Be sure to test on the iPad with rotation both enabled and disabled. +/// To make rotation synchronization easier, whenever a scanOverlayView is set, and card.io does an +/// in-place rotation (rotates its UI elements relative to their containers), card.io will generate +/// rotation notifications; see CardIOScanningOrientationDidChangeNotification +/// and associated userInfo key documentation below. +/// As with UIKit, the initial rotation is always UIInterfaceOrientationPortrait. +/// +/// * Be sure to pass touches through to the superview as appropriate. Note that the entire camera +/// preview responds to touches (triggers refocusing). Test the light button and the toolbar buttons. +/// +/// * Minimize animations, redrawing, or any other CPU/GPU/memory intensive activities +@property(nonatomic, retain, readwrite) UIView *scanOverlayView; + +/// CardIODetectionModeCardImageAndNumber: the scanner must successfully identify the card number. +/// CardIODetectionModeCardImageOnly: don't scan the card, just detect a credit-card-shaped card. +/// CardIODetectionModeAutomatic: start as CardIODetectionModeCardImageAndNumber, but fall back to +/// CardIODetectionModeCardImageOnly if scanning has not succeeded within a reasonable time. +/// Defaults to CardIODetectionModeCardImageAndNumber. +/// +/// @note Images returned in CardIODetectionModeCardImageOnly mode may be less focused, to accomodate scanning +/// cards that are dominantly white (e.g., the backs of drivers licenses), and thus +/// hard to calculate accurate focus scores for. +@property(nonatomic, assign, readwrite) CardIODetectionMode detectionMode; + +/// Set to NO if you don't need to collect the card expiration. Defaults to YES. +@property(nonatomic, assign, readwrite) BOOL collectExpiry; + +/// Set to NO if you don't need to collect the CVV from the user. Defaults to YES. +@property(nonatomic, assign, readwrite) BOOL collectCVV; + +/// Set to YES if you need to collect the billing postal code. Defaults to NO. +@property(nonatomic, assign, readwrite) BOOL collectPostalCode; + +/// Set to YES if the postal code should only collect numeric input. Defaults to NO. Set this if you know the +/// expected country's postal code has only numeric postal +/// codes. +@property(nonatomic, assign, readwrite) BOOL restrictPostalCodeToNumericOnly; + +/// Set to YES if you need to collect the cardholder name. Defaults to NO. +@property(nonatomic, assign, readwrite) BOOL collectCardholderName; + +/// Set to NO if you don't want the camera to try to scan the card expiration. +/// Applies only if collectExpiry is also YES. +/// Defaults to YES. +@property(nonatomic, assign, readwrite) BOOL scanExpiry; + +/// Set to YES to show the card.io logo over the camera view instead of the PayPal logo. Defaults to NO. +@property(nonatomic, assign, readwrite) BOOL useCardIOLogo; + +/// By default, in camera view the card guide and the buttons always rotate to match the device's orientation. +/// All four orientations are permitted, regardless of any app or viewcontroller constraints. +/// If you wish, the card guide and buttons can instead obey standard iOS constraints, including +/// the UISupportedInterfaceOrientations settings in your app's plist. +/// Set to NO to follow standard iOS constraints. Defaults to YES. (Does not affect the manual entry screen.) +@property(nonatomic, assign, readwrite) BOOL allowFreelyRotatingCardGuide; + +/// Set to YES to prevent card.io from showing its "Enter Manually" button. Defaults to NO. +/// +/// @note If [CardIOUtilities canReadCardWithCamera] returns false, then if card.io is presented it will +/// automatically display its manual entry screen. +/// Therefore, if you want to prevent users from *ever* seeing card.io's manual entry screen, +/// you should first check [CardIOUtilities canReadCardWithCamera] before initing the view controller. +@property(nonatomic, assign, readwrite) BOOL disableManualEntryButtons; + +/// Access to the delegate. +@property(nonatomic, weak, readwrite) id paymentDelegate; + +/// Name for orientation change notification. +extern NSString * const CardIOScanningOrientationDidChangeNotification; + +/// userInfo key for orientation change notification, to get the current scanning orientation. +/// +/// Returned as an NSValue wrapping a UIDeviceOrientation. Sample extraction code: +/// @code +/// NSValue *wrappedOrientation = notification.userInfo[CardIOCurrentScanningOrientation]; +/// UIDeviceOrientation scanningOrientation = UIDeviceOrientationPortrait; // set a default value just to be safe +/// [wrappedOrientation getValue:&scanningOrientation]; +/// // use scanningOrientation... +/// @endcode +extern NSString * const CardIOCurrentScanningOrientation; + +/// userInfo key for orientation change notification, to get the duration of the card.io rotation animations. +/// +/// Returned as an NSNumber wrapping an NSTimeInterval (i.e. a double). +extern NSString * const CardIOScanningOrientationAnimationDuration; + +@end + +/// Methods with names that do not conflict with Apple's private APIs. +@interface CardIOPaymentViewController (NonConflictingAPINames) + +/// If YES, the status bar's style will be kept as whatever your app has set it to. +/// If NO, the status bar style will be set to the default style. +/// Defaults to NO. +@property(nonatomic, assign, readwrite) BOOL keepStatusBarStyleForCardIO; + +/// The default appearance of the navigation bar is navigationBarStyleForCardIO == UIBarStyleDefault; +/// tintColor == nil (pre-iOS 7), barTintColor == nil (iOS 7). +/// Set either or both of these properties if you want to override these defaults. +/// @see navigationBarTintColorForCardIO +@property(nonatomic, assign, readwrite) UIBarStyle navigationBarStyleForCardIO; + +/// The default appearance of the navigation bar is navigationBarStyleForCardIO == UIBarStyleDefault; +/// tintColor == nil (pre-iOS 7), barTintColor == nil (iOS 7). +/// Set either or both of these properties if you want to override these defaults. +/// @see navigationBarStyleForCardIO +@property(nonatomic, retain, readwrite) UIColor *navigationBarTintColorForCardIO; + +@end + diff --git a/CardIO/CardIO/CardIOPaymentViewControllerDelegate.h b/CardIO/CardIO/CardIOPaymentViewControllerDelegate.h new file mode 100644 index 00000000..45785a6f --- /dev/null +++ b/CardIO/CardIO/CardIOPaymentViewControllerDelegate.h @@ -0,0 +1,32 @@ +// +// CardIOPaymentViewControllerDelegate.h +// Version 5.4.1 +// +// See the file "LICENSE.md" for the full license governing this code. +// + +#import + +@class CardIOPaymentViewController; +@class CardIOCreditCardInfo; + +/// The receiver will be notified when the CardIOPaymentViewController flow completes, due to either success or user-cancellation. +/// +/// Exactly one of these delegate methods will be called. +/// +/// Each of them MUST dismiss the CardIOPaymentViewController. +@protocol CardIOPaymentViewControllerDelegate + +@required + +/// This method will be called if the user cancels the scan. You MUST dismiss paymentViewController. +/// @param paymentViewController The active CardIOPaymentViewController. +- (void)userDidCancelPaymentViewController:(CardIOPaymentViewController *)paymentViewController; + +/// This method will be called when there is a successful scan (or manual entry). You MUST dismiss paymentViewController. +/// @param cardInfo The results of the scan. +/// @param paymentViewController The active CardIOPaymentViewController. +- (void)userDidProvideCreditCardInfo:(CardIOCreditCardInfo *)cardInfo inPaymentViewController:(CardIOPaymentViewController *)paymentViewController; + +@end + diff --git a/CardIO/CardIO/CardIOUtilities.h b/CardIO/CardIO/CardIOUtilities.h new file mode 100644 index 00000000..f52a48d3 --- /dev/null +++ b/CardIO/CardIO/CardIOUtilities.h @@ -0,0 +1,54 @@ +// +// CardIOUtilities.h +// Version 5.4.1 +// +// See the file "LICENSE.md" for the full license governing this code. +// + +#import +#import + +@interface CardIOUtilities : NSObject + +/// Please send the output of this method with any technical support requests. +/// @return Human-readable version of this library. ++ (NSString *)libraryVersion; + +/// Determine whether this device supports camera-based card scanning, considering +/// factors such as hardware support and OS version. +/// +/// card.io automatically provides manual entry of cards as a fallback, +/// so it is not typically necessary for your app to check this. +/// +/// @return YES iff the user's device supports camera-based card scanning. ++ (BOOL)canReadCardWithCamera; + +/// The preload method prepares card.io to launch faster. Calling preload is optional but suggested. +/// On an iPhone 5S, for example, preloading makes card.io launch ~400ms faster. +/// The best time to call preload is when displaying a view from which card.io might be launched; +/// e.g., inside your view controller's viewWillAppear: method. +/// preload works in the background; the call to preload returns immediately. ++ (void)preload; + +/// Returns a doubly Gaussian-blurred screenshot, intended for screenshots when backgrounding. +/// @return Blurred screenshot. ++ (UIImageView *)blurredScreenImageView; + +@end + +/// Methods with names that do not conflict with Apple's private APIs. +@interface CardIOUtilities (NonConflictingAPINames) + +/// Please send the output of this method with any technical support requests. +/// @return Human-readable version of this library. ++ (NSString *)cardIOLibraryVersion; + +/// The preload method prepares card.io to launch faster. Calling preload is optional but suggested. +/// On an iPhone 5S, for example, preloading makes card.io launch ~400ms faster. +/// The best time to call preload is when displaying a view from which card.io might be launched; +/// e.g., inside your view controller's viewWillAppear: method. +/// preload works in the background; the call to preload returns immediately. ++ (void)preloadCardIO; + +@end + diff --git a/CardIO/CardIO/CardIOView.h b/CardIO/CardIO/CardIOView.h new file mode 100644 index 00000000..242c5d34 --- /dev/null +++ b/CardIO/CardIO/CardIOView.h @@ -0,0 +1,126 @@ +// +// CardIOView.h +// Version 5.4.1 +// +// See the file "LICENSE.md" for the full license governing this code. +// + +#import +#import "CardIOViewDelegate.h" +#import "CardIODetectionMode.h" + +/// CardIOView is one of two main entry points into the card.io SDK. +/// @see CardIOPaymentViewController +@interface CardIOView : UIView + + +#pragma mark - Properties you MUST set + +/// Typically, your view controller will set itself as this delegate. +@property(nonatomic, weak, readwrite) id delegate; + + +#pragma mark - Properties you MAY set + +/// The preferred language for all strings appearing in the user interface. +/// If not set, or if set to nil, defaults to the device's current language setting. +/// +/// Can be specified as a language code ("en", "fr", "zh-Hans", etc.) or as a locale ("en_AU", "fr_FR", "zh-Hant_HK", etc.). +/// If card.io does not contain localized strings for a specified locale, then it will fall back to the language. E.g., "es_CO" -> "es". +/// If card.io does not contain localized strings for a specified language, then it will fall back to American English. +/// +/// If you specify only a language code, and that code matches the device's currently preferred language, +/// then card.io will attempt to use the device's current region as well. +/// E.g., specifying "en" on a device set to "English" and "United Kingdom" will result in "en_GB". +/// +/// These localizations are currently included: +/// ar,da,de,en,en_AU,en_GB,es,es_MX,fr,he,is,it,ja,ko,ms,nb,nl,pl,pt,pt_BR,ru,sv,th,tr,zh-Hans,zh-Hant,zh-Hant_TW. +@property(nonatomic, copy, readwrite) NSString *languageOrLocale; + +/// Alter the card guide (bracket) color. Opaque colors recommended. +/// Defaults to nil; if nil, will use card.io green. +@property(nonatomic, retain, readwrite) UIColor *guideColor; + +/// Set to YES to show the card.io logo over the camera instead of the PayPal logo. Defaults to NO. +@property(nonatomic, assign, readwrite) BOOL useCardIOLogo; + +/// Hide the PayPal or card.io logo in the scan view. Defaults to NO. +@property(nonatomic, assign, readwrite) BOOL hideCardIOLogo; + +/// By default, in camera view the card guide and the buttons always rotate to match the device's orientation. +/// All four orientations are permitted, regardless of any app or viewcontroller constraints. +/// If you wish, the card guide and buttons can instead obey standard iOS constraints, including +/// the UISupportedInterfaceOrientations settings in your app's plist. +/// Set to NO to follow standard iOS constraints. Defaults to YES. (Does not affect the manual entry screen.) +@property(nonatomic, assign, readwrite) BOOL allowFreelyRotatingCardGuide; + +/// Set the scan instruction text. If nil, use the default text. Defaults to nil. +/// Use newlines as desired to control the wrapping of text onto multiple lines. +@property(nonatomic, copy, readwrite) NSString *scanInstructions; + +/// A custom view that will be overlaid atop the entire scan view. Defaults to nil. +/// If you set a scanOverlayView, be sure to: +/// +/// * Consider rotation. Be sure to test on the iPad with rotation both enabled and disabled. +/// To make rotation synchronization easier, whenever a scanOverlayView is set, and card.io does an +/// in-place rotation (rotates its UI elements relative to their containers), card.io will generate +/// rotation notifications; see CardIOScanningOrientationDidChangeNotification +/// and associated userInfo key documentation below. +/// As with UIKit, the initial rotation is always UIInterfaceOrientationPortrait. +/// +/// * Be sure to pass touches through to the superview as appropriate. Note that the entire camera +/// preview responds to touches (triggers refocusing). Test the light button and the toolbar buttons. +/// +/// * Minimize animations, redrawing, or any other CPU/GPU/memory intensive activities +@property(nonatomic, retain, readwrite) UIView *scanOverlayView; + +/// Set to NO if you don't want the camera to try to scan the card expiration. +/// Defaults to YES. +@property(nonatomic, assign, readwrite) BOOL scanExpiry; + +/// CardIODetectionModeCardImageAndNumber: the scanner must successfully identify the card number. +/// CardIODetectionModeCardImageOnly: don't scan the card, just detect a credit-card-shaped card. +/// CardIODetectionModeAutomatic: start as CardIODetectionModeCardImageAndNumber, but fall back to +/// CardIODetectionModeCardImageOnly if scanning has not succeeded within a reasonable time. +/// Defaults to CardIODetectionModeCardImageAndNumber. +/// +/// @note Images returned in CardIODetectionModeCardImageOnly mode may be less focused, to accomodate scanning +/// cards that are dominantly white (e.g., the backs of drivers licenses), and thus +/// hard to calculate accurate focus scores for. +@property(nonatomic, assign, readwrite) CardIODetectionMode detectionMode; + +/// After a successful scan, the CardIOView will briefly display an image of the card with +/// the computed card number superimposed. This property controls how long (in seconds) +/// that image will be displayed. +/// Set this to 0.0 to suppress the display entirely. +/// Defaults to 1.0. +@property(nonatomic, assign, readwrite) CGFloat scannedImageDuration; + +/// Name for orientation change notification. +extern NSString * const CardIOScanningOrientationDidChangeNotification; + +/// userInfo key for orientation change notification, to get the current scanning orientation. +/// +/// Returned as an NSValue wrapping a UIDeviceOrientation. Sample extraction code: +/// @code +/// NSValue *wrappedOrientation = notification.userInfo[CardIOCurrentScanningOrientation]; +/// UIDeviceOrientation scanningOrientation = UIDeviceOrientationPortrait; // set a default value just to be safe +/// [wrappedOrientation getValue:&scanningOrientation]; +/// // use scanningOrientation... +/// @endcode +extern NSString * const CardIOCurrentScanningOrientation; + +/// userInfo key for orientation change notification, to get the duration of the card.io rotation animations. +/// +/// Returned as an NSNumber wrapping an NSTimeInterval (i.e. a double). +extern NSString * const CardIOScanningOrientationAnimationDuration; + + +#pragma mark - Property you MAY get + +/// The actual camera preview area within the CardIOView. Location is relative to the CardIOView's origin. +/// You might want to use this, for example, when adjusting your view controller's view layout. +@property(nonatomic, assign, readonly) CGRect cameraPreviewFrame; + +@end + diff --git a/CardIO/CardIO/CardIOViewDelegate.h b/CardIO/CardIO/CardIOViewDelegate.h new file mode 100644 index 00000000..c30ade54 --- /dev/null +++ b/CardIO/CardIO/CardIOViewDelegate.h @@ -0,0 +1,27 @@ +// +// CardIOViewDelegate.h +// Version 5.4.1 +// +// See the file "LICENSE.md" for the full license governing this code. +// + +#import + +@class CardIOCreditCardInfo; +@class CardIOView; + +/// The receiver will be notified when the CardIOView completes it work. +@protocol CardIOViewDelegate + +@required + +/// This method will be called when the CardIOView completes its work. +/// It is up to you to hide or remove the CardIOView. +/// At a minimum, you should give the user an opportunity to confirm that the card information was captured correctly. +/// @param cardIOView The active CardIOView. +/// @param cardInfo The results of the scan. +/// @note cardInfo will be nil if exiting due to a problem (e.g., no available camera). +- (void)cardIOView:(CardIOView *)cardIOView didScanCard:(CardIOCreditCardInfo *)cardInfo; + +@end + diff --git a/CardIO/CardIO/LICENSE.md b/CardIO/CardIO/LICENSE.md new file mode 100644 index 00000000..f538a99c --- /dev/null +++ b/CardIO/CardIO/LICENSE.md @@ -0,0 +1,23 @@ +All files are released under the MIT License: + + The MIT License (MIT) + + Copyright (c) 2013-2016 PayPal Holdings, Inc. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. diff --git a/CardIO/CardIO/README.md b/CardIO/CardIO/README.md new file mode 100644 index 00000000..839aa85b --- /dev/null +++ b/CardIO/CardIO/README.md @@ -0,0 +1,341 @@ +[![card.io logo](https://raw.githubusercontent.com/card-io/card.io-iOS-source/master/Resources/cardio_logo_220.png "card.io")](https://www.card.io) + +card.io SDK for iOS +=================== + +[card.io](https://www.card.io/) provides fast, easy credit card scanning in mobile apps. + +> #### *NEW!!! card.io is now an open-source project!* +> +> As of December 2014, all of the source code for card.io is now available at the [card.io-iOS-source repo](https://github.com/card-io/card.io-iOS-source). +> +> ##### What does this mean for you? +> +> * If you simply wish to integrate card.io into your mobile apps, then you can (and probably should) ignore the existence of [card.io-iOS-source](https://github.com/card-io/card.io-iOS-source). +> * But if you're curious about how card.io performs its magic, or if you'd like to improve the appearance or behavior of card.io, then come visit [card.io-iOS-source](https://github.com/card-io/card.io-iOS-source)! + +Brought to you by +[![PayPal logo](https://raw.githubusercontent.com/card-io/card.io-iOS-source/master/Resources/pp_h_rgb.png)](https://paypal.com/ "PayPal") + + +Stay up to date +--------------- + +Please keep your app up to date with the latest version of the SDK. +All releases follow [semantic versioning](http://semver.org/). + +To receive updates about new versions: + +* Follow [@cardio](https://twitter.com/cardio) (also great to send us feedback) +* Subscribe to our [card-io-sdk-announce](https://groups.google.com/forum/#!forum/card-io-sdk-announce) list +* "Watch" this GitHub repository + +You can find and start technical discussions using the [Stack Overflow card.io tag](http://stackoverflow.com/questions/tagged/card.io). + +Sample app +---------- + +For a quick first look at card.io, we have included a very small sample application that you can build and run. + +1. Download the latest version of the SDK. +2. Simply open the `SampleApp` folder or the `SampleApp-Swift` folder and follow the instructions in the `README.md` file you find there. + + +Instructions +------------ + +The card.io iOS SDK includes header files and a single static library. We'll walk you through integration and usage. + +### Requirements + +* The latest non-beta version of Xcode. (Older or newer versions *might* also work.) +* Supports target deployment of iOS version 6.1+ and instruction set armv7+ (including 64-bit). + +### Setup + +##### If you use [CocoaPods](http://cocoapods.org), then add this line to your podfile: + +```ruby +pod 'CardIO' +``` + +##### If you don't use CocoaPods, then: + +1. Download the latest version of the SDK. +2. Add the CardIO directory (containing several .h files, `libCardIO.a`, `libopencv_core.a`, and `libopencv_imgproc.a`) to your Xcode project. +3. In your project's Build Settings (in the `TARGETS` section, not the `PROJECTS` section), add `-lc++` to `Other Linker Flags`. +4. *Either:* + * Add these frameworks to your project. +[Weak linking](http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html) is supported. + * Accelerate + * AudioToolbox + * AVFoundation + * CoreGraphics + * CoreMedia + * CoreVideo + * Foundation + * MobileCoreServices + * OpenGLES + * QuartzCore + * Security + * UIKit +5. *or:* + * Add only these frameworks to your project (as `Optional` [i.e., weak-linked] libraries): + * Accelerate + * AVFoundation + * AudioToolbox + * CoreMedia + * MobileCoreServices + * and confirm that these two Build Settings are both enabled: + * `Enable Modules (C and Objective-C)` + * `Link Frameworks Automatically` + +##### With or without CocoaPods: + +1. Add [card.io's open source license acknowledgments](acknowledgments.md) to +[your app's acknowledgments](http://stackoverflow.com/questions/3966116/where-to-put-open-source-credit-information-for-an-iphone-app). +2. Refer to the header files for more usage options and information. +3. You should add the key [`NSCameraUsageDescription`](https://developer.apple.com/library/prerelease/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW24) to your app's `Info.plist` and set the value to be a string describing why your app needs to use the camera (e.g. "To scan credit cards."). This string will be displayed when the app initially requests permission to access the camera. + +### Sample code + +You can use card.io in two ways: + +* **As a view controller**: *Quick and easy.* Create a `CardIOPaymentViewController` and present it modally. The card.io view controller handles all aspects of the UX, including manual entry as a fallback, all transitions, and number confirmation. + +* **As a view**: *More flexible.* Create a `CardIOView` to do card scanning only and manage everything else yourself. This enables a broader range of presentations, such as in-place transitions, but requires that you handle the rest of the UI yourself. + + +#### Integrate as a View Controller + +Create a class (most likely a subclass of `UIViewController`) that conforms to `CardIOPaymentViewControllerDelegate`. + +```obj-c +// SomeViewController.h + +#import "CardIO.h" +@interface SomeViewController : UIViewController +// ... +``` + +Make an optional call to speed up the subsequent launch of card.io scanning: + +```obj-c +// SomeViewController.m + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + [CardIOUtilities preloadCardIO]; +} + +``` + +Start card.io card scanning: + +```obj-c +// SomeViewController.m + +- (IBAction)scanCard:(id)sender { + CardIOPaymentViewController *scanViewController = [[CardIOPaymentViewController alloc] initWithPaymentDelegate:self]; + [self presentViewController:scanViewController animated:YES completion:nil]; +} +``` + +Write delegate methods to receive the card info or a cancellation: + +```obj-c +// SomeViewController.m + +- (void)userDidCancelPaymentViewController:(CardIOPaymentViewController *)scanViewController { + NSLog(@"User canceled payment info"); + // Handle user cancellation here... + [scanViewController dismissViewControllerAnimated:YES completion:nil]; +} + +- (void)userDidProvideCreditCardInfo:(CardIOCreditCardInfo *)info inPaymentViewController:(CardIOPaymentViewController *)scanViewController { + // The full card number is available as info.cardNumber, but don't log that! + NSLog(@"Received card info. Number: %@, expiry: %02i/%i, cvv: %@.", info.redactedCardNumber, info.expiryMonth, info.expiryYear, info.cvv); + // Use the card info... + [scanViewController dismissViewControllerAnimated:YES completion:nil]; +} +``` + +#### Integrate as a View + +*CardIOView is new as of card.io Version 3.3.0 (September 2013). We look forward to seeing how creative developers integrate it into their apps. If you do something cool with it, share it with [@cardio](https://twitter.com/cardio)! We also look forward to quickly resolving any issues that you may discover.* + +Create a class (most likely a subclass of `UIViewController`) that conforms to `CardIOViewDelegate`. + +```obj-c +// SomeViewController.h + +#import "CardIO.h" +@interface SomeViewController : UIViewController +// ... +``` + +Using a CardIOView provides UI flexibility. Here are two sample integration options: + +* Create a CardIOView when you need it, and then delete it when its work is finished. +* Include a hidden CardIOView in your view, show it when you need it, and then hide it when its work is finished. + +##### Option 1: Create a CardIOView when you need it + +Confirm that the user's device is capable of scanning cards: + +```obj-c +// SomeViewController.m + +- (void)viewDidLoad { + [super viewDidLoad]; + + if (![CardIOUtilities canReadCardWithCamera]) { + // Hide your "Scan Card" button, or take other appropriate action... + } +} +``` + +Make an optional call to speed up the subsequent launch of card.io scanning: + +```obj-c +// SomeViewController.m + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + [CardIOUtilities preloadCardIO]; +} + +``` + +Start card.io card scanning: + +```obj-c +// SomeViewController.m + +- (IBAction)scanCard:(id)sender { + CardIOView *cardIOView = [[CardIOView alloc] initWithFrame:CGRECT_WITHIN_YOUR_VIEW]; + cardIOView.delegate = self; + + [self.view addSubview:cardIOView]; +} +``` + +Write the delegate method to receive the results: + +```obj-c +// SomeViewController.m + +- (void)cardIOView:(CardIOView *)cardIOView didScanCard:(CardIOCreditCardInfo *)info { + if (info) { + // The full card number is available as info.cardNumber, but don't log that! + NSLog(@"Received card info. Number: %@, expiry: %02i/%i, cvv: %@.", info.redactedCardNumber, info.expiryMonth, info.expiryYear, info.cvv); + // Use the card info... + } + else { + NSLog(@"User cancelled payment info"); + // Handle user cancellation here... + } + + [cardIOView removeFromSuperview]; +} +``` + +Include a method to cancel card scanning: + +```obj-c +// SomeViewController.m + +- (IBAction)cancelScanCard:(id)sender { + [cardIOView removeFromSuperview]; +} +``` + +##### Option 2: Include a hidden CardIOView in your view + +Make an IBOutlet property: + +```obj-c +// SomeViewController.m + +@interface SomeViewController () +@property(nonatomic, strong, readwrite) IBOutlet CardIOView *cardIOView; +@end +``` + +In your .xib, include a CardIOView, mark it as `hidden`, and connect it to the IBOutlet property. (Note: usually you will want to set the background color of the CardIOView to `clearColor`.) + +After confirming that the user's device is capable of scanning cards, set the `delegate` property of the CardIOView: + +```obj-c +// SomeViewController.m + +- (void)viewDidLoad { + [super viewDidLoad]; + + if (![CardIOUtilities canReadCardWithCamera]) { + // Hide your "Scan Card" button, remove the CardIOView from your view, and/or take other appropriate action... + } else { + self.cardIOView.delegate = self; + } +} +``` + +Make an optional call to speed up the subsequent launch of card.io scanning: + +```obj-c +// SomeViewController.m + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + [CardIOUtilities preloadCardIO]; +} + +``` + +Start card.io card scanning: + +```obj-c +// SomeViewController.m + +- (IBAction)scanCard:(id)sender { + self.cardIOView.hidden = NO; +} +``` + +Write the delegate method to receive the results: + +```obj-c +// SomeViewController.m + +- (void)cardIOView:(CardIOView *)cardIOView didScanCard:(CardIOCreditCardInfo *)info { + if (info) { + // The full card number is available as info.cardNumber, but don't log that! + NSLog(@"Received card info. Number: %@, expiry: %02i/%i, cvv: %@.", info.redactedCardNumber, info.expiryMonth, info.expiryYear, info.cvv); + // Use the card info... + } + else { + NSLog(@"User canceled payment info"); + // Handle user cancellation here... + } + + cardIOView.hidden = YES; +} +``` + +Include a method to cancel card scanning: + +```obj-c +// SomeViewController.m + +- (IBAction)cancelScanCard:(id)sender { + self.cardIOView.hidden = YES; +} +``` + + +### Hints & Tips + +* Processing images can be memory intensive, so make sure to test that your app properly handles memory warnings. +* For your users' security, [obscure your app's cached screenshots](https://viaforensics.com/resources/reports/best-practices-ios-android-secure-mobile-development/ios-avoid-cached-application-snapshots/). +**Note:** By default, a `CardIOPaymentViewController` automatically blurs its own screens when the app is backgrounded. A `CardIOView` does not do any automatic blurring. +* The first time that you create either a `CardIOPaymentViewController` or a `CardIOView`, the card.io SDK must load resources, which can result in a noticeable delay. To avoid this delay you may optionally call `[CardIOUtilities preloadCardIO]` in advance, so that this resource loading occurs in advance on a background thread. diff --git a/CardIO/CardIO/acknowledgments.md b/CardIO/CardIO/acknowledgments.md new file mode 100644 index 00000000..13ca9506 --- /dev/null +++ b/CardIO/CardIO/acknowledgments.md @@ -0,0 +1,105 @@ +Summary +------- + +card.io's iOS SDK uses code from the following libraries (with gratitude!): + + * Willow Garage's [OpenCV](http://opencv.willowgarage.com/wiki/) + * [Eigen](http://eigen.tuxfamily.org) + * Erica Sadun's [iPhone Developer's Cookbook Code Samples and uidevice-extension categories](https://github.com/erica/) + * Georg Kitz's [UIDevice-with-UniqueIdentifier-for-iOS-5](https://github.com/gekitz/UIDevice-with-UniqueIdentifier-for-iOS-5) + * Tomáš Znamenáček's [Lambda Alert](https://github.com/zoul/Lambda-Alert) + * Josh Bleecher Snyder's [TLCommon](https://github.com/treelinelabs/TLCommon) + * [Openstack](http://openstack.org/) + +Full licenses +------------- + +Eigen: MPLv2 license text can be found at [http://www.mozilla.org/MPL/2.0/](http://www.mozilla.org/MPL/2.0/); the source code is available at [https://bitbucket.org/eigen/eigen/](https://bitbucket.org/eigen/eigen/) or via [http://eigen.tuxfamily.org/](http://eigen.tuxfamily.org/) + +Erica Sadun's code, BSD license: + + Copyright (c) 2012, Erica Sadun + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +George Kitz's UIDevice-with-UniqueIdentifier-for-iOS-5, MIT license: + + Copyright (C) 2012, Georg Kitz, @gekitz + + Permission is hereby granted, free of charge, to any person obtaining a copy of + this software and associated documentation files (the "Software"), to deal in + the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is furnished to do + so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + +Willow Garage's OpenCV, BSD license: + + Actual license text not provided -- [the OpenCV website](http://opencv.willowgarage.com/wiki/) says "OpenCV is released under a BSD license, it is free for both academic and commercial use.", with links to http://opensource.org/licenses/bsd-license.php and http://en.wikipedia.org/wiki/BSD_licenses + +Josh Bleecher Snyder's TLCommon, MIT license: + + The MIT License + + Copyright (c) <2009> + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + +Tomáš Znamenáček's Lambda Alert, MIT license: + + Copyright (c) 2010–2011 Tomáš Znamenáček, + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the “Software”), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + The software is provided “as is”, without warranty of any kind, express or + implied, including but not limited to the warranties of merchantability, + fitness for a particular purpose and noninfringement. In no event shall the + authors or copyright holders be liable for any claim, damages or other + liability, whether in an action of contract, tort or otherwise, arising from, + out of or in connection with the Software or the use or other dealings in + the Software. + +Openstack, Apache 2.0 license: + + Actual license text not provided -- [the Openstack website](http://openstack.org/) says "The OpenStack project is provided under the Apache 2.0 license."; the Apache 2.0 license text can be found at http://www.apache.org/licenses/LICENSE-2.0.txt diff --git a/CardIO/CardIO/libCardIOCore.a b/CardIO/CardIO/libCardIOCore.a new file mode 100644 index 00000000..fa288605 Binary files /dev/null and b/CardIO/CardIO/libCardIOCore.a differ diff --git a/CardIO/CardIO/libopencv_core.a b/CardIO/CardIO/libopencv_core.a new file mode 100644 index 00000000..75c861f5 Binary files /dev/null and b/CardIO/CardIO/libopencv_core.a differ diff --git a/CardIO/CardIO/libopencv_imgproc.a b/CardIO/CardIO/libopencv_imgproc.a new file mode 100644 index 00000000..bca147ee Binary files /dev/null and b/CardIO/CardIO/libopencv_imgproc.a differ diff --git a/CardIO/CardIO/module.modulemap b/CardIO/CardIO/module.modulemap new file mode 100644 index 00000000..959d9d4c --- /dev/null +++ b/CardIO/CardIO/module.modulemap @@ -0,0 +1,4 @@ +module CardIO { + header "CardIO.h" + export * +} diff --git a/CardIO/CardIO/release_notes.txt b/CardIO/CardIO/release_notes.txt new file mode 100644 index 00000000..2456f2d4 --- /dev/null +++ b/CardIO/CardIO/release_notes.txt @@ -0,0 +1,600 @@ +card.io iOS SDK release notes +============================= + +5.4.1 (Fri 09/16/2016) + +* Fix issue with CocoaPods Objective-C projects not building correctly + +5.4.0 (Fri 09/16/2016) + +* Add methods with card.io specific signatures to avoid name collisions + ( https://github.com/card-io/card.io-iOS-SDK/issues/201 ) +* Add .m so that CocoaPods will generate CardIO modulemap. Thanks to @keith. + ( https://github.com/card-io/card.io-iOS-SDK/pull/210 ) +* Update CardIOViewStream's previewLayer to be CALayer. Thanks to @wisolith. + ( https://github.com/card-io/card.io-iOS-source/pull/63 ) +* Update CardIOVideoStream's delegate to be a UIResponder. Thanks to @reidmain. + ( https://github.com/card-io/card.io-iOS-source/pull/70 ) +* Remove incorrect warning about `suppressScanConfirmation`. Thanks to @kballard. + ( https://github.com/card-io/card.io-iOS-SDK/issues/217 ) +* Fix warnings when building from source + +5.3.2 (Mon 04/11/2016) + +* Fix memory management issues with CMSampleBufferRef causing crash + ( https://github.com/card-io/card.io-iOS-SDK/issues/194 ) + +5.3.1 (Tue 01/26/2016) + +* Prevent an issue with crashes when an invalid IplImage is used for + scanning causing an exception to be thrown later in cvGetSize(). + ( https://github.com/card-io/card.io-iOS-source/pull/57 ) + +5.3.0 (Mon 12/21/2015) + +* Add cardholder name for manual text input. Thanks to Mark Rogers and + Martin Rybak for the contribution. + ( https://github.com/card-io/card.io-iOS-source/pull/45 ) +* Add option for only numeric input for postal code. + ( https://github.com/card-io/card.io-iOS-source/pull/51 ) + +5.2.2 (Tue 11/03/2015) + +* You will need to link the `Accelerate` framework to your application. +* Fix issue where an app would hang on card-scanning screen + ( https://github.com/card-io/card.io-iOS-SDK/issues/153 ) + If an app was displaying the card-scanning screen and was sent to the + background, when the app was brought back to the foreground, the + app would possibly hang on certain hardware, mainly iPhone 5S. +* Add Carthage support + ( https://github.com/card-io/card.io-iOS-source/pull/36 + https://github.com/card-io/card.io-iOS-source/issues/32 ) + Initial support for Carthage. In a Cartfile, you can add + `github "card-io/card.io-iOS-source"` + to get Carthage to build a dynamic framework for inclusion in your + projects. +* Fix warning while running in simulator for 5.2.1 + ( https://github.com/card-io/card.io-iOS-SDK/issues/154 ) + Add the x86_64 and i386 slices to the OpenCV libraries to prevent warnings. + This was also necesary for clean builds for Carthage. + +5.2.1 (Mon 10/19/2015) + +* Split CardIO and OpenCV libraries + (https://github.com/card-io/card.io-iOS-SDK/issues/147 + https://github.com/card-io/card.io-iOS-source/issues/41) + The library is built with Xcode 7.0 with Bitcode enabled for all 3 + libraries. The libraries are now split into 3 static libraries: + `libCardIO.a`, `libopencv_core.a`, and `libopencv_imgproc.a`. + This split was done to reduce the individual file size to make it + more managable for GitHub repositories which limit individual files to + 100 MB. + + Note that when an application is "Bitcode compiled" and distributed + by the App Store, the app size should not be signficantly increased + compared to before Bitcode enablement. + + You must use Xcode 7 since previous versions of Xcode are not fully + compatible with Bitcode enabled libraries. + +-- + +5.2.0 (Wed 9/30/2015) + +* Enable Bitcode + (https://github.com/card-io/card.io-iOS-SDK/issues/119) + The library is now built with Xcode 7.0. It has Bitcode enabled which + does significantly increase the static library. However, when an app + is compiled and distributed by the App Store, the app size should not + significantly increase compared to before Bitcode enablement. You must also + use Xcode 7 since previous versions of Xcode are not fully compatible + with Bitcode enabled libraries. + +-- + +5.1.1 (Wed 8/26/2015) + +* Update CocoaPods podspec to use `vendored_libraries`. + (https://github.com/card-io/card.io-iOS-SDK/pull/126) + +-- + +5.1.0 (Sun 7/12/2015) + +* Update project and sample apps for Xcode 6.4. +* Expose `scannedImageDuration` in CardIOPaymentViewController. + (https://github.com/card-io/card.io-iOS-source/pull/29) +* Better respect UISupportedInterfaceOrientation from the app plist. + (https://github.com/card-io/card.io-iOS-SDK/issues/117) +* Fix iOS 9 crash by removing some obsolete localization code. + (https://github.com/card-io/card.io-iOS-SDK/issues/120) + +-- + +5.0.6 (Thu 5/21/2015) + +* Prevent crash when user simultaneously taps `Cancel` and `Enter Manually` buttons. + (https://github.com/card-io/card.io-iOS-SDK/issues/112) + +-- + +5.0.5 (Tue 5/19/2015) + +* Update Chinese translations for "CVV". + (https://github.com/paypal/PayPal-iOS-SDK/issues/278) +* Update project and sample apps for Xcode 6.3, but + build SDK with Xcode 6.2 this one last time to prevent + compatibility issues for clients still using Xcode 6.2. + +-- + +5.0.4 (Tue 4/14/2015) + +* Check existing video permissions before presenting camera view. + (https://github.com/card-io/card.io-iOS-SDK/issues/99) +* Restrict expiry year manual input to 2 digits in all cases. + (https://github.com/card-io/card.io-iOS-SDK/issues/104) + +-- + +5.0.3 (Tue 3/17/2015) + +* On scan cancelation, eliminate a visual stutter. + (https://github.com/card-io/card.io-iOS-SDK/issues/97) +* On scan completion, reset camera focus range to nonrestricted. + (https://github.com/card-io/card.io-iOS-source/issues/17) + +-- + +5.0.2 (Mon 2/23/2015) + +* Re-enable expiry-scanning for 32-bit devices (e.g., iPhone 4S). + +-- + +5.0.1 (Tue 2/10/2015) + +* Simplify expiry-scanning code to improve accuracy and also decrease library size a bit. +* For now, disable expiry-scanning for 32-bit devices (e.g., iPhone 4S). + - This is because of an apparent compiler bug for which we haven't yet found a workaround. + +-- + +5.0.0 (Tue 1/20/2015) + +* Add automatic expiry-scanning. + You can disable this feature via the new `scanExpiry` property of either CardIOView or CardIOPaymentViewController. + Note: Expiry scans will not infrequently fail to obtain the correct expiry date. + We are continuing to work to improve expiry-scanning accuracy. +* Remove various deprecated properties. + +-- + +4.0.2 (Tue 1/13/2015) + +* Fix an iOS 8 display issue involving right-to-left languages. (https://github.com/card-io/card.io-iOS-SDK/issues/90) +* In the manual-input screen combine Expiry and CVV into a single row, for more languages than before. + +-- + +4.0.1 (Mon 1/5/2015) + +* Fix a potential rare crash. (see https://github.com/paypal/PayPal-iOS-SDK/issues/220 for a similar case) + +-- + +4.0.0 (Mon 12/1/2014) + +* Build from the new open-source edition of card.io: https://github.com/card-io/card.io-iOS-source +* New class: CardIOUtilities + - libraryVersion (formerly a method of CardIOPaymentViewController) + - canReadCardWithCamera (formerly a method of CardIOPaymentViewController) + - preload (formerly a method of CardIOView and of CardIOPaymentViewController) + - blurredScreenImageView (new method) +* New property on CardIOCreditCardInfo: + - cardImage +* New properties on CardIOView and CardIOPaymentViewController: + - scanInstructions + - hideCardIOLogo + - scanOverlayView + - detectionMode +* New notification: + - CardIOScanningOrientationDidChangeNotification + +-- + +3.10.1 (Wed 11/5/2014) + +* Restore App Token as a deprecated property, so that existing card.io integrations will continue to build without modification. + +-- + +3.10.0 (Thu 10/2/2014) + +* Eliminate App Token. Developers no longer need to sign up on the card.io site before using card.io. +* Add Icelandic (is) to our supported localizations. (Thank you, Martin Kaplan!) + +-- + +3.9.0 (Tue 9/23/2014) + +* Add new optional method `preload` to noticeably speed up the creation of your first CardIOView or CardIOPaymentViewController. + +-- + +3.8.7 (Tue 9/16/2014) + +* Fix a crash that could occur if a user has restricted your app's camera access. + +-- + +3.8.6 (Fri 9/12/2014) + +* Solve (hopefully!) a build problem for Xcode 5 users. (see https://github.com/card-io/card.io-iOS-SDK/issues/66) + +-- + +3.8.5 (Thu 9/11/2014) + +* Add armv7s slice (work around an Xcode 6 bug). + +-- + +3.8.4 (Wed 9/10/2014) + +* Build with Xcode 6 GM seed. +* Update a few localized strings. (including: https://github.com/card-io/card.io-iOS-SDK/issues/65) + +-- + +3.8.3 (Tue 7/8/2014) + +* Fix a very rare problem involving the app caches directory getting cleared. (see https://github.com/paypal/PayPal-iOS-SDK/issues/163) + +-- + +3.8.2 (Thu 7/3/2014) + +* Fix some localization issues. (see https://github.com/paypal/PayPal-iOS-SDK/issues/164) + +-- + +3.8.1 (Thu 6/19/2014) + +* Fix an iOS 8 (beta 2) crash. + +-- + +3.8.0 (Wed 6/11/2014) + +* Accept Diners Club and China UnionPay card numbers as valid Discover card numbers. +* Allow manual entry of card numbers with unrecognized prefixes, as long as the card number passes the Luhn checksum test. +* Make zh-Hant_HK the default dialect for zh-Hant (Traditional Chinese). (zh-Hant_TW remains available, as well.) + +-- + +3.7.1 (Mon 5/19/2014) + +* Improve handling of Traditional Chinese. (github issue #47) + +-- + +3.7.0 (Wed 4/30/2014) + +* Add new maskManualEntryDigits property to CardIOPaymentViewController. +* Update PayPal logo. + +-- + +3.6.5 (Mon 4/21/2014) + +* Add Thai (th) to our supported localizations. + +-- + +3.6.4 (Tue 4/1/2014) + +* When the data-entry screen appears, automatically enter text-editing mode. (github issue #41) + +-- + +3.6.3 (Mon 3/10/2014) + +* Repair the disableManualEntryButtons property. (github issue #38) + +-- + +3.6.2 (Fri 3/7/2014) + +* Fix an orientation glitch when no camera is available. + +-- + +3.6.1 (Thu 3/6/2014) + +* Fix a compiler issue caused by a change in header file import ordering. + +-- + +3.6.0 (Thu 3/6/2014) + +* New appearance of the "Cancel" and "Enter Manually" buttons in camera view, including automatic button rotation to match device orientation. +* New property, allowFreelyRotatingCardGuide, for both CardIOPaymentViewController and CardIOView; provides the option to constrain camera-view UI rotation to follow standard iOS behavior. +* The manual entry screen now includes a landscape orientation. + +-- + +3.5.0 (Wed 2/26/2014) + +* Add suppressScannedCardImage property to CardIOPaymentViewController (github issue #33) + +-- + +3.4.4 (Tue 1/14/2014) + +* Fix two very rare bugs: + - Card-scan succeeds, but then reports a nil card number; + - Card-scan completes while the camera focus is being adjusted -> crash. + +-- + +3.4.3 (Thu 12/12/2013) + +* Restore use of CardIOView, which was accidentally broken in release 3.4.1. + +-- + +3.4.2 (Wed 12/11/2013) + +* Enable linking against iOS 6 SDK, for apps not yet targeted at iOS 7. +* Add Arabic (ar) and Malay (ms) to our supported localizations. +* Fix a memory leak when a user rapidly and repeatedly starts camera sessions. + +-- + +3.4.1 (Thu 12/05/2013) + +* Respect the setting for UIViewControllerBasedStatusBarAppearance in your app's Info.plist +* Enable copy/paste for the manual-entry fields. +* Improve the handling of right-to-left languages (e.g., Hebrew). + +-- + +3.4.0 (Tue 11/12/2013) + +* Now 64-bit compatible. + +-- + +3.3.0 (Tue 9/24/2013) + +* Introduce CardIOView for highly customizable, scan-only integration. +* Fix a few small bugs. + +-- + +3.2.4 (Mon 9/16/2013) + +* Build with Xcode 5 GM seed. +* Modify header comments to support Xcode 5 Quick Help. +* Fix a few small bugs. + +-- + +3.2.3 (Thu 8/29/2013) + +* Ready for iOS 7 (please let us know if you discover any issues!) +* Additional customizability in CardIOPaymentViewController: + - guideColor + - suppressScanConfirmation +* The former first-time/how-to alert is no more. +* Add human-readable version number to the string returned by +libraryVersion. +* Correct a Russian localization issue (github issue #13). + +-- + +3.2.2 (Thu 8/8/2013) + +* Change all uses of ZIP to postalCode. +* Fix a bug with translucent navigation bar (github issue #8). +* Fix a bug with MKMapKit (github issue #10). +* Add card.io version number to all header files (github issue #1). + +-- + +3.2.1 (Mon 7/29/2013) + +* Fix a rotation issue for apps which constrain their Supported Interface Orientations. +* Add ko, pt_BR, and es_MX to our supported localizations. + +-- + +3.2.0 (Thu 5/30/2013) + +* Update the required C++ Standard Library from libstdc++ to libc++ + - NOTE: this will probably require a corresponding change to your app's + "Other Linker Flags", from "-lstdc++" to "-lc++". + (If you still need libstdc++ for a component other than card.io, + you should be able to specify BOTH "-lstdc++" AND "-lc++".) + +--- + +3.1.1 (Wed 5/15/2013) + +* Fix torch-related crash on certain devices (particularly including some models of iPod Touch) + +--- + +3.1.0 (Tue 5/14/2013) + +* Add translations of all strings into ~20 languages, in addition to American English. + - Translation choice is controlled by a new "languageOrLocale" property of CardIOPaymentViewController. + - The translations that a few developers had previously created for their own apps will no longer be used by the SDK. + - NOTE: Default language, if not set by your app, will now be based upon the device's current language setting. +* Automatic control of the camera torch (for devices which support it). + +--- + +3.0.11 (Fri 4/5/2013) + +* Add work-around for a linker bug that affected some simulator builds. + +--- + +3.0.10 (Thu 4/4/2013) + +* Improve performance when card is lying on a flat surface. +* Blur screen when app is backgrounded, for security purposes. +* Eliminate some rare crashes caused by backgrounding the app during a scan. + +--- + +3.0.9 (Fri 3/22/2013) + +* CardIOCreditCardTypeUnknown has been deprecated and will be removed in a future release. + Use CardIOCreditCardTypeUnrecognized or CardIOCreditCardTypeAmbiguous instead. +* Improved autofocus behavior. +* Fix final iPad rotation bugs. (Really!) + +--- + +3.0.8 (Tue 3/5/2013) + +* Add +logoForCardType: to CardIOCreditCardInfo. +* Fix yet more iPad rotation bugs. (Sigh.) + +--- + +3.0.7 (Thu 2/21/2013) + +* Add useCardIOLogo property to CardIOPaymentViewController. +* Fix iPad rotation support for landscape-only iPad apps. +* Improve credit card number validation. + +--- + +3.0.6 (Mon 2/11/2013) + +* Add keepStatusBarStyle, navigationBarStyle, and navigationBarTintColor properties to CardIOPaymentViewController. +* Minor accessibility improvements. +* Fix crash when used with MapKit due to OpenGL interactions. + +--- + +3.0.5 (Tue 1/29/2013) + +* Fix simulator-only linker failure. + +--- + +3.0.4 (Tue 1/22/2013) + +* Now requires iOS 5+. +* Improve iPad rotation support. + +--- + +3.0.3 (Mon 12/3/2012) + +* Fix iOS 6 rotation bug. +* Improve UI for iPhone 5 and iPad. +* Reduce network chatter. +* Switch to PayPal logo. + +--- + +3.0.2 (Mon 9/17/2012) + +* Add armv7s support. Remove armv6 support. + +--- + +3.0.1 (Wed 8/29/2012) + +* Fix Simulator build issues. +* Minor bug fixes. + +--- + +3.0 (Tue 8/21/2012) + +* Card scanning can now be done without network access. +* The SDK now requires the OpenGLES framework. +* The SDK no longer requires the SystemConfiguration framework. +* Minor UI updates. +* Expiry is not scanned in this version. +* Scan availability notifications have been removed; scan availability no longer changes (a device either supports + scanning or not), so notifications are unnecessary. In particular, CardIOPaymentViewController's + +beginGeneratingScanAvailabilityNotifications, +endGeneratingScanAvailabilityNotifications, + CardIOCardScanningDidBecomeAvailable, and CardIOCardScanningDidBecomeUnavailable have been removed. + +--- + +2.3 (Tue 6/26/2012) + +* Add JCB support. +* Add scanned property to CardIOCreditCardInfo. +* Replace CardIOPaymentViewController's -initWithPaymentDelegate:forceManualEntry: with -initWithPaymentDelegate:scanningEnabled:. As before, this method should only be used for testing purposes. Note that the semantics for forceManualEntry: and scanningEnabled: are flipped (if you were using YES, now use NO). +* Remove support for payment processing (now scan only). +* The MessageUI framework is no longer used. + +------------- + +2.2 (Mon 3/26/2012) + +* Add disableManualEntryButtons and supporting methods to CardIOPaymentViewController. +* Remove calls to UIDevice's uniqueIdentifier. + +------------- + +2.1 (Tue 2/7/2012) + +* Drop support for 3.x. The minimum iOS version supported is now 4.0. +* The SDK now requires the Security framework. +* Minor UI and usability improvements. +* Bug fixes. +* Enhanced fraud detection and security. + +------------- + +2.0 (Thu 1/19/2012) + +* Added payment processing capabilities. See CardIO.h for a list of header files, and https://www.card.io/integrate/ios for integration instructions and sample code. +* Removed deprecated CardIOPaymentViewControllerDelegate methods. +* CardIOCreditCardInfo now implements NSCopying and uses copy properties. +* CardIOPaymentViewController can now be used in a form sheet on the iPad. +* UI improvements and bug fixes. + +------------- + +1.2 (Thu 8/24/2011) + +* Easier integration: Instead of requiring files to be Objective-C++ (.mm), you can just use the linker flag -lstdc++ (add it to "Other Linker Flags"). +* Added -redactedCardNumber to CardIOCreditCardInfo class. +* Improved card detection. +* Fixed minor memory leak. +* Minor data entry bug fixes. + +------------- + +1.1.1 (Wed 8/3/2011) + +* Bug fix: Returned card number no longer contains spaces. +* Several manual entry bug fixes. + +------------- + +1.1 (Wed 7/27/2011) + +* Added CardIOCreditCardInfo class. This is a data class that encapsulates the properties of a card: number, expiration, cvv, card type, etc. +* CardIOPaymentViewControllerDelegate now vends CardIOCreditCardInfo instances. +* Deprecated userDidProvideCreditCardNumber:expiryMonth:expiryYear:cvv:inPaymentViewController: in favor of userDidProvideCreditCardInfo:inPaymentViewController:. +* Added ability to optionally collect any/all of expiry, cvv, and zip code. (Previously, expiry was always collected and cvv was optional.) +* Improved capture frame rate. +* Usability improvements to manual entry. + +------------- + +1.0 (Tue 5/17/2011) + +* First release. diff --git a/Podfile b/Podfile index e96616b8..b3396f1a 100644 --- a/Podfile +++ b/Podfile @@ -2,16 +2,17 @@ source 'https://github.com/CocoaPods/Specs.git' source 'git@github.com:yoomoney/cocoa-pod-specs.git' platform :ios, '10.0' -use_frameworks! project 'YooKassaPaymentsDemoApp.xcodeproj' workspace 'YooKassaPayments.xcworkspace' target 'YooKassaPaymentsDemoApp' do + use_frameworks! pod 'SwiftLint' pod 'Reveal-SDK', :configurations => ['Debug'] pod 'YooKassaPayments', :path => './' + pod 'CardIO', :path => './CardIO' pod 'YooKassaPaymentsApi', '~> 2.11.0' end @@ -21,6 +22,7 @@ post_install do |installer| puts "Turn off build_settings 'Documentation comments' on all pods targets" installer.pods_project.targets.each do |target| target.build_configurations.each do |config| + config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'NO' config.build_settings['PROVISIONING_PROFILE_SPECIFIER'] = '' config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO' config.build_settings['CLANG_WARN_DOCUMENTATION_COMMENTS'] = 'NO' diff --git a/Podfile.lock b/Podfile.lock index b77ffdc6..d49a004a 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,4 +1,5 @@ PODS: + - CardIO (5.4.1) - FunctionalSwift (1.7.3) - MoneyAuth (3.3.0): - FunctionalSwift @@ -13,7 +14,7 @@ PODS: - YandexMobileMetrica/Dynamic/Core (3.17.0) - YandexMobileMetrica/Dynamic/Crashes (3.17.0): - YandexMobileMetrica/Dynamic/Core - - YooKassaPayments (6.6.0): + - YooKassaPayments (6.6.2): - MoneyAuth (~> 3.3.0) - ThreatMetrixAdapter (~> 3.3.3) - YandexMobileMetrica/Dynamic (~> 3.0) @@ -30,6 +31,7 @@ PODS: - FunctionalSwift (~> 1.7.3) DEPENDENCIES: + - CardIO (from `./CardIO`) - Reveal-SDK - SwiftLint - YooKassaPayments (from `./`) @@ -49,21 +51,24 @@ SPEC REPOS: - YandexMobileMetrica EXTERNAL SOURCES: + CardIO: + :path: "./CardIO" YooKassaPayments: :path: "./" SPEC CHECKSUMS: + CardIO: 3d68b6cf6f821a63c3a08cb08083c1a6702ce67d FunctionalSwift: 856da67cf3fb812341445d4e28f05875904d8da0 MoneyAuth: 74ba8e8fadbdabe2be706dcad1d0b9de96152897 Reveal-SDK: effba1c940b8337195563c425a6b5862ec875caa SwiftLint: 06ac37e4d38c7068e0935bb30cda95f093bec761 ThreatMetrixAdapter: 1b31f0afe02eb68be52945e160cc9c0fd117b06c YandexMobileMetrica: 9e713c16bb6aca0ba63b84c8d7b8b86d32f4ecc4 - YooKassaPayments: a682124f853fce382ae3b4e2a115cd6e79500c06 + YooKassaPayments: 93039e3a4b08a44ac8c901d20fbb9151673ffa47 YooKassaPaymentsApi: f76c84ec94ace98e8babc6996cf804840d93f8d8 YooKassaWalletApi: 817d511330332aaec84490f8335ab8c94285d9be - YooMoneyCoreApi: 80f30f988f1dc19a397baf246db64cbbca077fd6 + YooMoneyCoreApi: d16cbc3e816c89b7cca957090d7c290b9eb6ddf1 -PODFILE CHECKSUM: 09cf283b8b86edb3f9c9eb3e422765473b150274 +PODFILE CHECKSUM: 1409e3d8f2d0ffe0eba6fb3a46411d9cc57c8803 COCOAPODS: 1.11.2 diff --git a/SuperLibrary/.gitignore b/SuperLibrary/.gitignore new file mode 100644 index 00000000..bb460e7b --- /dev/null +++ b/SuperLibrary/.gitignore @@ -0,0 +1,7 @@ +.DS_Store +/.build +/Packages +/*.xcodeproj +xcuserdata/ +DerivedData/ +.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata diff --git a/SuperLibrary/Package.swift b/SuperLibrary/Package.swift new file mode 100644 index 00000000..2d5b5a15 --- /dev/null +++ b/SuperLibrary/Package.swift @@ -0,0 +1,33 @@ +// swift-tools-version:5.5 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "SuperLibrary", + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "SuperLibrary", + type: .dynamic, + targets: ["SuperLibrary"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "SuperLibrary", + dependencies: [], + path: "Sources", + sources: ["Core"], + publicHeadersPath: "Headers" + ), + .testTarget( + name: "SuperLibraryTests", + dependencies: ["SuperLibrary"]), + ] +) diff --git a/SuperLibrary/README.md b/SuperLibrary/README.md new file mode 100644 index 00000000..030ebed8 --- /dev/null +++ b/SuperLibrary/README.md @@ -0,0 +1,3 @@ +# SuperLibrary + +A description of this package. diff --git a/SuperLibrary/Sources/Core/Core.m b/SuperLibrary/Sources/Core/Core.m new file mode 100644 index 00000000..51b32849 --- /dev/null +++ b/SuperLibrary/Sources/Core/Core.m @@ -0,0 +1,18 @@ +// +// Core.m +// +// +// Created by Станислав Старжевский on 24.01.2022. +// + +#import + +#import "Core.h" + +@implementation Worker +- (void)test { + Worker *w = [[Worker alloc] init]; + [w test]; + NSLog(@"Worker"); +} +@end diff --git a/SuperLibrary/Sources/Headers/Core.h b/SuperLibrary/Sources/Headers/Core.h new file mode 100644 index 00000000..f473101f --- /dev/null +++ b/SuperLibrary/Sources/Headers/Core.h @@ -0,0 +1,11 @@ +#import + +typedef enum : NSUInteger { + MyEnumValueA, + MyEnumValueB, + MyEnumValueC, +} MyEnum; + +@interface Worker: NSObject +- (void)test; +@end diff --git a/SuperLibrary/Sources/Headers/JustAHeader.h b/SuperLibrary/Sources/Headers/JustAHeader.h new file mode 100644 index 00000000..7a1ec383 --- /dev/null +++ b/SuperLibrary/Sources/Headers/JustAHeader.h @@ -0,0 +1 @@ +#import "Core.h" diff --git a/SuperLibrary/Tests/SuperLibraryTests/MyLibraryTests.swift b/SuperLibrary/Tests/SuperLibraryTests/MyLibraryTests.swift new file mode 100644 index 00000000..ef73dde9 --- /dev/null +++ b/SuperLibrary/Tests/SuperLibraryTests/MyLibraryTests.swift @@ -0,0 +1,12 @@ +@testable import SuperLibrary +import XCTest + +final class MyLibraryTests: XCTestCase { + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct + // results. + + _ = Worker() + } +} diff --git a/YooKassaPayments.podspec b/YooKassaPayments.podspec index d41bf663..5e1be4b8 100644 --- a/YooKassaPayments.podspec +++ b/YooKassaPayments.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'YooKassaPayments' - s.version = '6.6.0' + s.version = '6.6.2' s.homepage = 'https://github.com/yoomoney/yookassa-payments-swift' s.license = { :type => "MIT", diff --git a/YooKassaPayments.xcodeproj/project.pbxproj b/YooKassaPayments.xcodeproj/project.pbxproj index 29707ea2..a4da7b76 100644 --- a/YooKassaPayments.xcodeproj/project.pbxproj +++ b/YooKassaPayments.xcodeproj/project.pbxproj @@ -3214,6 +3214,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = YooKassaPayments/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -3222,6 +3223,7 @@ PRODUCT_BUNDLE_IDENTIFIER = ru.yoo.sdk.kassa.payments; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; + SUPPORTS_MACCATALYST = NO; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -3240,6 +3242,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = YooKassaPayments/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -3248,6 +3251,7 @@ PRODUCT_BUNDLE_IDENTIFIER = ru.yoo.sdk.kassa.payments; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; + SUPPORTS_MACCATALYST = NO; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -3388,6 +3392,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = YooKassaPayments/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -3396,6 +3401,7 @@ PRODUCT_BUNDLE_IDENTIFIER = ru.yoo.sdk.kassa.payments; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; + SUPPORTS_MACCATALYST = NO; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; diff --git a/YooKassaPayments/Info.plist b/YooKassaPayments/Info.plist index 99178092..953eaa38 100644 --- a/YooKassaPayments/Info.plist +++ b/YooKassaPayments/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 6.6.0 + 6.6.2 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass diff --git a/YooKassaPayments/Private/Atomic Design/Molecules/UIKit+Styles/UINavigationBar+Style.swift b/YooKassaPayments/Private/Atomic Design/Molecules/UIKit+Styles/UINavigationBar+Style.swift index 95aca6a4..5e294119 100644 --- a/YooKassaPayments/Private/Atomic Design/Molecules/UIKit+Styles/UINavigationBar+Style.swift +++ b/YooKassaPayments/Private/Atomic Design/Molecules/UIKit+Styles/UINavigationBar+Style.swift @@ -31,23 +31,38 @@ extension UINavigationBar { // MARK: - Main styles static let `default` = InternalStyle(name: "default") { (view: UINavigationBar) in + update(view: view) + } + + static func update(view: UINavigationBar) { + if #available(iOS 13.0, *) { + let appearance = UINavigationBarAppearance() + appearance.configureWithOpaqueBackground() + appearance.backgroundColor = .systemBackground + appearance.titleTextAttributes = [ + NSAttributedString.Key.foregroundColor: UIColor.AdaptiveColors.primary, + ] + appearance.shadowImage = UIImage() + + view.standardAppearance = appearance + view.scrollEdgeAppearance = appearance + if #available(iOS 15.0, *) { + view.compactScrollEdgeAppearance = appearance + } + } else { + view.isTranslucent = false + view.barTintColor = .cararra + view.titleTextAttributes = [ + NSAttributedString.Key.foregroundColor: UIColor.AdaptiveColors.primary, + ] + view.shadowImage = UIImage() + + } - let barTintColor: UIColor if #available(iOS 11, *) { view.prefersLargeTitles = false } - if #available(iOS 13, *) { - barTintColor = .systemBackground - } else { - barTintColor = .cararra - } - view.isTranslucent = false - view.barTintColor = barTintColor - view.titleTextAttributes = [ - NSAttributedString.Key.foregroundColor: UIColor.AdaptiveColors.primary, - ] - view.shadowImage = UIImage() view.clipsToBounds = true view.layoutMargins = UIEdgeInsets(top: 0, left: Space.double, bottom: 0, right: Space.double) view.preservesSuperviewLayoutMargins = true diff --git a/YooKassaPayments/Private/Atomic Design/Views/BankCardDataInput/Router/BankCardDataInputRouter.swift b/YooKassaPayments/Private/Atomic Design/Views/BankCardDataInput/Router/BankCardDataInputRouter.swift index ca937651..bb44bd28 100644 --- a/YooKassaPayments/Private/Atomic Design/Views/BankCardDataInput/Router/BankCardDataInputRouter.swift +++ b/YooKassaPayments/Private/Atomic Design/Views/BankCardDataInput/Router/BankCardDataInputRouter.swift @@ -29,7 +29,7 @@ extension BankCardDataInputRouter: BankCardDataInputRouterInput { else { return } cardScanner.cardScanningDelegate = self if let navigationController = viewController as? UINavigationController { - navigationController.navigationBar.setStyles(UINavigationBar.Styles.default) + UINavigationBar.Styles.update(view: navigationController.navigationBar) } transitionHandler.present(viewController, animated: true, completion: nil) } diff --git a/YooKassaPayments/Private/Services/Config/ConfigMediatorImpl.swift b/YooKassaPayments/Private/Services/Config/ConfigMediatorImpl.swift index 9c85cf00..97f8431b 100644 --- a/YooKassaPayments/Private/Services/Config/ConfigMediatorImpl.swift +++ b/YooKassaPayments/Private/Services/Config/ConfigMediatorImpl.swift @@ -198,7 +198,7 @@ class ConfigMediatorImpl: ConfigMediator { newLoader.load { [weak self] result in guard let self = self else { return } self.loader = nil - PrintLogger.trace("Assets loading finished", info: ["result": result.description]) + PrintLogger.trace("Assets loading finished", info: ["result": String(describing: result)]) var toStore: [String: Data] = [:] result.forEach { (url: URL, value: Result) in let keysToUpdate = urls.keys.filter { urls[$0] == url } diff --git a/YooKassaPayments/Private/Services/Config/defaultConfig_en.json b/YooKassaPayments/Private/Services/Config/defaultConfig_en.json new file mode 100644 index 00000000..a9ddde42 --- /dev/null +++ b/YooKassaPayments/Private/Services/Config/defaultConfig_en.json @@ -0,0 +1,47 @@ +{ + "yooMoneyLogoUrlLight": "https://static.yoomoney.ru/mobile-app-content-front/msdk/payment-options/v1/iokassa-light-eng.png", + "yooMoneyLogoUrlDark": "https://static.yoomoney.ru/mobile-app-content-front/msdk/payment-options/v1/iokassa-dark-eng.png", + "paymentMethods": [{ + "method": "bank_card", + "title": "Bank card", + "iconUrl": "https://static.yoomoney.ru/mobile-app-content-front/msdk/payment-options/v1/ym_ic_add_card.png" + }, { + "method": "yoo_money", + "title": "YooMoney", + "iconUrl": "https://static.yoomoney.ru/mobile-app-content-front/msdk/payment-options/v1/ym_ic_yoomoney.png" + }, { + "method": "sberbank", + "title": "SberPay", + "iconUrl": "https://static.yoomoney.ru/mobile-app-content-front/msdk/payment-options/v1/ym_ic_sberbank.png" + }, { + "method": "apple_pay", + "title": "Apple Pay", + "iconUrl": "https://static.yoomoney.ru/mobile-app-content-front/msdk/payment-options/v1/other_cardSystemApplePay.png" + }], + "savePaymentMethodOptionTexts": { + "switchRecurrentOnBindOnTitle": "Allow autopayments and save payment details", + "switchRecurrentOnBindOnSubtitle": "After the payment, the store will save your bank card details and it'll be able to debit money without your participation", + "switchRecurrentOnBindOffTitle": "Allow autopayments", + "switchRecurrentOnBindOffSubtitle": "After the payment, this card will be saved: the store will be able to debit money without your participation", + "switchRecurrentOffBindOnTitle": "Save payment details", + "switchRecurrentOffBindOnSubtitle": "The store will save your bank card details: next time, you won't need to enter them", + "messageRecurrentOnBindOnTitle": "Allowing autopayments and saving payment details", + "messageRecurrentOnBindOnSubtitle": "By making this payment, you allow saving your bank card details and debiting money without your participation", + "messageRecurrentOnBindOffTitle": "Allowing autopayments", + "messageRecurrentOnBindOffSubtitle": "By making this payment, you allow saving this card and debiting money without your participation", + "messageRecurrentOffBindOnTitle": "Saving payment details", + "messageRecurrentOffBindOnSubtitle": "By making this payment, you allow the store to save your bank card details: next time, you won't need to enter them
", + "screenRecurrentOnBindOnTitle": "Autopayments
and saving payment details", + "screenRecurrentOnBindOnText": "If you allowed it, the store will save your bank card details: card number, cardholder's name, and expiration date (everything except the CVC). Next time, you won't need to enter them for payments in this store.

Besides that, we'll link the card (including if it's been used via Apple Pay) to the store. After that, the store will be able to send requests for debiting money automatically: then the payment is made without an additional confirmation from you.

Autopayments will continue even after you reissue the card, even if your bank can update the data automatically. You can cancel them and unlink the card at any moment via store's support service.", + "screenRecurrentOnBindOffTitle": "How autopayments work", + "screenRecurrentOnBindOffText": "If you allow autopayments, we'll link the bank card (including if it's been used via Apple Pay) to the store. After that, the store will be able to send requests for debiting money automatically, then the payment is made without an additional confirmation from you.

Autopayments will continue even after you reissue the card, even if your bank can update the data automatically. You can cancel them and unlink the card at any moment via store's support service.", + "screenRecurrentOffBindOnTitle": "Saving payment details", + "screenRecurrentOffBindOnText": "If you allowed it, your bank card details will be saved for this store and its partners: card number, cardholder's name, and expiration date (everything except the CVC). Next time, you won't need to enter them for payments in this store.

You can delete the bank card details during the payment process (tap on the three dots next to the card and select \"Remove the card\") or by contacting the support service.", + "screenRecurrentOnSberpayTitle": "How autopayments work", + "screenRecurrentOnSberpayText": "If you allow autopayments, we'll link the bank card (including if it's been used via Apple Pay) to the store. After that, the store will be able to send requests for debiting money automatically, then the payment is made without an additional confirmation from you.

Autopayments will continue even after you reissue the card, even if your bank can update the data automatically. You can cancel them and unlink the card at any moment via store's support service." + }, + "userAgreementUrl": "By clicking this button, you accept
the terms and conditions of the service", + "yooMoneyApiEndpoint": "https://sdk.yookassa.ru/api/frontend/v3", + "yooMoneyPaymentAuthorizationApiEndpoint": "https://yoomoney.ru/api/wallet-auth/v1", + "yooMoneyAuthApiEndpoint": "" +} diff --git a/YooKassaPayments/Private/Services/Config/defaultConfig_ru.json b/YooKassaPayments/Private/Services/Config/defaultConfig_ru.json new file mode 100644 index 00000000..67e5fbf7 --- /dev/null +++ b/YooKassaPayments/Private/Services/Config/defaultConfig_ru.json @@ -0,0 +1,52 @@ +{ + "yooMoneyLogoUrlLight": "https://static.yoomoney.ru/mobile-app-content-front/msdk/payment-options/v1/iokassa-light-rus.png", + "yooMoneyLogoUrlDark": "https://static.yoomoney.ru/mobile-app-content-front/msdk/payment-options/v1/iokassa-dark-rus.png", + "paymentMethods": [ + { + "method": "bank_card", + "title": "Банковская карта", + "iconUrl": "https://static.yoomoney.ru/mobile-app-content-front/msdk/payment-options/v1/ym_ic_add_card.png" + }, + { + "method": "yoo_money", + "title": "ЮMoney", + "iconUrl": "https://static.yoomoney.ru/mobile-app-content-front/msdk/payment-options/v1/ym_ic_yoomoney.png" + }, + { + "method": "sberbank", + "title": "SberPay", + "iconUrl": "https://static.yoomoney.ru/mobile-app-content-front/msdk/payment-options/v1/ym_ic_sberbank.png" + }, + { + "method": "apple_pay", + "title": "Apple Pay", + "iconUrl": "https://static.yoomoney.ru/mobile-app-content-front/msdk/payment-options/v1/other_cardSystemApplePay.png" + } + ], + "savePaymentMethodOptionTexts": { + "switchRecurrentOnBindOnTitle": "Разрешить автосписания и сохранить платёжные данные", + "switchRecurrentOnBindOnSubtitle": "После оплаты магазин сохранит данные карты и сможет списывать деньги без вашего участия", + "switchRecurrentOnBindOffTitle": "Разрешить автосписания", + "switchRecurrentOnBindOffSubtitle": "После оплаты запомним эту карту: магазин сможет списывать деньги без вашего участия", + "switchRecurrentOffBindOnTitle": "Сохранить платёжные данные", + "switchRecurrentOffBindOnSubtitle": "Магазин сохранит данные вашей карты —
в следующий раз можно будет их не вводить", + "messageRecurrentOnBindOnTitle": "Разрешим автосписания и сохраним платёжные данные", + "messageRecurrentOnBindOnSubtitle": "Заплатив здесь, вы соглашаетесь
сохранить данные карты и списывать деньги без вашего участия", + "messageRecurrentOnBindOffTitle": "Разрешим автосписания", + "messageRecurrentOnBindOffSubtitle": "Заплатив здесь, вы разрешаете запомнить эту карту и списывать деньги без вашего участия", + "messageRecurrentOffBindOnTitle": "Сохраним платёжные данные", + "messageRecurrentOffBindOnSubtitle": "Заплатив здесь, вы разрешаете магазину сохранить данные вашей карты — в следующий раз можно их не вводить
", + "screenRecurrentOnBindOnTitle": "Автосписания
и сохранение платёжных данных", + "screenRecurrentOnBindOnText": "Если вы это разрешили, мы сохраним для этого магазина и его партнёров данные вашей банковской карты — номер, имя владельца, срок действия (всё, кроме кода CVC). В следующий раз не нужно будет их вводить, чтобы заплатить в этом магазине.

Кроме того, мы привяжем карту (в том числе использованную через Apple Pay) к магазину. После этого магазин сможет присылать запросы на автоматические списания денег — тогда платёж выполняется без дополнительного подтверждения с вашей стороны.

Автосписания продолжатся даже при перевыпуске карты, если ваш банк умеет автоматически обновлять данные. Отключить их и отвязать карту можно в любой момент — через службу поддержки магазина.", + "screenRecurrentOnBindOffTitle": "Как работают автоматические списания", + "screenRecurrentOnBindOffText": "Если вы согласитесь на автосписания, мы привяжем банковскую карту (в том числе использованную через Apple Pay) к магазину. После этого магазин сможет присылать запросы на автоматические списания денег — тогда платёж выполняется без дополнительного подтверждения с вашей стороны.

Автосписания продолжатся даже при перевыпуске карты, если ваш банк умеет автоматически обновлять данные. Отключить их и отвязать карту можно в любой момент — через службу поддержки магазина.", + "screenRecurrentOffBindOnTitle": "Сохранение платёжных данных", + "screenRecurrentOffBindOnText": "Если вы это разрешили, мы сохраним для этого магазина и его партнёров данные вашей банковской карты — номер, имя владельца и срок действия (всё, кроме кода CVC). В следующий раз не нужно будет вводить их, чтобы заплатить в этом магазине.

Удалить данные карты можно в процессе оплаты (нажмите на три точки напротив карты и выберите «Удалить карту») или через службу поддержки.", + "screenRecurrentOnSberpayTitle": "Как работают автоматические списания", + "screenRecurrentOnSberpayText": "Если вы согласитесь на автосписания, мы привяжем банковскую карту (в том числе использованную через Apple Pay) к магазину. После этого магазин сможет присылать запросы на автоматические списания денег — тогда платёж выполняется без дополнительного подтверждения с вашей стороны.

Автосписания продолжатся даже при перевыпуске карты, если ваш банк умеет автоматически обновлять данные. Отключить их и отвязать карту можно в любой момент — через службу поддержки магазина." + }, + "userAgreementUrl": "Нажимая кнопку, вы принимаете
условия сервиса", + "yooMoneyApiEndpoint": "https://sdk.yookassa.ru/api/frontend/v3", + "yooMoneyPaymentAuthorizationApiEndpoint": "https://yoomoney.ru/api/wallet-auth/v1", + "yooMoneyAuthApiEndpoint": "" +} diff --git a/YooKassaPaymentsDemoApp.xcodeproj/project.pbxproj b/YooKassaPaymentsDemoApp.xcodeproj/project.pbxproj index d254b0b3..e7cb3b78 100644 --- a/YooKassaPaymentsDemoApp.xcodeproj/project.pbxproj +++ b/YooKassaPaymentsDemoApp.xcodeproj/project.pbxproj @@ -7,6 +7,14 @@ objects = { /* Begin PBXBuildFile section */ + 25513834279F376A00BDE805 /* SuperLibrary in Frameworks */ = {isa = PBXBuildFile; productRef = 25513833279F376A00BDE805 /* SuperLibrary */; }; + 25513835279F376A00BDE805 /* SuperLibrary in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 25513833279F376A00BDE805 /* SuperLibrary */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 25E11B36278CAB4300B35ED6 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25E11B35278CAB4300B35ED6 /* Accelerate.framework */; }; + 25E11B38278CAB4A00B35ED6 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25E11B37278CAB4A00B35ED6 /* AVFoundation.framework */; }; + 25E11B3A278CAB7E00B35ED6 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25E11B39278CAB7E00B35ED6 /* AudioToolbox.framework */; }; + 25E11B3C278CAB8900B35ED6 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25E11B3B278CAB8900B35ED6 /* CoreMedia.framework */; }; + 25E11B3E278CAB8E00B35ED6 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25E11B3D278CAB8E00B35ED6 /* MobileCoreServices.framework */; }; + 25E11BE2278F519D00B35ED6 /* CardIO Integration as Development Pod.md in Resources */ = {isa = PBXBuildFile; fileRef = 25E11BE1278F519D00B35ED6 /* CardIO Integration as Development Pod.md */; }; 309BD41A265CE9FA00D4804D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 309BD419265CE9FA00D4804D /* AppDelegate.swift */; }; 309BD423265CE9FC00D4804D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 309BD422265CE9FC00D4804D /* Assets.xcassets */; }; 309BD426265CE9FC00D4804D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 309BD424265CE9FC00D4804D /* LaunchScreen.storyboard */; }; @@ -99,7 +107,7 @@ 309BD509265CF7EA00D4804D /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 309BD4B1265CEED300D4804D /* Localizable.strings */; }; 309BD50A265CF7ED00D4804D /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 309BD4AE265CEED300D4804D /* InfoPlist.strings */; }; 309BD50E265CF8F900D4804D /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 309BD50D265CF8F900D4804D /* Settings.bundle */; }; - ED73462EE4D8338D36FFAF97 /* Pods_YooKassaPaymentsDemoApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96C8285F8FF84882B87AA7D0 /* Pods_YooKassaPaymentsDemoApp.framework */; }; + 5BE893CD9ED1FE41EFF5E4D0 /* Pods_YooKassaPaymentsDemoApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7572A89120D8E94C7AA3C387 /* Pods_YooKassaPaymentsDemoApp.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -111,6 +119,7 @@ files = ( 309BD507265CF67500D4804D /* TMXProfiling.xcframework in Embed Frameworks */, 309BD505265CF67500D4804D /* TMXProfilingConnections.xcframework in Embed Frameworks */, + 25513835279F376A00BDE805 /* SuperLibrary in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -118,6 +127,13 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 25513832279F24B900BDE805 /* SuperLibrary */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = SuperLibrary; sourceTree = ""; }; + 25E11B35278CAB4300B35ED6 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; + 25E11B37278CAB4A00B35ED6 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + 25E11B39278CAB7E00B35ED6 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + 25E11B3B278CAB8900B35ED6 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; + 25E11B3D278CAB8E00B35ED6 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; + 25E11BE1278F519D00B35ED6 /* CardIO Integration as Development Pod.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = "CardIO Integration as Development Pod.md"; sourceTree = SOURCE_ROOT; }; 309BD416265CE9FA00D4804D /* YooKassaPaymentsDemoApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = YooKassaPaymentsDemoApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; 309BD419265CE9FA00D4804D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 309BD422265CE9FC00D4804D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -125,7 +141,6 @@ 309BD427265CE9FC00D4804D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 309BD430265CEBAA00D4804D /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/LaunchScreen.strings; sourceTree = ""; }; 309BD432265CECA000D4804D /* YooKassaPaymentsDemoApp.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = YooKassaPaymentsDemoApp.entitlements; sourceTree = ""; }; - 309BD433265CED7700D4804D /* RootViewController+CardScanning+Carthage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "RootViewController+CardScanning+Carthage.swift"; sourceTree = ""; }; 309BD435265CED7700D4804D /* RootViewController+TokenizationModuleOutput.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "RootViewController+TokenizationModuleOutput.swift"; sourceTree = ""; }; 309BD43B265CED9200D4804D /* TestSettings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestSettings.swift; sourceTree = ""; }; 309BD43C265CED9200D4804D /* ProcessConfirmation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProcessConfirmation.swift; sourceTree = ""; }; @@ -169,7 +184,6 @@ 309BD472265CED9300D4804D /* TextFieldView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldView.swift; sourceTree = ""; }; 309BD473265CED9300D4804D /* ContainerTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContainerTableViewCell.swift; sourceTree = ""; }; 309BD474265CED9300D4804D /* TitledSwitchView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TitledSwitchView.swift; sourceTree = ""; }; - 309BD475265CED9300D4804D /* Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = ""; }; 309BD477265CED9300D4804D /* DevHostService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DevHostService.swift; sourceTree = ""; }; 309BD479265CED9300D4804D /* UserDefaultsStorage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserDefaultsStorage.swift; sourceTree = ""; }; 309BD47A265CED9300D4804D /* KeyValueStoring.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyValueStoring.swift; sourceTree = ""; }; @@ -216,8 +230,8 @@ 309BD502265CF67500D4804D /* TMXProfilingConnections.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = TMXProfilingConnections.xcframework; path = Frameworks/TMXProfilingConnections.xcframework; sourceTree = ""; }; 309BD503265CF67500D4804D /* TMXProfiling.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = TMXProfiling.xcframework; path = Frameworks/TMXProfiling.xcframework; sourceTree = ""; }; 309BD50D265CF8F900D4804D /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = ""; }; + 7572A89120D8E94C7AA3C387 /* Pods_YooKassaPaymentsDemoApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_YooKassaPaymentsDemoApp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 8F8158AE15EC622D52168F1B /* Pods-YooKassaPaymentsDemoApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YooKassaPaymentsDemoApp.debug.xcconfig"; path = "Target Support Files/Pods-YooKassaPaymentsDemoApp/Pods-YooKassaPaymentsDemoApp.debug.xcconfig"; sourceTree = ""; }; - 96C8285F8FF84882B87AA7D0 /* Pods_YooKassaPaymentsDemoApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_YooKassaPaymentsDemoApp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; B49D3919C08A0F73B99DDF1F /* Pods-YooKassaPaymentsDemoApp.adhoc.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YooKassaPaymentsDemoApp.adhoc.xcconfig"; path = "Target Support Files/Pods-YooKassaPaymentsDemoApp/Pods-YooKassaPaymentsDemoApp.adhoc.xcconfig"; sourceTree = ""; }; BBD7622FB34E579612CE1FE8 /* Pods-YooKassaPaymentsDemoApp.appstore.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YooKassaPaymentsDemoApp.appstore.xcconfig"; path = "Target Support Files/Pods-YooKassaPaymentsDemoApp/Pods-YooKassaPaymentsDemoApp.appstore.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -227,18 +241,33 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 25E11B38278CAB4A00B35ED6 /* AVFoundation.framework in Frameworks */, 309BD504265CF67500D4804D /* TMXProfilingConnections.xcframework in Frameworks */, - ED73462EE4D8338D36FFAF97 /* Pods_YooKassaPaymentsDemoApp.framework in Frameworks */, + 25513834279F376A00BDE805 /* SuperLibrary in Frameworks */, + 25E11B36278CAB4300B35ED6 /* Accelerate.framework in Frameworks */, + 25E11B3C278CAB8900B35ED6 /* CoreMedia.framework in Frameworks */, + 25E11B3A278CAB7E00B35ED6 /* AudioToolbox.framework in Frameworks */, 309BD506265CF67500D4804D /* TMXProfiling.xcframework in Frameworks */, + 25E11B3E278CAB8E00B35ED6 /* MobileCoreServices.framework in Frameworks */, + 5BE893CD9ED1FE41EFF5E4D0 /* Pods_YooKassaPaymentsDemoApp.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 25513831279F24B900BDE805 /* Packages */ = { + isa = PBXGroup; + children = ( + 25513832279F24B900BDE805 /* SuperLibrary */, + ); + name = Packages; + sourceTree = ""; + }; 309BD40D265CE9FA00D4804D = { isa = PBXGroup; children = ( + 25513831279F24B900BDE805 /* Packages */, B8050DD2E7DA581F680CB9F3 /* Frameworks */, F5CE47463A88A1107A58ED24 /* Pods */, 309BD417265CE9FA00D4804D /* Products */, @@ -257,8 +286,8 @@ 309BD418265CE9FA00D4804D /* YooKassaPaymentsDemoApp */ = { isa = PBXGroup; children = ( + 25E11BE1278F519D00B35ED6 /* CardIO Integration as Development Pod.md */, 309BD419265CE9FA00D4804D /* AppDelegate.swift */, - 309BD433265CED7700D4804D /* RootViewController+CardScanning+Carthage.swift */, 309BD435265CED7700D4804D /* RootViewController+TokenizationModuleOutput.swift */, 309BD431265CEC2600D4804D /* Resources */, 309BD439265CED9200D4804D /* Source */, @@ -283,7 +312,6 @@ 309BD439265CED9200D4804D /* Source */ = { isa = PBXGroup; children = ( - 309BD475265CED9300D4804D /* Bridging-Header.h */, 309BD4D8265CF2CB00D4804D /* Identifier.swift */, 309BD4DC265CF31700D4804D /* ActionTextDialog */, 309BD457265CED9300D4804D /* AtomicDesign */, @@ -572,9 +600,14 @@ B8050DD2E7DA581F680CB9F3 /* Frameworks */ = { isa = PBXGroup; children = ( + 25E11B3D278CAB8E00B35ED6 /* MobileCoreServices.framework */, + 25E11B3B278CAB8900B35ED6 /* CoreMedia.framework */, + 25E11B39278CAB7E00B35ED6 /* AudioToolbox.framework */, + 25E11B37278CAB4A00B35ED6 /* AVFoundation.framework */, + 25E11B35278CAB4300B35ED6 /* Accelerate.framework */, 309BD503265CF67500D4804D /* TMXProfiling.xcframework */, 309BD502265CF67500D4804D /* TMXProfilingConnections.xcframework */, - 96C8285F8FF84882B87AA7D0 /* Pods_YooKassaPaymentsDemoApp.framework */, + 7572A89120D8E94C7AA3C387 /* Pods_YooKassaPaymentsDemoApp.framework */, ); name = Frameworks; sourceTree = ""; @@ -609,6 +642,9 @@ dependencies = ( ); name = YooKassaPaymentsDemoApp; + packageProductDependencies = ( + 25513833279F376A00BDE805 /* SuperLibrary */, + ); productName = YooKassaPaymentsDemoApp; productReference = 309BD416265CE9FA00D4804D /* YooKassaPaymentsDemoApp.app */; productType = "com.apple.product-type.application"; @@ -624,8 +660,6 @@ TargetAttributes = { 309BD415265CE9FA00D4804D = { CreatedOnToolsVersion = 12.5; - DevelopmentTeam = 2752592HU5; - ProvisioningStyle = Manual; }; }; }; @@ -654,6 +688,7 @@ buildActionMask = 2147483647; files = ( 309BD426265CE9FC00D4804D /* LaunchScreen.storyboard in Resources */, + 25E11BE2278F519D00B35ED6 /* CardIO Integration as Development Pod.md in Resources */, 309BD509265CF7EA00D4804D /* Localizable.strings in Resources */, 309BD50E265CF8F900D4804D /* Settings.bundle in Resources */, 309BD423265CE9FC00D4804D /* Assets.xcassets in Resources */, @@ -997,9 +1032,8 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = YooKassaPaymentsDemoApp/Resources/YooKassaPaymentsDemoApp.entitlements; - CODE_SIGN_IDENTITY = "iPhone Distribution"; CODE_SIGN_STYLE = Manual; - DEVELOPMENT_TEAM = 2752592HU5; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = YooKassaPaymentsDemoApp/Resources/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -1121,6 +1155,13 @@ defaultConfigurationName = AppStore; }; /* End XCConfigurationList section */ + +/* Begin XCSwiftPackageProductDependency section */ + 25513833279F376A00BDE805 /* SuperLibrary */ = { + isa = XCSwiftPackageProductDependency; + productName = SuperLibrary; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 309BD40E265CE9FA00D4804D /* Project object */; } diff --git a/YooKassaPaymentsDemoApp/AppDelegate.swift b/YooKassaPaymentsDemoApp/AppDelegate.swift index 3fe402a4..194cf852 100644 --- a/YooKassaPaymentsDemoApp/AppDelegate.swift +++ b/YooKassaPaymentsDemoApp/AppDelegate.swift @@ -1,3 +1,4 @@ +import SuperLibrary import UIKit import YooKassaPayments @@ -9,6 +10,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate { _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { + // Objc source demo + _ = Worker() + // --- window = UIWindow(frame: UIScreen.main.bounds) let viewController = UINavigationController(rootViewController: RootViewController()) window?.rootViewController = viewController diff --git a/YooKassaPaymentsDemoApp/Resources/Info.plist b/YooKassaPaymentsDemoApp/Resources/Info.plist index 849f5fdc..8b23fbd8 100644 --- a/YooKassaPaymentsDemoApp/Resources/Info.plist +++ b/YooKassaPaymentsDemoApp/Resources/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 6.4.0 + 6.6.0 CFBundleURLTypes diff --git a/YooKassaPaymentsDemoApp/Source/UserStories/Root/RootViewController.swift b/YooKassaPaymentsDemoApp/Source/UserStories/Root/RootViewController.swift index 89c9e416..67b3fda6 100644 --- a/YooKassaPaymentsDemoApp/Source/UserStories/Root/RootViewController.swift +++ b/YooKassaPaymentsDemoApp/Source/UserStories/Root/RootViewController.swift @@ -1,3 +1,4 @@ +import CardIO import MessageUI import SafariServices import UIKit @@ -5,7 +6,6 @@ import WebKit import YooKassaPayments final class RootViewController: UIViewController { - public static func makeModule() -> UIViewController { return RootViewController(nibName: nil, bundle: nil) } @@ -352,7 +352,7 @@ final class RootViewController: UIViewController { amount: amount, tokenizationSettings: makeTokenizationSettings(), testModeSettings: testSettings, - cardScanning: nil, + cardScanning: self, applePayMerchantIdentifier: "merchant.ru.yoo.sdk.kassa.payments", isLoggingEnabled: true, userPhoneNumber: "7", @@ -670,3 +670,38 @@ private extension RootViewController { static let documentationPathEn = "https://yookassa.ru/en/developers/using-api/using-sdks" } } + +// MARK: - CardIOPaymentViewControllerDelegate + +extension RootViewController: CardIOPaymentViewControllerDelegate { + public func userDidProvide( + _ cardInfo: CardIOCreditCardInfo!, + in paymentViewController: CardIOPaymentViewController! + ) { + let scannedCardInfo = ScannedCardInfo( + number: cardInfo.cardNumber, + expiryMonth: "\(cardInfo.expiryMonth)", + expiryYear: "\(cardInfo.expiryYear)" + ) + cardScanningDelegate?.cardScannerDidFinish(scannedCardInfo) + } + + public func userDidCancel(_ paymentViewController: CardIOPaymentViewController!) { + cardScanningDelegate?.cardScannerDidFinish(nil) + } +} + +extension RootViewController: CardScanning { + var cardScanningViewController: UIViewController? { + guard let controller = CardIOPaymentViewController(paymentDelegate: self) else { + return nil + } + + controller.suppressScanConfirmation = true + controller.hideCardIOLogo = true + controller.disableManualEntryButtons = true + controller.collectCVV = false + + return controller + } +}