react-native-plaid-link-sdk 8.0.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -6
- package/android/build.gradle +1 -1
- package/android/src/main/AndroidManifest.xml +1 -1
- package/ios/.DS_Store +0 -0
- package/ios/RNLinksdk.m +10 -2
- package/ios/RNLinksdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/RNLinksdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/RNLinksdk.xcodeproj/project.xcworkspace/xcuserdata/wkiefer.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/RNLinksdk.xcodeproj/xcuserdata/wkiefer.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/package.json +1 -1
- package/react-native-plaid-link-sdk.podspec +1 -1
- package/android/.DS_Store +0 -0
- package/android/.gradle/5.6.4/fileChanges/last-build.bin +0 -0
- package/android/.gradle/5.6.4/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/5.6.4/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/5.6.4/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/caches/build_file_checksums.ser +0 -0
- package/android/.idea/codeStyles/Project.xml +0 -116
- package/android/.idea/compiler.xml +0 -6
- package/android/.idea/gradle.xml +0 -20
- package/android/.idea/jarRepositories.xml +0 -35
- package/android/.idea/libraries/Gradle__androidx_activity_activity_1_1_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_activity_activity_ktx_1_1_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_annotation_annotation_experimental_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_2_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_2_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_1_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_cardview_cardview_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_collection_collection_1_1_0.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_collection_collection_ktx_1_1_0.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_2_0_2_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_solver_2_0_2.xml +0 -9
- package/android/.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_1_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_core_core_1_3_1_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_core_core_ktx_1_1_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_fragment_fragment_1_2_5_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_fragment_fragment_ktx_1_2_5_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_2_0.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_extensions_2_2_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_2_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_2_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_ktx_2_2_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_process_2_2_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_2_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_ktx_2_2_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_service_2_2_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_2_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_ktx_2_2_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_savedstate_2_2_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_recyclerview_recyclerview_1_1_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_room_room_common_2_2_5.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_room_room_ktx_2_2_5_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_room_room_runtime_2_2_5_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_sqlite_sqlite_2_1_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_sqlite_sqlite_framework_2_1_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_swiperefreshlayout_swiperefreshlayout_1_0_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_transition_transition_1_2_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_viewpager2_viewpager2_1_0_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_work_work_runtime_2_4_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_work_work_runtime_ktx_2_4_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_work_work_rxjava2_2_4_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__com_facebook_fbjni_fbjni_java_only_0_0_3.xml +0 -13
- package/android/.idea/libraries/Gradle__com_facebook_fresco_drawee_2_0_0_aar.xml +0 -15
- package/android/.idea/libraries/Gradle__com_facebook_fresco_fbcore_2_0_0_aar.xml +0 -18
- package/android/.idea/libraries/Gradle__com_facebook_fresco_fresco_2_0_0_aar.xml +0 -18
- package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_2_0_0_aar.xml +0 -18
- package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_base_2_0_0_aar.xml +0 -18
- package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_okhttp3_2_0_0_aar.xml +0 -15
- package/android/.idea/libraries/Gradle__com_facebook_fresco_nativeimagefilters_2_0_0_aar.xml +0 -15
- package/android/.idea/libraries/Gradle__com_facebook_fresco_nativeimagetranscoder_2_0_0_aar.xml +0 -15
- package/android/.idea/libraries/Gradle__com_facebook_infer_annotation_infer_annotation_0_11_2.xml +0 -13
- package/android/.idea/libraries/Gradle__com_facebook_react_react_native_0_63_4_aar.xml +0 -18
- package/android/.idea/libraries/Gradle__com_facebook_soloader_annotation_0_9_0.xml +0 -13
- package/android/.idea/libraries/Gradle__com_facebook_soloader_nativeloader_0_9_0.xml +0 -13
- package/android/.idea/libraries/Gradle__com_facebook_soloader_soloader_0_9_0_aar.xml +0 -15
- package/android/.idea/libraries/Gradle__com_facebook_yoga_proguard_annotations_1_14_1.xml +0 -13
- package/android/.idea/libraries/Gradle__com_google_android_material_material_1_2_1_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_3_0_2.xml +0 -13
- package/android/.idea/libraries/Gradle__com_google_code_gson_gson_2_8_6.xml +0 -13
- package/android/.idea/libraries/Gradle__com_google_dagger_dagger_2_29_1.xml +0 -13
- package/android/.idea/libraries/Gradle__com_google_dagger_dagger_android_2_29_1_aar.xml +0 -15
- package/android/.idea/libraries/Gradle__com_google_dagger_dagger_lint_aar_2_29_1_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__com_google_guava_listenablefuture_1_0.xml +0 -13
- package/android/.idea/libraries/Gradle__com_jakewharton_rxrelay2_rxrelay_2_1_1.xml +0 -13
- package/android/.idea/libraries/Gradle__com_plaid_link_sdk_core_3_2_2_aar.xml +0 -12
- package/android/.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_4_10_0_RC1.xml +0 -13
- package/android/.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_urlconnection_3_12_12.xml +0 -13
- package/android/.idea/libraries/Gradle__com_squareup_okio_okio_2_9_0.xml +0 -13
- package/android/.idea/libraries/Gradle__com_squareup_retrofit2_adapter_rxjava2_2_9_0.xml +0 -13
- package/android/.idea/libraries/Gradle__com_squareup_retrofit2_converter_gson_2_9_0.xml +0 -13
- package/android/.idea/libraries/Gradle__com_squareup_retrofit2_retrofit_2_9_0.xml +0 -13
- package/android/.idea/libraries/Gradle__com_uber_autodispose_autodispose_1_4_0.xml +0 -13
- package/android/.idea/libraries/Gradle__com_uber_autodispose_autodispose_lifecycle_1_4_0.xml +0 -13
- package/android/.idea/libraries/Gradle__io_reactivex_rxjava2_rxandroid_2_1_1_aar.xml +0 -15
- package/android/.idea/libraries/Gradle__io_reactivex_rxjava2_rxjava_2_2_10.xml +0 -13
- package/android/.idea/libraries/Gradle__io_reactivex_rxjava2_rxkotlin_2_4_0.xml +0 -13
- package/android/.idea/libraries/Gradle__javax_inject_javax_inject_1.xml +0 -13
- package/android/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml +0 -13
- package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_android_extensions_runtime_1_4_10.xml +0 -13
- package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_reflect_1_4_10.xml +0 -13
- package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_4_10.xml +0 -13
- package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_4_10.xml +0 -13
- package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk7_1_4_10.xml +0 -13
- package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk8_1_4_10.xml +0 -13
- package/android/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_android_1_3_4.xml +0 -13
- package/android/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_core_1_3_4.xml +0 -13
- package/android/.idea/libraries/Gradle__org_reactivestreams_reactive_streams_1_0_3.xml +0 -13
- package/android/.idea/markdown-navigator-enh.xml +0 -29
- package/android/.idea/markdown-navigator.xml +0 -55
- package/android/.idea/misc.xml +0 -9
- package/android/.idea/modules.xml +0 -8
- package/android/.idea/runConfigurations.xml +0 -12
- package/android/.idea/vcs.xml +0 -6
- package/android/.idea/workspace.xml +0 -86
- package/android/android.iml +0 -230
- package/android/local.properties +0 -8
- package/android/src/.DS_Store +0 -0
- package/ios/RNLinksdk.m-e +0 -911
package/ios/RNLinksdk.m-e
DELETED
|
@@ -1,911 +0,0 @@
|
|
|
1
|
-
#import "RNLinksdk.h"
|
|
2
|
-
|
|
3
|
-
#import <Foundation/Foundation.h>
|
|
4
|
-
#import <LinkKit/LinkKit.h>
|
|
5
|
-
#import <React/RCTConvert.h>
|
|
6
|
-
#import <React/RCTUtils.h>
|
|
7
|
-
|
|
8
|
-
#import <objc/runtime.h>
|
|
9
|
-
|
|
10
|
-
static NSString* const kRNLinkKitConfigPublicKeyKey = @"publicKey";
|
|
11
|
-
static NSString* const kRNLinkKitConfigEnvKey = @"environment";
|
|
12
|
-
static NSString* const kRNLinkKitConfigProductsKey = @"products";
|
|
13
|
-
static NSString* const kRNLinkKitConfigClientNameKey = @"clientName";
|
|
14
|
-
static NSString* const kRNLinkKitConfigWebhookKey = @"webhook";
|
|
15
|
-
static NSString* const kRNLinkKitConfigLinkCustomizationName = @"linkCustomizationName";
|
|
16
|
-
static NSString* const kRNLinkKitConfigLinkTokenKey = @"token";
|
|
17
|
-
static NSString* const kRNLinkKitConfigSelectAccountKey = @"selectAccount";
|
|
18
|
-
static NSString* const kRNLinkKitConfigUserLegalNameKey = @"userLegalName";
|
|
19
|
-
static NSString* const kRNLinkKitConfigUserEmailAddressKey = @"userEmailAddress";
|
|
20
|
-
static NSString* const kRNLinkKitConfigUserPhoneNumberKey = @"userPhoneNumber";
|
|
21
|
-
static NSString* const kRNLinkKitConfigAccountSubtypes = @"accountSubtypes";
|
|
22
|
-
static NSString* const kRNLinkKitConfigCountryCodesKey = @"countryCodes";
|
|
23
|
-
static NSString* const kRNLinkKitConfigLanguageKey = @"language";
|
|
24
|
-
static NSString* const kRNLinkKitConfigInstitutionKey = @"institution";
|
|
25
|
-
static NSString* const kRNLinkKitConfigNoLoadingStateKey = @"noLoadingState";
|
|
26
|
-
static NSString* const kRNLinkKitConfigLongtailAuthKey = @"longtailAuth";
|
|
27
|
-
static NSString* const kRNLinkKitConfigApiVersionKey = @"apiVersion";
|
|
28
|
-
static NSString* const kRNLinkKitConfigOAuthRedirectUriKeyPath = @"oauthConfiguration.redirectUri";
|
|
29
|
-
static NSString* const kRNLinkKitConfigOAuthNonceKeyPath = @"oauthConfiguration.nonce";
|
|
30
|
-
|
|
31
|
-
static NSString* const kRNLinkKitOnEventEvent = @"onEvent";
|
|
32
|
-
static NSString* const kRNLinkKitEventErrorKey = @"error";
|
|
33
|
-
static NSString* const kRNLinkKitEventNameKey = @"event";
|
|
34
|
-
static NSString* const kRNLinkKitEventMetadataKey = @"metadata";
|
|
35
|
-
static NSString* const kRNLinkKitVersionConstant = @"version";
|
|
36
|
-
|
|
37
|
-
NSString* const kRNLinkKitLinkTokenPrefix = @"link-";
|
|
38
|
-
NSString* const kRNLinkKitItemAddTokenPrefix = @"item-add-";
|
|
39
|
-
NSString* const kRNLinkKitPaymentTokenPrefix = @"payment";
|
|
40
|
-
NSString* const kRNLinkKitDepositSwitchTokenPrefix = @"deposit-switch-";
|
|
41
|
-
NSString* const kRNLinkKitPublicTokenPrefix = @"public-";
|
|
42
|
-
|
|
43
|
-
@interface RNLinksdk ()
|
|
44
|
-
@property (nonatomic, strong) id<PLKHandler> linkHandler;
|
|
45
|
-
@property (nonatomic, strong) UIViewController* presentingViewController;
|
|
46
|
-
@property (nonatomic, strong) RCTResponseSenderBlock successCallback;
|
|
47
|
-
@property (nonatomic, strong) RCTResponseSenderBlock exitCallback;
|
|
48
|
-
@property (nonatomic, assign) BOOL hasObservers;
|
|
49
|
-
@property (nonatomic, copy) NSString *institutionID;
|
|
50
|
-
@property (nonatomic, nullable, strong) NSError *creationError;
|
|
51
|
-
@end
|
|
52
|
-
|
|
53
|
-
#pragma mark -
|
|
54
|
-
|
|
55
|
-
// Category to ensure both the old, typo spelling of `insitution` and
|
|
56
|
-
// the corrected spelling `institution` are visible to the implementation
|
|
57
|
-
// to allow compiling against any LinkKit dependency
|
|
58
|
-
@interface PLKSuccessMetadata (InstitutionTypoFix)
|
|
59
|
-
|
|
60
|
-
- (PLKInstitution * __nonnull)institution;
|
|
61
|
-
- (PLKInstitution * __nonnull)insitution;
|
|
62
|
-
|
|
63
|
-
@end
|
|
64
|
-
|
|
65
|
-
// Class to have a distinct +load method to hook into the runtime before
|
|
66
|
-
// SDK logic executes
|
|
67
|
-
@interface PLKSuccessMetadataTypoFix : NSObject
|
|
68
|
-
|
|
69
|
-
@end
|
|
70
|
-
|
|
71
|
-
@implementation PLKSuccessMetadataTypoFix
|
|
72
|
-
|
|
73
|
-
+ (void)load {
|
|
74
|
-
static dispatch_once_t onceToken;
|
|
75
|
-
// dispatch_once out of an abundance of caution in case +load is ever called multiple times
|
|
76
|
-
dispatch_once(&onceToken, ^{
|
|
77
|
-
Class targetClass = NSClassFromString(@"PLKSuccessMetadata");
|
|
78
|
-
if (targetClass == Nil) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
SEL typoSel = NSSelectorFromString(@"insitution");
|
|
83
|
-
SEL correctSel = NSSelectorFromString(@"institution");
|
|
84
|
-
|
|
85
|
-
BOOL respondsToTypoSel = class_respondsToSelector(targetClass, typoSel);
|
|
86
|
-
BOOL respondsToCorrectSel = class_respondsToSelector(targetClass, correctSel);
|
|
87
|
-
|
|
88
|
-
BOOL respondsToBoth = respondsToCorrectSel && respondsToTypoSel;
|
|
89
|
-
|
|
90
|
-
// If PLKSuccessMetadata responds to both, no swizzling is necessary
|
|
91
|
-
if (respondsToBoth) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
BOOL respondsToNeither = !(respondsToCorrectSel || respondsToTypoSel);
|
|
96
|
-
// If PLKSuccessMetadata responds to neither, swizzling cannot fix this
|
|
97
|
-
if (respondsToNeither) {
|
|
98
|
-
NSString *githubIssueURLString = @"https://github.com/plaid/react-native-plaid-link-sdk/issues/new?assignees=&labels=&template=bug_report.md&title=";
|
|
99
|
-
NSAssert(NO, @"%@ does not respond to correctly spelled %@ or legacy, typo %@. This is a bug in either react-native-plaid-link-sdk, or LinkKit. Please file an issue at: %@", NSStringFromClass(targetClass), NSStringFromSelector(correctSel), NSStringFromSelector(typoSel), githubIssueURLString);
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
SEL existingSel = respondsToCorrectSel ? correctSel : typoSel;
|
|
104
|
-
SEL missingSel = respondsToTypoSel ? correctSel : typoSel;
|
|
105
|
-
|
|
106
|
-
Method method = class_getInstanceMethod(targetClass, existingSel);
|
|
107
|
-
const char* types = method_getTypeEncoding(method);
|
|
108
|
-
IMP implementation = class_getMethodImplementation(targetClass, existingSel);
|
|
109
|
-
class_addMethod(targetClass, missingSel, implementation, types);
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
@end
|
|
114
|
-
|
|
115
|
-
@implementation RNLinksdk
|
|
116
|
-
|
|
117
|
-
RCT_EXPORT_MODULE();
|
|
118
|
-
|
|
119
|
-
+ (NSString*)sdkVersion {
|
|
120
|
-
return @"8.0.0"; // SDK_VERSION
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
+ (NSString*)objCBridgeVersion {
|
|
124
|
-
return @"1.1.0";
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
+ (BOOL)requiresMainQueueSetup
|
|
128
|
-
{
|
|
129
|
-
// Because LinkKit relies on UIKit.
|
|
130
|
-
return YES;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
- (dispatch_queue_t)methodQueue
|
|
134
|
-
{
|
|
135
|
-
return dispatch_get_main_queue();
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
- (NSArray<NSString *> *)supportedEvents
|
|
139
|
-
{
|
|
140
|
-
return @[kRNLinkKitOnEventEvent];
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
- (NSDictionary *)constantsToExport {
|
|
144
|
-
return @{
|
|
145
|
-
kRNLinkKitVersionConstant: [NSString stringWithFormat:@"%s+%.0f", LinkKitVersionString, LinkKitVersionNumber],
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
- (void)startObserving {
|
|
150
|
-
self.hasObservers = YES;
|
|
151
|
-
[super startObserving];
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
- (void)stopObserving {
|
|
155
|
-
[super stopObserving];
|
|
156
|
-
self.hasObservers = NO;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
RCT_EXPORT_METHOD(continueFromRedirectUriString:(NSString *)redirectUriString) {
|
|
160
|
-
NSURL *receivedRedirectUri = (id)redirectUriString == [NSNull null] ? nil : [NSURL URLWithString:redirectUriString];
|
|
161
|
-
|
|
162
|
-
if (receivedRedirectUri && self.linkHandler) {
|
|
163
|
-
[self.linkHandler continueFromRedirectUri:receivedRedirectUri];
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
RCT_EXPORT_METHOD(create:(NSDictionary*)configuration) {
|
|
168
|
-
// Configuration
|
|
169
|
-
NSString *linkTokenInput = [RCTConvert NSString:configuration[kRNLinkKitConfigLinkTokenKey]];
|
|
170
|
-
NSString *institution = [RCTConvert NSString:configuration[kRNLinkKitConfigInstitutionKey]];
|
|
171
|
-
|
|
172
|
-
BOOL isUsingLinkToken = [linkTokenInput length] && [linkTokenInput hasPrefix:kRNLinkKitLinkTokenPrefix];
|
|
173
|
-
|
|
174
|
-
__weak typeof(self) weakSelf = self;
|
|
175
|
-
void (^onSuccess)(PLKLinkSuccess *) = ^(PLKLinkSuccess *success) {
|
|
176
|
-
__typeof(weakSelf) strongSelf = weakSelf;
|
|
177
|
-
|
|
178
|
-
if (strongSelf.successCallback) {
|
|
179
|
-
NSDictionary<NSString*, id> *jsMetadata = [RNLinksdk dictionaryFromSuccess:success];
|
|
180
|
-
strongSelf.successCallback(@[jsMetadata]);
|
|
181
|
-
strongSelf.successCallback = nil;
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
void (^onExit)(PLKLinkExit *) = ^(PLKLinkExit *exit) {
|
|
186
|
-
__typeof(weakSelf) strongSelf = weakSelf;
|
|
187
|
-
|
|
188
|
-
if (strongSelf.exitCallback) {
|
|
189
|
-
NSDictionary *exitMetadata = [RNLinksdk dictionaryFromExit:exit];
|
|
190
|
-
if (exit.error) {
|
|
191
|
-
strongSelf.exitCallback(@[exitMetadata[@"error"], exitMetadata]);
|
|
192
|
-
} else {
|
|
193
|
-
strongSelf.exitCallback(@[[NSNull null], exitMetadata]);
|
|
194
|
-
}
|
|
195
|
-
strongSelf.exitCallback = nil;
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
void (^onEvent)(PLKLinkEvent *) = ^(PLKLinkEvent *event) {
|
|
200
|
-
__typeof(weakSelf) strongSelf = weakSelf;
|
|
201
|
-
if (strongSelf.hasObservers) {
|
|
202
|
-
NSDictionary *eventDictionary = [RNLinksdk dictionaryFromEvent:event];
|
|
203
|
-
[strongSelf sendEventWithName:kRNLinkKitOnEventEvent
|
|
204
|
-
body:eventDictionary];
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
if (isUsingLinkToken) {
|
|
209
|
-
PLKLinkTokenConfiguration *config = [self getLinkTokenConfiguration:configuration
|
|
210
|
-
onSuccessHandler:onSuccess];
|
|
211
|
-
config.onEvent = onEvent;
|
|
212
|
-
config.onExit = onExit;
|
|
213
|
-
config.noLoadingState = configuration[kRNLinkKitConfigNoLoadingStateKey];
|
|
214
|
-
|
|
215
|
-
NSError *creationError = nil;
|
|
216
|
-
self.linkHandler = [PLKPlaid createWithLinkTokenConfiguration:config
|
|
217
|
-
error:&creationError];
|
|
218
|
-
self.creationError = creationError;
|
|
219
|
-
} else {
|
|
220
|
-
PLKLinkPublicKeyConfiguration *config = [self getLegacyLinkConfiguration:configuration
|
|
221
|
-
onSuccessHandler:onSuccess];
|
|
222
|
-
config.onEvent = onEvent;
|
|
223
|
-
config.onExit = onExit;
|
|
224
|
-
NSError *creationError = nil;
|
|
225
|
-
self.linkHandler = [PLKPlaid createWithLinkPublicKeyConfiguration:config
|
|
226
|
-
error:&creationError];
|
|
227
|
-
self.creationError = creationError;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
if ([institution length] > 0) {
|
|
231
|
-
self.institutionID = institution;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
RCT_EXPORT_METHOD(open:(RCTResponseSenderBlock)onSuccess :(RCTResponseSenderBlock)onExit) {
|
|
236
|
-
if (self.linkHandler) {
|
|
237
|
-
self.successCallback = onSuccess;
|
|
238
|
-
self.exitCallback = onExit;
|
|
239
|
-
self.presentingViewController = RCTPresentedViewController();
|
|
240
|
-
NSDictionary *options = self.institutionID.length > 0 ? @{@"institution_id": self.institutionID} : @{};
|
|
241
|
-
|
|
242
|
-
__weak typeof(self) weakSelf = self;
|
|
243
|
-
void(^presentationHandler)(UIViewController *) = ^(UIViewController *linkViewController) {
|
|
244
|
-
[weakSelf.presentingViewController presentViewController:linkViewController animated:YES completion:nil];
|
|
245
|
-
};
|
|
246
|
-
void(^dismissalHandler)(UIViewController *) = ^(UIViewController *linkViewController) {
|
|
247
|
-
[weakSelf dismiss];
|
|
248
|
-
};
|
|
249
|
-
[self.linkHandler openWithPresentationHandler:presentationHandler dismissalHandler:dismissalHandler options:options];
|
|
250
|
-
} else {
|
|
251
|
-
id error = self.creationError ? RCTJSErrorFromNSError(self.creationError) : RCTMakeError(@"create was not called", nil, nil);
|
|
252
|
-
onExit(@[error]);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
RCT_EXPORT_METHOD(dismiss) {
|
|
257
|
-
[self.presentingViewController dismissViewControllerAnimated:YES
|
|
258
|
-
completion:nil];
|
|
259
|
-
self.presentingViewController = nil;
|
|
260
|
-
self.linkHandler = nil;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
- (PLKLinkTokenConfiguration *)getLinkTokenConfiguration:(NSDictionary *)configuration
|
|
264
|
-
onSuccessHandler:(void(^)(PLKLinkSuccess *))onSuccessHandler {
|
|
265
|
-
NSString *linkTokenInput = [RCTConvert NSString:configuration[kRNLinkKitConfigLinkTokenKey]];
|
|
266
|
-
|
|
267
|
-
return [PLKLinkTokenConfiguration createWithToken:linkTokenInput onSuccess:onSuccessHandler];
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
- (PLKLinkPublicKeyConfiguration *)getLegacyLinkConfiguration:(NSDictionary *)configuration
|
|
271
|
-
onSuccessHandler:(void(^)(PLKLinkSuccess *))onSuccessHandler {
|
|
272
|
-
NSString *key = [RCTConvert NSString:configuration[kRNLinkKitConfigPublicKeyKey]];
|
|
273
|
-
NSString *tokenInput = [RCTConvert NSString:configuration[kRNLinkKitConfigLinkTokenKey]];
|
|
274
|
-
NSString *env = [RCTConvert NSString:configuration[kRNLinkKitConfigEnvKey]];
|
|
275
|
-
NSArray<NSString*> *productsInput = [RCTConvert NSStringArray:configuration[kRNLinkKitConfigProductsKey]];
|
|
276
|
-
NSString *clientName = [RCTConvert NSString:configuration[kRNLinkKitConfigClientNameKey]];
|
|
277
|
-
NSString *webhook = [RCTConvert NSString:configuration[kRNLinkKitConfigWebhookKey]];
|
|
278
|
-
NSString *linkCustomizationName = [RCTConvert NSString:configuration[kRNLinkKitConfigLinkCustomizationName]];
|
|
279
|
-
NSString *userLegalName = [RCTConvert NSString:configuration[kRNLinkKitConfigUserLegalNameKey]];
|
|
280
|
-
NSString *userEmailAddress = [RCTConvert NSString:configuration[kRNLinkKitConfigUserEmailAddressKey]];
|
|
281
|
-
NSString *userPhoneNumber = [RCTConvert NSString:configuration[kRNLinkKitConfigUserPhoneNumberKey]];
|
|
282
|
-
NSString *oauthRedirectUriInput = [configuration valueForKeyPath:kRNLinkKitConfigOAuthRedirectUriKeyPath];
|
|
283
|
-
NSString *oauthRedirectUriString = [RCTConvert NSString:oauthRedirectUriInput];
|
|
284
|
-
NSString *oauthNonceInput = [configuration valueForKeyPath:kRNLinkKitConfigOAuthNonceKeyPath];
|
|
285
|
-
NSString *oauthNonce = [RCTConvert NSString:oauthNonceInput];
|
|
286
|
-
id accountSubtypesInput = configuration[kRNLinkKitConfigAccountSubtypes];
|
|
287
|
-
NSArray<NSDictionary<NSString*, NSString *>*> *accountSubtypeDictionaries = [RCTConvert NSDictionaryArray:accountSubtypesInput];
|
|
288
|
-
NSArray<NSString*> *countryCodes = [RCTConvert NSStringArray:configuration[kRNLinkKitConfigCountryCodesKey]];
|
|
289
|
-
NSString *language = [RCTConvert NSString:configuration[kRNLinkKitConfigLanguageKey]];
|
|
290
|
-
|
|
291
|
-
PLKLinkPublicKeyConfigurationToken *token;
|
|
292
|
-
BOOL isPaymentToken = [tokenInput hasPrefix:kRNLinkKitPaymentTokenPrefix];
|
|
293
|
-
BOOL isItemAddToken = [tokenInput hasPrefix:kRNLinkKitItemAddTokenPrefix];
|
|
294
|
-
BOOL isDepositSwitchToken = [tokenInput hasPrefix:kRNLinkKitDepositSwitchTokenPrefix];
|
|
295
|
-
BOOL isPublicToken = [tokenInput hasPrefix:kRNLinkKitPublicTokenPrefix];
|
|
296
|
-
if (isPaymentToken) {
|
|
297
|
-
token = [PLKLinkPublicKeyConfigurationToken createWithPaymentToken:tokenInput publicKey:key];
|
|
298
|
-
} else if (isItemAddToken) {
|
|
299
|
-
token = [PLKLinkPublicKeyConfigurationToken createWithPublicToken:tokenInput publicKey:key];
|
|
300
|
-
} else if (isDepositSwitchToken) {
|
|
301
|
-
token = [PLKLinkPublicKeyConfigurationToken createWithDepositSwitchToken:tokenInput publicKey:key];
|
|
302
|
-
} else if (isPublicToken) {
|
|
303
|
-
token = [PLKLinkPublicKeyConfigurationToken createWithPublicToken:tokenInput publicKey:key];
|
|
304
|
-
} else {
|
|
305
|
-
token = [PLKLinkPublicKeyConfigurationToken createWithPublicKey:key];
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
PLKEnvironment environment = [RNLinksdk environmentFromString:env];
|
|
309
|
-
NSArray<NSNumber *> *products = [RNLinksdk productsArrayFromProductsStringArray:productsInput];
|
|
310
|
-
PLKLinkPublicKeyConfiguration *linkConfiguration = [[PLKLinkPublicKeyConfiguration alloc] initWithClientName:clientName
|
|
311
|
-
environment:environment
|
|
312
|
-
products:products
|
|
313
|
-
language:language
|
|
314
|
-
token:token
|
|
315
|
-
countryCodes:countryCodes
|
|
316
|
-
onSuccess:onSuccessHandler];
|
|
317
|
-
if ([linkCustomizationName length] > 0) {
|
|
318
|
-
linkConfiguration.linkCustomizationName = linkCustomizationName;
|
|
319
|
-
}
|
|
320
|
-
if ([webhook length] > 0) {
|
|
321
|
-
linkConfiguration.webhook = [NSURL URLWithString:webhook];
|
|
322
|
-
}
|
|
323
|
-
if ([userLegalName length] > 0) {
|
|
324
|
-
linkConfiguration.userLegalName = userLegalName;
|
|
325
|
-
}
|
|
326
|
-
if ([userEmailAddress length] > 0) {
|
|
327
|
-
linkConfiguration.userEmailAddress = userEmailAddress;
|
|
328
|
-
}
|
|
329
|
-
if ([userPhoneNumber length] > 0) {
|
|
330
|
-
linkConfiguration.userPhoneNumber = userPhoneNumber;
|
|
331
|
-
}
|
|
332
|
-
if ([oauthRedirectUriString length] > 0 && [oauthNonce length] > 0) {
|
|
333
|
-
NSURL* oauthRedirectUri = [NSURL URLWithString:oauthRedirectUriString];
|
|
334
|
-
linkConfiguration.oauthConfiguration = [PLKOAuthNonceConfiguration createWithNonce:oauthNonce
|
|
335
|
-
redirectUri:oauthRedirectUri];
|
|
336
|
-
}
|
|
337
|
-
if ([accountSubtypeDictionaries count] > 0) {
|
|
338
|
-
linkConfiguration.accountSubtypes = [RNLinksdk accountSubtypesArrayFromAccountSubtypeDictionaries:accountSubtypeDictionaries];
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
return linkConfiguration;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
#pragma mark - Bridging
|
|
345
|
-
|
|
346
|
-
+ (PLKEnvironment)environmentFromString:(NSString *)string {
|
|
347
|
-
if ([string isEqualToString:@"production"]) {
|
|
348
|
-
return PLKEnvironmentProduction;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
if ([string isEqualToString:@"sandbox"]) {
|
|
352
|
-
return PLKEnvironmentSandbox;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
if ([string isEqualToString:@"development"]) {
|
|
356
|
-
return PLKEnvironmentDevelopment;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
// Default to Development
|
|
360
|
-
NSLog(@"Unexpected environment string value: %@. Expected one of: production, sandbox, or development.", string);
|
|
361
|
-
return PLKEnvironmentDevelopment;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
+ (NSArray<NSNumber *> *)productsArrayFromProductsStringArray:(NSArray<NSString *> *)productsStringArray {
|
|
365
|
-
NSMutableArray<NSNumber *> *results = [NSMutableArray arrayWithCapacity:productsStringArray.count];
|
|
366
|
-
|
|
367
|
-
for (NSString *productString in productsStringArray) {
|
|
368
|
-
NSNumber *product = [self productFromProductString:productString];
|
|
369
|
-
if (product) {
|
|
370
|
-
[results addObject:product];
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
return [results copy];
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
+ (NSNumber * __nullable)productFromProductString:(NSString *)productString {
|
|
378
|
-
NSDictionary *productStringMap = @{
|
|
379
|
-
@"auth": @(PLKProductAuth),
|
|
380
|
-
@"identity": @(PLKProductIdentity),
|
|
381
|
-
@"income": @(PLKProductIncome),
|
|
382
|
-
@"transactions": @(PLKProductTransactions),
|
|
383
|
-
@"assets": @(PLKProductAssets),
|
|
384
|
-
@"liabilities": @(PLKProductLiabilities),
|
|
385
|
-
@"investments": @(PLKProductInvestments),
|
|
386
|
-
@"deposit_switch": @(PLKProductDepositSwitch),
|
|
387
|
-
};
|
|
388
|
-
return productStringMap[productString.lowercaseString];
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
+ (NSArray<id<PLKAccountSubtype>> *)accountSubtypesArrayFromAccountSubtypeDictionaries:(NSArray<NSDictionary<NSString *, NSString *> *> *)accountSubtypeDictionaries {
|
|
392
|
-
__block NSMutableArray<id<PLKAccountSubtype>> *results = [NSMutableArray array];
|
|
393
|
-
|
|
394
|
-
for (NSDictionary *accountSubtypeDictionary in accountSubtypeDictionaries) {
|
|
395
|
-
NSString *type = accountSubtypeDictionary[@"type"];
|
|
396
|
-
NSString *subtype = accountSubtypeDictionary[@"subtype"];
|
|
397
|
-
id<PLKAccountSubtype> result = [self accountSubtypeFromTypeString:type subtypeString:subtype];
|
|
398
|
-
if (result) {
|
|
399
|
-
[results addObject:result];
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
return [results copy];
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
+ (id<PLKAccountSubtype>)accountSubtypeFromTypeString:(NSString *)typeString
|
|
407
|
-
subtypeString:(NSString *)subtypeString {
|
|
408
|
-
NSString *normalizedTypeString = typeString.lowercaseString;
|
|
409
|
-
NSString *normalizedSubtypeString = subtypeString.lowercaseString;
|
|
410
|
-
if ([normalizedTypeString isEqualToString:@"other"]) {
|
|
411
|
-
if ([normalizedSubtypeString isEqualToString:@"all"]) {
|
|
412
|
-
return [PLKAccountSubtypeOther createWithValue:PLKAccountSubtypeValueOtherAll];
|
|
413
|
-
} else if ([normalizedSubtypeString isEqualToString:@"other"]) {
|
|
414
|
-
return [PLKAccountSubtypeOther createWithValue:PLKAccountSubtypeValueOtherOther];
|
|
415
|
-
} else {
|
|
416
|
-
return [PLKAccountSubtypeOther createWithRawStringValue:normalizedSubtypeString];
|
|
417
|
-
}
|
|
418
|
-
} else if ([normalizedTypeString isEqualToString:@"credit"]) {
|
|
419
|
-
if ([normalizedSubtypeString isEqualToString:@"all"]) {
|
|
420
|
-
return [PLKAccountSubtypeCredit createWithValue:PLKAccountSubtypeValueCreditAll];
|
|
421
|
-
} else if ([normalizedSubtypeString isEqualToString:@"credit card"]) {
|
|
422
|
-
return [PLKAccountSubtypeCredit createWithValue:PLKAccountSubtypeValueCreditCreditCard];
|
|
423
|
-
} else if ([normalizedSubtypeString isEqualToString:@"paypal"]) {
|
|
424
|
-
return [PLKAccountSubtypeCredit createWithValue:PLKAccountSubtypeValueCreditPaypal];
|
|
425
|
-
} else {
|
|
426
|
-
return [PLKAccountSubtypeCredit createWithUnknownValue:subtypeString];
|
|
427
|
-
}
|
|
428
|
-
} else if ([normalizedTypeString isEqualToString:@"loan"]) {
|
|
429
|
-
if ([normalizedSubtypeString isEqualToString:@"all"]) {
|
|
430
|
-
return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanAll];
|
|
431
|
-
} else if ([normalizedSubtypeString isEqualToString:@"auto"]) {
|
|
432
|
-
return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanAuto];
|
|
433
|
-
} else if ([normalizedSubtypeString isEqualToString:@"business"]) {
|
|
434
|
-
return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanBusiness];
|
|
435
|
-
} else if ([normalizedSubtypeString isEqualToString:@"commercial"]) {
|
|
436
|
-
return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanCommercial];
|
|
437
|
-
} else if ([normalizedSubtypeString isEqualToString:@"construction"]) {
|
|
438
|
-
return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanConstruction];
|
|
439
|
-
} else if ([normalizedSubtypeString isEqualToString:@"consumer"]) {
|
|
440
|
-
return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanConsumer];
|
|
441
|
-
} else if ([normalizedSubtypeString isEqualToString:@"home equity"]) {
|
|
442
|
-
return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanHomeEquity];
|
|
443
|
-
} else if ([normalizedSubtypeString isEqualToString:@"line of credit"]) {
|
|
444
|
-
return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanLineOfCredit];
|
|
445
|
-
} else if ([normalizedSubtypeString isEqualToString:@"loan"]) {
|
|
446
|
-
return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanLoan];
|
|
447
|
-
} else if ([normalizedSubtypeString isEqualToString:@"mortgage"]) {
|
|
448
|
-
return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanMortgage];
|
|
449
|
-
} else if ([normalizedSubtypeString isEqualToString:@"overdraft"]) {
|
|
450
|
-
return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanOverdraft];
|
|
451
|
-
} else if ([normalizedSubtypeString isEqualToString:@"student"]) {
|
|
452
|
-
return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanStudent];
|
|
453
|
-
} else {
|
|
454
|
-
return [PLKAccountSubtypeLoan createWithUnknownValue:subtypeString];
|
|
455
|
-
}
|
|
456
|
-
} else if ([normalizedTypeString isEqualToString:@"depository"]) {
|
|
457
|
-
if ([normalizedSubtypeString isEqualToString:@"all"]) {
|
|
458
|
-
return [PLKAccountSubtypeDepository createWithValue:PLKAccountSubtypeValueDepositoryAll];
|
|
459
|
-
} else if ([normalizedSubtypeString isEqualToString:@"cash management"]) {
|
|
460
|
-
return [PLKAccountSubtypeDepository createWithValue:PLKAccountSubtypeValueDepositoryCashManagement];
|
|
461
|
-
} else if ([normalizedSubtypeString isEqualToString:@"cd"]) {
|
|
462
|
-
return [PLKAccountSubtypeDepository createWithValue:PLKAccountSubtypeValueDepositoryCd];
|
|
463
|
-
} else if ([normalizedSubtypeString isEqualToString:@"checking"]) {
|
|
464
|
-
return [PLKAccountSubtypeDepository createWithValue:PLKAccountSubtypeValueDepositoryChecking];
|
|
465
|
-
} else if ([normalizedSubtypeString isEqualToString:@"ebt"]) {
|
|
466
|
-
return [PLKAccountSubtypeDepository createWithValue:PLKAccountSubtypeValueDepositoryEbt];
|
|
467
|
-
} else if ([normalizedSubtypeString isEqualToString:@"hsa"]) {
|
|
468
|
-
return [PLKAccountSubtypeDepository createWithValue:PLKAccountSubtypeValueDepositoryHsa];
|
|
469
|
-
} else if ([normalizedSubtypeString isEqualToString:@"money market"]) {
|
|
470
|
-
return [PLKAccountSubtypeDepository createWithValue:PLKAccountSubtypeValueDepositoryMoneyMarket];
|
|
471
|
-
} else if ([normalizedSubtypeString isEqualToString:@"paypal"]) {
|
|
472
|
-
return [PLKAccountSubtypeDepository createWithValue:PLKAccountSubtypeValueDepositoryPaypal];
|
|
473
|
-
} else if ([normalizedSubtypeString isEqualToString:@"prepaid"]) {
|
|
474
|
-
return [PLKAccountSubtypeDepository createWithValue:PLKAccountSubtypeValueDepositoryPrepaid];
|
|
475
|
-
} else if ([normalizedSubtypeString isEqualToString:@"savings"]) {
|
|
476
|
-
return [PLKAccountSubtypeDepository createWithValue:PLKAccountSubtypeValueDepositorySavings];
|
|
477
|
-
} else {
|
|
478
|
-
return [PLKAccountSubtypeDepository createWithUnknownValue:subtypeString];
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
} else if ([normalizedTypeString isEqualToString:@"investment"]) {
|
|
482
|
-
if ([normalizedSubtypeString isEqualToString:@"all"]) {
|
|
483
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentAll];
|
|
484
|
-
} else if ([normalizedSubtypeString isEqualToString:@"401a"]) {
|
|
485
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestment401a];
|
|
486
|
-
} else if ([normalizedSubtypeString isEqualToString:@"401k"]) {
|
|
487
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestment401k];
|
|
488
|
-
} else if ([normalizedSubtypeString isEqualToString:@"403B"]) {
|
|
489
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestment403B];
|
|
490
|
-
} else if ([normalizedSubtypeString isEqualToString:@"457b"]) {
|
|
491
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestment457b];
|
|
492
|
-
} else if ([normalizedSubtypeString isEqualToString:@"529"]) {
|
|
493
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestment529];
|
|
494
|
-
} else if ([normalizedSubtypeString isEqualToString:@"brokerage"]) {
|
|
495
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentBrokerage];
|
|
496
|
-
} else if ([normalizedSubtypeString isEqualToString:@"cash isa"]) {
|
|
497
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentCashIsa];
|
|
498
|
-
} else if ([normalizedSubtypeString isEqualToString:@"education savings account"]) {
|
|
499
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentEducationSavingsAccount];
|
|
500
|
-
} else if ([normalizedSubtypeString isEqualToString:@"fixed annuity"]) {
|
|
501
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentFixedAnnuity];
|
|
502
|
-
} else if ([normalizedSubtypeString isEqualToString:@"gic"]) {
|
|
503
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentGic];
|
|
504
|
-
} else if ([normalizedSubtypeString isEqualToString:@"health reimbursement arrangement"]) {
|
|
505
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentHealthReimbursementArrangement];
|
|
506
|
-
} else if ([normalizedSubtypeString isEqualToString:@"hsa"]) {
|
|
507
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentHsa];
|
|
508
|
-
} else if ([normalizedSubtypeString isEqualToString:@"ira"]) {
|
|
509
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentIra];
|
|
510
|
-
} else if ([normalizedSubtypeString isEqualToString:@"isa"]) {
|
|
511
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentIsa];
|
|
512
|
-
} else if ([normalizedSubtypeString isEqualToString:@"keogh"]) {
|
|
513
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentKeogh];
|
|
514
|
-
} else if ([normalizedSubtypeString isEqualToString:@"lif"]) {
|
|
515
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentLif];
|
|
516
|
-
} else if ([normalizedSubtypeString isEqualToString:@"lira"]) {
|
|
517
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentLira];
|
|
518
|
-
} else if ([normalizedSubtypeString isEqualToString:@"lrif"]) {
|
|
519
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentLrif];
|
|
520
|
-
} else if ([normalizedSubtypeString isEqualToString:@"lrsp"]) {
|
|
521
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentLrsp];
|
|
522
|
-
} else if ([normalizedSubtypeString isEqualToString:@"mutual fund"]) {
|
|
523
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentMutualFund];
|
|
524
|
-
} else if ([normalizedSubtypeString isEqualToString:@"non-taxable brokerage account"]) {
|
|
525
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentNonTaxableBrokerageAccount];
|
|
526
|
-
} else if ([normalizedSubtypeString isEqualToString:@"pension"]) {
|
|
527
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentPension];
|
|
528
|
-
} else if ([normalizedSubtypeString isEqualToString:@"plan"]) {
|
|
529
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentPlan];
|
|
530
|
-
} else if ([normalizedSubtypeString isEqualToString:@"prif"]) {
|
|
531
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentPrif];
|
|
532
|
-
} else if ([normalizedSubtypeString isEqualToString:@"profit sharing plan"]) {
|
|
533
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentProfitSharingPlan];
|
|
534
|
-
} else if ([normalizedSubtypeString isEqualToString:@"rdsp"]) {
|
|
535
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentRdsp];
|
|
536
|
-
} else if ([normalizedSubtypeString isEqualToString:@"resp"]) {
|
|
537
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentResp];
|
|
538
|
-
} else if ([normalizedSubtypeString isEqualToString:@"retirement"]) {
|
|
539
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentRetirement];
|
|
540
|
-
} else if ([normalizedSubtypeString isEqualToString:@"rlif"]) {
|
|
541
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentRlif];
|
|
542
|
-
} else if ([normalizedSubtypeString isEqualToString:@"roth 401k"]) {
|
|
543
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentRoth401k];
|
|
544
|
-
} else if ([normalizedSubtypeString isEqualToString:@"roth"]) {
|
|
545
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentRoth];
|
|
546
|
-
} else if ([normalizedSubtypeString isEqualToString:@"rrif"]) {
|
|
547
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentRrif];
|
|
548
|
-
} else if ([normalizedSubtypeString isEqualToString:@"rrsp"]) {
|
|
549
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentRrsp];
|
|
550
|
-
} else if ([normalizedSubtypeString isEqualToString:@"sarsep"]) {
|
|
551
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentSarsep];
|
|
552
|
-
} else if ([normalizedSubtypeString isEqualToString:@"sep ira"]) {
|
|
553
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentSepIra];
|
|
554
|
-
} else if ([normalizedSubtypeString isEqualToString:@"simple ira"]) {
|
|
555
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentSimpleIra];
|
|
556
|
-
} else if ([normalizedSubtypeString isEqualToString:@"sipp"]) {
|
|
557
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentSipp];
|
|
558
|
-
} else if ([normalizedSubtypeString isEqualToString:@"stock plan"]) {
|
|
559
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentStockPlan];
|
|
560
|
-
} else if ([normalizedSubtypeString isEqualToString:@"tfsa"]) {
|
|
561
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentTfsa];
|
|
562
|
-
} else if ([normalizedSubtypeString isEqualToString:@"thrift savings plan"]) {
|
|
563
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentThriftSavingsPlan];
|
|
564
|
-
} else if ([normalizedSubtypeString isEqualToString:@"trust"]) {
|
|
565
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentTrust];
|
|
566
|
-
} else if ([normalizedSubtypeString isEqualToString:@"ugma"]) {
|
|
567
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentUgma];
|
|
568
|
-
} else if ([normalizedSubtypeString isEqualToString:@"utma"]) {
|
|
569
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentUtma];
|
|
570
|
-
} else if ([normalizedSubtypeString isEqualToString:@"variable annuity"]) {
|
|
571
|
-
return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentVariableAnnuity];
|
|
572
|
-
} else {
|
|
573
|
-
return [PLKAccountSubtypeInvestment createWithUnknownValue:subtypeString];
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
return [PLKAccountSubtypeUnknown createWithRawTypeStringValue:typeString rawSubtypeStringValue:subtypeString];
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
+ (NSDictionary *)dictionaryFromSuccess:(PLKLinkSuccess *)success {
|
|
581
|
-
PLKSuccessMetadata *metadata = success.metadata;
|
|
582
|
-
|
|
583
|
-
return @{
|
|
584
|
-
@"publicToken": success.publicToken ?: @"",
|
|
585
|
-
@"metadata": @{
|
|
586
|
-
@"linkSessionId": metadata.linkSessionID ?: @"",
|
|
587
|
-
@"institution": [self dictionaryFromInstitution:metadata.institution] ?: @"",
|
|
588
|
-
@"accounts": [self accountsDictionariesFromAccounts:metadata.accounts] ?: @"",
|
|
589
|
-
@"metadataJson": metadata.metadataJSON ?: @"",
|
|
590
|
-
},
|
|
591
|
-
};
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
+ (NSArray<NSDictionary *> *)accountsDictionariesFromAccounts:(NSArray<PLKAccount *> *)accounts {
|
|
595
|
-
NSMutableArray<NSDictionary *> *results = [NSMutableArray arrayWithCapacity:accounts.count];
|
|
596
|
-
|
|
597
|
-
for (PLKAccount *account in accounts) {
|
|
598
|
-
NSDictionary *accountDictionary = [self dictionaryFromAccount:account];
|
|
599
|
-
[results addObject:accountDictionary];
|
|
600
|
-
}
|
|
601
|
-
return [results copy];
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
+ (NSDictionary *)dictionaryFromAccount:(PLKAccount *)account {
|
|
605
|
-
return @{
|
|
606
|
-
@"id": account.ID ?: @"",
|
|
607
|
-
@"name": account.name ?: @"",
|
|
608
|
-
@"mask": account.mask ?: @"",
|
|
609
|
-
@"subtype": [self subtypeNameForAccountSubtype:account.subtype] ?: @"",
|
|
610
|
-
@"type": [self typeNameForAccountSubtype:account.subtype] ?: @"",
|
|
611
|
-
@"verificationStatus": [self stringForVerificationStatus:account.verificationStatus] ?: @"",
|
|
612
|
-
};
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
+ (NSString *)stringForVerificationStatus:(PLKVerificationStatus *)verificationStatus {
|
|
616
|
-
if (!verificationStatus) {
|
|
617
|
-
return @"";
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
if (verificationStatus.unknownStringValue) {
|
|
621
|
-
return verificationStatus.unknownStringValue;
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
switch (verificationStatus.value) {
|
|
625
|
-
case PLKVerificationStatusValueNone:
|
|
626
|
-
return @"";
|
|
627
|
-
case PLKVerificationStatusValuePendingAutomaticVerification:
|
|
628
|
-
return @"pending_automatic_verification";
|
|
629
|
-
case PLKVerificationStatusValuePendingManualVerification:
|
|
630
|
-
return @"pending_manual_verification";
|
|
631
|
-
case PLKVerificationStatusValueManuallyVerified:
|
|
632
|
-
return @"manually_verified";
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
return @"unknown";
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
+ (NSString *)typeNameForAccountSubtype:(id<PLKAccountSubtype>)accountSubtype {
|
|
639
|
-
if ([accountSubtype isKindOfClass:[PLKAccountSubtypeUnknown class]]) {
|
|
640
|
-
return ((PLKAccountSubtypeUnknown *)accountSubtype).rawStringValue;
|
|
641
|
-
} else if ([accountSubtype isKindOfClass:[PLKAccountSubtypeOther class]]) {
|
|
642
|
-
return @"other";
|
|
643
|
-
} else if ([accountSubtype isKindOfClass:[PLKAccountSubtypeCredit class]]) {
|
|
644
|
-
return @"credit";
|
|
645
|
-
} else if ([accountSubtype isKindOfClass:[PLKAccountSubtypeLoan class]]) {
|
|
646
|
-
return @"loan";
|
|
647
|
-
} else if ([accountSubtype isKindOfClass:[PLKAccountSubtypeDepository class]]) {
|
|
648
|
-
return @"depository";
|
|
649
|
-
} else if ([accountSubtype isKindOfClass:[PLKAccountSubtypeInvestment class]]) {
|
|
650
|
-
return @"investment";
|
|
651
|
-
}
|
|
652
|
-
return @"unknown";
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
+ (NSString *)subtypeNameForAccountSubtype:(id<PLKAccountSubtype>)accountSubtype {
|
|
656
|
-
if ([accountSubtype isKindOfClass:[PLKAccountSubtypeUnknown class]]) {
|
|
657
|
-
return ((PLKAccountSubtypeUnknown *)accountSubtype).rawSubtypeStringValue;
|
|
658
|
-
}
|
|
659
|
-
return accountSubtype.rawStringValue;
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
+ (NSDictionary *)dictionaryFromInstitution:(PLKInstitution *)institution {
|
|
663
|
-
return @{
|
|
664
|
-
@"name": institution.name ?: @"",
|
|
665
|
-
@"id": institution.ID ?: @"",
|
|
666
|
-
};
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
+ (NSDictionary *)dictionaryFromError:(PLKExitError *)error {
|
|
670
|
-
return @{
|
|
671
|
-
@"errorType": [self errorTypeStringFromError:error] ?: @"",
|
|
672
|
-
@"errorCode": [self errorCodeStringFromError:error] ?: @"",
|
|
673
|
-
@"errorMessage": [self errorMessageFromError:error] ?: @"",
|
|
674
|
-
// errorDisplayMessage is the deprecated name for displayMessage, both have to be populated
|
|
675
|
-
// until errorDisplayMessage is fully removed to avoid breaking the API
|
|
676
|
-
@"errorDisplayMessage": [self errorDisplayMessageFromError:error] ?: @"",
|
|
677
|
-
@"displayMessage": [self errorDisplayMessageFromError:error] ?: @"",
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
+ (NSDictionary *)dictionaryFromEvent:(PLKLinkEvent *)event {
|
|
682
|
-
PLKEventMetadata *metadata = event.eventMetadata;
|
|
683
|
-
|
|
684
|
-
return @{
|
|
685
|
-
@"eventName": [self stringForEventName:event.eventName] ?: @"",
|
|
686
|
-
@"metadata": @{
|
|
687
|
-
@"errorType": [self errorTypeStringFromError:metadata.error] ?: @"",
|
|
688
|
-
@"errorCode": [self errorCodeStringFromError:metadata.error] ?: @"",
|
|
689
|
-
@"errorMessage": [self errorMessageFromError:metadata.error] ?: @"",
|
|
690
|
-
@"exitStatus": [self stringForExitStatus:metadata.exitStatus] ?: @"",
|
|
691
|
-
@"institutionId": metadata.institutionID ?: @"",
|
|
692
|
-
@"institutionName": metadata.institutionName ?: @"",
|
|
693
|
-
@"institutionSearchQuery": metadata.institutionSearchQuery ?: @"",
|
|
694
|
-
@"linkSessionId": metadata.linkSessionID ?: @"",
|
|
695
|
-
@"mfaType": [self stringForMfaType:metadata.mfaType] ?: @"",
|
|
696
|
-
@"requestId": metadata.requestID ?: @"",
|
|
697
|
-
@"timestamp": [self iso8601StringFromDate:metadata.timestamp] ?: @"",
|
|
698
|
-
@"viewName": [self stringForViewName:metadata.viewName] ?: @"",
|
|
699
|
-
@"metadataJson": metadata.metadataJSON ?: @"",
|
|
700
|
-
},
|
|
701
|
-
};
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
+ (NSString *)errorDisplayMessageFromError:(PLKExitError *)error {
|
|
705
|
-
return error.userInfo[kPLKExitErrorDisplayMessageKey] ?: @"";
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
+ (NSString *)errorTypeStringFromError:(PLKExitError *)error {
|
|
709
|
-
NSString *errorDomain = error.domain;
|
|
710
|
-
if (!error || !errorDomain) {
|
|
711
|
-
return @"";
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
NSString *normalizedErrorDomain = errorDomain;
|
|
715
|
-
|
|
716
|
-
return @{
|
|
717
|
-
kPLKExitErrorInvalidRequestDomain: @"INVALID_REQUEST",
|
|
718
|
-
kPLKExitErrorInvalidInputDomain: @"INVALID_INPUT",
|
|
719
|
-
kPLKExitErrorInstitutionErrorDomain: @"INSTITUTION_ERROR",
|
|
720
|
-
kPLKExitErrorRateLimitExceededDomain: @"RATE_LIMIT_EXCEEDED",
|
|
721
|
-
kPLKExitErrorApiDomain: @"API_ERROR",
|
|
722
|
-
kPLKExitErrorItemDomain: @"ITEM_ERROR",
|
|
723
|
-
kPLKExitErrorAuthDomain: @"AUTH_ERROR",
|
|
724
|
-
kPLKExitErrorAssetReportDomain: @"ASSET_REPORT_ERROR",
|
|
725
|
-
kPLKExitErrorInternalDomain: @"INTERNAL",
|
|
726
|
-
kPLKExitErrorUnknownDomain: error.userInfo[kPLKExitErrorUnknownTypeKey] ?: @"UNKNOWN",
|
|
727
|
-
}[normalizedErrorDomain] ?: @"UNKNOWN";
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
+ (NSString *)errorCodeStringFromError:(PLKExitError *)error {
|
|
731
|
-
NSString *errorDomain = error.domain;
|
|
732
|
-
|
|
733
|
-
if (!error || !errorDomain) {
|
|
734
|
-
return @"";
|
|
735
|
-
}
|
|
736
|
-
return error.userInfo[kPLKExitErrorCodeKey];
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
+ (NSString *)errorMessageFromError:(PLKExitError *)error {
|
|
740
|
-
return error.userInfo[kPLKExitErrorMessageKey] ?: @"";
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
+ (NSString *)stringForEventName:(PLKEventName *)eventName {
|
|
744
|
-
if (!eventName) {
|
|
745
|
-
return @"";
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
if (eventName.unknownStringValue) {
|
|
749
|
-
return eventName.unknownStringValue;
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
switch (eventName.value) {
|
|
753
|
-
case PLKEventNameValueNone:
|
|
754
|
-
return @"";
|
|
755
|
-
case PLKEventNameValueBankIncomeInsightsCompleted:
|
|
756
|
-
return @"BANK_INCOME_INSIGHTS_COMPLETED";
|
|
757
|
-
case PLKEventNameValueCloseOAuth:
|
|
758
|
-
return @"CLOSE_OAUTH";
|
|
759
|
-
case PLKEventNameValueError:
|
|
760
|
-
return @"ERROR";
|
|
761
|
-
case PLKEventNameValueExit:
|
|
762
|
-
return @"EXIT";
|
|
763
|
-
case PLKEventNameValueFailOAuth:
|
|
764
|
-
return @"FAIL_OAUTH";
|
|
765
|
-
case PLKEventNameValueHandoff:
|
|
766
|
-
return @"HANDOFF";
|
|
767
|
-
case PLKEventNameValueMatchedSelectInstitution:
|
|
768
|
-
return @"MATCHED_SELECT_INSTITUTION";
|
|
769
|
-
case PLKEventNameValueMatchedSelectVerifyMethod:
|
|
770
|
-
return @"MATCHED_SELECT_VERIFY_METHOD";
|
|
771
|
-
case PLKEventNameValueOpen:
|
|
772
|
-
return @"OPEN";
|
|
773
|
-
case PLKEventNameValueOpenMyPlaid:
|
|
774
|
-
return @"OPEN_MY_PLAID";
|
|
775
|
-
case PLKEventNameValueOpenOAuth:
|
|
776
|
-
return @"OPEN_OAUTH";
|
|
777
|
-
case PLKEventNameValueSearchInstitution:
|
|
778
|
-
return @"SEARCH_INSTITUTION";
|
|
779
|
-
case PLKEventNameValueSelectInstitution:
|
|
780
|
-
return @"SELECT_INSTITUTION";
|
|
781
|
-
case PLKEventNameValueSubmitCredentials:
|
|
782
|
-
return @"SUBMIT_CREDENTIALS";
|
|
783
|
-
case PLKEventNameValueSubmitMFA:
|
|
784
|
-
return @"SUBMIT_MFA";
|
|
785
|
-
case PLKEventNameValueTransitionView:
|
|
786
|
-
return @"TRANSITION_VIEW";
|
|
787
|
-
case PLKEventNameValueSelectDegradedInstitution:
|
|
788
|
-
return @"SELECT_DEGRADED_INSTITUTION";
|
|
789
|
-
case PLKEventNameValueSelectDownInstitution:
|
|
790
|
-
return @"SELECT_DOWN_INSTITUTION";
|
|
791
|
-
}
|
|
792
|
-
return @"unknown";
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
+ (NSString *)iso8601StringFromDate:(NSDate *)date {
|
|
796
|
-
static NSISO8601DateFormatter *dateFormatter = nil;
|
|
797
|
-
static dispatch_once_t onceToken;
|
|
798
|
-
dispatch_once(&onceToken, ^{
|
|
799
|
-
dateFormatter = [[NSISO8601DateFormatter alloc] init];
|
|
800
|
-
dateFormatter.formatOptions |= NSISO8601DateFormatWithFractionalSeconds;
|
|
801
|
-
});
|
|
802
|
-
return [dateFormatter stringFromDate:date];
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
+ (NSString *)stringForExitStatus:(PLKExitStatus *)exitStatus {
|
|
806
|
-
if (!exitStatus) {
|
|
807
|
-
return @"";
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
if (exitStatus.unknownStringValue) {
|
|
811
|
-
return exitStatus.unknownStringValue;
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
switch (exitStatus.value) {
|
|
815
|
-
case PLKExitStatusValueNone:
|
|
816
|
-
return @"";
|
|
817
|
-
case PLKExitStatusValueRequiresQuestions:
|
|
818
|
-
return @"requires_questions";
|
|
819
|
-
case PLKExitStatusValueRequiresSelections:
|
|
820
|
-
return @"requires_selections";
|
|
821
|
-
case PLKExitStatusValueRequiresCode:
|
|
822
|
-
return @"requires_code";
|
|
823
|
-
case PLKExitStatusValueChooseDevice:
|
|
824
|
-
return @"choose_device";
|
|
825
|
-
case PLKExitStatusValueRequiresCredentials:
|
|
826
|
-
return @"requires_credentials";
|
|
827
|
-
case PLKExitStatusValueInstitutionNotFound:
|
|
828
|
-
return @"institution_not_found";
|
|
829
|
-
case PLKExitStatusValueRequiresAccountSelection:
|
|
830
|
-
return @"requires_account_selection";
|
|
831
|
-
}
|
|
832
|
-
return @"unknown";
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
+ (NSString *)stringForMfaType:(PLKMFAType)mfaType {
|
|
836
|
-
switch (mfaType) {
|
|
837
|
-
case PLKMFATypeNone:
|
|
838
|
-
return @"";
|
|
839
|
-
case PLKMFATypeCode:
|
|
840
|
-
return @"code";
|
|
841
|
-
case PLKMFATypeDevice:
|
|
842
|
-
return @"device";
|
|
843
|
-
case PLKMFATypeQuestions:
|
|
844
|
-
return @"questions";
|
|
845
|
-
case PLKMFATypeSelections:
|
|
846
|
-
return @"selections";
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
return @"unknown";
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
+ (NSString *)stringForViewName:(PLKViewName *)viewName {
|
|
853
|
-
if (!viewName) {
|
|
854
|
-
return @"";
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
if (viewName.unknownStringValue) {
|
|
858
|
-
return viewName.unknownStringValue;
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
switch (viewName.value) {
|
|
862
|
-
case PLKViewNameValueNone:
|
|
863
|
-
return @"";
|
|
864
|
-
case PLKViewNameValueConnected:
|
|
865
|
-
return @"CONNECTED";
|
|
866
|
-
case PLKViewNameValueConsent:
|
|
867
|
-
return @"CONSENT";
|
|
868
|
-
case PLKViewNameValueCredential:
|
|
869
|
-
return @"CREDENTIAL";
|
|
870
|
-
case PLKViewNameValueError:
|
|
871
|
-
return @"ERROR";
|
|
872
|
-
case PLKViewNameValueExit:
|
|
873
|
-
return @"EXIT";
|
|
874
|
-
case PLKViewNameValueLoading:
|
|
875
|
-
return @"LOADING";
|
|
876
|
-
case PLKViewNameValueMatchedConsent:
|
|
877
|
-
return @"MATCHED_CONSENT";
|
|
878
|
-
case PLKViewNameValueMatchedCredential:
|
|
879
|
-
return @"MATCHED_CREDENTIAL";
|
|
880
|
-
case PLKViewNameValueMatchedMFA:
|
|
881
|
-
return @"MATCHED_MFA";
|
|
882
|
-
case PLKViewNameValueMFA:
|
|
883
|
-
return @"MFA";
|
|
884
|
-
case PLKViewNameValueNumbers:
|
|
885
|
-
return @"NUMBERS";
|
|
886
|
-
case PLKViewNameValueRecaptcha:
|
|
887
|
-
return @"RECAPTCHA";
|
|
888
|
-
case PLKViewNameValueSelectAccount:
|
|
889
|
-
return @"SELECT_ACCOUNT";
|
|
890
|
-
case PLKViewNameValueSelectInstitution:
|
|
891
|
-
return @"SELECT_INSTITUTION";
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
return @"unknown";
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
+ (NSDictionary *)dictionaryFromExit:(PLKLinkExit *)exit {
|
|
898
|
-
PLKExitMetadata *metadata = exit.metadata;
|
|
899
|
-
return @{
|
|
900
|
-
@"error": [self dictionaryFromError:exit.error] ?: @{},
|
|
901
|
-
@"metadata": @{
|
|
902
|
-
@"status": [self stringForExitStatus:metadata.status] ?: @"",
|
|
903
|
-
@"institution": [self dictionaryFromInstitution:metadata.institution] ?: @"",
|
|
904
|
-
@"requestId": metadata.requestID ?: @"",
|
|
905
|
-
@"linkSessionId": metadata.linkSessionID ?: @"",
|
|
906
|
-
@"metadataJson": metadata.metadataJSON ?: @"",
|
|
907
|
-
},
|
|
908
|
-
};
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
@end
|