├── .gitattributes ├── .gitignore ├── README.md ├── RNSquarePos.podspec ├── android ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── io │ └── matix │ ├── RNSquarePosModule.java │ └── RNSquarePosPackage.java ├── index.js ├── ios ├── RNSquarePos.h ├── RNSquarePos.m ├── RNSquarePos.xcodeproj │ └── project.pbxproj └── RNSquarePos.xcworkspace │ └── contents.xcworkspacedata └── package.json /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # OSX 3 | # 4 | .DS_Store 5 | 6 | # node.js 7 | # 8 | node_modules/ 9 | npm-debug.log 10 | yarn-error.log 11 | 12 | 13 | # Xcode 14 | # 15 | build/ 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | xcuserdata 25 | *.xccheckout 26 | *.moved-aside 27 | DerivedData 28 | *.hmap 29 | *.ipa 30 | *.xcuserstate 31 | project.xcworkspace 32 | 33 | 34 | # Android/IntelliJ 35 | # 36 | build/ 37 | .idea 38 | .gradle 39 | local.properties 40 | *.iml 41 | 42 | # BUCK 43 | buck-out/ 44 | \.buckd/ 45 | *.keystore 46 | 47 | ._* -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # react-native-square-pos 3 | 4 | ## Getting started 5 | 6 | ### Installation 7 | 8 | 1. `npm install react-native-square-pos --save` or `yarn add react-native-square-pos` 9 | 2. `react-native link` 10 | 11 | ### iOS Installation 12 | 13 | 1. Add `RNSquarePos` to your Podfile: `pod 'RNSquarePos', :path => '../node_modules/react-native-square-pos'`, and run `pod install` 14 | 2. In the ["Getting Started" section from Square Docs](https://github.com/square/SquarePointOfSaleSDK-iOS/tree/fcb44143c9b199f62f9feb61e98a51516e0c28a3#update-your-infoplist), complete the following sections: "Update your Info.plist", and "Register your app with Square". **Take note of the _URL Scheme_ and the _Application ID_**. 15 | 3. Make sure you've modified [`AppDelegate.m` to include `RCTLinking`](https://facebook.github.io/react-native/docs/linking). 16 | 17 | ### Android Installation 18 | 19 | 1. Follow ["Step 2: Register your application" in Square Android docs](https://docs.connect.squareup.com/payments/pos/setup-android#step-2-register-your-application). 20 | 2. **Take note of your _Application ID_** (this is found in the Square Developer dashboard, under "Credentials") 21 | 22 | 23 | ## Usage 24 | 25 | Import the package 26 | 27 | ```javascript 28 | import SquarePOS from 'react-native-square-pos' 29 | ``` 30 | 31 | Configure the package 32 | 33 | ```javascript 34 | SquarePOS.configure({ 35 | applicationId: 'Your Square application ID', 36 | callbackUrl: 'yourUrlScheme://some-unique-path' 37 | }) 38 | ``` 39 | 40 | Make a transaction 41 | 42 | ```javascript 43 | const amountInCents = 100 44 | const currency = 'CAD' // 🇨🇦 45 | const options = { 46 | tenderTypes: [ 47 | 'CARD', 48 | 'CARD_ON_FILE', 49 | 'CASH', 50 | 'OTHER' 51 | ], 52 | note: 'This note shows up on the transaction', 53 | locationId: 'Optionally pass location Id', // only on iOS at the moment 54 | } 55 | SquarePOS.transaction(amountInCents, currency, options) 56 | .then((result) => { 57 | // the transaction was successful 58 | const { transactionId, clientTransactionId } = result 59 | }) 60 | .catch((err) => { 61 | // the transaction failed. 62 | // see error codes below. 63 | const { errorCode } = err 64 | }) 65 | ``` 66 | 67 | ### Errors 68 | 69 | There are a number of different error codes, which may differ on Android / iOS. Eventually, an exhaustive list should be compiled here. For now, here are the important ones: 70 | 71 | - `CANNOT_OPEN_SQUARE`: The user doesn't have the Square POS app installed 72 | - `NOT_LOGGED_IN`: The user isn't logged into a Square account 73 | - `USER_NOT_ACTIVE`: Not totally sure what this does 74 | - `PAYMENT_CANCELLED`: The payment got cancelled from within the app 75 | - `NO_NETWORK_CONNECTION`: No network connection on the phone 76 | - `AMOUNT_TOO_SMALL`: `amountInCents` was too small (iOS only) 77 | - `AMOUNT_TOO_LARGE`: `amountInCents` was too large (iOS only) 78 | - `INVALID_REQUEST`: Square Point-of-Sale couldn't process the request (because of malformed data or other) (Android only, check `err.squareResponse` for more information) 79 | 80 | Additionally, because this is a young project: 81 | 82 | - `UNKNOWN_ANDROID_ERROR`, if the response from Square Android SDK if the response wasn't handled by this package. On Android, you'll have access to `err.squareResponse` to see the entire response data sent back from Square Point-of-Sale. 83 | - `UNKNOWN_IOS_ERROR`, if the response from Square iOS SDK wasn't handled by this package. 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /RNSquarePos.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | s.name = "RNSquarePos" 4 | s.version = "1.0.13" 5 | s.summary = "RNSquarePos" 6 | s.description = <<-DESC 7 | RNSquarePos 8 | DESC 9 | s.homepage = "https://github.com/matix-io/react-native-square-pos" 10 | s.license = "MIT" 11 | # s.license = { :type => "MIT", :file => "FILE_LICENSE" } 12 | s.author = { "author" => "connor@matix.io" } 13 | s.platform = :ios, "7.0" 14 | s.source = { :git => "https://github.com/matix-io/react-native-square-pos.git", :tag => "master" } 15 | s.source_files = "ios/**/*.{h,m}" 16 | s.requires_arc = true 17 | 18 | 19 | s.dependency "React" 20 | s.dependency "SquarePointOfSaleSDK" 21 | end 22 | 23 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | 2 | buildscript { 3 | repositories { 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.3.1' 9 | } 10 | } 11 | 12 | apply plugin: 'com.android.library' 13 | 14 | android { 15 | compileSdkVersion 28 16 | buildToolsVersion "28.0.3" 17 | 18 | defaultConfig { 19 | minSdkVersion 16 20 | targetSdkVersion 22 21 | versionCode 1 22 | versionName "1.0" 23 | } 24 | lintOptions { 25 | abortOnError false 26 | } 27 | } 28 | 29 | repositories { 30 | mavenCentral() 31 | } 32 | 33 | dependencies { 34 | compile 'com.facebook.react:react-native:+' 35 | compile 'com.squareup.sdk:point-of-sale-sdk:2.+' 36 | } 37 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /android/src/main/java/io/matix/RNSquarePosModule.java: -------------------------------------------------------------------------------- 1 | 2 | package io.matix; 3 | 4 | import com.facebook.react.bridge.NativeModule; 5 | import com.facebook.react.bridge.ReactApplicationContext; 6 | import com.facebook.react.bridge.ReactContext; 7 | import com.facebook.react.bridge.ReactContextBaseJavaModule; 8 | import com.facebook.react.bridge.ReactMethod; 9 | import com.facebook.react.bridge.WritableMap; 10 | import com.facebook.react.bridge.ReadableMap; 11 | import com.facebook.react.bridge.ReadableArray; 12 | import com.facebook.react.bridge.Arguments; 13 | import com.facebook.react.bridge.Callback; 14 | import com.facebook.react.bridge.ActivityEventListener; 15 | import com.facebook.react.modules.core.DeviceEventManagerModule; 16 | import com.squareup.sdk.pos.PosClient; 17 | import com.squareup.sdk.pos.PosSdk; 18 | import com.squareup.sdk.pos.ChargeRequest; 19 | import com.squareup.sdk.pos.CurrencyCode; 20 | import android.content.ActivityNotFoundException; 21 | import android.content.Intent; 22 | import android.app.Activity; 23 | import java.util.concurrent.TimeUnit; 24 | 25 | 26 | class RequestCode { 27 | public static int CHARGE = 1; 28 | } 29 | 30 | 31 | class SquarePOSListener implements ActivityEventListener { 32 | private ReactContext reactContext; 33 | private PosClient posClient; 34 | 35 | public SquarePOSListener(ReactContext reactContext, PosClient posClient) { 36 | this.reactContext = reactContext; 37 | this.posClient = posClient; 38 | } 39 | 40 | public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) { 41 | WritableMap params = Arguments.createMap(); 42 | 43 | if (data == null || requestCode != RequestCode.CHARGE) { 44 | return; 45 | } 46 | 47 | if (resultCode == Activity.RESULT_OK) { 48 | ChargeRequest.Success success = this.posClient.parseChargeSuccess(data); 49 | params.putString("transactionId", success.serverTransactionId); 50 | params.putString("clientTransactionId", success.clientTransactionId); 51 | } else { 52 | ChargeRequest.Error error = this.posClient.parseChargeError(data); 53 | params.putString("debugDescription", error.debugDescription); 54 | params.putString("errorCode", error.code.toString()); 55 | params.putString("response", error.debugDescription); 56 | } 57 | 58 | this.reactContext 59 | .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) 60 | .emit("RNSquarePOSResponse", params); 61 | } 62 | 63 | public void onNewIntent(Intent intent) { 64 | 65 | } 66 | } 67 | 68 | 69 | public class RNSquarePosModule extends ReactContextBaseJavaModule { 70 | private ReactContext reactContext; 71 | private PosClient posClient; 72 | 73 | public RNSquarePosModule(ReactApplicationContext reactContext) { 74 | super(reactContext); 75 | this.reactContext = reactContext; 76 | } 77 | 78 | @Override 79 | public String getName() { 80 | return "RNSquarePos"; 81 | } 82 | 83 | @ReactMethod 84 | public void setApplicationId(String applicationId) { 85 | this.posClient = PosSdk.createClient(this.reactContext, applicationId); 86 | this.reactContext.addActivityEventListener(new SquarePOSListener(this.reactContext, this.posClient)); 87 | } 88 | 89 | @ReactMethod 90 | public void startTransaction(int amount, String currencyCode, ReadableMap data, Callback errorCallback) { 91 | CurrencyCode code = CurrencyCode.valueOf(currencyCode); 92 | 93 | ChargeRequest.Builder builder = new ChargeRequest.Builder( 94 | amount, 95 | code 96 | ); 97 | 98 | if (data.hasKey("autoReturn")) { 99 | builder.autoReturn(data.getInt("autoReturn"), TimeUnit.MILLISECONDS); 100 | } 101 | 102 | if (data.hasKey("note")) { 103 | builder.note(data.getString("note")); 104 | } 105 | 106 | if (data.hasKey("tenderTypes")) { 107 | ReadableArray types = data.getArray("tenderTypes"); 108 | ChargeRequest.TenderType tenderTypes[] = new ChargeRequest.TenderType[types.size()]; 109 | for (int i = 0; i < types.size(); i += 1) { 110 | tenderTypes[i] = ChargeRequest.TenderType.valueOf(types.getString(i)); 111 | } 112 | builder.restrictTendersTo(tenderTypes); 113 | } 114 | 115 | if (data.hasKey("locationId")) { 116 | builder.enforceBusinessLocation(data.getString("locationId")); 117 | } 118 | 119 | ChargeRequest request = builder.build(); 120 | 121 | try { 122 | Intent intent = posClient.createChargeIntent(request); 123 | this.reactContext.getCurrentActivity().startActivityForResult(intent, RequestCode.CHARGE); 124 | } catch (ActivityNotFoundException e) { 125 | errorCallback.invoke(e.toString()); 126 | } 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /android/src/main/java/io/matix/RNSquarePosPackage.java: -------------------------------------------------------------------------------- 1 | 2 | package io.matix; 3 | 4 | import java.util.Arrays; 5 | import java.util.Collections; 6 | import java.util.List; 7 | 8 | import com.facebook.react.ReactPackage; 9 | import com.facebook.react.bridge.NativeModule; 10 | import com.facebook.react.bridge.ReactApplicationContext; 11 | import com.facebook.react.uimanager.ViewManager; 12 | import com.facebook.react.bridge.JavaScriptModule; 13 | public class RNSquarePosPackage implements ReactPackage { 14 | @Override 15 | public List createNativeModules(ReactApplicationContext reactContext) { 16 | return Arrays.asList(new RNSquarePosModule(reactContext)); 17 | } 18 | 19 | // Deprecated from RN 0.47 20 | public List> createJSModules() { 21 | return Collections.emptyList(); 22 | } 23 | 24 | @Override 25 | public List createViewManagers(ReactApplicationContext reactContext) { 26 | return Collections.emptyList(); 27 | } 28 | } -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import { NativeModules, DeviceEventEmitter, Platform, Linking } from 'react-native' 2 | const SquarePOS = NativeModules.RNSquarePos 3 | 4 | let callbackUrl 5 | 6 | const errors = { 7 | CANNOT_OPEN_SQUARE: 'CANNOT_OPEN_SQUARE', 8 | UNKNOWN_IOS_ERROR: 'UNKNOWN_IOS_ERROR', 9 | UNKNOWN_ANDROID_ERROR: 'UNKNOWN_ANDROID_ERROR', 10 | PAYMENT_CANCELLED: 'PAYMENT_CANCELLED', 11 | NOT_LOGGED_IN: 'NOT_LOGGED_IN', 12 | USER_NOT_ACTIVE: 'USER_NOT_ACTIVE', 13 | AMOUNT_TOO_SMALL: 'AMOUNT_TOO_SMALL', 14 | AMOUNT_TOO_LARGE: 'AMOUNT_TOO_LARGE', 15 | INVALID_TENDER_TYPE: 'INVALID_TENDER_TYPE', 16 | UNSUPPORTED_TENDER_TYPE: 'UNSUPPORTED_TENDER_TYPE', 17 | NO_NETWORK_CONNECTION: 'NO_NETWORK_CONNECTION', 18 | TRANSACTION_ALREADY_IN_PROGRESS: 'TRANSACTION_ALREADY_IN_PROGRESS', 19 | INVALID_REQUEST: 'INVALID_REQUEST', 20 | } 21 | 22 | const iosErrors = { 23 | payment_canceled: errors.PAYMENT_CANCELLED, 24 | not_logged_in: errors.NOT_LOGGED_IN, 25 | user_not_active: errors.USER_NOT_ACTIVE, 26 | amount_too_small: errors.AMOUNT_TOO_SMALL, 27 | amount_too_large: errors.AMOUNT_TOO_LARGE, 28 | invalid_tender_type: errors.INVALID_TENDER_TYPE, 29 | unsupported_tender_type: errors.UNSUPPORTED_TENDER_TYPE, 30 | no_network_connection: errors.NO_NETWORK_CONNECTION, 31 | } 32 | 33 | const androidErrors = { 34 | TRANSACTION_CANCELED: errors.PAYMENT_CANCELLED, 35 | USER_NOT_LOGGED_IN: errors.NOT_LOGGED_IN, 36 | USER_NOT_ACTIVATED: errors.USER_NOT_ACTIVE, 37 | NO_NETWORK: errors.NO_NETWORK_CONNECTION, 38 | TRANSACTION_ALREADY_IN_PROGRESS: errors.TRANSACTION_ALREADY_IN_PROGRESS, 39 | INVALID_REQUEST: errors.INVALID_REQUEST, 40 | } 41 | 42 | const RNSquarePos = { 43 | ERRORS: errors, 44 | configure: (options) => { 45 | SquarePOS.setApplicationId(options.applicationId) 46 | callbackUrl = options.callbackUrl 47 | }, 48 | transaction: (amount, currency, options = {}) => { 49 | return new Promise((resolve, reject) => { 50 | if (Platform.OS === 'android') { 51 | SquarePOS.startTransaction(amount, currency, options, () => { 52 | return reject({ 53 | errorCode: errors.CANNOT_OPEN_SQUARE 54 | }) 55 | }) 56 | 57 | function handleResponse(data) { 58 | DeviceEventEmitter.removeListener('RNSquarePOSResponse', handleResponse); 59 | if (data.errorCode) { 60 | if (androidErrors[data.errorCode]) { 61 | return reject({ 62 | errorCode: androidErrors[data.errorCode], 63 | squareResponse: data 64 | }) 65 | } else { 66 | return reject({ 67 | errorCode: errors.UNKNOWN_ANDROID_ERROR, 68 | originalCode: data.errorCode, 69 | squareResponse: data 70 | }) 71 | } 72 | } else { 73 | return resolve(data) 74 | } 75 | } 76 | 77 | DeviceEventEmitter.addListener('RNSquarePOSResponse', handleResponse); 78 | } else if (Platform.OS === 'ios') { 79 | SquarePOS.startTransaction(amount, currency, options, callbackUrl, (errorCode, errorDescription) => { 80 | switch (errorCode) { 81 | case 6: 82 | reject({ 83 | errorCode: errors.CANNOT_OPEN_SQUARE 84 | }) 85 | break 86 | 87 | default: 88 | reject({ 89 | errorCode: errors.UNKNOWN_IOS_ERROR, 90 | errorDescription 91 | }) 92 | break 93 | } 94 | }) 95 | 96 | function handleIOSResponse(event) { 97 | Linking.removeEventListener('url', handleIOSResponse); 98 | const url = event.url 99 | 100 | if (url.match(callbackUrl)) { 101 | const data = JSON.parse(decodeURIComponent(url.split('?data=')[1])) 102 | 103 | if (data.error_code) { 104 | if (iosErrors[data.error_code]) { 105 | return reject({ 106 | errorCode: iosErrors[data.error_code] 107 | }) 108 | } else { 109 | return reject({ 110 | errorCode: errors.UNKNOWN_IOS_ERROR, 111 | originalCode: data.error_code 112 | }) 113 | } 114 | } else { 115 | return resolve({ 116 | transactionId: data.transaction_id, 117 | clientTransactionId: data.client_transaction_id 118 | }) 119 | } 120 | } 121 | } 122 | 123 | Linking.addEventListener('url', handleIOSResponse); 124 | } 125 | }) 126 | }, 127 | } 128 | 129 | export default RNSquarePos; 130 | 131 | -------------------------------------------------------------------------------- /ios/RNSquarePos.h: -------------------------------------------------------------------------------- 1 | 2 | #if __has_include("RCTBridgeModule.h") 3 | #import "RCTBridgeModule.h" 4 | #else 5 | #import 6 | #endif 7 | 8 | @interface RNSquarePos : NSObject 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /ios/RNSquarePos.m: -------------------------------------------------------------------------------- 1 | 2 | #import "RNSquarePos.h" 3 | //Following have been added as the umbrella header file of SquarePointOfSaleSDK.h is no more shipped from upstream SquarePointOfSaleSDK 4 | #import 5 | #import 6 | #import 7 | #import 8 | 9 | @implementation RNSquarePos 10 | 11 | NSString *applicationId; 12 | 13 | RCT_EXPORT_METHOD(setApplicationId:(NSString *) _applicationId) { 14 | applicationId = _applicationId; 15 | } 16 | 17 | RCT_EXPORT_METHOD( 18 | startTransaction:(int)_amount 19 | currency:(NSString *)currency 20 | options:(NSDictionary *)options 21 | callbackUrl:(NSString *)callbackUrl 22 | onError:(RCTResponseSenderBlock)onError 23 | ) { 24 | NSError *error; 25 | NSURL *const callbackURL = [NSURL URLWithString:callbackUrl]; 26 | SCCMoney *const amount = [SCCMoney moneyWithAmountCents:_amount currencyCode:currency error:NULL]; 27 | [SCCAPIRequest setApplicationID:applicationId]; //clientID property is deprecated. Instead per documentation applicationID property needs to be set. 28 | 29 | // notes 30 | NSString *notes = nil; 31 | if ([options objectForKey:@"note"]) { 32 | notes = [options objectForKey:@"note"]; 33 | } 34 | 35 | // tenderTypes 36 | SCCAPIRequestTenderTypes tenderTypes = nil; 37 | SCCAPIRequestTenderTypes currType; 38 | NSArray *_tenderTypes = nil; 39 | NSString *tenderType; 40 | if ([options objectForKey:@"tenderTypes"]) { 41 | _tenderTypes = [options objectForKey:@"tenderTypes"]; 42 | for (int i = 0; i < [_tenderTypes count]; i++) { 43 | tenderType = [_tenderTypes objectAtIndex:i]; 44 | currType = nil; 45 | if ([tenderType isEqualToString:@"CASH"]) { 46 | currType = SCCAPIRequestTenderTypeCash; 47 | } else if ([tenderType isEqualToString:@"CARD"]) { 48 | currType = SCCAPIRequestTenderTypeCard; 49 | } else if ([tenderType isEqualToString:@"CARD_ON_FILE"]) { 50 | currType = SCCAPIRequestTenderTypeCardOnFile; 51 | } else if ([tenderType isEqualToString:@"OTHER"]) { 52 | currType = SCCAPIRequestTenderTypeOther; 53 | } 54 | 55 | if (currType != nil) { 56 | if (tenderTypes == nil) { 57 | tenderTypes = currType; 58 | } else { 59 | tenderTypes = tenderTypes | currType; 60 | } 61 | } 62 | } 63 | } 64 | if (tenderTypes == nil) { 65 | tenderTypes = SCCAPIRequestTenderTypeAll; 66 | } 67 | 68 | // location id 69 | NSString *locationId = nil; 70 | if ([options objectForKey:@"locationId"]) { 71 | locationId = [options objectForKey:@"locationId"]; 72 | } 73 | 74 | // autoreturn 75 | BOOL autoReturn = NO; 76 | if ([options objectForKey:@"returnAutomaticallyAfterPayment"]) { 77 | autoReturn = [options objectForKey:@"returnAutomaticallyAfterPayment"]; 78 | } 79 | 80 | SCCAPIRequest *request = [SCCAPIRequest 81 | requestWithCallbackURL:callbackURL 82 | amount:amount 83 | userInfoString:nil 84 | locationID:locationId 85 | notes:notes 86 | customerID:nil 87 | supportedTenderTypes:tenderTypes 88 | clearsDefaultFees:NO 89 | returnsAutomaticallyAfterPayment:autoReturn 90 | disablesKeyedInCardEntry:NO 91 | skipsReceipt:NO 92 | error:&error]; 93 | [SCCAPIConnection performRequest:request error:&error]; 94 | if (error != nil) { 95 | onError(@[[NSNumber numberWithInt:[error code]], [error localizedDescription]]); 96 | } 97 | } 98 | 99 | - (dispatch_queue_t)methodQueue 100 | { 101 | return dispatch_get_main_queue(); 102 | } 103 | RCT_EXPORT_MODULE() 104 | 105 | @end 106 | -------------------------------------------------------------------------------- /ios/RNSquarePos.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B3E7B58A1CC2AC0600A0062D /* RNSquarePos.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNSquarePos.m */; }; 11 | /* End PBXBuildFile section */ 12 | 13 | /* Begin PBXCopyFilesBuildPhase section */ 14 | 58B511D91A9E6C8500147676 /* CopyFiles */ = { 15 | isa = PBXCopyFilesBuildPhase; 16 | buildActionMask = 2147483647; 17 | dstPath = "include/$(PRODUCT_NAME)"; 18 | dstSubfolderSpec = 16; 19 | files = ( 20 | ); 21 | runOnlyForDeploymentPostprocessing = 0; 22 | }; 23 | /* End PBXCopyFilesBuildPhase section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | 134814201AA4EA6300B7C361 /* libRNSquarePos.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNSquarePos.a; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | B3E7B5881CC2AC0600A0062D /* RNSquarePos.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSquarePos.h; sourceTree = ""; }; 28 | B3E7B5891CC2AC0600A0062D /* RNSquarePos.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSquarePos.m; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | 58B511D81A9E6C8500147676 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | 134814211AA4EA7D00B7C361 /* Products */ = { 43 | isa = PBXGroup; 44 | children = ( 45 | 134814201AA4EA6300B7C361 /* libRNSquarePos.a */, 46 | ); 47 | name = Products; 48 | sourceTree = ""; 49 | }; 50 | 58B511D21A9E6C8500147676 = { 51 | isa = PBXGroup; 52 | children = ( 53 | B3E7B5881CC2AC0600A0062D /* RNSquarePos.h */, 54 | B3E7B5891CC2AC0600A0062D /* RNSquarePos.m */, 55 | 134814211AA4EA7D00B7C361 /* Products */, 56 | ); 57 | sourceTree = ""; 58 | }; 59 | /* End PBXGroup section */ 60 | 61 | /* Begin PBXNativeTarget section */ 62 | 58B511DA1A9E6C8500147676 /* RNSquarePos */ = { 63 | isa = PBXNativeTarget; 64 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNSquarePos" */; 65 | buildPhases = ( 66 | 58B511D71A9E6C8500147676 /* Sources */, 67 | 58B511D81A9E6C8500147676 /* Frameworks */, 68 | 58B511D91A9E6C8500147676 /* CopyFiles */, 69 | ); 70 | buildRules = ( 71 | ); 72 | dependencies = ( 73 | ); 74 | name = RNSquarePos; 75 | productName = RCTDataManager; 76 | productReference = 134814201AA4EA6300B7C361 /* libRNSquarePos.a */; 77 | productType = "com.apple.product-type.library.static"; 78 | }; 79 | /* End PBXNativeTarget section */ 80 | 81 | /* Begin PBXProject section */ 82 | 58B511D31A9E6C8500147676 /* Project object */ = { 83 | isa = PBXProject; 84 | attributes = { 85 | LastUpgradeCheck = 0830; 86 | ORGANIZATIONNAME = Facebook; 87 | TargetAttributes = { 88 | 58B511DA1A9E6C8500147676 = { 89 | CreatedOnToolsVersion = 6.1.1; 90 | }; 91 | }; 92 | }; 93 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNSquarePos" */; 94 | compatibilityVersion = "Xcode 3.2"; 95 | developmentRegion = English; 96 | hasScannedForEncodings = 0; 97 | knownRegions = ( 98 | en, 99 | ); 100 | mainGroup = 58B511D21A9E6C8500147676; 101 | productRefGroup = 58B511D21A9E6C8500147676; 102 | projectDirPath = ""; 103 | projectRoot = ""; 104 | targets = ( 105 | 58B511DA1A9E6C8500147676 /* RNSquarePos */, 106 | ); 107 | }; 108 | /* End PBXProject section */ 109 | 110 | /* Begin PBXSourcesBuildPhase section */ 111 | 58B511D71A9E6C8500147676 /* Sources */ = { 112 | isa = PBXSourcesBuildPhase; 113 | buildActionMask = 2147483647; 114 | files = ( 115 | B3E7B58A1CC2AC0600A0062D /* RNSquarePos.m in Sources */, 116 | ); 117 | runOnlyForDeploymentPostprocessing = 0; 118 | }; 119 | /* End PBXSourcesBuildPhase section */ 120 | 121 | /* Begin XCBuildConfiguration section */ 122 | 58B511ED1A9E6C8500147676 /* Debug */ = { 123 | isa = XCBuildConfiguration; 124 | buildSettings = { 125 | ALWAYS_SEARCH_USER_PATHS = NO; 126 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 127 | CLANG_CXX_LIBRARY = "libc++"; 128 | CLANG_ENABLE_MODULES = YES; 129 | CLANG_ENABLE_OBJC_ARC = YES; 130 | CLANG_WARN_BOOL_CONVERSION = YES; 131 | CLANG_WARN_CONSTANT_CONVERSION = YES; 132 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 133 | CLANG_WARN_EMPTY_BODY = YES; 134 | CLANG_WARN_ENUM_CONVERSION = YES; 135 | CLANG_WARN_INFINITE_RECURSION = YES; 136 | CLANG_WARN_INT_CONVERSION = YES; 137 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 138 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 139 | CLANG_WARN_UNREACHABLE_CODE = YES; 140 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 141 | COPY_PHASE_STRIP = NO; 142 | ENABLE_STRICT_OBJC_MSGSEND = YES; 143 | ENABLE_TESTABILITY = YES; 144 | GCC_C_LANGUAGE_STANDARD = gnu99; 145 | GCC_DYNAMIC_NO_PIC = NO; 146 | GCC_NO_COMMON_BLOCKS = YES; 147 | GCC_OPTIMIZATION_LEVEL = 0; 148 | GCC_PREPROCESSOR_DEFINITIONS = ( 149 | "DEBUG=1", 150 | "$(inherited)", 151 | ); 152 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 153 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 154 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 155 | GCC_WARN_UNDECLARED_SELECTOR = YES; 156 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 157 | GCC_WARN_UNUSED_FUNCTION = YES; 158 | GCC_WARN_UNUSED_VARIABLE = YES; 159 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 160 | MTL_ENABLE_DEBUG_INFO = YES; 161 | ONLY_ACTIVE_ARCH = YES; 162 | SDKROOT = iphoneos; 163 | }; 164 | name = Debug; 165 | }; 166 | 58B511EE1A9E6C8500147676 /* Release */ = { 167 | isa = XCBuildConfiguration; 168 | buildSettings = { 169 | ALWAYS_SEARCH_USER_PATHS = NO; 170 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 171 | CLANG_CXX_LIBRARY = "libc++"; 172 | CLANG_ENABLE_MODULES = YES; 173 | CLANG_ENABLE_OBJC_ARC = YES; 174 | CLANG_WARN_BOOL_CONVERSION = YES; 175 | CLANG_WARN_CONSTANT_CONVERSION = YES; 176 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 177 | CLANG_WARN_EMPTY_BODY = YES; 178 | CLANG_WARN_ENUM_CONVERSION = YES; 179 | CLANG_WARN_INFINITE_RECURSION = YES; 180 | CLANG_WARN_INT_CONVERSION = YES; 181 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 182 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 183 | CLANG_WARN_UNREACHABLE_CODE = YES; 184 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 185 | COPY_PHASE_STRIP = YES; 186 | ENABLE_NS_ASSERTIONS = NO; 187 | ENABLE_STRICT_OBJC_MSGSEND = YES; 188 | GCC_C_LANGUAGE_STANDARD = gnu99; 189 | GCC_NO_COMMON_BLOCKS = YES; 190 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 191 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 192 | GCC_WARN_UNDECLARED_SELECTOR = YES; 193 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 194 | GCC_WARN_UNUSED_FUNCTION = YES; 195 | GCC_WARN_UNUSED_VARIABLE = YES; 196 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 197 | MTL_ENABLE_DEBUG_INFO = NO; 198 | SDKROOT = iphoneos; 199 | VALIDATE_PRODUCT = YES; 200 | }; 201 | name = Release; 202 | }; 203 | 58B511F01A9E6C8500147676 /* Debug */ = { 204 | isa = XCBuildConfiguration; 205 | buildSettings = { 206 | HEADER_SEARCH_PATHS = ( 207 | "$(inherited)", 208 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 209 | "$(SRCROOT)/../../../React/**", 210 | "$(SRCROOT)/../../react-native/React/**", 211 | ); 212 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 213 | OTHER_LDFLAGS = "-ObjC"; 214 | PRODUCT_NAME = RNSquarePos; 215 | SKIP_INSTALL = YES; 216 | }; 217 | name = Debug; 218 | }; 219 | 58B511F11A9E6C8500147676 /* Release */ = { 220 | isa = XCBuildConfiguration; 221 | buildSettings = { 222 | HEADER_SEARCH_PATHS = ( 223 | "$(inherited)", 224 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 225 | "$(SRCROOT)/../../../React/**", 226 | "$(SRCROOT)/../../react-native/React/**", 227 | ); 228 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 229 | OTHER_LDFLAGS = "-ObjC"; 230 | PRODUCT_NAME = RNSquarePos; 231 | SKIP_INSTALL = YES; 232 | }; 233 | name = Release; 234 | }; 235 | /* End XCBuildConfiguration section */ 236 | 237 | /* Begin XCConfigurationList section */ 238 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNSquarePos" */ = { 239 | isa = XCConfigurationList; 240 | buildConfigurations = ( 241 | 58B511ED1A9E6C8500147676 /* Debug */, 242 | 58B511EE1A9E6C8500147676 /* Release */, 243 | ); 244 | defaultConfigurationIsVisible = 0; 245 | defaultConfigurationName = Release; 246 | }; 247 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNSquarePos" */ = { 248 | isa = XCConfigurationList; 249 | buildConfigurations = ( 250 | 58B511F01A9E6C8500147676 /* Debug */, 251 | 58B511F11A9E6C8500147676 /* Release */, 252 | ); 253 | defaultConfigurationIsVisible = 0; 254 | defaultConfigurationName = Release; 255 | }; 256 | /* End XCConfigurationList section */ 257 | }; 258 | rootObject = 58B511D31A9E6C8500147676 /* Project object */; 259 | } 260 | -------------------------------------------------------------------------------- /ios/RNSquarePos.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | 3 | 5 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "react-native-square-pos", 4 | "version": "1.1.2", 5 | "description": "React Native wrapper around Square's Android / iOS POS SDKs", 6 | "main": "index.js", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "keywords": [ 11 | "react-native", 12 | "react", 13 | "native", 14 | "square", 15 | "pos", 16 | "point of sale" 17 | ], 18 | "author": "Connor Bode ", 19 | "license": "MIT", 20 | "homepage": "https://matix.io/react-native-square-pos/", 21 | "peerDependencies": { 22 | "react-native": "^0.41.2" 23 | }, 24 | "repository": "github:matix-io/react-native-square-pos" 25 | } 26 | --------------------------------------------------------------------------------