@aptos-scp/scp-component-rn-device-services 0.0.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.
Files changed (82) hide show
  1. package/LICENSE.md +1 -0
  2. package/README.md +57 -0
  3. package/constants/package.json +7 -0
  4. package/interfaces/package.json +7 -0
  5. package/ios/AurusEnterpriseSDK.framework/AurusEnterpriseSDK +0 -0
  6. package/ios/AurusEnterpriseSDK.framework/Headers/AurusEnterpriseSDK.h +96 -0
  7. package/ios/SCPRNDeviceServices/AdyenPaymentTerminal.h +18 -0
  8. package/ios/SCPRNDeviceServices/AdyenPaymentTerminal.m +63 -0
  9. package/ios/SCPRNDeviceServices/AurusPaymentTerminal.h +19 -0
  10. package/ios/SCPRNDeviceServices/AurusPaymentTerminal.m +72 -0
  11. package/ios/SCPRNDeviceServices/VendorPaymentTerminal.h +24 -0
  12. package/ios/SCPRNDeviceServices/VendorPaymentTerminal.m +58 -0
  13. package/ios/SCPRNDeviceServices.xcodeproj/project.pbxproj +551 -0
  14. package/lib/AurusDevice/AurusPaymentDevice.d.ts +77 -0
  15. package/lib/AurusDevice/AurusPaymentDevice.js +473 -0
  16. package/lib/AurusDevice/AurusPaymentDevice.js.map +1 -0
  17. package/lib/AurusDevice/constants.d.ts +89 -0
  18. package/lib/AurusDevice/constants.js +94 -0
  19. package/lib/AurusDevice/constants.js.map +1 -0
  20. package/lib/AurusDevice/index.d.ts +2 -0
  21. package/lib/AurusDevice/index.js +8 -0
  22. package/lib/AurusDevice/index.js.map +1 -0
  23. package/lib/AurusDevice/sdk-interface/AESDKRegistration.d.ts +43 -0
  24. package/lib/AurusDevice/sdk-interface/AESDKRegistration.js +9 -0
  25. package/lib/AurusDevice/sdk-interface/AESDKRegistration.js.map +1 -0
  26. package/lib/AurusDevice/sdk-interface/AurusPaymentSupport.d.ts +40 -0
  27. package/lib/AurusDevice/sdk-interface/AurusPaymentSupport.js +307 -0
  28. package/lib/AurusDevice/sdk-interface/AurusPaymentSupport.js.map +1 -0
  29. package/lib/AurusDevice/sdk-interface/CancelTransaction.d.ts +49 -0
  30. package/lib/AurusDevice/sdk-interface/CancelTransaction.js +9 -0
  31. package/lib/AurusDevice/sdk-interface/CancelTransaction.js.map +1 -0
  32. package/lib/AurusDevice/sdk-interface/GetCardBinRequest.d.ts +35 -0
  33. package/lib/AurusDevice/sdk-interface/GetCardBinRequest.js +9 -0
  34. package/lib/AurusDevice/sdk-interface/GetCardBinRequest.js.map +1 -0
  35. package/lib/AurusDevice/sdk-interface/PLCCApplication.d.ts +64 -0
  36. package/lib/AurusDevice/sdk-interface/PLCCApplication.js +9 -0
  37. package/lib/AurusDevice/sdk-interface/PLCCApplication.js.map +1 -0
  38. package/lib/AurusDevice/sdk-interface/TransactionRequest.d.ts +159 -0
  39. package/lib/AurusDevice/sdk-interface/TransactionRequest.js +9 -0
  40. package/lib/AurusDevice/sdk-interface/TransactionRequest.js.map +1 -0
  41. package/lib/AurusDevice/sdk-interface/index.d.ts +6 -0
  42. package/lib/AurusDevice/sdk-interface/index.js +7 -0
  43. package/lib/AurusDevice/sdk-interface/index.js.map +1 -0
  44. package/lib/PaymentDeviceFactory.d.ts +11 -0
  45. package/lib/PaymentDeviceFactory.js +33 -0
  46. package/lib/PaymentDeviceFactory.js.map +1 -0
  47. package/lib/PaymentDeviceService.d.ts +19 -0
  48. package/lib/PaymentDeviceService.js +129 -0
  49. package/lib/PaymentDeviceService.js.map +1 -0
  50. package/lib/constants/constants.d.ts +52 -0
  51. package/lib/constants/constants.js +64 -0
  52. package/lib/constants/constants.js.map +1 -0
  53. package/lib/constants/index.d.ts +1 -0
  54. package/lib/constants/index.js +7 -0
  55. package/lib/constants/index.js.map +1 -0
  56. package/lib/index.d.ts +3 -0
  57. package/lib/index.js +8 -0
  58. package/lib/index.js.map +1 -0
  59. package/lib/interfaces/IDeviceStatus.d.ts +7 -0
  60. package/lib/interfaces/IDeviceStatus.js +4 -0
  61. package/lib/interfaces/IDeviceStatus.js.map +1 -0
  62. package/lib/interfaces/index.d.ts +2 -0
  63. package/lib/interfaces/index.js +3 -0
  64. package/lib/interfaces/index.js.map +1 -0
  65. package/lib/interfaces/payment/IPayment.d.ts +25 -0
  66. package/lib/interfaces/payment/IPayment.js +3 -0
  67. package/lib/interfaces/payment/IPayment.js.map +1 -0
  68. package/lib/interfaces/payment/index.d.ts +2 -0
  69. package/lib/interfaces/payment/index.js +3 -0
  70. package/lib/interfaces/payment/index.js.map +1 -0
  71. package/lib/interfaces/payment/messages/index.d.ts +2 -0
  72. package/lib/interfaces/payment/messages/index.js +3 -0
  73. package/lib/interfaces/payment/messages/index.js.map +1 -0
  74. package/lib/interfaces/payment/messages/requests.d.ts +47 -0
  75. package/lib/interfaces/payment/messages/requests.js +3 -0
  76. package/lib/interfaces/payment/messages/requests.js.map +1 -0
  77. package/lib/interfaces/payment/messages/responses.d.ts +57 -0
  78. package/lib/interfaces/payment/messages/responses.js +3 -0
  79. package/lib/interfaces/payment/messages/responses.js.map +1 -0
  80. package/package.json +84 -0
  81. package/types/money-works/index.d.ts +49 -0
  82. package/types/react-native-xml2js/index.d.ts +6 -0
package/LICENSE.md ADDED
@@ -0,0 +1 @@
1
+ Copyright (c) 2017 Aptos, Inc. All rights reserved.
package/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # scp-component-rn-device-services
2
+ The device services library handles integration with various devices (payment, scanner, etc).
3
+
4
+ ## Installation
5
+
6
+ Login to the private NPM registry:
7
+
8
+ ```
9
+ npm adduser --registry=http://registry.npmjs.com/ --scope=@aptos-scp
10
+ ```
11
+
12
+ Then from a project that includes scp-component-rn-device-services as a dependency (like the DPTestHarness sub-project), run the following to install the
13
+ dependency packages:
14
+
15
+ ```
16
+ $ npm install
17
+ ```
18
+
19
+ ## Publishing changes
20
+
21
+ When you make a change, and want it to be made available for all to use, do the following:
22
+
23
+ 1. Commit and push the changes.
24
+
25
+ 1. Update the version of the package using one of the following:
26
+ ```
27
+ npm version patch
28
+ ```
29
+ or
30
+ ```
31
+ npm version minor
32
+ ```
33
+ or one of the other variations (see [npm-version](https://docs.npmjs.com/cli/version))
34
+
35
+ 1. Push the version tag
36
+ ```
37
+ git push origin --tags
38
+ ```
39
+ or
40
+
41
+ From WebStorm or IntelliJ make sure that the Push Tags check-box is checked, when you push changes.
42
+
43
+ When the build in Circle CI sees the version tag, it will publish the changes to the NPM repository.
44
+
45
+ ## API
46
+
47
+
48
+ [//]: # ( TODO : Replace with CORE API)
49
+ tbd
50
+
51
+ ## Troubleshooting / Tips
52
+
53
+ - *I just installed a package and now I'm getting an `Unexpected token import` error when I run tests*: The unit tests are run with mocha under node.js. Unfortunately node's CommonJS module system is incompatible with ES6 modules. Some React Native modules are compiled as ES6 modules, and will have to be either mocked or transpiled to run under node. There is a file in the root of this procect, `custom-babel-register.js`, which contains a regular expression intended to match any modules that require transpilation to run under the node testing framework. If necessary, modify this expression to include your package and see if the problem is resolved.
54
+
55
+ ## License
56
+
57
+ Copyright (c) 2017 Aptos, Inc. All rights reserved.
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@aptos-scp/scp-component-rn-device-services/constants",
3
+ "description": "A submoudle housing constants for integrating with payment interfaces.",
4
+ "private": true,
5
+ "main": "../lib/constants/index.js",
6
+ "types": "../lib/constants"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@aptos-scp/scp-component-rn-device-services/interfaces",
3
+ "description": "A submoudle for integrating with payment interfaces.",
4
+ "private": true,
5
+ "main": "../lib/interfaces/index.js",
6
+ "types": "../lib/interfaces"
7
+ }
@@ -0,0 +1,96 @@
1
+ //
2
+ // AurusEnterpriseSDK.h
3
+ //
4
+ // Created by Vinay Kole on 18/3/16.
5
+ // Copyright (c) 2016 Aurus. All rights reserved.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+ //#import <UIKit/UIKit.h>
10
+
11
+
12
+ @protocol AESDKProtocols <NSObject>
13
+
14
+ -(void)onAESDKResponse:(NSString *)withResponse;
15
+
16
+ @end
17
+
18
+
19
+
20
+ @interface AurusEnterpriseSDK : NSObject
21
+
22
+ -(void)OnAESDKProcessRequest:(NSString*)WithRequest;
23
+ -(void)OnAESDKSetEncMessage:(NSString*)withMessage;
24
+
25
+ @property(nonatomic,retain)id setAESDKDelegateRefference;
26
+
27
+ #pragma mark- Utility Methods
28
+
29
+ /**
30
+ Get application unique ID
31
+
32
+ @return NSString applicationUniqueID
33
+ */
34
+ -(NSString *)getApplicationUniqueID;
35
+
36
+ /**
37
+ Log file details
38
+
39
+ @return NSMutableDictionary log file details
40
+ */
41
+ -(NSMutableDictionary *)getLogFileDetails;
42
+
43
+
44
+ /**
45
+ Initialize AurusEnterpriseSDK with blocking mode.
46
+ This method should call only once.
47
+
48
+ @param isBlockingMode set YES to executes pinpad commands on main thread.
49
+ @return AurusEnterpriseSDK instance
50
+
51
+ @code
52
+ //To execute Pinpad commands in background thread.
53
+ AurusEnterpriseSDK *aesdk = [[AurusEnterpriseSDK alloc] initWithPEDBlockingMode:NO];
54
+ @endcode
55
+
56
+ */
57
+ -(id)initWithPEDBlockingMode:(BOOL)isBlockingMode;
58
+
59
+
60
+
61
+ /**
62
+ Pinpad logs are enabled or not
63
+
64
+ @return BOOL YES when Pinpad logs are enabled otherwise returns NO.
65
+ */
66
+ -(BOOL)isPEDLogEnabled;
67
+
68
+
69
+ typedef enum {
70
+ EventProcessingRequest = 501,
71
+ EventSwipeOrInsertOrTap,
72
+ EventEnterManualCardEntry,
73
+ EventProcessing,
74
+ EventCardAuthorization,
75
+ EventEnterPIN,
76
+ EventEnterZIP,
77
+ EventEnterSSN,
78
+ EventEnterSIN,
79
+ EventEnterAnnualDebitIncome,
80
+ EventEnterMonthlyDebitIncome,
81
+ EventEnterPhoneNumber,
82
+ EventEnterPasscode,
83
+ EventEnterExpiryDate,
84
+ EventEnterCVV,
85
+ EventEnterTIP,
86
+ //EventConfirmProcessAsCredit, //Debit to Credit Confirmation.
87
+ EventConfirmation,
88
+ EventProcessingTransaction,
89
+
90
+
91
+ EventNone = 0
92
+
93
+ }NotificationEvent;
94
+
95
+
96
+ @end
@@ -0,0 +1,18 @@
1
+ //
2
+ // AdyenPaymentTerminal.h
3
+ // scpComponentRnDeviceServices
4
+ //
5
+ // Created by Wesley Anderson on 10/13/17.
6
+ // Copyright © 2017 Aptos, Inc. All rights reserved.
7
+ //
8
+
9
+ #ifndef AdyenPaymentTerminal_h
10
+ #define AdyenPaymentTerminal_h
11
+
12
+ #import "VendorPaymentTerminal.h"
13
+
14
+ @interface AdyenPaymentTerminal : VendorPaymentTerminal
15
+ @end
16
+
17
+ #endif /* AdyenPaymentTerminal_h */
18
+
@@ -0,0 +1,63 @@
1
+ //
2
+ // AdyenPaymentTerminal.m
3
+ // scpComponentRnDeviceServices
4
+ //
5
+ // Created by Wesley Anderson on 10/13/17.
6
+ // Copyright © 2017 Aptos, Inc. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import <React/RCTLog.h>
11
+ #import "AdyenPaymentTerminal.h"
12
+
13
+ // TODO: Refactor and add additional methods as needed. This is a basic example to test component interactions.
14
+ NSString* const native_exampleResponse1 = @"exampleResponse1";
15
+ NSString* const native_exampleResponse1_name = @"native_exampleResponse1";
16
+ NSString* const native_exampleResponse2 = @"exampleResponse2";
17
+ NSString* const native_exampleResponse2_name = @"native_exampleResponse2";
18
+
19
+ @interface AdyenPaymentTerminal ()
20
+ @end
21
+
22
+ #pragma mark -
23
+
24
+ @implementation AdyenPaymentTerminal
25
+
26
+ RCT_EXPORT_MODULE();
27
+
28
+ // TODO: Refactor and add additional methods as needed. This is a basic example to test component interactions.
29
+ - (NSDictionary *)constantsToExport {
30
+ return @{
31
+ native_exampleResponse1_name: native_exampleResponse1,
32
+ native_exampleResponse2_name: native_exampleResponse2
33
+ };
34
+ }
35
+
36
+ #pragma mark - Exported to JavaScript methods
37
+
38
+ // TODO: Refactor and add additional methods as needed. This is a basic example to test component interactions.
39
+ RCT_EXPORT_METHOD(exampleRequest1:(NSString*)exampleParam1) {
40
+ RCTLog(@"%@", [NSString stringWithFormat:@"In AdyenPaymentTerminal.exampleRequest1, calling sendEventWithName:%@ body:%@", native_exampleResponse1, exampleParam1]);
41
+ [self sendEventWithName:native_exampleResponse1 body:exampleParam1];
42
+ }
43
+
44
+ // TODO: Refactor and add additional methods as needed. This is a basic example to test component interactions.
45
+ RCT_EXPORT_METHOD(exampleRequest2:(NSString*)exampleParam2) {
46
+ RCTLog(@"%@", [NSString stringWithFormat:@"In AdyenPaymentTerminal.exampleRequest2, calling sendEventWithName:%@ body:%@", native_exampleResponse2, exampleParam2]);
47
+ [self sendEventWithName:native_exampleResponse2 body:exampleParam2];
48
+ }
49
+
50
+ #pragma mark - RCTEventEmitter implementation
51
+
52
+ // TODO: Refactor and add additional methods as needed. This is a basic example to test component interactions.
53
+ - (NSArray<NSString *> *)supportedEvents {
54
+ return @[
55
+ native_exampleResponse1,
56
+ native_exampleResponse2
57
+ ];
58
+ }
59
+
60
+ @end
61
+
62
+ //AdyenPaymentTerminal
63
+
@@ -0,0 +1,19 @@
1
+ //
2
+ // AurusPaymentTerminal.h
3
+ // scpComponentRnDeviceServices
4
+ //
5
+ // Created by Wesley Anderson on 10/13/17.
6
+ // Copyright © 2017 Aptos, Inc. All rights reserved.
7
+ //
8
+
9
+ #ifndef AurusPaymentTerminal_h
10
+ #define AurusPaymentTerminal_h
11
+
12
+ #import "VendorPaymentTerminal.h"
13
+ #import <AurusEnterpriseSDK/AurusEnterpriseSDK.h>
14
+
15
+ @interface AurusPaymentTerminal : VendorPaymentTerminal <AESDKProtocols>
16
+ @end
17
+
18
+ #endif /* AurusPaymentTerminal_h */
19
+
@@ -0,0 +1,72 @@
1
+ //
2
+ // AurusPaymentTerminal.m
3
+ // scpComponentRnDeviceServices
4
+ //
5
+ // Created by Wesley Anderson on 10/13/17.
6
+ // Copyright © 2017 Aptos, Inc. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import <React/RCTLog.h>
11
+ #import "AurusPaymentTerminal.h"
12
+
13
+ NSString* const native_onAESDKResponse = @"onAESDKResponse";
14
+ NSString* const native_onAESDKResponse_name = @"native_onAESDKResponse";
15
+
16
+ @interface AurusPaymentTerminal ()
17
+
18
+ @property (nonatomic) AurusEnterpriseSDK* aesdk;
19
+
20
+ @end
21
+
22
+ #pragma mark -
23
+
24
+ @implementation AurusPaymentTerminal
25
+
26
+ RCT_EXPORT_MODULE();
27
+
28
+ - (NSDictionary *)constantsToExport {
29
+ return @{
30
+ native_onAESDKResponse_name: native_onAESDKResponse
31
+ };
32
+ }
33
+
34
+ #pragma mark - Exported to JavaScript methods
35
+
36
+ RCT_EXPORT_METHOD(initialize) {
37
+ RCTLog(@"In AurusPaymentTerminal.initialize, creating AurusEnterpriseSDK. This starts the connection and EMV configuration.");
38
+ if (!self.aesdk) {
39
+ self.aesdk = [[AurusEnterpriseSDK alloc] init];
40
+ }
41
+ if (!self.aesdk.setAESDKDelegateRefference) {
42
+ self.aesdk.setAESDKDelegateRefference = self;
43
+ }
44
+ }
45
+
46
+ RCT_EXPORT_METHOD(OnAESDKProcessRequest:(NSString*)WithRequest) {
47
+ RCTLog(@"%@", [NSString stringWithFormat:@"In AurusPaymentTerminal.OnAESDKProcessRequest, calling OnAESDKProcessRequest:%@", WithRequest]);
48
+ if (!self.aesdk || !self.aesdk.setAESDKDelegateRefference) {
49
+ [self initialize];
50
+ }
51
+ [self.aesdk OnAESDKProcessRequest:WithRequest];
52
+ }
53
+
54
+ #pragma mark - AESDKProtocols implementation
55
+
56
+ - (void)onAESDKResponse:(NSString *)withResponse {
57
+ RCTLog(@"%@", [NSString stringWithFormat:@"In AurusPaymentTerminal.onAESDKResponse, calling sendEventWithName:%@ body:%@", native_onAESDKResponse, withResponse]);
58
+ [self sendEventWithName:native_onAESDKResponse body:withResponse];
59
+ }
60
+
61
+ #pragma mark - RCTEventEmitter implementation
62
+
63
+ - (NSArray<NSString *> *)supportedEvents {
64
+ return @[
65
+ native_onAESDKResponse
66
+ ];
67
+ }
68
+
69
+ @end
70
+
71
+ //AurusPaymentTerminal
72
+
@@ -0,0 +1,24 @@
1
+ //
2
+ // VendorPaymentTerminal.h
3
+ // scpComponentRnDeviceServices
4
+ //
5
+ // Created by Wesley Anderson on 10/12/17.
6
+ // Copyright © 2017 Aptos, Inc. All rights reserved.
7
+ //
8
+
9
+ #pragma clang diagnostic push
10
+ #pragma ide diagnostic ignored "OCUnusedClassInspection"
11
+
12
+ #ifndef VendorPaymentTerminal_h
13
+ #define VendorPaymentTerminal_h
14
+
15
+ #import <React/RCTBridgeModule.h>
16
+ #import <React/RCTEventEmitter.h>
17
+
18
+ @interface VendorPaymentTerminal : RCTEventEmitter <RCTBridgeModule>
19
+ @end
20
+
21
+ #endif /* VendorPaymentTerminal_h */
22
+
23
+ #pragma clang diagnostic pop
24
+
@@ -0,0 +1,58 @@
1
+ //
2
+ // VendorPaymentTerminal.m
3
+ // scpComponentRnDeviceServices
4
+ //
5
+ // Created by Wesley Anderson on 10/12/17.
6
+ // Copyright © 2017 Aptos, Inc. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import <React/RCTLog.h>
11
+ #import "VendorPaymentTerminal.h"
12
+
13
+ #pragma clang diagnostic push
14
+ #pragma ide diagnostic ignored "OCUnusedClassInspection"
15
+
16
+ @interface VendorPaymentTerminal ()
17
+
18
+ @property (nonatomic) BOOL hasListeners;
19
+
20
+ @end
21
+
22
+ @implementation VendorPaymentTerminal
23
+
24
+ - (NSDictionary *)constantsToExport {
25
+ return @{};
26
+ }
27
+
28
+ #pragma mark - Exported to JavaScript methods
29
+
30
+ #pragma mark - RCTEventEmitter implementation
31
+
32
+ - (NSArray<NSString *> *)supportedEvents {
33
+ return @[];
34
+ }
35
+
36
+ // Note: startObserving will be called when this module's first listener is added.
37
+ - (void)startObserving {
38
+ self.hasListeners = YES;
39
+ // Set up any upstream listeners or background tasks as necessary
40
+ }
41
+
42
+ // Note: stopObserving will be called when this module's last listener is removed, or on dealloc.
43
+ - (void)stopObserving {
44
+ self.hasListeners = NO;
45
+ // Remove upstream listeners, stop unnecessary background tasks
46
+ }
47
+
48
+ - (void)sendEventWithName:(NSString *)eventName body:(id)body {
49
+ // Only send events if anyone is listening
50
+ if (self.hasListeners) {
51
+ [super sendEventWithName: eventName body: body];
52
+ }
53
+ }
54
+
55
+ @end
56
+
57
+ #pragma clang diagnostic pop
58
+