10 | #endif
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/android/src/main/java/com/pagseguroplugpag/AppException.java:
--------------------------------------------------------------------------------
1 | package com.pagseguroplugpag;
2 |
3 | public class AppException extends Throwable {
4 | public AppException(String message) {
5 | super(message);
6 | }
7 |
8 | public AppException(String message, Throwable cause) {
9 | super(message, cause);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig helps developers define and maintain consistent
2 | # coding styles between different editors and IDEs
3 | # editorconfig.org
4 |
5 | root = true
6 |
7 | [*]
8 |
9 | indent_style = space
10 | indent_size = 2
11 |
12 | end_of_line = lf
13 | charset = utf-8
14 | trim_trailing_whitespace = true
15 | insert_final_newline = true
16 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/lefthook.yml:
--------------------------------------------------------------------------------
1 | pre-commit:
2 | parallel: true
3 | commands:
4 | lint:
5 | files: git diff --name-only @{push}
6 | glob: "*.{js,ts,jsx,tsx}"
7 | run: npx eslint {files}
8 | types:
9 | files: git diff --name-only @{push}
10 | glob: "*.{js,ts, jsx, tsx}"
11 | run: npx tsc --noEmit
12 | commit-msg:
13 | parallel: true
14 | commands:
15 | commitlint:
16 | run: npx commitlint --edit
17 |
--------------------------------------------------------------------------------
/example/babel.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const pak = require('../package.json');
3 |
4 | module.exports = {
5 | presets: ['module:metro-react-native-babel-preset'],
6 | plugins: [
7 | [
8 | 'module-resolver',
9 | {
10 | extensions: ['.tsx', '.ts', '.js', '.json'],
11 | alias: {
12 | [pak.name]: path.join(__dirname, '..', pak.source),
13 | },
14 | },
15 | ],
16 | ],
17 | };
18 |
--------------------------------------------------------------------------------
/example/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
--------------------------------------------------------------------------------
/ios/PagseguroPlugpag.mm:
--------------------------------------------------------------------------------
1 | #import "PagseguroPlugpag.h"
2 |
3 | @implementation PagseguroPlugpag
4 | RCT_EXPORT_MODULE()
5 |
6 | // Example method
7 | // See // https://reactnative.dev/docs/native-modules-ios
8 | RCT_EXPORT_METHOD(multiply:(double)a
9 | b:(double)b
10 | resolve:(RCTPromiseResolveBlock)resolve
11 | reject:(RCTPromiseRejectBlock)reject)
12 | {
13 | NSNumber *result = @(a * b);
14 |
15 | resolve(result);
16 | }
17 |
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/example/ios/.xcode.env:
--------------------------------------------------------------------------------
1 | # This `.xcode.env` file is versioned and is used to source the environment
2 | # used when running script phases inside Xcode.
3 | # To customize your local environment, you can create an `.xcode.env.local`
4 | # file that is not versioned.
5 |
6 | # NODE_BINARY variable contains the PATH to the node executable.
7 | #
8 | # Customize the NODE_BINARY variable here.
9 | # For example, to use nvm with brew, add the following line
10 | # . "$(brew --prefix nvm)/nvm.sh" --no-use
11 | export NODE_BINARY=$(command -v node)
12 |
--------------------------------------------------------------------------------
/plugin/src/index.ts:
--------------------------------------------------------------------------------
1 | import {
2 | withPlugins,
3 | createRunOncePlugin,
4 | type ConfigPlugin,
5 | } from '@expo/config-plugins';
6 | import {
7 | withBuildScriptDependency,
8 | withScriptAppBuildGradle,
9 | } from './android/buildScriptDependency';
10 |
11 | const withExpoSettingsApp: ConfigPlugin = (config) => {
12 | return withPlugins(config, [
13 | withBuildScriptDependency,
14 | withScriptAppBuildGradle,
15 | ]);
16 | };
17 |
18 | const pak = require('../../package.json');
19 | export default createRunOncePlugin(withExpoSettingsApp, pak.name, pak.version);
20 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/example/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "PagseguroPlugpagExample",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "android": "react-native run-android",
7 | "ios": "react-native run-ios",
8 | "start": "react-native start",
9 | "pods": "pod-install --quiet"
10 | },
11 | "dependencies": {
12 | "react": "18.2.0",
13 | "react-native": "0.72.4"
14 | },
15 | "devDependencies": {
16 | "@babel/core": "^7.20.0",
17 | "@babel/preset-env": "^7.20.0",
18 | "@babel/runtime": "^7.20.0",
19 | "@react-native/eslint-config": "^0.72.2",
20 | "@react-native/metro-config": "^0.72.11",
21 | "babel-plugin-module-resolver": "^5.0.0",
22 | "metro-react-native-babel-preset": "0.76.8"
23 | },
24 | "engines": {
25 | "node": ">=16"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/example/android/app/src/release/java/com/pagseguroplugpagexample/ReactNativeFlipper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the LICENSE file in the root
5 | * directory of this source tree.
6 | */
7 | package com.pagseguroplugpagexample;
8 |
9 | import android.content.Context;
10 | import com.facebook.react.ReactInstanceManager;
11 |
12 | /**
13 | * Class responsible of loading Flipper inside your React Native application. This is the release
14 | * flavor of it so it's empty as we don't want to load Flipper.
15 | */
16 | public class ReactNativeFlipper {
17 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
18 | // Do nothing as we don't want to initialize Flipper on Release.
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://turbo.build/schema.json",
3 | "pipeline": {
4 | "build:android": {
5 | "inputs": [
6 | "package.json",
7 | "android",
8 | "!android/build",
9 | "src/*.ts",
10 | "src/*.tsx",
11 | "example/package.json",
12 | "example/android",
13 | "!example/android/.gradle",
14 | "!example/android/build",
15 | "!example/android/app/build"
16 | ],
17 | "outputs": []
18 | },
19 | "build:ios": {
20 | "inputs": [
21 | "package.json",
22 | "*.podspec",
23 | "ios",
24 | "src/*.ts",
25 | "src/*.tsx",
26 | "example/package.json",
27 | "example/ios",
28 | "!example/ios/build",
29 | "!example/ios/Pods"
30 | ],
31 | "outputs": []
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "baseUrl": "./",
4 | "paths": {
5 | "react-native-pagseguro-plugpag": ["./src/index"]
6 | },
7 | "allowUnreachableCode": false,
8 | "allowUnusedLabels": false,
9 | "esModuleInterop": true,
10 | "forceConsistentCasingInFileNames": true,
11 | "jsx": "react",
12 | "lib": ["esnext"],
13 | "module": "esnext",
14 | "moduleResolution": "node",
15 | "noFallthroughCasesInSwitch": true,
16 | "noImplicitReturns": true,
17 | "noImplicitUseStrict": false,
18 | "noStrictGenericChecks": false,
19 | "noUncheckedIndexedAccess": true,
20 | "noUnusedLocals": true,
21 | "noUnusedParameters": true,
22 | "resolveJsonModule": true,
23 | "skipLibCheck": true,
24 | "strict": true,
25 | "target": "esnext",
26 | "verbatimModuleSyntax": true
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/example/ios/PagseguroPlugpagExampleTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/scripts/bootstrap.js:
--------------------------------------------------------------------------------
1 | const os = require('os');
2 | const path = require('path');
3 | const child_process = require('child_process');
4 |
5 | const root = path.resolve(__dirname, '..');
6 | const args = process.argv.slice(2);
7 | const options = {
8 | cwd: process.cwd(),
9 | env: process.env,
10 | stdio: 'inherit',
11 | encoding: 'utf-8',
12 | };
13 |
14 | if (os.type() === 'Windows_NT') {
15 | options.shell = true;
16 | }
17 |
18 | let result;
19 |
20 | if (process.cwd() !== root || args.length) {
21 | // We're not in the root of the project, or additional arguments were passed
22 | // In this case, forward the command to `yarn`
23 | result = child_process.spawnSync('yarn', args, options);
24 | } else {
25 | // If `yarn` is run without arguments, perform bootstrap
26 | result = child_process.spawnSync('yarn', ['bootstrap'], options);
27 | }
28 |
29 | process.exitCode = result.status;
30 |
--------------------------------------------------------------------------------
/example/ios/PagseguroPlugpagExample/AppDelegate.mm:
--------------------------------------------------------------------------------
1 | #import "AppDelegate.h"
2 |
3 | #import
4 |
5 | @implementation AppDelegate
6 |
7 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
8 | {
9 | self.moduleName = @"PagseguroPlugpagExample";
10 | // You can add your custom initial props in the dictionary below.
11 | // They will be passed down to the ViewController used by React Native.
12 | self.initialProps = @{};
13 |
14 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
15 | }
16 |
17 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
18 | {
19 | #if DEBUG
20 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
21 | #else
22 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
23 | #endif
24 | }
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/.github/actions/setup/action.yml:
--------------------------------------------------------------------------------
1 | name: Setup
2 | description: Setup Node.js and install dependencies
3 |
4 | runs:
5 | using: composite
6 | steps:
7 | - name: Setup Node.js
8 | uses: actions/setup-node@v3
9 | with:
10 | node-version-file: .nvmrc
11 |
12 | - name: Cache dependencies
13 | id: yarn-cache
14 | uses: actions/cache@v3
15 | with:
16 | path: |
17 | **/node_modules
18 | key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/package.json') }}
19 | restore-keys: |
20 | ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
21 | ${{ runner.os }}-yarn-
22 |
23 | - name: Install dependencies
24 | if: steps.yarn-cache.outputs.cache-hit != 'true'
25 | run: |
26 | yarn install --cwd example --frozen-lockfile
27 | yarn install --frozen-lockfile
28 | shell: bash
29 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext {
5 | buildToolsVersion = "33.0.0"
6 | minSdkVersion = 23
7 | compileSdkVersion = 33
8 | targetSdkVersion = 33
9 |
10 | // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
11 | ndkVersion = "23.1.7779620"
12 | }
13 | repositories {
14 | google()
15 | mavenCentral()
16 | }
17 | dependencies {
18 | classpath("com.android.tools.build:gradle")
19 | classpath("com.facebook.react:react-native-gradle-plugin")
20 | }
21 | }
22 |
23 | allprojects {
24 | repositories {
25 | google()
26 | mavenCentral()
27 | maven {
28 | url 'https://github.com/pagseguro/PlugPagServiceWrapper/raw/master'
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/android/src/main/java/com/pagseguroplugpag/PagseguroPlugpagPackage.java:
--------------------------------------------------------------------------------
1 | package com.pagseguroplugpag;
2 |
3 | import androidx.annotation.NonNull;
4 |
5 | import com.facebook.react.ReactPackage;
6 | import com.facebook.react.bridge.NativeModule;
7 | import com.facebook.react.bridge.ReactApplicationContext;
8 | import com.facebook.react.uimanager.ViewManager;
9 |
10 | import java.util.ArrayList;
11 | import java.util.Collections;
12 | import java.util.List;
13 |
14 | public class PagseguroPlugpagPackage implements ReactPackage {
15 | @NonNull
16 | @Override
17 | public List createNativeModules(@NonNull ReactApplicationContext reactContext) {
18 | List modules = new ArrayList<>();
19 | modules.add(new PagseguroPlugpagModule(reactContext));
20 | return modules;
21 | }
22 |
23 | @NonNull
24 | @Override
25 | public List createViewManagers(@NonNull ReactApplicationContext reactContext) {
26 | return Collections.emptyList();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX
2 | #
3 | .DS_Store
4 |
5 | # XDE
6 | .expo/
7 |
8 | # VSCode
9 | .vscode/
10 | jsconfig.json
11 |
12 | # Xcode
13 | #
14 | build/
15 | *.pbxuser
16 | !default.pbxuser
17 | *.mode1v3
18 | !default.mode1v3
19 | *.mode2v3
20 | !default.mode2v3
21 | *.perspectivev3
22 | !default.perspectivev3
23 | xcuserdata
24 | *.xccheckout
25 | *.moved-aside
26 | DerivedData
27 | *.hmap
28 | *.ipa
29 | *.xcuserstate
30 | project.xcworkspace
31 |
32 | # Android/IJ
33 | #
34 | .classpath
35 | .cxx
36 | .gradle
37 | .idea
38 | .project
39 | .settings
40 | local.properties
41 | android.iml
42 |
43 | # Cocoapods
44 | #
45 | example/ios/Pods
46 |
47 | # Ruby
48 | example/vendor/
49 |
50 | # node.js
51 | #
52 | node_modules/
53 | npm-debug.log
54 | yarn-debug.log
55 | yarn-error.log
56 |
57 | # BUCK
58 | buck-out/
59 | \.buckd/
60 | android/app/libs
61 | android/keystores/debug.keystore
62 |
63 | # Expo
64 | .expo/
65 |
66 | # Turborepo
67 | .turbo/
68 |
69 | # generated by bob
70 | lib/
71 |
72 | # Yarn
73 | yarn.lock
74 | .yarn
75 | example/yarn.lock
76 | example/.yarn
77 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
12 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 brunodsazevedo
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all
12 | copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | SOFTWARE.
21 |
--------------------------------------------------------------------------------
/example/ios/PagseguroPlugpagExample/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "scale" : "2x",
6 | "size" : "20x20"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "scale" : "3x",
11 | "size" : "20x20"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "scale" : "2x",
16 | "size" : "29x29"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "scale" : "3x",
21 | "size" : "29x29"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "scale" : "2x",
26 | "size" : "40x40"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "scale" : "3x",
31 | "size" : "40x40"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "scale" : "2x",
36 | "size" : "60x60"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "scale" : "3x",
41 | "size" : "60x60"
42 | },
43 | {
44 | "idiom" : "ios-marketing",
45 | "scale" : "1x",
46 | "size" : "1024x1024"
47 | }
48 | ],
49 | "info" : {
50 | "author" : "xcode",
51 | "version" : 1
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/pagseguroplugpagexample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.pagseguroplugpagexample;
2 |
3 | import com.facebook.react.ReactActivity;
4 | import com.facebook.react.ReactActivityDelegate;
5 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
6 | import com.facebook.react.defaults.DefaultReactActivityDelegate;
7 |
8 | public class MainActivity extends ReactActivity {
9 |
10 | /**
11 | * Returns the name of the main component registered from JavaScript. This is used to schedule
12 | * rendering of the component.
13 | */
14 | @Override
15 | protected String getMainComponentName() {
16 | return "PagseguroPlugpagExample";
17 | }
18 |
19 | /**
20 | * Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link
21 | * DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React
22 | * (aka React 18) with two boolean flags.
23 | */
24 | @Override
25 | protected ReactActivityDelegate createReactActivityDelegate() {
26 | return new DefaultReactActivityDelegate(
27 | this,
28 | getMainComponentName(),
29 | // If you opted-in for the New Architecture, we enable the Fabric Renderer.
30 | DefaultNewArchitectureEntryPoint.getFabricEnabled());
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/plugin/src/android/buildScriptDependency.ts:
--------------------------------------------------------------------------------
1 | import {
2 | withProjectBuildGradle,
3 | withAppBuildGradle,
4 | type ConfigPlugin,
5 | } from '@expo/config-plugins';
6 |
7 | export function setMavenBuildGradle(buildGradle: string) {
8 | return buildGradle.replace(
9 | /allprojects\s\{\n\s{4}repositories\s\{/gm,
10 | `allprojects {
11 | repositories {
12 | maven {
13 | url 'https://github.com/pagseguro/PlugPagServiceWrapper/raw/master'
14 | }`
15 | );
16 | }
17 |
18 | export function setDependenceAppBuildGradle(buildGradleApp: string) {
19 | return buildGradleApp.replace(
20 | /dependencies\s\{/gm,
21 | `dependencies {
22 | implementation("br.com.uol.pagseguro.plugpagservice.wrapper:wrapper:1.7.6")
23 | `
24 | );
25 | }
26 |
27 | export const withScriptAppBuildGradle: ConfigPlugin = (config) => {
28 | return withAppBuildGradle(config, (config) => {
29 | config.modResults.contents = setDependenceAppBuildGradle(
30 | config.modResults.contents
31 | );
32 |
33 | return config;
34 | });
35 | };
36 |
37 | export const withBuildScriptDependency: ConfigPlugin = (config) => {
38 | return withProjectBuildGradle(config, (config) => {
39 | config.modResults.contents = setMavenBuildGradle(
40 | config.modResults.contents
41 | );
42 |
43 | return config;
44 | });
45 | };
46 |
--------------------------------------------------------------------------------
/example/metro.config.js:
--------------------------------------------------------------------------------
1 | const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
2 | const path = require('path');
3 | const escape = require('escape-string-regexp');
4 | const exclusionList = require('metro-config/src/defaults/exclusionList');
5 | const pak = require('../package.json');
6 |
7 | const root = path.resolve(__dirname, '..');
8 | const modules = Object.keys({ ...pak.peerDependencies });
9 |
10 | /**
11 | * Metro configuration
12 | * https://facebook.github.io/metro/docs/configuration
13 | *
14 | * @type {import('metro-config').MetroConfig}
15 | */
16 | const config = {
17 | watchFolders: [root],
18 |
19 | // We need to make sure that only one version is loaded for peerDependencies
20 | // So we block them at the root, and alias them to the versions in example's node_modules
21 | resolver: {
22 | blacklistRE: exclusionList(
23 | modules.map(
24 | (m) =>
25 | new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`)
26 | )
27 | ),
28 |
29 | extraNodeModules: modules.reduce((acc, name) => {
30 | acc[name] = path.join(__dirname, 'node_modules', name);
31 | return acc;
32 | }, {}),
33 | },
34 |
35 | transformer: {
36 | getTransformOptions: async () => ({
37 | transform: {
38 | experimentalImportSupport: false,
39 | inlineRequires: true,
40 | },
41 | }),
42 | },
43 | };
44 |
45 | module.exports = mergeConfig(getDefaultConfig(__dirname), config);
46 |
--------------------------------------------------------------------------------
/example/ios/PagseguroPlugpagExample/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | PagseguroPlugpagExample
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(MARKETING_VERSION)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(CURRENT_PROJECT_VERSION)
25 | LSRequiresIPhoneOS
26 |
27 | NSAppTransportSecurity
28 |
29 | NSExceptionDomains
30 |
31 | localhost
32 |
33 | NSExceptionAllowsInsecureHTTPLoads
34 |
35 |
36 |
37 |
38 | NSLocationWhenInUseUsageDescription
39 |
40 | UILaunchStoryboardName
41 | LaunchScreen
42 | UIRequiredDeviceCapabilities
43 |
44 | armv7
45 |
46 | UISupportedInterfaceOrientations
47 |
48 | UIInterfaceOrientationPortrait
49 | UIInterfaceOrientationLandscapeLeft
50 | UIInterfaceOrientationLandscapeRight
51 |
52 | UIViewControllerBasedStatusBarAppearance
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/react-native-pagseguro-plugpag.podspec:
--------------------------------------------------------------------------------
1 | require "json"
2 |
3 | package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4 | folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
5 |
6 | Pod::Spec.new do |s|
7 | s.name = "react-native-pagseguro-plugpag"
8 | s.version = package["version"]
9 | s.summary = package["description"]
10 | s.homepage = package["homepage"]
11 | s.license = package["license"]
12 | s.authors = package["author"]
13 |
14 | s.platforms = { :ios => "11.0" }
15 | s.source = { :git => "https://github.com/brunodsazevedo/react-native-pagseguro-plugpag.git", :tag => "#{s.version}" }
16 |
17 | s.source_files = "ios/**/*.{h,m,mm}"
18 |
19 | # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
20 | # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
21 | if respond_to?(:install_modules_dependencies, true)
22 | install_modules_dependencies(s)
23 | else
24 | s.dependency "React-Core"
25 |
26 | # Don't install the dependencies when we run `pod install` in the old architecture.
27 | if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
28 | s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
29 | s.pod_target_xcconfig = {
30 | "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
31 | "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
32 | "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
33 | }
34 | s.dependency "React-Codegen"
35 | s.dependency "RCT-Folly"
36 | s.dependency "RCTRequired"
37 | s.dependency "RCTTypeSafety"
38 | s.dependency "ReactCommon/turbomodule/core"
39 | end
40 | end
41 | end
42 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/rn_edit_text_material.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
21 |
22 |
23 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
13 | org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | # AndroidX package structure to make it clearer which packages are bundled with the
21 | # Android operating system, and which are packaged with your app's APK
22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
23 | android.useAndroidX=true
24 | # Automatically convert third-party libraries to use AndroidX
25 | android.enableJetifier=true
26 |
27 | # Version of flipper SDK to use with React Native
28 | FLIPPER_VERSION=0.182.0
29 |
30 | # Use this property to specify which architecture you want to build.
31 | # You can also override it from the CLI using
32 | # ./gradlew -PreactNativeArchitectures=x86_64
33 | reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
34 |
35 | # Use this property to enable support to the new architecture.
36 | # This will allow you to use TurboModules and the Fabric render in
37 | # your application. You should enable this flag either if you want
38 | # to write custom TurboModules/Fabric components OR use libraries that
39 | # are providing them.
40 | newArchEnabled=false
41 |
42 | # Use this property to enable or disable the Hermes JS engine.
43 | # If set to false, you will be using JSC instead.
44 | hermesEnabled=true
45 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/pagseguroplugpagexample/MainApplication.java:
--------------------------------------------------------------------------------
1 | package com.pagseguroplugpagexample;
2 |
3 | import android.app.Application;
4 | import com.facebook.react.PackageList;
5 | import com.facebook.react.ReactApplication;
6 | import com.facebook.react.ReactNativeHost;
7 | import com.facebook.react.ReactPackage;
8 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
9 | import com.facebook.react.defaults.DefaultReactNativeHost;
10 | import com.facebook.soloader.SoLoader;
11 | import java.util.List;
12 |
13 | public class MainApplication extends Application implements ReactApplication {
14 |
15 | private final ReactNativeHost mReactNativeHost =
16 | new DefaultReactNativeHost(this) {
17 | @Override
18 | public boolean getUseDeveloperSupport() {
19 | return BuildConfig.DEBUG;
20 | }
21 |
22 | @Override
23 | protected List getPackages() {
24 | @SuppressWarnings("UnnecessaryLocalVariable")
25 | List packages = new PackageList(this).getPackages();
26 | // Packages that cannot be autolinked yet can be added manually here, for example:
27 | // packages.add(new MyReactNativePackage());
28 | return packages;
29 | }
30 |
31 | @Override
32 | protected String getJSMainModuleName() {
33 | return "index";
34 | }
35 |
36 | @Override
37 | protected boolean isNewArchEnabled() {
38 | return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
39 | }
40 |
41 | @Override
42 | protected Boolean isHermesEnabled() {
43 | return BuildConfig.IS_HERMES_ENABLED;
44 | }
45 | };
46 |
47 | @Override
48 | public ReactNativeHost getReactNativeHost() {
49 | return mReactNativeHost;
50 | }
51 |
52 | @Override
53 | public void onCreate() {
54 | super.onCreate();
55 | SoLoader.init(this, /* native exopackage */ false);
56 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
57 | // If you opted-in for the New Architecture, we load the native entry point for this app.
58 | DefaultNewArchitectureEntryPoint.load();
59 | }
60 | ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/example/ios/PagseguroPlugpagExampleTests/PagseguroPlugpagExampleTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | #import
5 | #import
6 |
7 | #define TIMEOUT_SECONDS 600
8 | #define TEXT_TO_LOOK_FOR @"Welcome to React"
9 |
10 | @interface PagseguroPlugpagExampleTests : XCTestCase
11 |
12 | @end
13 |
14 | @implementation PagseguroPlugpagExampleTests
15 |
16 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL (^)(UIView *view))test
17 | {
18 | if (test(view)) {
19 | return YES;
20 | }
21 | for (UIView *subview in [view subviews]) {
22 | if ([self findSubviewInView:subview matching:test]) {
23 | return YES;
24 | }
25 | }
26 | return NO;
27 | }
28 |
29 | - (void)testRendersWelcomeScreen
30 | {
31 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
32 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
33 | BOOL foundElement = NO;
34 |
35 | __block NSString *redboxError = nil;
36 | #ifdef DEBUG
37 | RCTSetLogFunction(
38 | ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
39 | if (level >= RCTLogLevelError) {
40 | redboxError = message;
41 | }
42 | });
43 | #endif
44 |
45 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
46 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
47 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
48 |
49 | foundElement = [self findSubviewInView:vc.view
50 | matching:^BOOL(UIView *view) {
51 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
52 | return YES;
53 | }
54 | return NO;
55 | }];
56 | }
57 |
58 | #ifdef DEBUG
59 | RCTSetLogFunction(RCTDefaultLogFunction);
60 | #endif
61 |
62 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
63 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
64 | }
65 |
66 | @end
67 |
--------------------------------------------------------------------------------
/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Resolve react_native_pods.rb with node to allow for hoisting
2 | require Pod::Executable.execute_command('node', ['-p',
3 | 'require.resolve(
4 | "react-native/scripts/react_native_pods.rb",
5 | {paths: [process.argv[1]]},
6 | )', __dir__]).strip
7 |
8 | platform :ios, min_ios_version_supported
9 | prepare_react_native_project!
10 |
11 | # If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
12 | # because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
13 | #
14 | # To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
15 | # ```js
16 | # module.exports = {
17 | # dependencies: {
18 | # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
19 | # ```
20 | flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
21 |
22 | linkage = ENV['USE_FRAMEWORKS']
23 | if linkage != nil
24 | Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
25 | use_frameworks! :linkage => linkage.to_sym
26 | end
27 |
28 | target 'PagseguroPlugpagExample' do
29 | config = use_native_modules!
30 |
31 | # Flags change depending on the env values.
32 | flags = get_default_flags()
33 |
34 | use_react_native!(
35 | :path => config[:reactNativePath],
36 | # Hermes is now enabled by default. Disable by setting this flag to false.
37 | :hermes_enabled => flags[:hermes_enabled],
38 | :fabric_enabled => flags[:fabric_enabled],
39 | # Enables Flipper.
40 | #
41 | # Note that if you have use_frameworks! enabled, Flipper will not work and
42 | # you should disable the next line.
43 | :flipper_configuration => flipper_config,
44 | # An absolute path to your application root.
45 | :app_path => "#{Pod::Config.instance.installation_root}/.."
46 | )
47 |
48 | target 'PagseguroPlugpagExampleTests' do
49 | inherit! :complete
50 | # Pods for testing
51 | end
52 |
53 | post_install do |installer|
54 | # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
55 | react_native_post_install(
56 | installer,
57 | config[:reactNativePath],
58 | :mac_catalyst_enabled => false
59 | )
60 | __apply_Xcode_12_5_M1_post_install_workaround(installer)
61 | end
62 | end
63 |
--------------------------------------------------------------------------------
/android/src/main/java/com/pagseguroplugpag/JsonParseUtils.java:
--------------------------------------------------------------------------------
1 | package com.pagseguroplugpag;
2 |
3 | import android.util.Log;
4 |
5 | import androidx.annotation.Nullable;
6 |
7 | import org.json.JSONException;
8 | import org.json.JSONObject;
9 |
10 | import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagActivationData;
11 | import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPaymentData;
12 | import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagVoidData;
13 |
14 | public class JsonParseUtils {
15 | @Nullable
16 | public static PlugPagActivationData getPlugPagActivationDataFromJson(String jsonStr) {
17 | try {
18 | JSONObject object = new JSONObject(jsonStr);
19 | String activationCode = object.getString("activationCode");
20 |
21 | PlugPagActivationData activationData = new PlugPagActivationData(activationCode);
22 | Log.d("PlugPag Json Parse", "PlugPagActivationData parse success");
23 |
24 | return activationData;
25 | } catch (JSONException e) {
26 | Log.d("PlugPag Json Parse", "PlugPagActivationData parse error");
27 | return null;
28 | }
29 | }
30 |
31 | @Nullable
32 | public static PlugPagPaymentData getPlugPagPaymentDataFromJson(String jsonStr) {
33 | try {
34 | JSONObject object = new JSONObject(jsonStr);
35 | int amount = object.getInt("amount");
36 | int installmentType = object.getInt("installmentType");
37 | int installments = object.getInt("installments");
38 | int type = object.getInt("type");
39 | String userReference = object.getString("userReference");
40 | Boolean printReceipt = object.getBoolean("printReceipt");
41 |
42 | PlugPagPaymentData paymentData = new PlugPagPaymentData(type, amount, installmentType, installments, userReference, printReceipt);
43 | Log.d("PlugPag Json Parse", "PlugPagPaymentData parse success");
44 |
45 | return paymentData;
46 | } catch (JSONException e) {
47 | Log.d("PlugPag Json Parse", "PlugPagPaymentData parse error");
48 | return null;
49 | }
50 | }
51 |
52 | @Nullable
53 | public static PlugPagVoidData getPlugPagVoidDataFromJson(String jsonStr) {
54 | try {
55 | JSONObject object = new JSONObject(jsonStr);
56 | String transactionCode = object.getString("transactionCode");
57 | String transactionId = object.getString("transactionId");
58 | Boolean printReceipt = object.getBoolean("printReceipt");
59 |
60 | PlugPagVoidData voidPayment = new PlugPagVoidData(transactionCode, transactionId, printReceipt);
61 | Log.d("PlugPag Json Parse", "PlugPagVoidData parse success");
62 |
63 | return voidPayment;
64 | } catch (JSONException e) {
65 | Log.d("PlugPag Json Parse", "PlugPagVoidData parse error");
66 | return null;
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | google()
4 | mavenCentral()
5 | }
6 |
7 | dependencies {
8 | classpath "com.android.tools.build:gradle:7.2.1"
9 | }
10 | }
11 |
12 | def isNewArchitectureEnabled() {
13 | return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
14 | }
15 |
16 | apply plugin: "com.android.library"
17 |
18 |
19 | def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
20 |
21 | if (isNewArchitectureEnabled()) {
22 | apply plugin: "com.facebook.react"
23 | }
24 |
25 | def getExtOrDefault(name) {
26 | return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["PagseguroPlugpag_" + name]
27 | }
28 |
29 | def getExtOrIntegerDefault(name) {
30 | return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["PagseguroPlugpag_" + name]).toInteger()
31 | }
32 |
33 | def supportsNamespace() {
34 | def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
35 | def major = parsed[0].toInteger()
36 | def minor = parsed[1].toInteger()
37 |
38 | // Namespace support was added in 7.3.0
39 | if (major == 7 && minor >= 3) {
40 | return true
41 | }
42 |
43 | return major >= 8
44 | }
45 |
46 | android {
47 | if (supportsNamespace()) {
48 | namespace "com.pagseguroplugpag"
49 |
50 | sourceSets {
51 | main {
52 | manifest.srcFile "src/main/AndroidManifestNew.xml"
53 | }
54 | }
55 | }
56 |
57 | compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
58 |
59 | defaultConfig {
60 | minSdkVersion getExtOrIntegerDefault("minSdkVersion")
61 | targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
62 | buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
63 | }
64 | buildTypes {
65 | release {
66 | minifyEnabled false
67 | }
68 | }
69 |
70 | lintOptions {
71 | disable "GradleCompatible"
72 | }
73 |
74 | compileOptions {
75 | sourceCompatibility JavaVersion.VERSION_1_8
76 | targetCompatibility JavaVersion.VERSION_1_8
77 | }
78 |
79 | }
80 |
81 | repositories {
82 | mavenCentral()
83 | google()
84 | maven {
85 | url 'https://github.com/pagseguro/PlugPagServiceWrapper/raw/master'
86 | }
87 | }
88 |
89 |
90 | dependencies {
91 | // For < 0.71, this will be from the local maven repo
92 | // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
93 | //noinspection GradleDynamicVersion
94 | implementation "com.facebook.react:react-native:+"
95 | implementation 'br.com.uol.pagseguro.plugpagservice.wrapper:wrapper:1.26.1'
96 | }
97 |
98 | if (isNewArchitectureEnabled()) {
99 | react {
100 | jsRootDir = file("../src/")
101 | libraryName = "PagseguroPlugpag"
102 | codegenJavaPackageName = "com.pagseguroplugpag"
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/example/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem Find java.exe
40 | if defined JAVA_HOME goto findJavaFromJavaHome
41 |
42 | set JAVA_EXE=java.exe
43 | %JAVA_EXE% -version >NUL 2>&1
44 | if %ERRORLEVEL% equ 0 goto execute
45 |
46 | echo.
47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48 | echo.
49 | echo Please set the JAVA_HOME variable in your environment to match the
50 | echo location of your Java installation.
51 |
52 | goto fail
53 |
54 | :findJavaFromJavaHome
55 | set JAVA_HOME=%JAVA_HOME:"=%
56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57 |
58 | if exist "%JAVA_EXE%" goto execute
59 |
60 | echo.
61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62 | echo.
63 | echo Please set the JAVA_HOME variable in your environment to match the
64 | echo location of your Java installation.
65 |
66 | goto fail
67 |
68 | :execute
69 | @rem Setup the command line
70 |
71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72 |
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if %ERRORLEVEL% equ 0 goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | set EXIT_CODE=%ERRORLEVEL%
85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87 | exit /b %EXIT_CODE%
88 |
89 | :mainEnd
90 | if "%OS%"=="Windows_NT" endlocal
91 |
92 | :omega
93 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
2 |
3 | # Getting Started
4 |
5 | >**Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
6 |
7 | ## Step 1: Start the Metro Server
8 |
9 | First, you will need to start **Metro**, the JavaScript _bundler_ that ships _with_ React Native.
10 |
11 | To start Metro, run the following command from the _root_ of your React Native project:
12 |
13 | ```bash
14 | # using npm
15 | npm start
16 |
17 | # OR using Yarn
18 | yarn start
19 | ```
20 |
21 | ## Step 2: Start your Application
22 |
23 | Let Metro Bundler run in its _own_ terminal. Open a _new_ terminal from the _root_ of your React Native project. Run the following command to start your _Android_ or _iOS_ app:
24 |
25 | ### For Android
26 |
27 | ```bash
28 | # using npm
29 | npm run android
30 |
31 | # OR using Yarn
32 | yarn android
33 | ```
34 |
35 | ### For iOS
36 |
37 | ```bash
38 | # using npm
39 | npm run ios
40 |
41 | # OR using Yarn
42 | yarn ios
43 | ```
44 |
45 | If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or _iOS Simulator_ shortly provided you have set up your emulator/simulator correctly.
46 |
47 | This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively.
48 |
49 | ## Step 3: Modifying your App
50 |
51 | Now that you have successfully run the app, let's modify it.
52 |
53 | 1. Open `App.tsx` in your text editor of choice and edit some lines.
54 | 2. For **Android**: Press the R key twice or select **"Reload"** from the **Developer Menu** (Ctrl + M (on Window and Linux) or Cmd ⌘ + M (on macOS)) to see your changes!
55 |
56 | For **iOS**: Hit Cmd ⌘ + R in your iOS Simulator to reload the app and see your changes!
57 |
58 | ## Congratulations! :tada:
59 |
60 | You've successfully run and modified your React Native App. :partying_face:
61 |
62 | ### Now what?
63 |
64 | - If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
65 | - If you're curious to learn more about React Native, check out the [Introduction to React Native](https://reactnative.dev/docs/getting-started).
66 |
67 | # Troubleshooting
68 |
69 | If you can't get this to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
70 |
71 | # Learn More
72 |
73 | To learn more about React Native, take a look at the following resources:
74 |
75 | - [React Native Website](https://reactnative.dev) - learn more about React Native.
76 | - [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.
77 | - [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.
78 | - [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
79 | - [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.
80 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/java/com/pagseguroplugpagexample/ReactNativeFlipper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the LICENSE file in the root
5 | * directory of this source tree.
6 | */
7 | package com.pagseguroplugpagexample;
8 |
9 | import android.content.Context;
10 | import com.facebook.flipper.android.AndroidFlipperClient;
11 | import com.facebook.flipper.android.utils.FlipperUtils;
12 | import com.facebook.flipper.core.FlipperClient;
13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping;
17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
20 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
21 | import com.facebook.react.ReactInstanceEventListener;
22 | import com.facebook.react.ReactInstanceManager;
23 | import com.facebook.react.bridge.ReactContext;
24 | import com.facebook.react.modules.network.NetworkingModule;
25 | import okhttp3.OkHttpClient;
26 |
27 | /**
28 | * Class responsible of loading Flipper inside your React Native application. This is the debug
29 | * flavor of it. Here you can add your own plugins and customize the Flipper setup.
30 | */
31 | public class ReactNativeFlipper {
32 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
33 | if (FlipperUtils.shouldEnableFlipper(context)) {
34 | final FlipperClient client = AndroidFlipperClient.getInstance(context);
35 |
36 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
37 | client.addPlugin(new DatabasesFlipperPlugin(context));
38 | client.addPlugin(new SharedPreferencesFlipperPlugin(context));
39 | client.addPlugin(CrashReporterPlugin.getInstance());
40 |
41 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
42 | NetworkingModule.setCustomClientBuilder(
43 | new NetworkingModule.CustomClientBuilder() {
44 | @Override
45 | public void apply(OkHttpClient.Builder builder) {
46 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
47 | }
48 | });
49 | client.addPlugin(networkFlipperPlugin);
50 | client.start();
51 |
52 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
53 | // Hence we run if after all native modules have been initialized
54 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
55 | if (reactContext == null) {
56 | reactInstanceManager.addReactInstanceEventListener(
57 | new ReactInstanceEventListener() {
58 | @Override
59 | public void onReactContextInitialized(ReactContext reactContext) {
60 | reactInstanceManager.removeReactInstanceEventListener(this);
61 | reactContext.runOnNativeModulesQueueThread(
62 | new Runnable() {
63 | @Override
64 | public void run() {
65 | client.addPlugin(new FrescoFlipperPlugin());
66 | }
67 | });
68 | }
69 | });
70 | } else {
71 | client.addPlugin(new FrescoFlipperPlugin());
72 | }
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/example/ios/PagseguroPlugpagExample.xcodeproj/xcshareddata/xcschemes/PagseguroPlugpagExample.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
53 |
55 |
61 |
62 |
63 |
64 |
70 |
72 |
78 |
79 |
80 |
81 |
83 |
84 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/example/ios/PagseguroPlugpagExample/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
24 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | Contributions are always welcome, no matter how large or small!
4 |
5 | We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. Before contributing, please read the [code of conduct](./CODE_OF_CONDUCT.md).
6 |
7 | ## Development workflow
8 |
9 | To get started with the project, run `yarn` in the root directory to install the required dependencies for each package:
10 |
11 | ```sh
12 | yarn
13 | ```
14 |
15 | > While it's possible to use [`npm`](https://github.com/npm/cli), the tooling is built around [`yarn`](https://classic.yarnpkg.com/), so you'll have an easier time if you use `yarn` for development.
16 |
17 | While developing, you can run the [example app](/example/) to test your changes. Any changes you make in your library's JavaScript code will be reflected in the example app without a rebuild. If you change any native code, then you'll need to rebuild the example app.
18 |
19 | To start the packager:
20 |
21 | ```sh
22 | yarn example start
23 | ```
24 |
25 | To run the example app on Android:
26 |
27 | ```sh
28 | yarn example android
29 | ```
30 |
31 | To run the example app on iOS:
32 |
33 | ```sh
34 | yarn example ios
35 | ```
36 |
37 | Make sure your code passes TypeScript and ESLint. Run the following to verify:
38 |
39 | ```sh
40 | yarn typecheck
41 | yarn lint
42 | ```
43 |
44 | To fix formatting errors, run the following:
45 |
46 | ```sh
47 | yarn lint --fix
48 | ```
49 |
50 | Remember to add tests for your change if possible. Run the unit tests by:
51 |
52 | ```sh
53 | yarn test
54 | ```
55 |
56 | To edit the Objective-C or Swift files, open `example/ios/PagseguroPlugpagExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-pagseguro-plugpag`.
57 |
58 | To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-pagseguro-plugpag` under `Android`.
59 |
60 |
61 | ### Commit message convention
62 |
63 | We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages:
64 |
65 | - `fix`: bug fixes, e.g. fix crash due to deprecated method.
66 | - `feat`: new features, e.g. add new method to the module.
67 | - `refactor`: code refactor, e.g. migrate from class components to hooks.
68 | - `docs`: changes into documentation, e.g. add usage example for the module..
69 | - `test`: adding or updating tests, e.g. add integration tests using detox.
70 | - `chore`: tooling changes, e.g. change CI config.
71 |
72 | Our pre-commit hooks verify that your commit message matches this format when committing.
73 |
74 | ### Linting and tests
75 |
76 | [ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/)
77 |
78 | We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing.
79 |
80 | Our pre-commit hooks verify that the linter and tests pass when committing.
81 |
82 | ### Publishing to npm
83 |
84 | We use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc.
85 |
86 | To publish new versions, run the following:
87 |
88 | ```sh
89 | yarn release
90 | ```
91 |
92 | ### Scripts
93 |
94 | The `package.json` file contains various scripts for common tasks:
95 |
96 | - `yarn bootstrap`: setup project by installing all dependencies and pods.
97 | - `yarn typecheck`: type-check files with TypeScript.
98 | - `yarn lint`: lint files with ESLint.
99 | - `yarn test`: run unit tests with Jest.
100 | - `yarn example start`: start the Metro server for the example app.
101 | - `yarn example android`: run the example app on Android.
102 | - `yarn example ios`: run the example app on iOS.
103 |
104 | ### Sending a pull request
105 |
106 | > **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github).
107 |
108 | When you're sending a pull request:
109 |
110 | - Prefer small pull requests focused on one change.
111 | - Verify that linters and tests are passing.
112 | - Review the documentation to make sure it looks good.
113 | - Follow the pull request template when opening a pull request.
114 | - For pull requests that change the API or implementation, discuss with maintainers first by opening an issue.
115 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 | on:
3 | push:
4 | branches:
5 | - main
6 | pull_request:
7 | branches:
8 | - main
9 |
10 | jobs:
11 | lint:
12 | runs-on: ubuntu-latest
13 | steps:
14 | - name: Checkout
15 | uses: actions/checkout@v3
16 |
17 | - name: Setup
18 | uses: ./.github/actions/setup
19 |
20 | - name: Lint files
21 | run: yarn lint
22 |
23 | - name: Typecheck files
24 | run: yarn typecheck
25 |
26 | test:
27 | runs-on: ubuntu-latest
28 | steps:
29 | - name: Checkout
30 | uses: actions/checkout@v3
31 |
32 | - name: Setup
33 | uses: ./.github/actions/setup
34 |
35 | - name: Run unit tests
36 | run: yarn test --maxWorkers=2 --coverage
37 |
38 | build-library:
39 | runs-on: ubuntu-latest
40 | steps:
41 | - name: Checkout
42 | uses: actions/checkout@v3
43 |
44 | - name: Setup
45 | uses: ./.github/actions/setup
46 |
47 | - name: Build package
48 | run: yarn prepack
49 |
50 | build-android:
51 | runs-on: ubuntu-latest
52 | env:
53 | TURBO_CACHE_DIR: .turbo/android
54 | steps:
55 | - name: Checkout
56 | uses: actions/checkout@v3
57 |
58 | - name: Setup
59 | uses: ./.github/actions/setup
60 |
61 | - name: Cache turborepo for Android
62 | uses: actions/cache@v3
63 | with:
64 | path: ${{ env.TURBO_CACHE_DIR }}
65 | key: ${{ runner.os }}-turborepo-android-${{ hashFiles('**/yarn.lock') }}
66 | restore-keys: |
67 | ${{ runner.os }}-turborepo-android-
68 |
69 | - name: Check turborepo cache for Android
70 | run: |
71 | TURBO_CACHE_STATUS=$(node -p "($(yarn --silent turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status")
72 |
73 | if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
74 | echo "turbo_cache_hit=1" >> $GITHUB_ENV
75 | fi
76 |
77 | - name: Install JDK
78 | if: env.turbo_cache_hit != 1
79 | uses: actions/setup-java@v3
80 | with:
81 | distribution: 'zulu'
82 | java-version: '11'
83 |
84 | - name: Finalize Android SDK
85 | if: env.turbo_cache_hit != 1
86 | run: |
87 | /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
88 |
89 | - name: Cache Gradle
90 | if: env.turbo_cache_hit != 1
91 | uses: actions/cache@v3
92 | with:
93 | path: |
94 | ~/.gradle/wrapper
95 | ~/.gradle/caches
96 | key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }}
97 | restore-keys: |
98 | ${{ runner.os }}-gradle-
99 |
100 | - name: Build example for Android
101 | run: |
102 | yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"
103 |
104 | build-ios:
105 | runs-on: macos-latest
106 | env:
107 | TURBO_CACHE_DIR: .turbo/ios
108 | steps:
109 | - name: Checkout
110 | uses: actions/checkout@v3
111 |
112 | - name: Setup
113 | uses: ./.github/actions/setup
114 |
115 | - name: Cache turborepo for iOS
116 | uses: actions/cache@v3
117 | with:
118 | path: ${{ env.TURBO_CACHE_DIR }}
119 | key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('**/yarn.lock') }}
120 | restore-keys: |
121 | ${{ runner.os }}-turborepo-ios-
122 |
123 | - name: Check turborepo cache for iOS
124 | run: |
125 | TURBO_CACHE_STATUS=$(node -p "($(yarn --silent turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status")
126 |
127 | if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
128 | echo "turbo_cache_hit=1" >> $GITHUB_ENV
129 | fi
130 |
131 | - name: Cache cocoapods
132 | if: env.turbo_cache_hit != 1
133 | id: cocoapods-cache
134 | uses: actions/cache@v3
135 | with:
136 | path: |
137 | **/ios/Pods
138 | key: ${{ runner.os }}-cocoapods-${{ hashFiles('example/ios/Podfile.lock') }}
139 | restore-keys: |
140 | ${{ runner.os }}-cocoapods-
141 |
142 | - name: Install cocoapods
143 | if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
144 | run: |
145 | yarn example pods
146 | env:
147 | NO_FLIPPER: 1
148 |
149 | - name: Build example for iOS
150 | run: |
151 | yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
152 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.application"
2 | apply plugin: "com.facebook.react"
3 |
4 | /**
5 | * This is the configuration block to customize your React Native Android app.
6 | * By default you don't need to apply any configuration, just uncomment the lines you need.
7 | */
8 | react {
9 | /* Folders */
10 | // The root of your project, i.e. where "package.json" lives. Default is '..'
11 | // root = file("../")
12 | // The folder where the react-native NPM package is. Default is ../node_modules/react-native
13 | // reactNativeDir = file("../node_modules/react-native")
14 | // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
15 | // codegenDir = file("../node_modules/@react-native/codegen")
16 | // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
17 | // cliFile = file("../node_modules/react-native/cli.js")
18 |
19 | /* Variants */
20 | // The list of variants to that are debuggable. For those we're going to
21 | // skip the bundling of the JS bundle and the assets. By default is just 'debug'.
22 | // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
23 | // debuggableVariants = ["liteDebug", "prodDebug"]
24 |
25 | /* Bundling */
26 | // A list containing the node command and its flags. Default is just 'node'.
27 | // nodeExecutableAndArgs = ["node"]
28 | //
29 | // The command to run when bundling. By default is 'bundle'
30 | // bundleCommand = "ram-bundle"
31 | //
32 | // The path to the CLI configuration file. Default is empty.
33 | // bundleConfig = file(../rn-cli.config.js)
34 | //
35 | // The name of the generated asset file containing your JS bundle
36 | // bundleAssetName = "MyApplication.android.bundle"
37 | //
38 | // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
39 | // entryFile = file("../js/MyApplication.android.js")
40 | //
41 | // A list of extra flags to pass to the 'bundle' commands.
42 | // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
43 | // extraPackagerArgs = []
44 |
45 | /* Hermes Commands */
46 | // The hermes compiler command to run. By default it is 'hermesc'
47 | // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
48 | //
49 | // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
50 | // hermesFlags = ["-O", "-output-source-map"]
51 | }
52 |
53 | /**
54 | * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
55 | */
56 | def enableProguardInReleaseBuilds = false
57 |
58 | /**
59 | * The preferred build flavor of JavaScriptCore (JSC)
60 | *
61 | * For example, to use the international variant, you can use:
62 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
63 | *
64 | * The international variant includes ICU i18n library and necessary data
65 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
66 | * give correct results when using with locales other than en-US. Note that
67 | * this variant is about 6MiB larger per architecture than default.
68 | */
69 | def jscFlavor = 'org.webkit:android-jsc:+'
70 |
71 | android {
72 | ndkVersion rootProject.ext.ndkVersion
73 |
74 | compileSdkVersion rootProject.ext.compileSdkVersion
75 |
76 | namespace "com.pagseguroplugpagexample"
77 | defaultConfig {
78 | applicationId "com.pagseguroplugpagexample"
79 | minSdkVersion rootProject.ext.minSdkVersion
80 | targetSdkVersion rootProject.ext.targetSdkVersion
81 | versionCode 1
82 | versionName "1.0"
83 | }
84 | signingConfigs {
85 | debug {
86 | storeFile file('debug.keystore')
87 | storePassword 'android'
88 | keyAlias 'androiddebugkey'
89 | keyPassword 'android'
90 | }
91 | }
92 | buildTypes {
93 | debug {
94 | signingConfig signingConfigs.debug
95 | }
96 | release {
97 | // Caution! In production, you need to generate your own keystore file.
98 | // see https://reactnative.dev/docs/signed-apk-android.
99 | signingConfig signingConfigs.debug
100 | minifyEnabled enableProguardInReleaseBuilds
101 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
102 | }
103 | }
104 | }
105 |
106 | dependencies {
107 | // The version of react-native is set by the React Native Gradle Plugin
108 | implementation("com.facebook.react:react-android")
109 | implementation 'br.com.uol.pagseguro.plugpagservice.wrapper:wrapper:1.7.6'
110 |
111 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
112 | debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
113 | exclude group:'com.squareup.okhttp3', module:'okhttp'
114 | }
115 |
116 | debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
117 | if (hermesEnabled.toBoolean()) {
118 | implementation("com.facebook.react:hermes-android")
119 | } else {
120 | implementation jscFlavor
121 | }
122 | }
123 |
124 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
125 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-pagseguro-plugpag",
3 | "version": "0.1.1",
4 | "description": "Integre facilmente as principais formas de pagamento da PagSeguro em seus aplicativos React Native através deste módulo nativo.",
5 | "main": "lib/commonjs/index",
6 | "module": "lib/module/index",
7 | "types": "lib/typescript/src/index.d.ts",
8 | "react-native": "src/index",
9 | "source": "src/index",
10 | "files": [
11 | "src",
12 | "lib",
13 | "android",
14 | "ios",
15 | "cpp",
16 | "*.podspec",
17 | "!lib/typescript/example",
18 | "!ios/build",
19 | "!android/build",
20 | "!android/gradle",
21 | "!android/gradlew",
22 | "!android/gradlew.bat",
23 | "!android/local.properties",
24 | "!**/__tests__",
25 | "!**/__fixtures__",
26 | "!**/__mocks__",
27 | "!**/.*"
28 | ],
29 | "scripts": {
30 | "test": "jest",
31 | "typecheck": "tsc --noEmit",
32 | "lint": "eslint \"**/*.{js,ts,tsx}\"",
33 | "prepack": "yarn build:plugin && bob build",
34 | "release": "yarn build:plugin && release-it",
35 | "example": "yarn --cwd example",
36 | "build:android": "cd example/android && ./gradlew assembleDebug --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a",
37 | "build:ios": "cd example/ios && xcodebuild -workspace PagseguroPlugpagExample.xcworkspace -scheme PagseguroPlugpagExample -configuration Debug -sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO",
38 | "bootstrap": "yarn example && yarn install && yarn example pods",
39 | "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build",
40 | "expo-module": "expo-module",
41 | "build:plugin": "tsc --build plugin"
42 | },
43 | "keywords": [
44 | "react-native",
45 | "expo",
46 | "android",
47 | "pagseguro",
48 | "plugpag"
49 | ],
50 | "repository": "https://github.com/brunodsazevedo/react-native-pagseguro-plugpag",
51 | "author": "brunodsazevedo (https://github.com/brunodsazevedo)",
52 | "license": "MIT",
53 | "bugs": {
54 | "url": "https://github.com/brunodsazevedo/react-native-pagseguro-plugpag/issues"
55 | },
56 | "homepage": "https://github.com/brunodsazevedo/react-native-pagseguro-plugpag#readme",
57 | "publishConfig": {
58 | "registry": "https://registry.npmjs.org/"
59 | },
60 | "devDependencies": {
61 | "@commitlint/config-conventional": "^17.0.2",
62 | "@evilmartians/lefthook": "^1.2.2",
63 | "@react-native-community/eslint-config": "^3.0.2",
64 | "@release-it/conventional-changelog": "^5.0.0",
65 | "@types/jest": "^28.1.2",
66 | "@types/react": "~17.0.21",
67 | "@types/react-native": "0.70.0",
68 | "commitlint": "^17.0.2",
69 | "del-cli": "^5.0.0",
70 | "eslint": "^8.4.1",
71 | "eslint-config-prettier": "^8.5.0",
72 | "eslint-plugin-prettier": "^4.0.0",
73 | "expo": "^47.0.0",
74 | "expo-module-scripts": "^3.0.11",
75 | "expo-modules-core": "^1.5.10",
76 | "jest": "^28.1.1",
77 | "pod-install": "^0.1.0",
78 | "prettier": "^2.0.5",
79 | "react": "18.2.0",
80 | "react-native": "0.72.4",
81 | "react-native-builder-bob": "^0.20.0",
82 | "release-it": "^15.0.0",
83 | "turbo": "^1.10.7",
84 | "typescript": "^5.0.2"
85 | },
86 | "resolutions": {
87 | "@types/react": "17.0.21"
88 | },
89 | "peerDependencies": {
90 | "expo": ">=47.0.0",
91 | "react": "*",
92 | "react-native": "*"
93 | },
94 | "peerDependenciesMeta": {
95 | "expo": {
96 | "optional": true
97 | }
98 | },
99 | "engines": {
100 | "node": ">= 16.0.0"
101 | },
102 | "jest": {
103 | "preset": "react-native",
104 | "modulePathIgnorePatterns": [
105 | "/example/node_modules",
106 | "/lib/"
107 | ]
108 | },
109 | "commitlint": {
110 | "extends": [
111 | "@commitlint/config-conventional"
112 | ]
113 | },
114 | "release-it": {
115 | "git": {
116 | "commitMessage": "chore: release ${version}",
117 | "tagName": "v${version}"
118 | },
119 | "npm": {
120 | "publish": true
121 | },
122 | "github": {
123 | "release": true
124 | },
125 | "plugins": {
126 | "@release-it/conventional-changelog": {
127 | "preset": "angular"
128 | }
129 | }
130 | },
131 | "eslintConfig": {
132 | "root": true,
133 | "extends": [
134 | "@react-native-community",
135 | "prettier"
136 | ],
137 | "rules": {
138 | "prettier/prettier": [
139 | "error",
140 | {
141 | "quoteProps": "consistent",
142 | "singleQuote": true,
143 | "tabWidth": 2,
144 | "trailingComma": "es5",
145 | "useTabs": false
146 | }
147 | ]
148 | }
149 | },
150 | "eslintIgnore": [
151 | "node_modules/",
152 | "lib/"
153 | ],
154 | "prettier": {
155 | "quoteProps": "consistent",
156 | "singleQuote": true,
157 | "tabWidth": 2,
158 | "trailingComma": "es5",
159 | "useTabs": false
160 | },
161 | "react-native-builder-bob": {
162 | "source": "src",
163 | "output": "lib",
164 | "targets": [
165 | "commonjs",
166 | "module",
167 | [
168 | "typescript",
169 | {
170 | "project": "tsconfig.build.json"
171 | }
172 | ]
173 | ]
174 | }
175 | }
176 |
--------------------------------------------------------------------------------
/src/index.tsx:
--------------------------------------------------------------------------------
1 | import { NativeModules, DeviceEventEmitter } from 'react-native';
2 |
3 | export enum PaymentTypes {
4 | CREDIT = 1,
5 | DEBIT = 2,
6 | VOUCHER = 3,
7 | PIX_QR_CODE = 5,
8 | }
9 |
10 | export enum InstallmentTypes {
11 | NO_INSTALLMENT = 1,
12 | SELLER_INSTALLMENT = 2,
13 | BUYER_INSTALLMENT = 3,
14 | }
15 |
16 | export type InitializeAndActivatePinPadResponse = {
17 | result: number;
18 | errorCode?: string;
19 | errorMessage?: string;
20 | };
21 |
22 | export type PlugPagPaymentDataProps = {
23 | amount: number;
24 | type: PaymentTypes;
25 | installmentType: InstallmentTypes;
26 | installments: number;
27 | printReceipt: boolean;
28 | userReference?: string;
29 | };
30 |
31 | export type PaymentTransactionResponseProps = {
32 | result: number;
33 | errorCode?: string;
34 | message?: string;
35 | transactionCode?: string;
36 | transactionId?: string;
37 | hostNsu?: string;
38 | date?: string;
39 | time?: string;
40 | cardBrand?: string;
41 | bin?: string;
42 | holder?: string;
43 | userReference?: string;
44 | terminalSerialNumber?: string;
45 | amount?: string;
46 | availableBalance?: string;
47 | cardApplication?: string;
48 | label?: string;
49 | holderName?: string;
50 | extendedHolderName?: string;
51 | };
52 |
53 | export type PlugPagRefundPaymentDataProps = {
54 | transactionCode: string;
55 | transactionId: string;
56 | printReceipt: boolean;
57 | };
58 |
59 | export type RefundPaymentTransactionResponseProps = {
60 | result: number;
61 | errorCode?: string;
62 | message?: string;
63 | transactionCode?: string;
64 | transactionId?: string;
65 | hostNsu?: string;
66 | date?: string;
67 | time?: string;
68 | cardBrand?: string;
69 | bin?: string;
70 | holder?: string;
71 | userReference?: string;
72 | terminalSerialNumber?: string;
73 | amount?: string;
74 | availableBalance?: string;
75 | cardApplication?: string;
76 | label?: string;
77 | holderName?: string;
78 | extendedHolderName?: string;
79 | };
80 |
81 | export type TransactionPaymentEventProps = {
82 | code: number;
83 | message: string;
84 | };
85 |
86 | import { useEffect, useState } from 'react';
87 |
88 | const { PagseguroPlugpag } = NativeModules;
89 |
90 | export const plugPag = {
91 | installmentTypes: InstallmentTypes,
92 | paymentTypes: PaymentTypes,
93 | };
94 |
95 | export async function initializeAndActivatePinPad(
96 | activationCode: String
97 | ): Promise {
98 | try {
99 | const response: InitializeAndActivatePinPadResponse =
100 | await PagseguroPlugpag.initializeAndActivatePinPad(activationCode);
101 |
102 | return response;
103 | } catch (error) {
104 | console.error(error);
105 | throw error;
106 | }
107 | }
108 |
109 | export async function doPayment({
110 | amount,
111 | installmentType,
112 | installments,
113 | printReceipt,
114 | type,
115 | userReference,
116 | }: PlugPagPaymentDataProps) {
117 | try {
118 | const dataPayment = {
119 | amount,
120 | installmentType,
121 | installments,
122 | printReceipt,
123 | type,
124 | userReference,
125 | };
126 |
127 | const dataFormatted = JSON.stringify(dataPayment);
128 | const response: PaymentTransactionResponseProps =
129 | await PagseguroPlugpag.doPayment(dataFormatted);
130 |
131 | return response;
132 | } catch (error) {
133 | console.error(error);
134 | throw error;
135 | }
136 | }
137 |
138 | export async function refundPayment(
139 | refundPaymentData: PlugPagRefundPaymentDataProps
140 | ): Promise {
141 | try {
142 | const data = JSON.stringify(refundPaymentData);
143 |
144 | const response: RefundPaymentTransactionResponseProps =
145 | await PagseguroPlugpag.voidPayment(data);
146 |
147 | return response;
148 | } catch (error) {
149 | console.error(error);
150 | throw error;
151 | }
152 | }
153 |
154 | export async function print(filePath: string): Promise {
155 | try {
156 | const response = await PagseguroPlugpag.print(filePath);
157 |
158 | // Emitir eventos para sucesso ou erro com base no resultado da impressão
159 | if (response.retCode === 0) {
160 | // 0 significa sucesso (PlugPag.RET_OK)
161 | DeviceEventEmitter.emit('printSuccess', {
162 | message: response.message,
163 | errorCode: response.errorCode,
164 | });
165 | return response; // Retornar o resultado de sucesso diretamente
166 | } else {
167 | DeviceEventEmitter.emit('printError', {
168 | message: response.message,
169 | errorCode: response.errorCode,
170 | });
171 |
172 | // Enriquecer o objeto de erro com errorCode e retCode
173 | const error = new Error(response.message);
174 | (error as any).errorCode = response.errorCode;
175 | (error as any).retCode = response.retCode;
176 | throw error;
177 | }
178 | } catch (error) {
179 | DeviceEventEmitter.emit('printError', {
180 | message: 'Erro ao imprimir',
181 | errorCode: 'PrintException',
182 | });
183 |
184 | // Enriquecer o objeto de erro com retCode padrão se não estiver presente
185 | if (!(error as any).retCode) {
186 | (error as any).retCode = 'PrintException';
187 | }
188 |
189 | throw error; // Lançar o erro para que possa ser capturado por quem chamou a função
190 | }
191 | }
192 |
193 | export function useTransactionPaymentEvent() {
194 | const [transactionPaymentEvent, setTransactionPaymentEvent] =
195 | useState({ code: 0, message: '' });
196 |
197 | useEffect(() => {
198 | DeviceEventEmitter.addListener('eventPayments', (event) => {
199 | setTransactionPaymentEvent(event);
200 | });
201 | }, []);
202 |
203 | return transactionPaymentEvent;
204 | }
205 |
206 | export default plugPag;
207 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 |
2 | # Contributor Covenant Code of Conduct
3 |
4 | ## Our Pledge
5 |
6 | We as members, contributors, and leaders pledge to make participation in our
7 | community a harassment-free experience for everyone, regardless of age, body
8 | size, visible or invisible disability, ethnicity, sex characteristics, gender
9 | identity and expression, level of experience, education, socio-economic status,
10 | nationality, personal appearance, race, caste, color, religion, or sexual
11 | identity and orientation.
12 |
13 | We pledge to act and interact in ways that contribute to an open, welcoming,
14 | diverse, inclusive, and healthy community.
15 |
16 | ## Our Standards
17 |
18 | Examples of behavior that contributes to a positive environment for our
19 | community include:
20 |
21 | * Demonstrating empathy and kindness toward other people
22 | * Being respectful of differing opinions, viewpoints, and experiences
23 | * Giving and gracefully accepting constructive feedback
24 | * Accepting responsibility and apologizing to those affected by our mistakes,
25 | and learning from the experience
26 | * Focusing on what is best not just for us as individuals, but for the overall
27 | community
28 |
29 | Examples of unacceptable behavior include:
30 |
31 | * The use of sexualized language or imagery, and sexual attention or advances of
32 | any kind
33 | * Trolling, insulting or derogatory comments, and personal or political attacks
34 | * Public or private harassment
35 | * Publishing others' private information, such as a physical or email address,
36 | without their explicit permission
37 | * Other conduct which could reasonably be considered inappropriate in a
38 | professional setting
39 |
40 | ## Enforcement Responsibilities
41 |
42 | Community leaders are responsible for clarifying and enforcing our standards of
43 | acceptable behavior and will take appropriate and fair corrective action in
44 | response to any behavior that they deem inappropriate, threatening, offensive,
45 | or harmful.
46 |
47 | Community leaders have the right and responsibility to remove, edit, or reject
48 | comments, commits, code, wiki edits, issues, and other contributions that are
49 | not aligned to this Code of Conduct, and will communicate reasons for moderation
50 | decisions when appropriate.
51 |
52 | ## Scope
53 |
54 | This Code of Conduct applies within all community spaces, and also applies when
55 | an individual is officially representing the community in public spaces.
56 | Examples of representing our community include using an official e-mail address,
57 | posting via an official social media account, or acting as an appointed
58 | representative at an online or offline event.
59 |
60 | ## Enforcement
61 |
62 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
63 | reported to the community leaders responsible for enforcement at
64 | [INSERT CONTACT METHOD].
65 | All complaints will be reviewed and investigated promptly and fairly.
66 |
67 | All community leaders are obligated to respect the privacy and security of the
68 | reporter of any incident.
69 |
70 | ## Enforcement Guidelines
71 |
72 | Community leaders will follow these Community Impact Guidelines in determining
73 | the consequences for any action they deem in violation of this Code of Conduct:
74 |
75 | ### 1. Correction
76 |
77 | **Community Impact**: Use of inappropriate language or other behavior deemed
78 | unprofessional or unwelcome in the community.
79 |
80 | **Consequence**: A private, written warning from community leaders, providing
81 | clarity around the nature of the violation and an explanation of why the
82 | behavior was inappropriate. A public apology may be requested.
83 |
84 | ### 2. Warning
85 |
86 | **Community Impact**: A violation through a single incident or series of
87 | actions.
88 |
89 | **Consequence**: A warning with consequences for continued behavior. No
90 | interaction with the people involved, including unsolicited interaction with
91 | those enforcing the Code of Conduct, for a specified period of time. This
92 | includes avoiding interactions in community spaces as well as external channels
93 | like social media. Violating these terms may lead to a temporary or permanent
94 | ban.
95 |
96 | ### 3. Temporary Ban
97 |
98 | **Community Impact**: A serious violation of community standards, including
99 | sustained inappropriate behavior.
100 |
101 | **Consequence**: A temporary ban from any sort of interaction or public
102 | communication with the community for a specified period of time. No public or
103 | private interaction with the people involved, including unsolicited interaction
104 | with those enforcing the Code of Conduct, is allowed during this period.
105 | Violating these terms may lead to a permanent ban.
106 |
107 | ### 4. Permanent Ban
108 |
109 | **Community Impact**: Demonstrating a pattern of violation of community
110 | standards, including sustained inappropriate behavior, harassment of an
111 | individual, or aggression toward or disparagement of classes of individuals.
112 |
113 | **Consequence**: A permanent ban from any sort of public interaction within the
114 | community.
115 |
116 | ## Attribution
117 |
118 | This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119 | version 2.1, available at
120 | [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
121 |
122 | Community Impact Guidelines were inspired by
123 | [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124 |
125 | For answers to common questions about this code of conduct, see the FAQ at
126 | [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
127 | [https://www.contributor-covenant.org/translations][translations].
128 |
129 | [homepage]: https://www.contributor-covenant.org
130 | [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
131 | [Mozilla CoC]: https://github.com/mozilla/diversity
132 | [FAQ]: https://www.contributor-covenant.org/faq
133 | [translations]: https://www.contributor-covenant.org/translations
134 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | React Native Pagseguro Plugpag
5 |
6 |
7 | [README PORTUGUESE-BR VERSION](README-PORTUGUESE-BR.md)
8 |
9 | React Native Pagseguro Plugpag is a library aimed at integrating with the native library PlugPagServiceWrapper, maintained by Pagseguro. The library's purpose is to integrate Android applications with smart terminals, such as Moderninha Smart (A930), Moderninha Smart 2 (P2), and other terminals provided by the company.
10 |
11 | ## 💻 Prerequisites
12 |
13 | - NodeJS >= 18.0.0
14 | - React Native >= 0.72
15 | - Expo >= 47 (optional)
16 |
17 | ## 🚀 Installation
18 |
19 | Installing with Yarn:
20 | ```sh
21 | yarn add react-native-pagseguro-plugpag
22 | ```
23 | Installing with npm:
24 | ```sh
25 | npm install react-native-pagseguro-plugpag
26 | ```
27 | ### Configuration in React Native
28 |
29 | Add this line to the file `/android/build.gradle`:
30 | ```
31 | buildscript {
32 | dependencies {
33 | ...
34 | classpath 'com.google.gms:google-services:4.3.15'
35 | }
36 | }
37 | ```
38 | and add this dependency to the file `/android/app/build.gradle`:
39 | ```
40 | dependencies {
41 | // ... other dependencies
42 | implementation 'br.com.uol.pagseguro.plugpagservice.wrapper:wrapper:1.7.6'
43 | ...
44 | }
45 | ```
46 |
47 | ### Configuration in Expo
48 | ***NOTE***: The library does not support running on ***Expo Go*** due to its handling of libraries. The PlugPag Wrapper library is designed for use with Pagseguro's Android devices. Therefore, you need to use ***expo-dev-client*** to expose the android folder of your Expo project.
49 |
50 | Add the react-native-pagseguro-plugpag plugin to `app.json` or `app.config.js`:
51 | ```
52 | {
53 | "expo": {
54 | "plugins": [
55 | "react-native-pagseguro-plugpag"
56 | ]
57 | }
58 | }
59 | ```
60 | And to finalize, execute the prebuild step of expo to complete the configuration:
61 | ```
62 | npx expo prebuild -p android --clean
63 | ```
64 |
65 | ## 📖 Usage
66 |
67 | ***initializeAndActivatePinPad***: initializes and activates the pin pad.
68 |
69 | ***doPayment***: performs communication and execution of financial transactions (debit card, credit card, voucher, and PIX).
70 |
71 | ***refundPayment***: performs refunds of financial transactions.
72 |
73 | ***print***: does customized printing from a JPEG/PNG file.
74 |
75 | ***useTransactionPaymentEvent***: hook for native events related to financial transactions.
76 |
77 | ### Usage Examples
78 |
79 | Example for activating a pin pad terminal.
80 |
81 | ***NOTE***: For development terminals, the code `403938` is commonly used. If it doesn't work, contact Pagseguro support.
82 |
83 | ```JS
84 | import { initializeAndActivatePinPad } from 'react-native-pagseguro-plugpag';
85 |
86 | async function handleInitializeAndActivatePinPad() {
87 | try {
88 | const data = await initializeAndActivatePinPad('403938');
89 |
90 | if (data.result !== 0) {
91 | Alert.alert('Error activating terminal', data.errorMessage);
92 | return;
93 | }
94 |
95 | Alert.alert('Terminal activated successfully!');
96 | } catch (error) {
97 | console.log(error);
98 | Alert.alert('Error activating terminal');
99 | }
100 | }
101 | ```
102 |
103 | Example for making credit card transactions with R$ 25.00:
104 | ```js
105 | import { plugPag, doPayment } from 'react-native-pagseguro-plugpag';
106 |
107 | async function handleDoPaymentCreditType() {
108 | try {
109 | const data = await doPayment({
110 | amount: 2500, // Amount to be paid in cents
111 | type: plugPag.paymentTypes.CREDIT, // Payment type option
112 | printReceipt: true, // Print or not from the establishment
113 | installments: 1, // Number of installments
114 | installmentType: plugPag.installmentTypes.BUYER_INSTALLMENT, // In case of installments, define whether the fee will be charged to the buyer or the seller
115 | userReference: 'test', // External code to identify the transaction in the future.
116 | });
117 |
118 | Alert.alert('Transaction completed successfully');
119 | } catch (error) {
120 | console.log(error);
121 | setIsModalVisible(false);
122 |
123 | Alert.alert('Error completing transaction');
124 | }
125 | }
126 | ```
127 |
128 | Example for making debit card transactions with R$ 25.00:
129 | ```js
130 | import { plugPag, doPayment } from 'react-native-pagseguro-plugpag';
131 |
132 | async function handleDoPaymentDebitType() {
133 | try {
134 | const data = await doPayment({
135 | amount: 2500, // Amount to be paid in cents
136 | type: plugPag.paymentTypes.DEBIT, // Payment type option
137 | printReceipt: true, // Print or not from the establishment
138 | installments: 1, // Number of installments
139 | installmentType: plugPag.installmentTypes.BUYER_INSTALLMENT, // In case of installments, define whether the fee will be charged to the buyer or the seller
140 | userReference: 'test', // External code to identify the transaction in the future.
141 | });
142 |
143 | Alert.alert('Transaction completed successfully');
144 | } catch (error) {
145 | console.log(error);
146 | setIsModalVisible(false);
147 |
148 | Alert.alert('Error completing transaction');
149 | }
150 | }
151 | ```
152 |
153 | Example for refunding a transaction:
154 |
155 | ```JS
156 | async function handleRefundLastTransaction() {
157 | try {
158 | const response = await refundPayment({
159 | transactionCode: '123dwqwd5465sdas',
160 | transactionId: '78911qweqwdw7de44dd7qweqwed7d1qwe',
161 | printReceipt: true,
162 | });
163 |
164 | if (response.result !== 0) {
165 | Alert.alert('Refund', 'An error occurred while processing the refund');
166 | return;
167 | }
168 |
169 | Alert.alert('Refund completed successfully');
170 | } catch (error) {
171 | console.log(error);
172 |
173 | setIsModalVisible(false);
174 | Alert.alert('Refund', 'An error occurred while processing the refund');
175 | }
176 | }
177 | ```
178 |
179 | For more examples, see the demo app in this repository.
180 |
181 | ## Contributing
182 |
183 | See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development flow.
184 |
185 | ## License
186 |
187 | [MIT](LICENSE)
188 |
189 | ---
190 |
191 | Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
192 |
--------------------------------------------------------------------------------
/README-PORTUGUESE-BR.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | React Native Pagseguro Plugpag
5 |
6 |
7 | [README EM VERSÃO INGLÊS](README.md)
8 |
9 | React Native Pagseguro Plugpag é uma biblioteca com o intuito de integrar com a biblioteca nativa PlugPagServiceWrapper, mantida pela Pagseguro, que possui o intuito de integrar aplicativos Android com terminais smart, como Moderninha Smart (A930), Moderninha Smart 2 (P2), entre outros terminais disponibilizados pela empresa.
10 |
11 | ## 💻 Pré-requisitos
12 |
13 | - NodeJS >= 18.0.0
14 | - React Native >= 0.72
15 | - Expo >= 47 (opcional)
16 |
17 | ## 🚀 Instalando
18 |
19 | Instalando com Yarn:
20 | ```sh
21 | yarn add react-native-pagseguro-plugpag
22 | ```
23 | Instalando com npm:
24 | ```sh
25 | npm install react-native-pagseguro-plugpag
26 | ```
27 | ### Configuração em React Native
28 |
29 | Adicione essa linha no arquivo `/android/build.gradle`
30 | ```
31 | buildscript {
32 | dependencies {
33 | ...
34 | classpath 'com.google.gms:google-services:4.3.15'
35 | }
36 | }
37 | ```
38 | e adicione essa dependência no arquivo `/android/app/build.gradle`:
39 | ```
40 | dependencies {
41 | // ... other dependencies
42 | implementation 'br.com.uol.pagseguro.plugpagservice.wrapper:wrapper:1.7.6'
43 | ...
44 | }
45 | ```
46 |
47 | ### Configuração em Expo
48 | ***OBS***: A biblioteca não suporta rodar em ***Expo Go*** por lidar com bibliotecas, já que a biblioteca PlugPag Wrapper foi projetado para uso de device Android da Pagseguro. Com isso, é preciso utilizar ***expo-dev-client*** para expor a pasta android de seu projeto expo.
49 |
50 | Adicione em `app.json` ou `app.config.js` o plugin da react-native-pagseguro-plugpag:
51 | ```
52 | {
53 | "expo": {
54 | "plugins": [
55 | "react-native-pagseguro-plugpag"
56 | ]
57 | }
58 | }
59 | ```
60 | E para concluir, execute o pre build do expo para concluir configuração:
61 | ```
62 | npx expo prebuild -p android --clean
63 | ```
64 |
65 | ## 📖 Uso
66 |
67 | ***initializeAndActivatePinPad***: inicializa e ativa pin pad.
68 |
69 | ***doPayment***: efetua comunicação e execução de transações financeiras (cartão de débito, cartão de crédito, voucher e PIX).
70 |
71 | ***refundPayment***: efetuar estorno de transações financeiras.
72 |
73 | ***print***: faz impressões personalizadas a partir de um arquivo JPEG/PNG.
74 |
75 | ***useTransactionPaymentEvent***: hook de eventos nativos em relação as transações financeiras
76 |
77 |
78 |
79 | ### Exemplos de uso
80 |
81 | Exemplo para ativação de terminal de pin pad.
82 |
83 | ***OBS***: Para terminais de desenvolvimento, comumente utiliza-se o código `403938`. Caso não funcione, contate o suporte da Pagseguro.
84 |
85 | ```JS
86 | import { initializeAndActivatePinPad } from 'react-native-pagseguro-plugpag';
87 |
88 | handleInitializeAndActivatePinPad() {
89 | try {
90 | const data = await initializeAndActivatePinPad('403938');
91 |
92 | if (data.result !== 0) {
93 | Alert.alert('Erro ao ativar terminal', data.errorMessage);
94 | return;
95 | }
96 |
97 | Alert.alert('Terminal ativado com sucesso!');
98 | } catch (error) {
99 | console.log(error);
100 | Alert.alert('Erro ao ativar terminal');
101 | }
102 | }
103 | ```
104 |
105 | Exemplo para efetuar transações com cartão de crédito com R$ 25,00:
106 | ```js
107 | import { plugPag, doPayment } from 'react-native-pagseguro-plugpag';
108 |
109 | handleDoPaymentCreditType() {
110 | try {
111 | const data: PaymentTransactionResponseProps = await doPayment({
112 | amount: 2500, // Valor a ser pago em centavos
113 | type: plugPag.paymentTypes.CREDIT, // Opção de tipo de pagamento
114 | printReceipt: true, // Imprime ou não via do estabelecimento
115 | installments: 1, // Números de parcelas
116 | installmentType: plugPag.installmentTypes.BUYER_INSTALLMENT, // Nos casos de parcelamentos, define se a taxa será cobrada pelo comprador ou pelo vendedor
117 | userReference: 'test', // Código externo caso queira identificar transação no futuro.
118 | });
119 |
120 | Alert.alert('Transação concluída com sucesso');
121 | } catch (error) {
122 | console.log(error);
123 | setIsModalVisible(false);
124 |
125 | Alert.alert('Erro ao concluir transação');
126 | }
127 | }
128 | ```
129 |
130 | Exemplo para efetuar transações com cartão de débito com R$ 25,00:
131 | ```js
132 | import { plugPag, doPayment } from 'react-native-pagseguro-plugpag';
133 |
134 | handleDoPaymentDebitType() {
135 | try {
136 | const data = await doPayment({
137 | amount: 2500, // Valor a ser pago em centavos
138 | type: plugPag.paymentTypes.DEBIT, // Opção de tipo de pagamento
139 | printReceipt: true, // Imprime ou não via do estabelecimento.
140 | installments: 1, // Números de parcelas
141 | installmentType: plugPag.installmentTypes.BUYER_INSTALLMENT, // Nos casos de parcelamentos, define se a taxa será cobrada pelo comprador ou pelo vendedor
142 | userReference: 'test', // Código externo caso queira identificar transação no futuro.
143 | });
144 |
145 | Alert.alert('Transação concluída com sucesso');
146 | } catch (error) {
147 | console.log(error);
148 | setIsModalVisible(false);
149 |
150 | Alert.alert('Erro ao concluir transação');
151 | }
152 | }
153 | ```
154 |
155 | Exemplo para efetuar estorno de transação:
156 |
157 | ```JS
158 | handleRefundLastTransaction() {
159 | try {
160 | const response = await refundPayment({
161 | transactionCode: 123dwqwd5465sdas,
162 | transactionId: 78911qweqwdw7de44dd7qweqwed7d1qwe,
163 | printReceipt: true,
164 | });
165 |
166 | if (response.result !== 0) {
167 | Alert.alert('Estorno', 'Ocorreu um erro ao efetuar estorno');
168 | return;
169 | }
170 |
171 | Alert.alert('Estorno efetuado com sucesso');
172 | } catch (error) {
173 | console.log(error);
174 |
175 | setIsModalVisible(false);
176 | Alert.alert('Estorno', 'Ocorreu um erro ao efetuar estorno');
177 | }
178 | }
179 | ```
180 |
181 | Para mais exemplos, veja o app demo nesse repositório
182 |
183 | ## Contributing
184 |
185 | Veja [contributing guide](CONTRIBUTING.md) para aprender como contribuir para o repositório e o fluxo de desenvolvimento.
186 |
187 | ## License
188 |
189 | [MIT](LICENSE)
190 |
191 | ---
192 |
193 | Feito com [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
194 |
--------------------------------------------------------------------------------
/example/src/App.tsx:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 |
3 | import {
4 | StyleSheet,
5 | View,
6 | Text,
7 | Image,
8 | TouchableOpacity,
9 | ScrollView,
10 | Modal,
11 | ActivityIndicator,
12 | Alert,
13 | } from 'react-native';
14 |
15 | import {
16 | useTransactionPaymentEvent,
17 | doPayment,
18 | initializeAndActivatePinPad,
19 | refundPayment,
20 | plugPag,
21 | type PaymentTransactionResponseProps,
22 | } from 'react-native-pagseguro-plugpag';
23 |
24 | import LogoImg from './assets/react-native-pagseguro-plugpag-logo.png';
25 |
26 | export default function App() {
27 | const [isModalVisible, setIsModalVisible] = useState(false);
28 | const [lastPayment, setLastPayment] =
29 | useState(
30 | {} as PaymentTransactionResponseProps
31 | );
32 |
33 | const eventPayment = useTransactionPaymentEvent();
34 |
35 | async function handleInitializeAndActivatePinPad() {
36 | try {
37 | const data = await initializeAndActivatePinPad('403938');
38 |
39 | if (data.result !== 0) {
40 | Alert.alert('Erro ao ativar terminal', data.errorMessage);
41 | return;
42 | }
43 |
44 | Alert.alert('Terminal ativado com sucesso!');
45 | } catch (error) {
46 | console.log(error);
47 | Alert.alert('Erro ao ativar terminal');
48 | }
49 | }
50 |
51 | async function handleDoPaymentCreditType() {
52 | try {
53 | setIsModalVisible(true);
54 |
55 | const data = await doPayment({
56 | amount: 2500,
57 | type: plugPag.paymentTypes.CREDIT,
58 | printReceipt: true,
59 | installments: 1,
60 | installmentType: plugPag.installmentTypes.BUYER_INSTALLMENT,
61 | userReference: 'test',
62 | });
63 |
64 | setLastPayment(data);
65 | setIsModalVisible(false);
66 |
67 | Alert.alert('Transação concluída com sucesso');
68 | } catch (error) {
69 | console.log(error);
70 | setIsModalVisible(false);
71 |
72 | Alert.alert('Erro ao concluir transação');
73 | }
74 | }
75 |
76 | async function handleDoPaymentDebitType() {
77 | try {
78 | setIsModalVisible(true);
79 |
80 | const data = await doPayment({
81 | amount: 2500,
82 | type: plugPag.paymentTypes.DEBIT,
83 | printReceipt: true,
84 | installments: 1,
85 | installmentType: plugPag.installmentTypes.BUYER_INSTALLMENT,
86 | userReference: 'test',
87 | });
88 |
89 | console.log(data);
90 |
91 | setIsModalVisible(false);
92 | } catch (error) {
93 | console.log(error);
94 | setIsModalVisible(false);
95 | }
96 | }
97 |
98 | async function handleRefundLastTransaction() {
99 | try {
100 | setIsModalVisible(true);
101 |
102 | const response = await refundPayment({
103 | transactionCode: lastPayment.transactionCode!,
104 | transactionId: lastPayment.transactionId!,
105 | printReceipt: true,
106 | });
107 |
108 | setIsModalVisible(false);
109 |
110 | if (response.result !== 0) {
111 | Alert.alert('Estorno', 'Ocorreu um erro ao efetuar estorno');
112 | return;
113 | }
114 |
115 | Alert.alert('Estorno efetuado com sucesso');
116 |
117 | setLastPayment({} as PaymentTransactionResponseProps);
118 | } catch (error) {
119 | console.log(error);
120 |
121 | setIsModalVisible(false);
122 | Alert.alert('Estorno', 'Ocorreu um erro ao efetuar estorno');
123 | }
124 | }
125 |
126 | return (
127 |
128 |
129 |
130 | React Native Pagseguro PlugPag
131 |
132 |
133 |
134 |
135 |
136 |
140 | Inicializar e ativar o Pin Pad
141 |
142 |
143 |
147 | Pagar R$ 25 no crédito
148 |
149 |
150 |
154 | Pagar R$ 25 no débito
155 |
156 |
157 |
166 | Estornar última transação
167 |
168 |
169 |
170 |
171 |
172 |
173 | {eventPayment.message ?? 'PROCESSANDO'}
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 | );
184 | }
185 |
186 | const styles = StyleSheet.create({
187 | container: {
188 | padding: 24,
189 |
190 | backgroundColor: 'white',
191 | },
192 | header: {
193 | width: '100%',
194 | alignItems: 'center',
195 | justifyContent: 'center',
196 | },
197 | logo: {
198 | width: 180,
199 | height: 180,
200 | },
201 | titleHeader: {
202 | fontSize: 18,
203 | fontWeight: 'bold',
204 | textAlign: 'center',
205 | },
206 | button: {
207 | width: '100%',
208 | alignItems: 'center',
209 | justifyContent: 'center',
210 |
211 | padding: 12,
212 |
213 | borderRadius: 12,
214 | borderWidth: 2,
215 | borderColor: '#00DDFC',
216 | },
217 | textButton: {
218 | fontSize: 16,
219 | fontWeight: 'bold',
220 | textAlign: 'center',
221 | color: '#00DDFC',
222 | },
223 | space: {
224 | marginBottom: 12,
225 | },
226 | centeredView: {
227 | flex: 1,
228 | justifyContent: 'center',
229 | alignItems: 'center',
230 | marginTop: 22,
231 | },
232 | modalView: {
233 | margin: 20,
234 | backgroundColor: 'white',
235 | borderRadius: 20,
236 | padding: 35,
237 | shadowColor: '#000',
238 | shadowOffset: {
239 | width: 0,
240 | height: 2,
241 | },
242 | shadowOpacity: 0.25,
243 | shadowRadius: 4,
244 | elevation: 5,
245 | },
246 | modalTitle: {
247 | fontSize: 16,
248 | fontWeight: 'bold',
249 | textAlign: 'center',
250 | },
251 | modalBox: {
252 | alignItems: 'center',
253 | justifyContent: 'center',
254 | padding: 24,
255 | },
256 | });
257 |
--------------------------------------------------------------------------------
/example/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | # This is normally unused
84 | # shellcheck disable=SC2034
85 | APP_BASE_NAME=${0##*/}
86 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
87 |
88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
90 |
91 | # Use the maximum available, or set MAX_FD != -1 to use that value.
92 | MAX_FD=maximum
93 |
94 | warn () {
95 | echo "$*"
96 | } >&2
97 |
98 | die () {
99 | echo
100 | echo "$*"
101 | echo
102 | exit 1
103 | } >&2
104 |
105 | # OS specific support (must be 'true' or 'false').
106 | cygwin=false
107 | msys=false
108 | darwin=false
109 | nonstop=false
110 | case "$( uname )" in #(
111 | CYGWIN* ) cygwin=true ;; #(
112 | Darwin* ) darwin=true ;; #(
113 | MSYS* | MINGW* ) msys=true ;; #(
114 | NONSTOP* ) nonstop=true ;;
115 | esac
116 |
117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118 |
119 |
120 | # Determine the Java command to use to start the JVM.
121 | if [ -n "$JAVA_HOME" ] ; then
122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123 | # IBM's JDK on AIX uses strange locations for the executables
124 | JAVACMD=$JAVA_HOME/jre/sh/java
125 | else
126 | JAVACMD=$JAVA_HOME/bin/java
127 | fi
128 | if [ ! -x "$JAVACMD" ] ; then
129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130 |
131 | Please set the JAVA_HOME variable in your environment to match the
132 | location of your Java installation."
133 | fi
134 | else
135 | JAVACMD=java
136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 |
142 | # Increase the maximum file descriptors if we can.
143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144 | case $MAX_FD in #(
145 | max*)
146 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147 | # shellcheck disable=SC3045
148 | MAX_FD=$( ulimit -H -n ) ||
149 | warn "Could not query maximum file descriptor limit"
150 | esac
151 | case $MAX_FD in #(
152 | '' | soft) :;; #(
153 | *)
154 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155 | # shellcheck disable=SC3045
156 | ulimit -n "$MAX_FD" ||
157 | warn "Could not set maximum file descriptor limit to $MAX_FD"
158 | esac
159 | fi
160 |
161 | # Collect all arguments for the java command, stacking in reverse order:
162 | # * args from the command line
163 | # * the main class name
164 | # * -classpath
165 | # * -D...appname settings
166 | # * --module-path (only if needed)
167 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
168 |
169 | # For Cygwin or MSYS, switch paths to Windows format before running java
170 | if "$cygwin" || "$msys" ; then
171 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
172 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
173 |
174 | JAVACMD=$( cygpath --unix "$JAVACMD" )
175 |
176 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
177 | for arg do
178 | if
179 | case $arg in #(
180 | -*) false ;; # don't mess with options #(
181 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
182 | [ -e "$t" ] ;; #(
183 | *) false ;;
184 | esac
185 | then
186 | arg=$( cygpath --path --ignore --mixed "$arg" )
187 | fi
188 | # Roll the args list around exactly as many times as the number of
189 | # args, so each arg winds up back in the position where it started, but
190 | # possibly modified.
191 | #
192 | # NB: a `for` loop captures its iteration list before it begins, so
193 | # changing the positional parameters here affects neither the number of
194 | # iterations, nor the values presented in `arg`.
195 | shift # remove old arg
196 | set -- "$@" "$arg" # push replacement arg
197 | done
198 | fi
199 |
200 | # Collect all arguments for the java command;
201 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
202 | # shell script including quotes and variable substitutions, so put them in
203 | # double quotes to make sure that they get re-expanded; and
204 | # * put everything else in single quotes, so that it's not re-expanded.
205 |
206 | set -- \
207 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
208 | -classpath "$CLASSPATH" \
209 | org.gradle.wrapper.GradleWrapperMain \
210 | "$@"
211 |
212 | # Stop when "xargs" is not available.
213 | if ! command -v xargs >/dev/null 2>&1
214 | then
215 | die "xargs is not available"
216 | fi
217 |
218 | # Use "xargs" to parse quoted args.
219 | #
220 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
221 | #
222 | # In Bash we could simply go:
223 | #
224 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
225 | # set -- "${ARGS[@]}" "$@"
226 | #
227 | # but POSIX shell has neither arrays nor command substitution, so instead we
228 | # post-process each arg (as a line of input to sed) to backslash-escape any
229 | # character that might be a shell metacharacter, then use eval to reverse
230 | # that process (while maintaining the separation between arguments), and wrap
231 | # the whole thing up as a single "set" statement.
232 | #
233 | # This will of course break if any of these variables contains a newline or
234 | # an unmatched quote.
235 | #
236 |
237 | eval "set -- $(
238 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
239 | xargs -n1 |
240 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
241 | tr '\n' ' '
242 | )" '"$@"'
243 |
244 | exec "$JAVACMD" "$@"
245 |
--------------------------------------------------------------------------------
/ios/PagseguroPlugpag.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 5E555C0D2413F4C50049A1A2 /* PagseguroPlugpag.mm in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* PagseguroPlugpag.mm */; };
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 /* libPagseguroPlugpag.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPagseguroPlugpag.a; sourceTree = BUILT_PRODUCTS_DIR; };
27 | B3E7B5881CC2AC0600A0062D /* PagseguroPlugpag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PagseguroPlugpag.h; sourceTree = ""; };
28 | B3E7B5891CC2AC0600A0062D /* PagseguroPlugpag.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PagseguroPlugpag.mm; 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 /* libPagseguroPlugpag.a */,
46 | );
47 | name = Products;
48 | sourceTree = "";
49 | };
50 | 58B511D21A9E6C8500147676 = {
51 | isa = PBXGroup;
52 | children = (
53 | B3E7B5881CC2AC0600A0062D /* PagseguroPlugpag.h */,
54 | B3E7B5891CC2AC0600A0062D /* PagseguroPlugpag.mm */,
55 | 134814211AA4EA7D00B7C361 /* Products */,
56 | );
57 | sourceTree = "";
58 | };
59 | /* End PBXGroup section */
60 |
61 | /* Begin PBXNativeTarget section */
62 | 58B511DA1A9E6C8500147676 /* PagseguroPlugpag */ = {
63 | isa = PBXNativeTarget;
64 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "PagseguroPlugpag" */;
65 | buildPhases = (
66 | 58B511D71A9E6C8500147676 /* Sources */,
67 | 58B511D81A9E6C8500147676 /* Frameworks */,
68 | 58B511D91A9E6C8500147676 /* CopyFiles */,
69 | );
70 | buildRules = (
71 | );
72 | dependencies = (
73 | );
74 | name = PagseguroPlugpag;
75 | productName = RCTDataManager;
76 | productReference = 134814201AA4EA6300B7C361 /* libPagseguroPlugpag.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 = 0920;
86 | ORGANIZATIONNAME = Facebook;
87 | TargetAttributes = {
88 | 58B511DA1A9E6C8500147676 = {
89 | CreatedOnToolsVersion = 6.1.1;
90 | };
91 | };
92 | };
93 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "PagseguroPlugpag" */;
94 | compatibilityVersion = "Xcode 3.2";
95 | developmentRegion = English;
96 | hasScannedForEncodings = 0;
97 | knownRegions = (
98 | English,
99 | en,
100 | );
101 | mainGroup = 58B511D21A9E6C8500147676;
102 | productRefGroup = 58B511D21A9E6C8500147676;
103 | projectDirPath = "";
104 | projectRoot = "";
105 | targets = (
106 | 58B511DA1A9E6C8500147676 /* PagseguroPlugpag */,
107 | );
108 | };
109 | /* End PBXProject section */
110 |
111 | /* Begin PBXSourcesBuildPhase section */
112 | 58B511D71A9E6C8500147676 /* Sources */ = {
113 | isa = PBXSourcesBuildPhase;
114 | buildActionMask = 2147483647;
115 | files = (
116 | B3E7B58A1CC2AC0600A0062D /* PagseguroPlugpag.mm in Sources */,
117 | );
118 | runOnlyForDeploymentPostprocessing = 0;
119 | };
120 | /* End PBXSourcesBuildPhase section */
121 |
122 | /* Begin XCBuildConfiguration section */
123 | 58B511ED1A9E6C8500147676 /* Debug */ = {
124 | isa = XCBuildConfiguration;
125 | buildSettings = {
126 | ALWAYS_SEARCH_USER_PATHS = NO;
127 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
128 | CLANG_CXX_LIBRARY = "libc++";
129 | CLANG_ENABLE_MODULES = YES;
130 | CLANG_ENABLE_OBJC_ARC = YES;
131 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
132 | CLANG_WARN_BOOL_CONVERSION = YES;
133 | CLANG_WARN_COMMA = YES;
134 | CLANG_WARN_CONSTANT_CONVERSION = YES;
135 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
136 | CLANG_WARN_EMPTY_BODY = YES;
137 | CLANG_WARN_ENUM_CONVERSION = YES;
138 | CLANG_WARN_INFINITE_RECURSION = YES;
139 | CLANG_WARN_INT_CONVERSION = YES;
140 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
141 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
142 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
143 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
144 | CLANG_WARN_STRICT_PROTOTYPES = YES;
145 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
146 | CLANG_WARN_UNREACHABLE_CODE = YES;
147 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
148 | COPY_PHASE_STRIP = NO;
149 | ENABLE_STRICT_OBJC_MSGSEND = YES;
150 | ENABLE_TESTABILITY = YES;
151 | "EXCLUDED_ARCHS[sdk=*]" = arm64;
152 | GCC_C_LANGUAGE_STANDARD = gnu99;
153 | GCC_DYNAMIC_NO_PIC = NO;
154 | GCC_NO_COMMON_BLOCKS = YES;
155 | GCC_OPTIMIZATION_LEVEL = 0;
156 | GCC_PREPROCESSOR_DEFINITIONS = (
157 | "DEBUG=1",
158 | "$(inherited)",
159 | );
160 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
161 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
162 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
163 | GCC_WARN_UNDECLARED_SELECTOR = YES;
164 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
165 | GCC_WARN_UNUSED_FUNCTION = YES;
166 | GCC_WARN_UNUSED_VARIABLE = YES;
167 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
168 | MTL_ENABLE_DEBUG_INFO = YES;
169 | ONLY_ACTIVE_ARCH = YES;
170 | SDKROOT = iphoneos;
171 | };
172 | name = Debug;
173 | };
174 | 58B511EE1A9E6C8500147676 /* Release */ = {
175 | isa = XCBuildConfiguration;
176 | buildSettings = {
177 | ALWAYS_SEARCH_USER_PATHS = NO;
178 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
179 | CLANG_CXX_LIBRARY = "libc++";
180 | CLANG_ENABLE_MODULES = YES;
181 | CLANG_ENABLE_OBJC_ARC = YES;
182 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
183 | CLANG_WARN_BOOL_CONVERSION = YES;
184 | CLANG_WARN_COMMA = YES;
185 | CLANG_WARN_CONSTANT_CONVERSION = YES;
186 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
187 | CLANG_WARN_EMPTY_BODY = YES;
188 | CLANG_WARN_ENUM_CONVERSION = YES;
189 | CLANG_WARN_INFINITE_RECURSION = YES;
190 | CLANG_WARN_INT_CONVERSION = YES;
191 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
192 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
193 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
194 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
195 | CLANG_WARN_STRICT_PROTOTYPES = YES;
196 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
197 | CLANG_WARN_UNREACHABLE_CODE = YES;
198 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
199 | COPY_PHASE_STRIP = YES;
200 | ENABLE_NS_ASSERTIONS = NO;
201 | ENABLE_STRICT_OBJC_MSGSEND = YES;
202 | "EXCLUDED_ARCHS[sdk=*]" = arm64;
203 | GCC_C_LANGUAGE_STANDARD = gnu99;
204 | GCC_NO_COMMON_BLOCKS = YES;
205 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
206 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
207 | GCC_WARN_UNDECLARED_SELECTOR = YES;
208 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
209 | GCC_WARN_UNUSED_FUNCTION = YES;
210 | GCC_WARN_UNUSED_VARIABLE = YES;
211 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
212 | MTL_ENABLE_DEBUG_INFO = NO;
213 | SDKROOT = iphoneos;
214 | VALIDATE_PRODUCT = YES;
215 | };
216 | name = Release;
217 | };
218 | 58B511F01A9E6C8500147676 /* Debug */ = {
219 | isa = XCBuildConfiguration;
220 | buildSettings = {
221 | HEADER_SEARCH_PATHS = (
222 | "$(inherited)",
223 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
224 | "$(SRCROOT)/../../../React/**",
225 | "$(SRCROOT)/../../react-native/React/**",
226 | );
227 | LIBRARY_SEARCH_PATHS = "$(inherited)";
228 | OTHER_LDFLAGS = "-ObjC";
229 | PRODUCT_NAME = PagseguroPlugpag;
230 | SKIP_INSTALL = YES;
231 | };
232 | name = Debug;
233 | };
234 | 58B511F11A9E6C8500147676 /* Release */ = {
235 | isa = XCBuildConfiguration;
236 | buildSettings = {
237 | HEADER_SEARCH_PATHS = (
238 | "$(inherited)",
239 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
240 | "$(SRCROOT)/../../../React/**",
241 | "$(SRCROOT)/../../react-native/React/**",
242 | );
243 | LIBRARY_SEARCH_PATHS = "$(inherited)";
244 | OTHER_LDFLAGS = "-ObjC";
245 | PRODUCT_NAME = PagseguroPlugpag;
246 | SKIP_INSTALL = YES;
247 | };
248 | name = Release;
249 | };
250 | /* End XCBuildConfiguration section */
251 |
252 | /* Begin XCConfigurationList section */
253 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "PagseguroPlugpag" */ = {
254 | isa = XCConfigurationList;
255 | buildConfigurations = (
256 | 58B511ED1A9E6C8500147676 /* Debug */,
257 | 58B511EE1A9E6C8500147676 /* Release */,
258 | );
259 | defaultConfigurationIsVisible = 0;
260 | defaultConfigurationName = Release;
261 | };
262 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "PagseguroPlugpag" */ = {
263 | isa = XCConfigurationList;
264 | buildConfigurations = (
265 | 58B511F01A9E6C8500147676 /* Debug */,
266 | 58B511F11A9E6C8500147676 /* Release */,
267 | );
268 | defaultConfigurationIsVisible = 0;
269 | defaultConfigurationName = Release;
270 | };
271 | /* End XCConfigurationList section */
272 | };
273 | rootObject = 58B511D31A9E6C8500147676 /* Project object */;
274 | }
275 |
--------------------------------------------------------------------------------
/android/src/main/java/com/pagseguroplugpag/PagseguroPlugpagModule.java:
--------------------------------------------------------------------------------
1 | package com.pagseguroplugpag;
2 |
3 | import static com.pagseguroplugpag.JsonParseUtils.getPlugPagVoidDataFromJson;
4 |
5 | import android.content.pm.PackageInfo;
6 | import android.util.Log;
7 |
8 | import androidx.annotation.NonNull;
9 |
10 | import com.facebook.react.bridge.Arguments;
11 | import com.facebook.react.bridge.Promise;
12 | import com.facebook.react.bridge.ReactApplicationContext;
13 | import com.facebook.react.bridge.ReactContextBaseJavaModule;
14 | import com.facebook.react.bridge.ReactMethod;
15 | import com.facebook.react.bridge.WritableMap;
16 | import com.facebook.react.module.annotations.ReactModule;
17 | import com.facebook.react.modules.core.DeviceEventManagerModule;
18 |
19 | import java.util.HashMap;
20 | import java.util.Map;
21 | import java.util.concurrent.Callable;
22 | import java.util.concurrent.ExecutionException;
23 | import java.util.concurrent.ExecutorService;
24 | import java.util.concurrent.Executors;
25 | import java.util.concurrent.Future;
26 |
27 | import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPag;
28 | import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagActivationData;
29 | import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagAppIdentification;
30 | import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagEventData;
31 | import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagEventListener;
32 | import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagInitializationResult;
33 | import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPaymentData;
34 | import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPrintResult;
35 | import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPrinterData;
36 | import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagPrinterListener;
37 | import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagTransactionResult;
38 | import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagVoidData;
39 |
40 | @ReactModule(name = PagseguroPlugpagModule.NAME)
41 | public class PagseguroPlugpagModule extends ReactContextBaseJavaModule {
42 | public static final String NAME = "PagseguroPlugpag";
43 |
44 | private final ReactApplicationContext reactContext;
45 | private PlugPagAppIdentification appIdentification;
46 | private PlugPag plugPag;
47 | private String messageCard = null;
48 | private int countPassword = 0;
49 | private String getPassword = null;
50 |
51 | private PackageInfo getPackageInfo() throws Exception {
52 | return getReactApplicationContext().getPackageManager().getPackageInfo(getReactApplicationContext().getPackageName(), 0);
53 | }
54 |
55 | public PagseguroPlugpagModule(ReactApplicationContext reactContext) {
56 | super(reactContext);
57 | this.reactContext = reactContext;
58 | }
59 |
60 | @Override
61 | @NonNull
62 | public String getName() {
63 | return NAME;
64 | }
65 |
66 | @Override
67 | public Map getConstants() {
68 | final Map constants = new HashMap<>();
69 |
70 | constants.put("PAYMENT_CREDITO", PlugPag.TYPE_CREDITO);
71 | constants.put("PAYMENT_DEBITO", PlugPag.TYPE_DEBITO);
72 | constants.put("PAYMENT_VOUCHER", PlugPag.TYPE_VOUCHER);
73 |
74 | constants.put("INSTALLMENT_TYPE_A_VISTA", PlugPag.INSTALLMENT_TYPE_A_VISTA);
75 | constants.put("INSTALLMENT_TYPE_PARC_VENDEDOR", PlugPag.INSTALLMENT_TYPE_PARC_VENDEDOR);
76 | constants.put("INSTALLMENT_TYPE_PARC_COMPRADOR", PlugPag.INSTALLMENT_TYPE_PARC_COMPRADOR);
77 |
78 | constants.put("OPERATION_ABORTED", PlugPag.OPERATION_ABORTED);
79 |
80 | constants.put("ACTION_POST_OPERATION", PlugPag.ACTION_POST_OPERATION);
81 | constants.put("ACTION_PRE_OPERATION", PlugPag.ACTION_PRE_OPERATION);
82 | constants.put("ACTION_UPDATE", PlugPag.ACTION_UPDATE);
83 |
84 |
85 | constants.put("AUTHENTICATION_FAILED", PlugPag.AUTHENTICATION_FAILED);
86 | constants.put("COMMUNICATION_ERROR", PlugPag.COMMUNICATION_ERROR);
87 | constants.put("ERROR_CODE_OK", PlugPag.ERROR_CODE_OK);
88 | constants.put("MIN_PRINTER_STEPS", PlugPag.MIN_PRINTER_STEPS);
89 |
90 | constants.put("NO_PRINTER_DEVICE", PlugPag.NO_PRINTER_DEVICE);
91 | constants.put("NO_TRANSACTION_DATA", PlugPag.NO_TRANSACTION_DATA);
92 | constants.put("SERVICE_CLASS_NAME", PlugPag.SERVICE_CLASS_NAME);
93 | constants.put("SERVICE_PACKAGE_NAME", PlugPag.SERVICE_PACKAGE_NAME);
94 |
95 | constants.put("RET_OK", PlugPag.RET_OK);
96 | String appVersion;
97 |
98 | try {
99 | appVersion = getPackageInfo().versionName;
100 | } catch (Exception e) {
101 | appVersion = "unkown";
102 | }
103 | constants.put("appVersion", appVersion);
104 | return constants;
105 | }
106 |
107 | // Cria a identificação do aplicativo
108 | @ReactMethod
109 | public void setAppIdentification() {
110 | try {
111 | plugPag = new PlugPag(reactContext);
112 | } catch (Exception e) {
113 | throw new RuntimeException(e);
114 | }
115 | plugPag = new PlugPag(reactContext);
116 | }
117 |
118 | // Ativa terminal e faz o pagamento
119 | @ReactMethod
120 | public void initializeAndActivatePinPad(String activationCode, Promise promise) {
121 | setAppIdentification();
122 |
123 | final PlugPagActivationData activationData = new PlugPagActivationData(activationCode);
124 |
125 | ExecutorService executor = Executors.newSingleThreadExecutor();
126 | Callable callable = new Callable() {
127 | @Override
128 | public PlugPagInitializationResult call() throws Exception {
129 | return plugPag.initializeAndActivatePinpad(activationData);
130 | }
131 | };
132 |
133 | Future future = executor.submit(callable);
134 | executor.shutdown();
135 |
136 | try {
137 | PlugPagInitializationResult initResult = future.get();
138 |
139 | final WritableMap map = Arguments.createMap();
140 | map.putInt("result", initResult.getResult());
141 | map.putString("errorCode", initResult.getErrorCode());
142 | map.putString("errorMessage", initResult.getErrorMessage());
143 |
144 | promise.resolve(map);
145 | } catch (ExecutionException e) {
146 | Log.d("PlugPag", e.getMessage());
147 | promise.reject("error", e.getMessage());
148 | } catch (InterruptedException e) {
149 | Log.d("PlugPag", e.getMessage());
150 | promise.reject("error", e.getMessage());
151 | }
152 | }
153 |
154 | // Efetua pagamentos
155 | @ReactMethod
156 | public void doPayment(String jsonStr, Promise promise) {
157 | setAppIdentification();
158 |
159 | final PlugPagPaymentData paymentData = JsonParseUtils.getPlugPagPaymentDataFromJson(jsonStr);
160 |
161 | plugPag.setEventListener(new PlugPagEventListener() {
162 | @Override
163 | public void onEvent(final PlugPagEventData plugPagEventData) {
164 | messageCard = plugPagEventData.getCustomMessage();
165 | int code = plugPagEventData.getEventCode();
166 |
167 | WritableMap params = Arguments.createMap();
168 | params.putInt("code", plugPagEventData.getEventCode());
169 |
170 | if (plugPagEventData.getEventCode() == PlugPagEventData.EVENT_CODE_DIGIT_PASSWORD || plugPagEventData.getEventCode() == PlugPagEventData.EVENT_CODE_NO_PASSWORD) {
171 | if (plugPagEventData.getEventCode() == PlugPagEventData.EVENT_CODE_DIGIT_PASSWORD) {
172 | countPassword++;
173 | } else if (plugPagEventData.getEventCode() == PlugPagEventData.EVENT_CODE_NO_PASSWORD) {
174 | countPassword = 0;
175 | }
176 |
177 | if (countPassword == 0 ) {
178 | getPassword = "Senha:";
179 | } else if (countPassword == 1) {
180 | getPassword = "Senha: *";
181 | } else if (countPassword == 2) {
182 | getPassword = "Senha: **";
183 | } else if (countPassword == 3) {
184 | getPassword = "Senha: ***";
185 | } else if (countPassword == 4) {
186 | getPassword = "Senha: ****";
187 | } else if (countPassword == 5) {
188 | getPassword = "Senha: *****";
189 | } else if (countPassword == 6 || countPassword > 6) {
190 | getPassword = "Senha: ******";
191 | }
192 |
193 | params.putString("message", getPassword);
194 | reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit("eventPayments", params);
195 | } else {
196 | params.putString("message", messageCard);
197 | reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit("eventPayments", params);
198 | }
199 | }
200 | });
201 |
202 | final ExecutorService executor = Executors.newSingleThreadExecutor();
203 |
204 | Runnable runnableTask = new Runnable() {
205 | @Override
206 | public void run() {
207 | try {
208 | PlugPagTransactionResult transactionResult = plugPag.doPayment(paymentData);
209 | final WritableMap map = Arguments.createMap();
210 | map.putInt("result", transactionResult.getResult());
211 | map.putString("errorCode", transactionResult.getErrorCode());
212 | map.putString("message", transactionResult.getMessage());
213 | map.putString("transactionCode", transactionResult.getTransactionCode());
214 | map.putString("transactionId", transactionResult.getTransactionId());
215 | map.putString("hostNsu", transactionResult.getHostNsu());
216 | map.putString("date", transactionResult.getDate());
217 | map.putString("time", transactionResult.getTime());
218 | map.putString("cardBrand", transactionResult.getCardBrand());
219 | map.putString("bin", transactionResult.getBin());
220 | map.putString("holder", transactionResult.getHolder());
221 | map.putString("userReference", transactionResult.getUserReference());
222 | map.putString("terminalSerialNumber", transactionResult.getTerminalSerialNumber());
223 | map.putString("amount", transactionResult.getAmount());
224 | map.putString("availableBalance", transactionResult.getAvailableBalance());
225 | map.putString("cardApplication", transactionResult.getCardApplication());
226 | map.putString("label", transactionResult.getLabel());
227 | map.putString("holderName", transactionResult.getHolderName());
228 | map.putString("extendedHolderName", transactionResult.getExtendedHolderName());
229 |
230 | promise.resolve(map);
231 | executor.isTerminated();
232 | System.gc();
233 | } catch (Exception error) {
234 | Log.v("DoPaymentError", error.getMessage());
235 |
236 | promise.reject("DoPaymentPlugPagError", error);
237 | executor.isTerminated();
238 | System.gc();
239 | }
240 | }
241 | };
242 | executor.execute(runnableTask);
243 | executor.shutdown();
244 | }
245 |
246 | // Estorno de pagamento
247 | @ReactMethod
248 | public void voidPayment(String dataJSON, Promise promise) {
249 | setAppIdentification();
250 |
251 | final PlugPagVoidData voidPaymentData = getPlugPagVoidDataFromJson(dataJSON);
252 |
253 | plugPag.setEventListener(new PlugPagEventListener() {
254 | @Override
255 | public void onEvent(final PlugPagEventData plugPagEventData) {
256 | messageCard = plugPagEventData.getCustomMessage();
257 | int code = plugPagEventData.getEventCode();
258 |
259 | WritableMap params = Arguments.createMap();
260 | params.putInt("code", plugPagEventData.getEventCode());
261 |
262 | if (plugPagEventData.getEventCode() == PlugPagEventData.EVENT_CODE_DIGIT_PASSWORD || plugPagEventData.getEventCode() == PlugPagEventData.EVENT_CODE_NO_PASSWORD) {
263 | if (plugPagEventData.getEventCode() == PlugPagEventData.EVENT_CODE_DIGIT_PASSWORD) {
264 | countPassword++;
265 | } else if (plugPagEventData.getEventCode() == PlugPagEventData.EVENT_CODE_NO_PASSWORD) {
266 | countPassword = 0;
267 | }
268 |
269 | if (countPassword == 0 ) {
270 | getPassword = "Senha:";
271 | } else if (countPassword == 1) {
272 | getPassword = "Senha: *";
273 | } else if (countPassword == 2) {
274 | getPassword = "Senha: **";
275 | } else if (countPassword == 3) {
276 | getPassword = "Senha: ***";
277 | } else if (countPassword == 4) {
278 | getPassword = "Senha: ****";
279 | } else if (countPassword == 5) {
280 | getPassword = "Senha: *****";
281 | } else if (countPassword == 6 || countPassword > 6) {
282 | getPassword = "Senha: ******";
283 | }
284 |
285 | params.putString("message", getPassword);
286 | reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit("eventPayments", params);
287 | } else {
288 | params.putString("message", messageCard);
289 | reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit("eventPayments", params);
290 | }
291 | }
292 | });
293 |
294 | final ExecutorService executor = Executors.newSingleThreadExecutor();
295 |
296 | Runnable runnableTask = new Runnable() {
297 | @Override
298 | public void run() {
299 | try {
300 | PlugPagTransactionResult voidPaymentResult = plugPag.voidPayment(voidPaymentData);
301 |
302 | final WritableMap map = Arguments.createMap();
303 | map.putInt("result", voidPaymentResult.getResult());
304 | map.putString("errorCode", voidPaymentResult.getErrorCode());
305 | map.putString("message", voidPaymentResult.getMessage());
306 | map.putString("transactionCode", voidPaymentResult.getTransactionCode());
307 | map.putString("transactionId", voidPaymentResult.getTransactionId());
308 | map.putString("hostNsu", voidPaymentResult.getHostNsu());
309 | map.putString("date", voidPaymentResult.getDate());
310 | map.putString("time", voidPaymentResult.getTime());
311 | map.putString("cardBrand", voidPaymentResult.getCardBrand());
312 | map.putString("bin", voidPaymentResult.getBin());
313 | map.putString("holder", voidPaymentResult.getHolder());
314 | map.putString("userReference", voidPaymentResult.getUserReference());
315 | map.putString("terminalSerialNumber", voidPaymentResult.getTerminalSerialNumber());
316 | map.putString("amount", voidPaymentResult.getAmount());
317 | map.putString("availableBalance", voidPaymentResult.getAvailableBalance());
318 | map.putString("cardApplication", voidPaymentResult.getCardApplication());
319 | map.putString("label", voidPaymentResult.getLabel());
320 | map.putString("holderName", voidPaymentResult.getHolderName());
321 | map.putString("extendedHolderName", voidPaymentResult.getExtendedHolderName());
322 |
323 | promise.resolve(map);
324 | executor.isTerminated();
325 | System.gc();
326 | } catch (Exception error) {
327 | Log.v("VoidPaymentError", error.getMessage());
328 |
329 | promise.reject("VoidPaymentError", error);
330 | executor.isTerminated();
331 | System.gc();
332 | }
333 | }
334 | };
335 |
336 | executor.execute(runnableTask);
337 | executor.shutdown();
338 | }
339 |
340 | // Impressão personalizada a partir de URI de PNG/JPEG
341 | @ReactMethod
342 | public void print(String filePath, Promise promise) {
343 | setAppIdentification();
344 |
345 | final ExecutorService executor = Executors.newSingleThreadExecutor();
346 |
347 | Runnable runnableTask = new Runnable() {
348 | @Override
349 | public void run() {
350 | try {
351 | // Verifica permissões, se necessário
352 |
353 | // Cria objeto com informações da impressão
354 | final PlugPagPrinterData file = new PlugPagPrinterData(filePath, 4, 0);
355 |
356 | // Executa a impressão
357 | PlugPagPrintResult result = plugPag.printFromFile(file);
358 |
359 | // Cria mapa de retorno para o React Native
360 | WritableMap map = Arguments.createMap();
361 | map.putInt("retCode", result.getResult());
362 | map.putString("message", result.getMessage());
363 | map.putString("errorCode", result.getErrorCode());
364 |
365 | // Verifica resultado da impressão
366 | if (result.getResult() != PlugPag.RET_OK) {
367 | promise.reject("PrintError", result.getMessage());
368 | } else {
369 | promise.resolve(map);
370 | }
371 |
372 | Log.d("PrintResult", "Message => " + result.getMessage());
373 | } catch (Exception error) {
374 | Log.e("PrintException", error.getMessage());
375 | promise.reject("PrintException", error);
376 | } finally {
377 | executor.shutdown();
378 | System.gc();
379 | }
380 | }
381 | };
382 |
383 | executor.execute(runnableTask);
384 | }
385 | }
386 |
--------------------------------------------------------------------------------
/example/ios/PagseguroPlugpagExample.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 54;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 00E356F31AD99517003FC87E /* PagseguroPlugpagExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* PagseguroPlugpagExampleTests.m */; };
11 | 0C80B921A6F3F58F76C31292 /* libPods-PagseguroPlugpagExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DCACB8F33CDC322A6C60F78 /* libPods-PagseguroPlugpagExample.a */; };
12 | 13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; };
13 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
14 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
15 | 7699B88040F8A987B510C191 /* libPods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 19F6CBCC0A4E27FBF8BF4A61 /* libPods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests.a */; };
16 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
17 | /* End PBXBuildFile section */
18 |
19 | /* Begin PBXContainerItemProxy section */
20 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = {
21 | isa = PBXContainerItemProxy;
22 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
23 | proxyType = 1;
24 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A;
25 | remoteInfo = PagseguroPlugpagExample;
26 | };
27 | /* End PBXContainerItemProxy section */
28 |
29 | /* Begin PBXFileReference section */
30 | 00E356EE1AD99517003FC87E /* PagseguroPlugpagExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PagseguroPlugpagExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
31 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
32 | 00E356F21AD99517003FC87E /* PagseguroPlugpagExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PagseguroPlugpagExampleTests.m; sourceTree = ""; };
33 | 13B07F961A680F5B00A75B9A /* PagseguroPlugpagExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PagseguroPlugpagExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
34 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = PagseguroPlugpagExample/AppDelegate.h; sourceTree = ""; };
35 | 13B07FB01A68108700A75B9A /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = PagseguroPlugpagExample/AppDelegate.mm; sourceTree = ""; };
36 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = PagseguroPlugpagExample/Images.xcassets; sourceTree = ""; };
37 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = PagseguroPlugpagExample/Info.plist; sourceTree = ""; };
38 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = PagseguroPlugpagExample/main.m; sourceTree = ""; };
39 | 19F6CBCC0A4E27FBF8BF4A61 /* libPods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
40 | 3B4392A12AC88292D35C810B /* Pods-PagseguroPlugpagExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PagseguroPlugpagExample.debug.xcconfig"; path = "Target Support Files/Pods-PagseguroPlugpagExample/Pods-PagseguroPlugpagExample.debug.xcconfig"; sourceTree = ""; };
41 | 5709B34CF0A7D63546082F79 /* Pods-PagseguroPlugpagExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PagseguroPlugpagExample.release.xcconfig"; path = "Target Support Files/Pods-PagseguroPlugpagExample/Pods-PagseguroPlugpagExample.release.xcconfig"; sourceTree = ""; };
42 | 5B7EB9410499542E8C5724F5 /* Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests.debug.xcconfig"; path = "Target Support Files/Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests/Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests.debug.xcconfig"; sourceTree = ""; };
43 | 5DCACB8F33CDC322A6C60F78 /* libPods-PagseguroPlugpagExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-PagseguroPlugpagExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
44 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = PagseguroPlugpagExample/LaunchScreen.storyboard; sourceTree = ""; };
45 | 89C6BE57DB24E9ADA2F236DE /* Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests.release.xcconfig"; path = "Target Support Files/Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests/Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests.release.xcconfig"; sourceTree = ""; };
46 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
47 | /* End PBXFileReference section */
48 |
49 | /* Begin PBXFrameworksBuildPhase section */
50 | 00E356EB1AD99517003FC87E /* Frameworks */ = {
51 | isa = PBXFrameworksBuildPhase;
52 | buildActionMask = 2147483647;
53 | files = (
54 | 7699B88040F8A987B510C191 /* libPods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests.a in Frameworks */,
55 | );
56 | runOnlyForDeploymentPostprocessing = 0;
57 | };
58 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
59 | isa = PBXFrameworksBuildPhase;
60 | buildActionMask = 2147483647;
61 | files = (
62 | 0C80B921A6F3F58F76C31292 /* libPods-PagseguroPlugpagExample.a in Frameworks */,
63 | );
64 | runOnlyForDeploymentPostprocessing = 0;
65 | };
66 | /* End PBXFrameworksBuildPhase section */
67 |
68 | /* Begin PBXGroup section */
69 | 00E356EF1AD99517003FC87E /* PagseguroPlugpagExampleTests */ = {
70 | isa = PBXGroup;
71 | children = (
72 | 00E356F21AD99517003FC87E /* PagseguroPlugpagExampleTests.m */,
73 | 00E356F01AD99517003FC87E /* Supporting Files */,
74 | );
75 | path = PagseguroPlugpagExampleTests;
76 | sourceTree = "";
77 | };
78 | 00E356F01AD99517003FC87E /* Supporting Files */ = {
79 | isa = PBXGroup;
80 | children = (
81 | 00E356F11AD99517003FC87E /* Info.plist */,
82 | );
83 | name = "Supporting Files";
84 | sourceTree = "";
85 | };
86 | 13B07FAE1A68108700A75B9A /* PagseguroPlugpagExample */ = {
87 | isa = PBXGroup;
88 | children = (
89 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */,
90 | 13B07FB01A68108700A75B9A /* AppDelegate.mm */,
91 | 13B07FB51A68108700A75B9A /* Images.xcassets */,
92 | 13B07FB61A68108700A75B9A /* Info.plist */,
93 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */,
94 | 13B07FB71A68108700A75B9A /* main.m */,
95 | );
96 | name = PagseguroPlugpagExample;
97 | sourceTree = "";
98 | };
99 | 2D16E6871FA4F8E400B85C8A /* Frameworks */ = {
100 | isa = PBXGroup;
101 | children = (
102 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
103 | 5DCACB8F33CDC322A6C60F78 /* libPods-PagseguroPlugpagExample.a */,
104 | 19F6CBCC0A4E27FBF8BF4A61 /* libPods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests.a */,
105 | );
106 | name = Frameworks;
107 | sourceTree = "";
108 | };
109 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = {
110 | isa = PBXGroup;
111 | children = (
112 | );
113 | name = Libraries;
114 | sourceTree = "";
115 | };
116 | 83CBB9F61A601CBA00E9B192 = {
117 | isa = PBXGroup;
118 | children = (
119 | 13B07FAE1A68108700A75B9A /* PagseguroPlugpagExample */,
120 | 832341AE1AAA6A7D00B99B32 /* Libraries */,
121 | 00E356EF1AD99517003FC87E /* PagseguroPlugpagExampleTests */,
122 | 83CBBA001A601CBA00E9B192 /* Products */,
123 | 2D16E6871FA4F8E400B85C8A /* Frameworks */,
124 | BBD78D7AC51CEA395F1C20DB /* Pods */,
125 | );
126 | indentWidth = 2;
127 | sourceTree = "";
128 | tabWidth = 2;
129 | usesTabs = 0;
130 | };
131 | 83CBBA001A601CBA00E9B192 /* Products */ = {
132 | isa = PBXGroup;
133 | children = (
134 | 13B07F961A680F5B00A75B9A /* PagseguroPlugpagExample.app */,
135 | 00E356EE1AD99517003FC87E /* PagseguroPlugpagExampleTests.xctest */,
136 | );
137 | name = Products;
138 | sourceTree = "";
139 | };
140 | BBD78D7AC51CEA395F1C20DB /* Pods */ = {
141 | isa = PBXGroup;
142 | children = (
143 | 3B4392A12AC88292D35C810B /* Pods-PagseguroPlugpagExample.debug.xcconfig */,
144 | 5709B34CF0A7D63546082F79 /* Pods-PagseguroPlugpagExample.release.xcconfig */,
145 | 5B7EB9410499542E8C5724F5 /* Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests.debug.xcconfig */,
146 | 89C6BE57DB24E9ADA2F236DE /* Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests.release.xcconfig */,
147 | );
148 | path = Pods;
149 | sourceTree = "";
150 | };
151 | /* End PBXGroup section */
152 |
153 | /* Begin PBXNativeTarget section */
154 | 00E356ED1AD99517003FC87E /* PagseguroPlugpagExampleTests */ = {
155 | isa = PBXNativeTarget;
156 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "PagseguroPlugpagExampleTests" */;
157 | buildPhases = (
158 | A55EABD7B0C7F3A422A6CC61 /* [CP] Check Pods Manifest.lock */,
159 | 00E356EA1AD99517003FC87E /* Sources */,
160 | 00E356EB1AD99517003FC87E /* Frameworks */,
161 | 00E356EC1AD99517003FC87E /* Resources */,
162 | C59DA0FBD6956966B86A3779 /* [CP] Embed Pods Frameworks */,
163 | F6A41C54EA430FDDC6A6ED99 /* [CP] Copy Pods Resources */,
164 | );
165 | buildRules = (
166 | );
167 | dependencies = (
168 | 00E356F51AD99517003FC87E /* PBXTargetDependency */,
169 | );
170 | name = PagseguroPlugpagExampleTests;
171 | productName = PagseguroPlugpagExampleTests;
172 | productReference = 00E356EE1AD99517003FC87E /* PagseguroPlugpagExampleTests.xctest */;
173 | productType = "com.apple.product-type.bundle.unit-test";
174 | };
175 | 13B07F861A680F5B00A75B9A /* PagseguroPlugpagExample */ = {
176 | isa = PBXNativeTarget;
177 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "PagseguroPlugpagExample" */;
178 | buildPhases = (
179 | C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */,
180 | FD10A7F022414F080027D42C /* Start Packager */,
181 | 13B07F871A680F5B00A75B9A /* Sources */,
182 | 13B07F8C1A680F5B00A75B9A /* Frameworks */,
183 | 13B07F8E1A680F5B00A75B9A /* Resources */,
184 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
185 | 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */,
186 | E235C05ADACE081382539298 /* [CP] Copy Pods Resources */,
187 | );
188 | buildRules = (
189 | );
190 | dependencies = (
191 | );
192 | name = PagseguroPlugpagExample;
193 | productName = PagseguroPlugpagExample;
194 | productReference = 13B07F961A680F5B00A75B9A /* PagseguroPlugpagExample.app */;
195 | productType = "com.apple.product-type.application";
196 | };
197 | /* End PBXNativeTarget section */
198 |
199 | /* Begin PBXProject section */
200 | 83CBB9F71A601CBA00E9B192 /* Project object */ = {
201 | isa = PBXProject;
202 | attributes = {
203 | LastUpgradeCheck = 1210;
204 | TargetAttributes = {
205 | 00E356ED1AD99517003FC87E = {
206 | CreatedOnToolsVersion = 6.2;
207 | TestTargetID = 13B07F861A680F5B00A75B9A;
208 | };
209 | 13B07F861A680F5B00A75B9A = {
210 | LastSwiftMigration = 1120;
211 | };
212 | };
213 | };
214 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "PagseguroPlugpagExample" */;
215 | compatibilityVersion = "Xcode 12.0";
216 | developmentRegion = en;
217 | hasScannedForEncodings = 0;
218 | knownRegions = (
219 | en,
220 | Base,
221 | );
222 | mainGroup = 83CBB9F61A601CBA00E9B192;
223 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
224 | projectDirPath = "";
225 | projectRoot = "";
226 | targets = (
227 | 13B07F861A680F5B00A75B9A /* PagseguroPlugpagExample */,
228 | 00E356ED1AD99517003FC87E /* PagseguroPlugpagExampleTests */,
229 | );
230 | };
231 | /* End PBXProject section */
232 |
233 | /* Begin PBXResourcesBuildPhase section */
234 | 00E356EC1AD99517003FC87E /* Resources */ = {
235 | isa = PBXResourcesBuildPhase;
236 | buildActionMask = 2147483647;
237 | files = (
238 | );
239 | runOnlyForDeploymentPostprocessing = 0;
240 | };
241 | 13B07F8E1A680F5B00A75B9A /* Resources */ = {
242 | isa = PBXResourcesBuildPhase;
243 | buildActionMask = 2147483647;
244 | files = (
245 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */,
246 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
247 | );
248 | runOnlyForDeploymentPostprocessing = 0;
249 | };
250 | /* End PBXResourcesBuildPhase section */
251 |
252 | /* Begin PBXShellScriptBuildPhase section */
253 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = {
254 | isa = PBXShellScriptBuildPhase;
255 | buildActionMask = 2147483647;
256 | files = (
257 | );
258 | inputPaths = (
259 | "$(SRCROOT)/.xcode.env.local",
260 | "$(SRCROOT)/.xcode.env",
261 | );
262 | name = "Bundle React Native code and images";
263 | outputPaths = (
264 | );
265 | runOnlyForDeploymentPostprocessing = 0;
266 | shellPath = /bin/sh;
267 | shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
268 | };
269 | 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = {
270 | isa = PBXShellScriptBuildPhase;
271 | buildActionMask = 2147483647;
272 | files = (
273 | );
274 | inputFileListPaths = (
275 | "${PODS_ROOT}/Target Support Files/Pods-PagseguroPlugpagExample/Pods-PagseguroPlugpagExample-frameworks-${CONFIGURATION}-input-files.xcfilelist",
276 | );
277 | name = "[CP] Embed Pods Frameworks";
278 | outputFileListPaths = (
279 | "${PODS_ROOT}/Target Support Files/Pods-PagseguroPlugpagExample/Pods-PagseguroPlugpagExample-frameworks-${CONFIGURATION}-output-files.xcfilelist",
280 | );
281 | runOnlyForDeploymentPostprocessing = 0;
282 | shellPath = /bin/sh;
283 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-PagseguroPlugpagExample/Pods-PagseguroPlugpagExample-frameworks.sh\"\n";
284 | showEnvVarsInLog = 0;
285 | };
286 | A55EABD7B0C7F3A422A6CC61 /* [CP] Check Pods Manifest.lock */ = {
287 | isa = PBXShellScriptBuildPhase;
288 | buildActionMask = 2147483647;
289 | files = (
290 | );
291 | inputFileListPaths = (
292 | );
293 | inputPaths = (
294 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
295 | "${PODS_ROOT}/Manifest.lock",
296 | );
297 | name = "[CP] Check Pods Manifest.lock";
298 | outputFileListPaths = (
299 | );
300 | outputPaths = (
301 | "$(DERIVED_FILE_DIR)/Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests-checkManifestLockResult.txt",
302 | );
303 | runOnlyForDeploymentPostprocessing = 0;
304 | shellPath = /bin/sh;
305 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
306 | showEnvVarsInLog = 0;
307 | };
308 | C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */ = {
309 | isa = PBXShellScriptBuildPhase;
310 | buildActionMask = 2147483647;
311 | files = (
312 | );
313 | inputFileListPaths = (
314 | );
315 | inputPaths = (
316 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
317 | "${PODS_ROOT}/Manifest.lock",
318 | );
319 | name = "[CP] Check Pods Manifest.lock";
320 | outputFileListPaths = (
321 | );
322 | outputPaths = (
323 | "$(DERIVED_FILE_DIR)/Pods-PagseguroPlugpagExample-checkManifestLockResult.txt",
324 | );
325 | runOnlyForDeploymentPostprocessing = 0;
326 | shellPath = /bin/sh;
327 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
328 | showEnvVarsInLog = 0;
329 | };
330 | C59DA0FBD6956966B86A3779 /* [CP] Embed Pods Frameworks */ = {
331 | isa = PBXShellScriptBuildPhase;
332 | buildActionMask = 2147483647;
333 | files = (
334 | );
335 | inputFileListPaths = (
336 | "${PODS_ROOT}/Target Support Files/Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests/Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests-frameworks-${CONFIGURATION}-input-files.xcfilelist",
337 | );
338 | name = "[CP] Embed Pods Frameworks";
339 | outputFileListPaths = (
340 | "${PODS_ROOT}/Target Support Files/Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests/Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests-frameworks-${CONFIGURATION}-output-files.xcfilelist",
341 | );
342 | runOnlyForDeploymentPostprocessing = 0;
343 | shellPath = /bin/sh;
344 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests/Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests-frameworks.sh\"\n";
345 | showEnvVarsInLog = 0;
346 | };
347 | E235C05ADACE081382539298 /* [CP] Copy Pods Resources */ = {
348 | isa = PBXShellScriptBuildPhase;
349 | buildActionMask = 2147483647;
350 | files = (
351 | );
352 | inputFileListPaths = (
353 | "${PODS_ROOT}/Target Support Files/Pods-PagseguroPlugpagExample/Pods-PagseguroPlugpagExample-resources-${CONFIGURATION}-input-files.xcfilelist",
354 | );
355 | name = "[CP] Copy Pods Resources";
356 | outputFileListPaths = (
357 | "${PODS_ROOT}/Target Support Files/Pods-PagseguroPlugpagExample/Pods-PagseguroPlugpagExample-resources-${CONFIGURATION}-output-files.xcfilelist",
358 | );
359 | runOnlyForDeploymentPostprocessing = 0;
360 | shellPath = /bin/sh;
361 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-PagseguroPlugpagExample/Pods-PagseguroPlugpagExample-resources.sh\"\n";
362 | showEnvVarsInLog = 0;
363 | };
364 | F6A41C54EA430FDDC6A6ED99 /* [CP] Copy Pods Resources */ = {
365 | isa = PBXShellScriptBuildPhase;
366 | buildActionMask = 2147483647;
367 | files = (
368 | );
369 | inputFileListPaths = (
370 | "${PODS_ROOT}/Target Support Files/Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests/Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests-resources-${CONFIGURATION}-input-files.xcfilelist",
371 | );
372 | name = "[CP] Copy Pods Resources";
373 | outputFileListPaths = (
374 | "${PODS_ROOT}/Target Support Files/Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests/Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests-resources-${CONFIGURATION}-output-files.xcfilelist",
375 | );
376 | runOnlyForDeploymentPostprocessing = 0;
377 | shellPath = /bin/sh;
378 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests/Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests-resources.sh\"\n";
379 | showEnvVarsInLog = 0;
380 | };
381 | FD10A7F022414F080027D42C /* Start Packager */ = {
382 | isa = PBXShellScriptBuildPhase;
383 | buildActionMask = 2147483647;
384 | files = (
385 | );
386 | inputFileListPaths = (
387 | );
388 | inputPaths = (
389 | );
390 | name = "Start Packager";
391 | outputFileListPaths = (
392 | );
393 | outputPaths = (
394 | );
395 | runOnlyForDeploymentPostprocessing = 0;
396 | shellPath = /bin/sh;
397 | shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n";
398 | showEnvVarsInLog = 0;
399 | };
400 | /* End PBXShellScriptBuildPhase section */
401 |
402 | /* Begin PBXSourcesBuildPhase section */
403 | 00E356EA1AD99517003FC87E /* Sources */ = {
404 | isa = PBXSourcesBuildPhase;
405 | buildActionMask = 2147483647;
406 | files = (
407 | 00E356F31AD99517003FC87E /* PagseguroPlugpagExampleTests.m in Sources */,
408 | );
409 | runOnlyForDeploymentPostprocessing = 0;
410 | };
411 | 13B07F871A680F5B00A75B9A /* Sources */ = {
412 | isa = PBXSourcesBuildPhase;
413 | buildActionMask = 2147483647;
414 | files = (
415 | 13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */,
416 | 13B07FC11A68108700A75B9A /* main.m in Sources */,
417 | );
418 | runOnlyForDeploymentPostprocessing = 0;
419 | };
420 | /* End PBXSourcesBuildPhase section */
421 |
422 | /* Begin PBXTargetDependency section */
423 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = {
424 | isa = PBXTargetDependency;
425 | target = 13B07F861A680F5B00A75B9A /* PagseguroPlugpagExample */;
426 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */;
427 | };
428 | /* End PBXTargetDependency section */
429 |
430 | /* Begin XCBuildConfiguration section */
431 | 00E356F61AD99517003FC87E /* Debug */ = {
432 | isa = XCBuildConfiguration;
433 | baseConfigurationReference = 5B7EB9410499542E8C5724F5 /* Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests.debug.xcconfig */;
434 | buildSettings = {
435 | BUNDLE_LOADER = "$(TEST_HOST)";
436 | GCC_PREPROCESSOR_DEFINITIONS = (
437 | "DEBUG=1",
438 | "$(inherited)",
439 | );
440 | INFOPLIST_FILE = PagseguroPlugpagExampleTests/Info.plist;
441 | IPHONEOS_DEPLOYMENT_TARGET = 12.4;
442 | LD_RUNPATH_SEARCH_PATHS = (
443 | "$(inherited)",
444 | "@executable_path/Frameworks",
445 | "@loader_path/Frameworks",
446 | );
447 | OTHER_LDFLAGS = (
448 | "-ObjC",
449 | "-lc++",
450 | "$(inherited)",
451 | );
452 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
453 | PRODUCT_NAME = "$(TARGET_NAME)";
454 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PagseguroPlugpagExample.app/PagseguroPlugpagExample";
455 | };
456 | name = Debug;
457 | };
458 | 00E356F71AD99517003FC87E /* Release */ = {
459 | isa = XCBuildConfiguration;
460 | baseConfigurationReference = 89C6BE57DB24E9ADA2F236DE /* Pods-PagseguroPlugpagExample-PagseguroPlugpagExampleTests.release.xcconfig */;
461 | buildSettings = {
462 | BUNDLE_LOADER = "$(TEST_HOST)";
463 | COPY_PHASE_STRIP = NO;
464 | INFOPLIST_FILE = PagseguroPlugpagExampleTests/Info.plist;
465 | IPHONEOS_DEPLOYMENT_TARGET = 12.4;
466 | LD_RUNPATH_SEARCH_PATHS = (
467 | "$(inherited)",
468 | "@executable_path/Frameworks",
469 | "@loader_path/Frameworks",
470 | );
471 | OTHER_LDFLAGS = (
472 | "-ObjC",
473 | "-lc++",
474 | "$(inherited)",
475 | );
476 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
477 | PRODUCT_NAME = "$(TARGET_NAME)";
478 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PagseguroPlugpagExample.app/PagseguroPlugpagExample";
479 | };
480 | name = Release;
481 | };
482 | 13B07F941A680F5B00A75B9A /* Debug */ = {
483 | isa = XCBuildConfiguration;
484 | baseConfigurationReference = 3B4392A12AC88292D35C810B /* Pods-PagseguroPlugpagExample.debug.xcconfig */;
485 | buildSettings = {
486 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
487 | CLANG_ENABLE_MODULES = YES;
488 | CURRENT_PROJECT_VERSION = 1;
489 | ENABLE_BITCODE = NO;
490 | INFOPLIST_FILE = PagseguroPlugpagExample/Info.plist;
491 | LD_RUNPATH_SEARCH_PATHS = (
492 | "$(inherited)",
493 | "@executable_path/Frameworks",
494 | );
495 | MARKETING_VERSION = 1.0;
496 | OTHER_LDFLAGS = (
497 | "$(inherited)",
498 | "-ObjC",
499 | "-lc++",
500 | );
501 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
502 | PRODUCT_NAME = PagseguroPlugpagExample;
503 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
504 | SWIFT_VERSION = 5.0;
505 | VERSIONING_SYSTEM = "apple-generic";
506 | };
507 | name = Debug;
508 | };
509 | 13B07F951A680F5B00A75B9A /* Release */ = {
510 | isa = XCBuildConfiguration;
511 | baseConfigurationReference = 5709B34CF0A7D63546082F79 /* Pods-PagseguroPlugpagExample.release.xcconfig */;
512 | buildSettings = {
513 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
514 | CLANG_ENABLE_MODULES = YES;
515 | CURRENT_PROJECT_VERSION = 1;
516 | INFOPLIST_FILE = PagseguroPlugpagExample/Info.plist;
517 | LD_RUNPATH_SEARCH_PATHS = (
518 | "$(inherited)",
519 | "@executable_path/Frameworks",
520 | );
521 | MARKETING_VERSION = 1.0;
522 | OTHER_LDFLAGS = (
523 | "$(inherited)",
524 | "-ObjC",
525 | "-lc++",
526 | );
527 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
528 | PRODUCT_NAME = PagseguroPlugpagExample;
529 | SWIFT_VERSION = 5.0;
530 | VERSIONING_SYSTEM = "apple-generic";
531 | };
532 | name = Release;
533 | };
534 | 83CBBA201A601CBA00E9B192 /* Debug */ = {
535 | isa = XCBuildConfiguration;
536 | buildSettings = {
537 | ALWAYS_SEARCH_USER_PATHS = NO;
538 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
539 | CLANG_CXX_LANGUAGE_STANDARD = "c++17";
540 | CLANG_CXX_LIBRARY = "libc++";
541 | CLANG_ENABLE_MODULES = YES;
542 | CLANG_ENABLE_OBJC_ARC = YES;
543 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
544 | CLANG_WARN_BOOL_CONVERSION = YES;
545 | CLANG_WARN_COMMA = YES;
546 | CLANG_WARN_CONSTANT_CONVERSION = YES;
547 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
548 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
549 | CLANG_WARN_EMPTY_BODY = YES;
550 | CLANG_WARN_ENUM_CONVERSION = YES;
551 | CLANG_WARN_INFINITE_RECURSION = YES;
552 | CLANG_WARN_INT_CONVERSION = YES;
553 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
554 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
555 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
556 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
557 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
558 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
559 | CLANG_WARN_STRICT_PROTOTYPES = YES;
560 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
561 | CLANG_WARN_UNREACHABLE_CODE = YES;
562 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
563 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
564 | COPY_PHASE_STRIP = NO;
565 | ENABLE_STRICT_OBJC_MSGSEND = YES;
566 | ENABLE_TESTABILITY = YES;
567 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
568 | GCC_C_LANGUAGE_STANDARD = gnu99;
569 | GCC_DYNAMIC_NO_PIC = NO;
570 | GCC_NO_COMMON_BLOCKS = YES;
571 | GCC_OPTIMIZATION_LEVEL = 0;
572 | GCC_PREPROCESSOR_DEFINITIONS = (
573 | "DEBUG=1",
574 | "$(inherited)",
575 | );
576 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
577 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
578 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
579 | GCC_WARN_UNDECLARED_SELECTOR = YES;
580 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
581 | GCC_WARN_UNUSED_FUNCTION = YES;
582 | GCC_WARN_UNUSED_VARIABLE = YES;
583 | IPHONEOS_DEPLOYMENT_TARGET = 12.4;
584 | LD_RUNPATH_SEARCH_PATHS = (
585 | /usr/lib/swift,
586 | "$(inherited)",
587 | );
588 | LIBRARY_SEARCH_PATHS = (
589 | "\"$(SDKROOT)/usr/lib/swift\"",
590 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
591 | "\"$(inherited)\"",
592 | );
593 | MTL_ENABLE_DEBUG_INFO = YES;
594 | ONLY_ACTIVE_ARCH = YES;
595 | OTHER_CPLUSPLUSFLAGS = (
596 | "$(OTHER_CFLAGS)",
597 | "-DFOLLY_NO_CONFIG",
598 | "-DFOLLY_MOBILE=1",
599 | "-DFOLLY_USE_LIBCPP=1",
600 | );
601 | SDKROOT = iphoneos;
602 | };
603 | name = Debug;
604 | };
605 | 83CBBA211A601CBA00E9B192 /* Release */ = {
606 | isa = XCBuildConfiguration;
607 | buildSettings = {
608 | ALWAYS_SEARCH_USER_PATHS = NO;
609 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
610 | CLANG_CXX_LANGUAGE_STANDARD = "c++17";
611 | CLANG_CXX_LIBRARY = "libc++";
612 | CLANG_ENABLE_MODULES = YES;
613 | CLANG_ENABLE_OBJC_ARC = YES;
614 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
615 | CLANG_WARN_BOOL_CONVERSION = YES;
616 | CLANG_WARN_COMMA = YES;
617 | CLANG_WARN_CONSTANT_CONVERSION = YES;
618 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
619 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
620 | CLANG_WARN_EMPTY_BODY = YES;
621 | CLANG_WARN_ENUM_CONVERSION = YES;
622 | CLANG_WARN_INFINITE_RECURSION = YES;
623 | CLANG_WARN_INT_CONVERSION = YES;
624 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
625 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
626 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
627 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
628 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
629 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
630 | CLANG_WARN_STRICT_PROTOTYPES = YES;
631 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
632 | CLANG_WARN_UNREACHABLE_CODE = YES;
633 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
634 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
635 | COPY_PHASE_STRIP = YES;
636 | ENABLE_NS_ASSERTIONS = NO;
637 | ENABLE_STRICT_OBJC_MSGSEND = YES;
638 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
639 | GCC_C_LANGUAGE_STANDARD = gnu99;
640 | GCC_NO_COMMON_BLOCKS = YES;
641 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
642 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
643 | GCC_WARN_UNDECLARED_SELECTOR = YES;
644 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
645 | GCC_WARN_UNUSED_FUNCTION = YES;
646 | GCC_WARN_UNUSED_VARIABLE = YES;
647 | IPHONEOS_DEPLOYMENT_TARGET = 12.4;
648 | LD_RUNPATH_SEARCH_PATHS = (
649 | /usr/lib/swift,
650 | "$(inherited)",
651 | );
652 | LIBRARY_SEARCH_PATHS = (
653 | "\"$(SDKROOT)/usr/lib/swift\"",
654 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
655 | "\"$(inherited)\"",
656 | );
657 | MTL_ENABLE_DEBUG_INFO = NO;
658 | OTHER_CPLUSPLUSFLAGS = (
659 | "$(OTHER_CFLAGS)",
660 | "-DFOLLY_NO_CONFIG",
661 | "-DFOLLY_MOBILE=1",
662 | "-DFOLLY_USE_LIBCPP=1",
663 | );
664 | SDKROOT = iphoneos;
665 | VALIDATE_PRODUCT = YES;
666 | };
667 | name = Release;
668 | };
669 | /* End XCBuildConfiguration section */
670 |
671 | /* Begin XCConfigurationList section */
672 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "PagseguroPlugpagExampleTests" */ = {
673 | isa = XCConfigurationList;
674 | buildConfigurations = (
675 | 00E356F61AD99517003FC87E /* Debug */,
676 | 00E356F71AD99517003FC87E /* Release */,
677 | );
678 | defaultConfigurationIsVisible = 0;
679 | defaultConfigurationName = Release;
680 | };
681 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "PagseguroPlugpagExample" */ = {
682 | isa = XCConfigurationList;
683 | buildConfigurations = (
684 | 13B07F941A680F5B00A75B9A /* Debug */,
685 | 13B07F951A680F5B00A75B9A /* Release */,
686 | );
687 | defaultConfigurationIsVisible = 0;
688 | defaultConfigurationName = Release;
689 | };
690 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "PagseguroPlugpagExample" */ = {
691 | isa = XCConfigurationList;
692 | buildConfigurations = (
693 | 83CBBA201A601CBA00E9B192 /* Debug */,
694 | 83CBBA211A601CBA00E9B192 /* Release */,
695 | );
696 | defaultConfigurationIsVisible = 0;
697 | defaultConfigurationName = Release;
698 | };
699 | /* End XCConfigurationList section */
700 | };
701 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */;
702 | }
703 |
--------------------------------------------------------------------------------