@aptos-scp/scp-component-rn-device-services 0.2.6 → 0.3.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.
Files changed (36) hide show
  1. package/ios/AurusEnterpriseSDK.framework/AurusEnterpriseSDK +0 -0
  2. package/ios/AurusEnterpriseSDK.framework/Headers/AurusEnterpriseSDK.h +30 -36
  3. package/ios/SCPRNDeviceServices/AurusPaymentTerminal.m +33 -37
  4. package/lib/AurusDevice/AurusDevice.d.ts +24 -22
  5. package/lib/AurusDevice/AurusDevice.js +204 -245
  6. package/lib/AurusDevice/AurusDevice.js.map +1 -1
  7. package/lib/AurusDevice/constants.d.ts +6 -5
  8. package/lib/AurusDevice/constants.js +8 -7
  9. package/lib/AurusDevice/constants.js.map +1 -1
  10. package/lib/AurusDevice/sdk-interface/AurusPaymentSupport.d.ts +2 -2
  11. package/lib/AurusDevice/sdk-interface/AurusPaymentSupport.js +21 -18
  12. package/lib/AurusDevice/sdk-interface/AurusPaymentSupport.js.map +1 -1
  13. package/lib/AurusDevice/sdk-interface/Upgrade.d.ts +23 -0
  14. package/lib/AurusDevice/sdk-interface/Upgrade.js +9 -0
  15. package/lib/AurusDevice/sdk-interface/Upgrade.js.map +1 -0
  16. package/lib/PaymentDeviceFactory.d.ts +4 -4
  17. package/lib/PaymentDeviceFactory.js +3 -3
  18. package/lib/PaymentDeviceFactory.js.map +1 -1
  19. package/lib/PaymentDeviceService.d.ts +4 -3
  20. package/lib/PaymentDeviceService.js +47 -30
  21. package/lib/PaymentDeviceService.js.map +1 -1
  22. package/lib/ScannerDeviceFactory.d.ts +4 -4
  23. package/lib/ScannerDeviceFactory.js +3 -3
  24. package/lib/ScannerDeviceFactory.js.map +1 -1
  25. package/lib/ScannerDeviceService.d.ts +2 -2
  26. package/lib/ScannerDeviceService.js +6 -2
  27. package/lib/ScannerDeviceService.js.map +1 -1
  28. package/lib/configs/inversify/inversify.config.js +1 -6
  29. package/lib/configs/inversify/inversify.config.js.map +1 -1
  30. package/lib/constants/constants.d.ts +6 -8
  31. package/lib/constants/constants.js +6 -8
  32. package/lib/constants/constants.js.map +1 -1
  33. package/lib/interfaces/IDeviceStatus.d.ts +1 -0
  34. package/lib/interfaces/payment/IPayment.d.ts +4 -9
  35. package/lib/interfaces/scanner/IScanner.d.ts +2 -8
  36. package/package.json +1 -1
@@ -49,45 +49,39 @@ typedef void(^onAESDKCompletionResponse)(NSString *xmlResponse);
49
49
  -(NSMutableDictionary *)getLogFileDetails;
50
50
 
51
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,
52
+ EventSwipeOrInsertOrTap = 501, // Notify when insert/swipe prompt on swiper device.
53
+ EventEnterManualCardEntry, // Notify Manual entry prompt on swiper device.
54
+ EventProcessing, // Notify
55
+ EventEnterPIN, // Notify when Pin prompt appears on Swiper device
56
+ EventEnterZIP, // Notify when Zip prompt appears on Swiper device
57
+ EventEnterSSN, // Notify when SSN prompt appears on Swiper device
58
+ EventEnterExpiryDate, // Notify when ExpiryDate prompt appears on Swiper device
59
+ EventEnterCVV, // Notify when CVV prompt appears on Swiper device
60
+ EventEnterTIP, // Notify when TIP prompt appears on Swiper device
61
+ EventConfirmation, // Notify when Confirmation prompt appears on Swiper device
62
+ EventProcessingTransaction, // Notify when Processing Transaction Request
63
+
71
64
  //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,
65
+ EventBarcodeInformation, // Notify when device reads barcode data
66
+ EventDeviceNotConnected, // Notify when device not connected
67
+ EventDeviceConnecting, // Notify when device is in connecting state but not connected yet
68
+ EventDeviceConnected, // Notify when device is connected
69
+ EventDeviceConfigurationStarted, // Notify when EMV Configuration started
70
+ EventDeviceConfigurationCompleted, // Notify when EMV Configuration Completed
71
+ EventDeviceConfigurationFailed, // Notify when EMV Configuration failed
72
+ EventDeviceAlreadyConfigured, // Notify when EMV Configuration already configured.
73
+ EventFileDownloadProgress, // Notify when File downloading is in progress.
74
+ EventFileDownloadFailed, // Notify when File downloading Failed.
75
+ EventFileDownloadRetry, // Notify when File download retrying.
76
+ EventPEDFileUpgrade, // Notify when File upgrade process running on PED device.
77
+ EventPEDFileUpgradeFailed, // Notify when File upgrades/pushed failed.
78
+ EventPEDFileUpgradeCompleted, // Notify when File upgrades/pushed Completed.
79
+ EventPEDFileTransferInfo, // Notify with transfer details.
80
+ EventPEDFileTransferProgress, // Notify with file transfer progress
81
+
82
+ EventTakeSignatureOnPOS,
88
83
  EventNone = 0
89
84
 
90
85
  }NotificationEvent;
91
86
 
92
-
93
87
  @end
@@ -41,40 +41,33 @@ RCT_EXPORT_MODULE();
41
41
  native_onAESDKResponse_name: native_onAESDKResponse,
42
42
  native_onNotificationReceived_name: native_onNotificationReceived,
43
43
  native_onAESDKLogResponse_name: native_onAESDKLogResponse,
44
- @"NotificationEvent": @{ @"ProcessingRequest" : @(EventProcessingRequest),
45
- @"SwipeOrInsertOrTap" : @(EventSwipeOrInsertOrTap),
44
+ @"NotificationEvent": @{ @"SwipeOrInsertOrTap" : @(EventSwipeOrInsertOrTap), //501
46
45
  @"EnterManualCardEntry" : @(EventEnterManualCardEntry),
47
46
  @"Processing" : @(EventProcessing),
48
- @"CardAuthorization" : @(EventCardAuthorization),
49
47
  @"EnterPIN" : @(EventEnterPIN),
50
48
  @"EnterZIP" : @(EventEnterZIP),
51
49
  @"EnterSSN" : @(EventEnterSSN),
52
- @"EnterSIN" : @(EventEnterSIN),
53
- @"EnterAnnualDebitIncome" : @(EventEnterAnnualDebitIncome),
54
- @"EnterMonthlyDebitIncome" : @(EventEnterMonthlyDebitIncome),
55
- @"EnterPhoneNumber" : @(EventEnterPhoneNumber),
56
- @"EnterPasscode" : @(EventEnterPasscode),
57
50
  @"EnterExpiryDate" : @(EventEnterExpiryDate),
58
51
  @"EnterCVV" : @(EventEnterCVV),
59
52
  @"EnterTIP" : @(EventEnterTIP),
60
53
  @"Confirmation" : @(EventConfirmation),
61
54
  @"ProcessingTransaction" : @(EventProcessingTransaction),
62
- @"BarcodeInformation" : @(EventBarcodeInformation), //519
63
- @"DeviceNotConnected" : @(EventDeviceNotConnected), //520
64
- @"DeviceConnecting" : @(EventDeviceConnecting), //521
65
- @"DeviceConnected" : @(EventDeviceConnected), //522
66
- @"DeviceConfigurationStarted" : @(EventDeviceConfigurationStarted), //523
67
- @"DeviceConfigurationCompleted" : @(EventDeviceConfigurationCompleted), //524
68
- @"DeviceConfigurationFailed" : @(EventDeviceConfigurationFailed), //525
69
- @"DeviceAlreadyConfigured" : @(EventDeviceAlreadyConfigured), //526
70
- @"FileDownloading" : @(EventFileDownloading),
55
+ @"BarcodeInformation" : @(EventBarcodeInformation), //512
56
+ @"DeviceNotConnected" : @(EventDeviceNotConnected), //513
57
+ @"DeviceConnecting" : @(EventDeviceConnecting), //514
58
+ @"DeviceConnected" : @(EventDeviceConnected), //515
59
+ @"DeviceConfigurationStarted" : @(EventDeviceConfigurationStarted), //516
60
+ @"DeviceConfigurationCompleted" : @(EventDeviceConfigurationCompleted), //517
61
+ @"DeviceConfigurationFailed" : @(EventDeviceConfigurationFailed), //518
62
+ @"DeviceAlreadyConfigured" : @(EventDeviceAlreadyConfigured), //519
63
+ @"FileDownloadProgress" : @(EventFileDownloadProgress),
71
64
  @"FileDownloadFailed" : @(EventFileDownloadFailed),
72
- @"FileDownloadRetrying" : @(EventFileDownloadRetrying),
73
- @"FileUpgradingToPED" : @(EventFileUpgradingToPED),
74
- @"FileUpgradingToPEDFailed" : @(EventFileUpgradingToPEDFailed),
75
- @"FileUpgradingToPEDCompleted" : @(EventFileUpgradingToPEDCompleted),
76
- @"FileTransferToPEDInfo" : @(EventFileTransferToPEDInfo),
77
- @"FileTransferToPEDProgress" : @(EventFileTransferToPEDProgress),
65
+ @"FileDownloadRetry" : @(EventFileDownloadRetry),
66
+ @"PEDFileUpgrade" : @(EventPEDFileUpgrade),
67
+ @"PEDFileUpgradeFailed" : @(EventPEDFileUpgradeFailed),
68
+ @"PEDFileUpgradeCompleted" : @(EventPEDFileUpgradeCompleted),
69
+ @"PEDFileTransferInfo" : @(EventPEDFileTransferInfo),
70
+ @"PEDFileTransferProgress" : @(EventPEDFileTransferProgress),
78
71
  @"None" : @(EventNone)
79
72
  }
80
73
  };
@@ -82,32 +75,29 @@ RCT_EXPORT_MODULE();
82
75
 
83
76
  #pragma mark - Exported to JavaScript methods
84
77
 
85
- static BOOL configurationComplete = NO;
78
+ static BOOL firstTimeConnectionComplete = NO;
86
79
  static id observer;
87
80
 
88
81
  RCT_EXPORT_METHOD(initialize) {
89
82
  if (!self.aesdk) {
90
83
  RCTLog(@"In AurusPaymentTerminal.initialize, adding %@ observer.", AURUS_NOTIFICATION);
91
84
  if (observer) {
85
+ RCTLog(@"In AurusPaymentTerminal.initialize, app was reloaded after adding observers. This should only happen in DEV. Attempting to work-around this scenario.");
92
86
  [[NSNotificationCenter defaultCenter] removeObserver:observer name:AURUS_NOTIFICATION object:nil];
93
87
  }
94
88
  observer = self;
95
89
  [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onNotificationReceived:) name:AURUS_NOTIFICATION object:nil];
96
-
90
+
97
91
  RCTLog(@"In AurusPaymentTerminal.initialize, creating AurusEnterpriseSDK.");
98
92
  self.aesdk = [[AurusEnterpriseSDK alloc] init];
99
93
  self.aesdk.setAESDKDelegateRefference = self;
100
94
  [self.aesdk OnAESDKLogProcessRequest];
101
-
102
- if (!configurationComplete) {
103
- RCTLog(@"In AurusPaymentTerminal.initialize, EMV configuration should be starting.");
104
- } else {
95
+
96
+ if (firstTimeConnectionComplete) {
105
97
  // allows payment to function as normal when app is reloaded
106
- RCTLog(@"In AurusPaymentTerminal.initialize, app was reloaded and EMV is already configured.");
98
+ RCTLog(@"In AurusPaymentTerminal.initialize, app was reloaded after being previously connected. This should only happen in DEV. Attempting to work-around this scenario.");
107
99
  dispatch_async(dispatch_get_main_queue(), ^{
108
- // sending on main thread to prevent UI timing issues
109
- NSDictionary *userInfo = @{ USER_INFO_CODE : @(EventDeviceAlreadyConfigured) };
110
- [[NSNotificationCenter defaultCenter] postNotificationName:AURUS_NOTIFICATION object:nil userInfo:userInfo];
100
+ [self performSelector:@selector(notifyFakeEventDeviceConnected) withObject:nil afterDelay:10.0];
111
101
  });
112
102
  }
113
103
  } else {
@@ -115,7 +105,13 @@ RCT_EXPORT_METHOD(initialize) {
115
105
  }
116
106
  }
117
107
 
118
- RCT_EXPORT_METHOD(OnAESDKProcessRequest:(NSString*)WithRequest) {
108
+ - (void)notifyFakeEventDeviceConnected {
109
+ RCTLog(@"In AurusPaymentTerminal.notifyFakeEventDeviceConnected, app was reloaded after being previously connected. This should only happen in DEV. Attempting to work-around this scenario.");
110
+ NSDictionary *userInfo = @{ USER_INFO_CODE : @(EventDeviceConnected) };
111
+ [[NSNotificationCenter defaultCenter] postNotificationName:AURUS_NOTIFICATION object:nil userInfo:userInfo];
112
+ }
113
+
114
+ RCT_EXPORT_METHOD(OnAESDKProcessRequest:(NSString *)WithRequest) {
119
115
  RCTLog(@"%@", [NSString stringWithFormat:@"In AurusPaymentTerminal.OnAESDKProcessRequest, calling OnAESDKProcessRequest:%@", WithRequest]);
120
116
  [self.aesdk OnAESDKProcessRequest:WithRequest];
121
117
  }
@@ -134,10 +130,10 @@ RCT_EXPORT_METHOD(OnAESDKProcessRequest:(NSString*)WithRequest) {
134
130
 
135
131
  - (void)onNotificationReceived:(NSNotification *)notification {
136
132
  RCTLog(@"%@", [NSString stringWithFormat:@"In AurusPaymentTerminal.onNotificationReceived, calling sendEventWithName:%@ body:%@", native_onNotificationReceived, notification.userInfo]);
137
- if (!configurationComplete && notification && notification.userInfo) {
133
+ if (!firstTimeConnectionComplete && notification && notification.userInfo) {
138
134
  int code = [notification.userInfo[USER_INFO_CODE] intValue];
139
- if (code == EventDeviceConfigurationCompleted || code == EventDeviceAlreadyConfigured) {
140
- configurationComplete = YES;
135
+ if (code == EventDeviceConnected) {
136
+ firstTimeConnectionComplete = YES;
141
137
  }
142
138
  }
143
139
  [self sendEventWithName:native_onNotificationReceived body:notification.userInfo];
@@ -1,16 +1,7 @@
1
1
  import { EventEmitter } from "fbemitter";
2
- import { IBankCardRequest, IGiftCardRequest, IPaymentDeviceConfiguration, IScannerDeviceConfiguration } from "../";
2
+ import { IBankCardRequest, IGiftCardRequest } from "../";
3
3
  import { IVendorPaymentDevice } from "../interfaces/payment/IPayment";
4
4
  import { IVendorScannerDevice } from "../interfaces/scanner/IScanner";
5
- /**
6
- * This is the interface that the native (bridge) class implements.
7
- *
8
- * Note: any changes to the native API must be reflected here and vice-versa.
9
- */
10
- export interface INativeAurusPaymentTerminal {
11
- initialize(): void;
12
- OnAESDKProcessRequest(WithRequest: string): void;
13
- }
14
5
  export declare class AurusDevice implements IVendorPaymentDevice, IVendorScannerDevice {
15
6
  private _paymentConfig;
16
7
  private _scannerConfig;
@@ -18,31 +9,34 @@ export declare class AurusDevice implements IVendorPaymentDevice, IVendorScanner
18
9
  private _nativeSubscriptions;
19
10
  private _paymentEmitter;
20
11
  private _scannerEmitter;
21
- private _initInProgress;
22
- private _initialized;
12
+ private _initializeCalled;
23
13
  private _listenersAdded;
24
14
  private _nativeEventEmitter;
25
15
  private _registrationInProgress;
16
+ private _waitingForDeviceConnected;
26
17
  private _scannerEnabled;
27
18
  private _paymentEnvironment;
19
+ private _requestInProgress;
20
+ private _requestQueue;
28
21
  /**
29
22
  * To avoid pushing native component awareness onto the rest of the app, the native objects
30
23
  * are created in the constructor, which only accepts JavaScript parameters.
31
24
  */
32
25
  constructor();
33
- configurePaymentDevice(emitter: EventEmitter, config: IPaymentDeviceConfiguration): Promise<void>;
34
- configureScannerDevice(emitter: EventEmitter, config: IScannerDeviceConfiguration): Promise<void>;
26
+ configurePaymentDevice(emitter: EventEmitter, config: any): Promise<void>;
27
+ configureScannerDevice(emitter: EventEmitter, config: any): Promise<void>;
35
28
  startPaymentDevice(): Promise<void>;
36
29
  startScannerDevice(): Promise<void>;
37
30
  captureSale(authRequest: IBankCardRequest): Promise<void>;
38
31
  captureRefund(authRequest: IBankCardRequest): Promise<void>;
32
+ captureVoid(authRequest: IBankCardRequest): Promise<void>;
39
33
  enableScannerDevice(): Promise<void>;
40
34
  disableScannerDevice(): Promise<void>;
41
35
  giftcardActivate(authRequest: IGiftCardRequest): Promise<void>;
42
36
  giftcardBalance(authRequest: IGiftCardRequest): Promise<void>;
43
37
  giftcardIssue(authRequest: IGiftCardRequest): Promise<void>;
44
38
  giftcardRedeem(authRequest: IGiftCardRequest): Promise<void>;
45
- void(authRequest: IBankCardRequest): Promise<void>;
39
+ giftcardVoid(authRequest: IBankCardRequest): Promise<void>;
46
40
  stopPaymentDevice(): Promise<void>;
47
41
  stopScannerDevice(): Promise<void>;
48
42
  tearDownPaymentDevice(): Promise<void>;
@@ -67,9 +61,9 @@ export declare class AurusDevice implements IVendorPaymentDevice, IVendorScanner
67
61
  private sendGetCardBin(authRequest);
68
62
  /**
69
63
  * Sends an AESDKRegistrationRequest to register the device
70
- * @param authRequest
71
64
  */
72
- private sendAESDKRegistration(authRequest);
65
+ private sendAESDKRegistration();
66
+ private sendUpgradeRequest(upgradeType);
73
67
  private handleAESDKResponse(xml);
74
68
  private convertXmlToJs(xml);
75
69
  private processTrans(response);
@@ -84,15 +78,23 @@ export declare class AurusDevice implements IVendorPaymentDevice, IVendorScanner
84
78
  private mapAurusSignatureRequired(signatureReceiptFlag);
85
79
  private mapAurusPinCaptured(signatureReceiptFlag);
86
80
  private parseEMVData(data);
87
- private handleBarcodeDataReceived(xml);
88
- private processBarcodeData(barcode);
89
81
  /**
90
82
  * This method handles events published by the native components. This is an adapter between the native and JavaScript
91
83
  * components for asynchronous events from the native layer.
92
- *
93
- * @param args
94
- * @return {any}
95
84
  */
96
85
  private onNotificationReceived(...args);
86
+ private handleNotificationEvent(userInfo);
87
+ private handleBarcodeInformationEvent(xmlBarcodeInfo);
88
+ private processBarcodeData(barcode);
89
+ private handleDeviceNotConnectedEvent();
90
+ private handleDeviceConnectedEvent();
91
+ private handleDeviceConfigurationStartedEvent();
92
+ private handleDeviceConfigurationCompletedEvent();
93
+ private handleDeviceConfigurationFailedEvent();
94
+ private handleDeviceAlreadyConfiguredEvent();
95
+ private handleDefaultEvent(userInfoCode);
96
+ private emitPaymentStatus(deviceAvailable, statusCode);
97
+ private emitAuthorizationResponse(responseCode, status);
97
98
  private onAESDKLogResponse(...args);
99
+ private sendRequest(xmlRequest);
98
100
  }