@aptos-scp/scp-component-rn-device-services 0.1.1 → 0.2.1
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/ios/AurusEnterpriseSDK.framework/AurusEnterpriseSDK +0 -0
- package/ios/AurusEnterpriseSDK.framework/Headers/AurusEnterpriseSDK.h +93 -96
- package/ios/SCPRNDeviceServices/AurusPaymentTerminal.m +71 -21
- package/lib/AurusDevice/AurusDevice.d.ts +6 -6
- package/lib/AurusDevice/AurusDevice.js +195 -87
- package/lib/AurusDevice/AurusDevice.js.map +1 -1
- package/lib/AurusDevice/constants.d.ts +30 -28
- package/lib/AurusDevice/constants.js +57 -29
- package/lib/AurusDevice/constants.js.map +1 -1
- package/lib/AurusDevice/sdk-interface/AurusPaymentSupport.js +5 -2
- package/lib/AurusDevice/sdk-interface/AurusPaymentSupport.js.map +1 -1
- package/lib/AurusDevice/sdk-interface/GetCardBinRequest.d.ts +1 -0
- package/lib/AurusDevice/sdk-interface/TransactionRequest.d.ts +2 -0
- package/lib/interfaces/payment/messages/responses.d.ts +1 -0
- package/package.json +1 -1
|
Binary file
|
|
@@ -1,96 +1,93 @@
|
|
|
1
|
-
//
|
|
2
|
-
// AurusEnterpriseSDK.h
|
|
3
|
-
//
|
|
4
|
-
// Created by
|
|
5
|
-
// Copyright (c) 2016 Aurus. All rights reserved.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
#import <Foundation/Foundation.h>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
@end
|
|
1
|
+
//
|
|
2
|
+
// AurusEnterpriseSDK.h
|
|
3
|
+
//
|
|
4
|
+
// Created by Aurus on 18/3/16.
|
|
5
|
+
// Copyright (c) 2016 Aurus. All rights reserved.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@protocol AESDKProtocols <NSObject>
|
|
12
|
+
|
|
13
|
+
-(void)onAESDKResponse:(NSString *)withResponse;
|
|
14
|
+
|
|
15
|
+
@optional
|
|
16
|
+
-(void)onAESDKLogResponse: (NSString *)withResponse;
|
|
17
|
+
|
|
18
|
+
@end
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@interface AurusEnterpriseSDK : NSObject
|
|
22
|
+
|
|
23
|
+
typedef void(^onAESDKCompletionResponse)(NSString *xmlResponse);
|
|
24
|
+
@property (atomic,copy) void(^onAESDKCompletionResponse)(NSString *xmlResponse);
|
|
25
|
+
|
|
26
|
+
@property(nonatomic,retain)id setAESDKDelegateRefference;
|
|
27
|
+
|
|
28
|
+
//BY this Method Calling the Response of AESDK will get in onAESDKResponse Delegate Method
|
|
29
|
+
-(void)OnAESDKProcessRequest:(NSString *)xmlRequest;
|
|
30
|
+
|
|
31
|
+
//BY this Method Calling the Response of AESDK will get Completion Handler.
|
|
32
|
+
-(void)OnAESDKProcessRequest:(NSString *)xmlRequest onCompletion:(onAESDKCompletionResponse)completionBlock;
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
//BY this Method Calling the Response of AESDK will get in onAESDKLogResponse Delegate Method
|
|
36
|
+
-(void)OnAESDKLogProcessRequest;
|
|
37
|
+
|
|
38
|
+
///
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
#pragma mark- Utility Methods
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
Log file details
|
|
46
|
+
|
|
47
|
+
@return NSMutableDictionary log file details
|
|
48
|
+
*/
|
|
49
|
+
-(NSMutableDictionary *)getLogFileDetails;
|
|
50
|
+
|
|
51
|
+
typedef enum {
|
|
52
|
+
EventProcessingRequest = 501,
|
|
53
|
+
EventSwipeOrInsertOrTap,
|
|
54
|
+
EventEnterManualCardEntry,
|
|
55
|
+
EventProcessing,
|
|
56
|
+
EventCardAuthorization,
|
|
57
|
+
EventEnterPIN,
|
|
58
|
+
EventEnterZIP,
|
|
59
|
+
EventEnterSSN,
|
|
60
|
+
EventEnterSIN,
|
|
61
|
+
EventEnterAnnualDebitIncome,
|
|
62
|
+
EventEnterMonthlyDebitIncome,
|
|
63
|
+
EventEnterPhoneNumber,
|
|
64
|
+
EventEnterPasscode,
|
|
65
|
+
EventEnterExpiryDate,
|
|
66
|
+
EventEnterCVV,
|
|
67
|
+
EventEnterTIP,
|
|
68
|
+
//EventConfirmProcessAsCredit, //Debit to Credit Confirmation.
|
|
69
|
+
EventConfirmation,
|
|
70
|
+
EventProcessingTransaction,
|
|
71
|
+
//E355 Device Events
|
|
72
|
+
EventBarcodeInformation,
|
|
73
|
+
EventDeviceNotConnected,
|
|
74
|
+
EventDeviceConnecting,
|
|
75
|
+
EventDeviceConnected,
|
|
76
|
+
EventDeviceConfigurationStarted,
|
|
77
|
+
EventDeviceConfigurationCompleted,
|
|
78
|
+
EventDeviceConfigurationFailed,
|
|
79
|
+
EventDeviceAlreadyConfigured,
|
|
80
|
+
EventFileDownloading,
|
|
81
|
+
EventFileDownloadFailed,
|
|
82
|
+
EventFileDownloadRetrying,
|
|
83
|
+
EventFileUpgradingToPED,
|
|
84
|
+
EventFileUpgradingToPEDFailed,
|
|
85
|
+
EventFileUpgradingToPEDCompleted,
|
|
86
|
+
EventFileTransferToPEDInfo,
|
|
87
|
+
EventFileTransferToPEDProgress,
|
|
88
|
+
EventNone = 0
|
|
89
|
+
|
|
90
|
+
}NotificationEvent;
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
@end
|
|
@@ -12,8 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
NSString* const native_onAESDKResponse = @"onAESDKResponse";
|
|
14
14
|
NSString* const native_onAESDKResponse_name = @"native_onAESDKResponse";
|
|
15
|
-
NSString* const
|
|
16
|
-
NSString* const
|
|
15
|
+
NSString* const native_onNotificationReceived = @"onNotificationReceived";
|
|
16
|
+
NSString* const native_onNotificationReceived_name = @"native_onNotificationReceived";
|
|
17
|
+
NSString* const AURUS_NOTIFICATION = @"AURUS_NOTIFICATION";
|
|
18
|
+
NSString* const USER_INFO_CODE = @"CODE";
|
|
17
19
|
|
|
18
20
|
@interface AurusPaymentTerminal ()
|
|
19
21
|
|
|
@@ -25,34 +27,74 @@ NSString* const native_onBarcodeDataReceived_name = @"native_onBarcodeDataReceiv
|
|
|
25
27
|
|
|
26
28
|
@implementation AurusPaymentTerminal
|
|
27
29
|
|
|
30
|
+
- (void) dealloc {
|
|
31
|
+
[[NSNotificationCenter defaultCenter] removeObserver:self name:AURUS_NOTIFICATION object:nil];
|
|
32
|
+
observer = nil;
|
|
33
|
+
}
|
|
34
|
+
|
|
28
35
|
RCT_EXPORT_MODULE();
|
|
29
36
|
|
|
30
37
|
- (NSDictionary *)constantsToExport {
|
|
31
38
|
return @{
|
|
32
39
|
native_onAESDKResponse_name: native_onAESDKResponse,
|
|
33
|
-
|
|
40
|
+
native_onNotificationReceived_name: native_onNotificationReceived,
|
|
41
|
+
@"NotificationEvent": @{ @"ProcessingRequest" : @(EventProcessingRequest),
|
|
42
|
+
@"SwipeOrInsertOrTap" : @(EventSwipeOrInsertOrTap),
|
|
43
|
+
@"EnterManualCardEntry" : @(EventEnterManualCardEntry),
|
|
44
|
+
@"Processing" : @(EventProcessing),
|
|
45
|
+
@"CardAuthorization" : @(EventCardAuthorization),
|
|
46
|
+
@"EnterPIN" : @(EventEnterPIN),
|
|
47
|
+
@"EnterZIP" : @(EventEnterZIP),
|
|
48
|
+
@"EnterSSN" : @(EventEnterSSN),
|
|
49
|
+
@"EnterSIN" : @(EventEnterSIN),
|
|
50
|
+
@"EnterAnnualDebitIncome" : @(EventEnterAnnualDebitIncome),
|
|
51
|
+
@"EnterMonthlyDebitIncome" : @(EventEnterMonthlyDebitIncome),
|
|
52
|
+
@"EnterPhoneNumber" : @(EventEnterPhoneNumber),
|
|
53
|
+
@"EnterPasscode" : @(EventEnterPasscode),
|
|
54
|
+
@"EnterExpiryDate" : @(EventEnterExpiryDate),
|
|
55
|
+
@"EnterCVV" : @(EventEnterCVV),
|
|
56
|
+
@"EnterTIP" : @(EventEnterTIP),
|
|
57
|
+
@"Confirmation" : @(EventConfirmation),
|
|
58
|
+
@"ProcessingTransaction" : @(EventProcessingTransaction),
|
|
59
|
+
@"BarcodeInformation" : @(EventBarcodeInformation), //519
|
|
60
|
+
@"DeviceNotConnected" : @(EventDeviceNotConnected), //520
|
|
61
|
+
@"DeviceConnecting" : @(EventDeviceConnecting), //521
|
|
62
|
+
@"DeviceConnected" : @(EventDeviceConnected), //522
|
|
63
|
+
@"DeviceConfigurationStarted" : @(EventDeviceConfigurationStarted), //523
|
|
64
|
+
@"DeviceConfigurationCompleted" : @(EventDeviceConfigurationCompleted), //524
|
|
65
|
+
@"DeviceConfigurationFailed" : @(EventDeviceConfigurationFailed), //525
|
|
66
|
+
@"DeviceAlreadyConfigured" : @(EventDeviceAlreadyConfigured), //526
|
|
67
|
+
@"FileDownloading" : @(EventFileDownloading),
|
|
68
|
+
@"FileDownloadFailed" : @(EventFileDownloadFailed),
|
|
69
|
+
@"FileDownloadRetrying" : @(EventFileDownloadRetrying),
|
|
70
|
+
@"FileUpgradingToPED" : @(EventFileUpgradingToPED),
|
|
71
|
+
@"FileUpgradingToPEDFailed" : @(EventFileUpgradingToPEDFailed),
|
|
72
|
+
@"FileUpgradingToPEDCompleted" : @(EventFileUpgradingToPEDCompleted),
|
|
73
|
+
@"FileTransferToPEDInfo" : @(EventFileTransferToPEDInfo),
|
|
74
|
+
@"FileTransferToPEDProgress" : @(EventFileTransferToPEDProgress),
|
|
75
|
+
@"None" : @(EventNone)
|
|
76
|
+
}
|
|
34
77
|
};
|
|
35
78
|
}
|
|
36
79
|
|
|
37
80
|
#pragma mark - Exported to JavaScript methods
|
|
38
81
|
|
|
39
82
|
static BOOL configurationComplete = NO;
|
|
83
|
+
static id observer;
|
|
40
84
|
|
|
41
85
|
RCT_EXPORT_METHOD(initialize) {
|
|
42
86
|
if (!self.aesdk) {
|
|
87
|
+
RCTLog(@"In AurusPaymentTerminal.initialize, adding %@ observer.", AURUS_NOTIFICATION);
|
|
88
|
+
if (observer) {
|
|
89
|
+
[[NSNotificationCenter defaultCenter] removeObserver:observer name:AURUS_NOTIFICATION object:nil];
|
|
90
|
+
}
|
|
91
|
+
observer = self;
|
|
92
|
+
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onNotificationReceived:) name:AURUS_NOTIFICATION object:nil];
|
|
93
|
+
|
|
43
94
|
RCTLog(@"In AurusPaymentTerminal.initialize, creating AurusEnterpriseSDK.");
|
|
44
95
|
self.aesdk = [[AurusEnterpriseSDK alloc] init];
|
|
45
96
|
self.aesdk.setAESDKDelegateRefference = self;
|
|
46
|
-
|
|
47
|
-
static BOOL observersAdded = NO;
|
|
48
|
-
if (!observersAdded) {
|
|
49
|
-
RCTLog(@"In AurusPaymentTerminal.initialize, adding IPC_BARCODE_DATA observer.");
|
|
50
|
-
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onBarcodeDataReceived:) name:@"IPC_BARCODE_DATA" object:nil];
|
|
51
|
-
observersAdded = YES;
|
|
52
|
-
} else {
|
|
53
|
-
// prevents multiple observers from being added when the app is reloaded
|
|
54
|
-
RCTLog(@"In AurusPaymentTerminal.initialize, app was reloaded and observers are already added.");
|
|
55
|
-
}
|
|
97
|
+
[self.aesdk OnAESDKLogProcessRequest];
|
|
56
98
|
|
|
57
99
|
if (!configurationComplete) {
|
|
58
100
|
RCTLog(@"In AurusPaymentTerminal.initialize, EMV configuration should be starting.");
|
|
@@ -61,7 +103,8 @@ RCT_EXPORT_METHOD(initialize) {
|
|
|
61
103
|
RCTLog(@"In AurusPaymentTerminal.initialize, app was reloaded and EMV is already configured.");
|
|
62
104
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
63
105
|
// sending on main thread to prevent UI timing issues
|
|
64
|
-
|
|
106
|
+
NSDictionary *userInfo = @{ USER_INFO_CODE : @(EventDeviceAlreadyConfigured) };
|
|
107
|
+
[[NSNotificationCenter defaultCenter] postNotificationName:AURUS_NOTIFICATION object:nil userInfo:userInfo];
|
|
65
108
|
});
|
|
66
109
|
}
|
|
67
110
|
} else {
|
|
@@ -78,15 +121,22 @@ RCT_EXPORT_METHOD(OnAESDKProcessRequest:(NSString*)WithRequest) {
|
|
|
78
121
|
|
|
79
122
|
- (void)onAESDKResponse:(NSString *)withResponse {
|
|
80
123
|
RCTLog(@"%@", [NSString stringWithFormat:@"In AurusPaymentTerminal.onAESDKResponse, calling sendEventWithName:%@ body:%@", native_onAESDKResponse, withResponse]);
|
|
81
|
-
if ([withResponse isEqualToString:@"EMV_CONFIGURATION_COMPLETED"] || [withResponse isEqualToString:@"DEVICE_ALREADY_CONFIGURED"]) {
|
|
82
|
-
configurationComplete = YES;
|
|
83
|
-
}
|
|
84
124
|
[self sendEventWithName:native_onAESDKResponse body:withResponse];
|
|
85
125
|
}
|
|
86
126
|
|
|
87
|
-
- (void)
|
|
88
|
-
RCTLog(@"%@",
|
|
89
|
-
|
|
127
|
+
- (void)onAESDKLogResponse:(NSString *)withResponse {
|
|
128
|
+
RCTLog(@"AurusLogging: %@", withResponse);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
- (void)onNotificationReceived:(NSNotification *)notification {
|
|
132
|
+
RCTLog(@"%@", [NSString stringWithFormat:@"In AurusPaymentTerminal.onNotificationReceived, calling sendEventWithName:%@ body:%@", native_onNotificationReceived, notification.userInfo]);
|
|
133
|
+
if (!configurationComplete && notification && notification.userInfo) {
|
|
134
|
+
int code = [notification.userInfo[USER_INFO_CODE] intValue];
|
|
135
|
+
if (code == EventDeviceConfigurationCompleted || code == EventDeviceAlreadyConfigured) {
|
|
136
|
+
configurationComplete = YES;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
[self sendEventWithName:native_onNotificationReceived body:notification.userInfo];
|
|
90
140
|
}
|
|
91
141
|
|
|
92
142
|
#pragma mark - RCTEventEmitter implementation
|
|
@@ -94,7 +144,7 @@ RCT_EXPORT_METHOD(OnAESDKProcessRequest:(NSString*)WithRequest) {
|
|
|
94
144
|
- (NSArray<NSString *> *)supportedEvents {
|
|
95
145
|
return @[
|
|
96
146
|
native_onAESDKResponse,
|
|
97
|
-
|
|
147
|
+
native_onNotificationReceived
|
|
98
148
|
];
|
|
99
149
|
}
|
|
100
150
|
|
|
@@ -15,8 +15,7 @@ export declare class AurusDevice implements IVendorPaymentDevice, IVendorScanner
|
|
|
15
15
|
private _paymentConfig;
|
|
16
16
|
private _scannerConfig;
|
|
17
17
|
private _devicePaymentTerminal;
|
|
18
|
-
private
|
|
19
|
-
private _scannerSubscriptions;
|
|
18
|
+
private _nativeSubscriptions;
|
|
20
19
|
private _paymentEmitter;
|
|
21
20
|
private _scannerEmitter;
|
|
22
21
|
private _initInProgress;
|
|
@@ -24,6 +23,7 @@ export declare class AurusDevice implements IVendorPaymentDevice, IVendorScanner
|
|
|
24
23
|
private _nativeEventEmitter;
|
|
25
24
|
private _registrationInProgress;
|
|
26
25
|
private _scannerEnabled;
|
|
26
|
+
private _paymentEnvironment;
|
|
27
27
|
/**
|
|
28
28
|
* To avoid pushing native component awareness onto the rest of the app, the native objects
|
|
29
29
|
* are created in the constructor, which only accepts JavaScript parameters.
|
|
@@ -49,6 +49,7 @@ export declare class AurusDevice implements IVendorPaymentDevice, IVendorScanner
|
|
|
49
49
|
processTimeout(): Promise<void>;
|
|
50
50
|
private authorize(authRequest);
|
|
51
51
|
private initializeNative();
|
|
52
|
+
private tearDownNative();
|
|
52
53
|
/**
|
|
53
54
|
* This method handles events published by the native components. This is an adapter between the native and JavaScript
|
|
54
55
|
* components for asynchronous events from the native layer.
|
|
@@ -70,7 +71,6 @@ export declare class AurusDevice implements IVendorPaymentDevice, IVendorScanner
|
|
|
70
71
|
private sendAESDKRegistration(authRequest);
|
|
71
72
|
private handleAESDKResponse(xml);
|
|
72
73
|
private convertXmlToJs(xml);
|
|
73
|
-
private processResponse(response);
|
|
74
74
|
private processTrans(response);
|
|
75
75
|
private processGetCardBin(response);
|
|
76
76
|
private processCancelTrans(response);
|
|
@@ -81,6 +81,8 @@ export declare class AurusDevice implements IVendorPaymentDevice, IVendorScanner
|
|
|
81
81
|
private mapAurusTenderType(aurusCardType);
|
|
82
82
|
private parseEMVData(data);
|
|
83
83
|
private parseEMVField(field, emvData);
|
|
84
|
+
private handleBarcodeDataReceived(xml);
|
|
85
|
+
private processBarcodeData(barcode);
|
|
84
86
|
/**
|
|
85
87
|
* This method handles events published by the native components. This is an adapter between the native and JavaScript
|
|
86
88
|
* components for asynchronous events from the native layer.
|
|
@@ -88,7 +90,5 @@ export declare class AurusDevice implements IVendorPaymentDevice, IVendorScanner
|
|
|
88
90
|
* @param args
|
|
89
91
|
* @return {any}
|
|
90
92
|
*/
|
|
91
|
-
private
|
|
92
|
-
private handleBarcodeDataReceived(xml);
|
|
93
|
-
private processBarcodeData(barcode);
|
|
93
|
+
private onNotificationReceived(...args);
|
|
94
94
|
}
|