react-native-hyperpay-sdk 0.7.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
package/README.md CHANGED
@@ -1,21 +1,42 @@
1
- # react-native-hyperpay
1
+ # react-native-hyperpay-sdk
2
2
 
3
3
  hyperpay
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```sh
8
- npm install react-native-hyperpay
8
+ npm i react-native-hyperpay-sdk
9
9
  ```
10
10
 
11
11
  ## Usage
12
12
 
13
13
  ```js
14
- import { multiply } from "react-native-hyperpay";
15
-
14
+ import { setConfig } from "react-native-hyperpay-sdk";
15
+
16
+ // the firt step , set default configiration
17
+ // 1- shopperResultURL to redirect to this url after the payment completed
18
+ // 2- select your country code from list
19
+ // 3- merchantIdentifier is for apply pay only
20
+ setConfig({
21
+ shopperResultURL:"shopperResultURL",
22
+ countryCode:"SA",
23
+ merchantIdentifier:"merchantIdentifier"
24
+ })
16
25
  // ...
17
-
18
- const result = await multiply(3, 7);
26
+ // to pay with apple
27
+ const result = await applePay("CheckoutId")
28
+
29
+ // to pay with any brand
30
+ const result=await createPaymentTransaction(
31
+ { paymentBrand: "VISA",
32
+ holderName: "Test Test",
33
+ cardNumber: '4111111111111111',
34
+ expiryYear: '2027',
35
+ expiryMonth: '12',
36
+ cvv: '123',
37
+ checkoutID: `${res.data?.checkout_id}`,
38
+ shopperResultURL: "[YOUR_APP_IDENTIFIER]://[URL_SCHEMES]"
39
+ })
19
40
  ```
20
41
 
21
42
  ## Contributing
package/ios/HyperPay.m CHANGED
@@ -9,7 +9,7 @@ OPPPaymentProvider *provider;
9
9
  NSString *shopperResultURL = @"";
10
10
  NSString *merchantIdentifier = @"";
11
11
  NSString *countryCode = @"";
12
-
12
+ NSString *mode=@"Test";
13
13
 
14
14
  RCT_EXPORT_MODULE(HyperPay)
15
15
 
@@ -20,13 +20,12 @@ RCT_EXPORT_MODULE(HyperPay)
20
20
 
21
21
  self = [super init];
22
22
  if (self) {
23
- #ifdef DEBUG
23
+ // #ifdef DEBUG
24
+ if ([mode isEqual:@"Test"])
24
25
  provider = [OPPPaymentProvider paymentProviderWithMode:OPPProviderModeTest];
25
- #else
26
+ else
26
27
  provider = [OPPPaymentProvider paymentProviderWithMode:OPPProviderModeLive];
27
- #endif
28
28
  }
29
-
30
29
  return self;
31
30
  }
32
31
 
@@ -45,6 +44,8 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(setConfig: (NSDictionary*)options) {
45
44
  shopperResultURL=[options valueForKey:@"merchantIdentifier"];
46
45
  if ([options valueForKey:@"countryCode"])
47
46
  countryCode=[options valueForKey:@"countryCode"];
47
+ if ([options valueForKey:@"mode"])
48
+ mode=[options valueForKey:@"mode"];
48
49
  return options;
49
50
  }
50
51
 
@@ -20,6 +20,9 @@ export type ConfigType = {
20
20
  * required for apple pay
21
21
  */
22
22
  merchantIdentifier?: string
23
+
24
+ mode:"Test"|"Live"
25
+
23
26
  }
24
27
 
25
28
  export type CreateTransactionParams = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-hyperpay-sdk",
3
- "version": "0.7.0",
3
+ "version": "0.10.0",
4
4
  "description": "hyperpay",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -13,7 +13,7 @@
13
13
  "android",
14
14
  "ios",
15
15
  "cpp",
16
- "react-native-hyperpay.podspec",
16
+ "react-native-hyperpay-sdk.podspec",
17
17
  "OPPWAMobile-Resources.bundle",
18
18
  "OPPWAMobile.framework",
19
19
  "!lib/typescript/example",
@@ -37,13 +37,13 @@
37
37
  "ios",
38
38
  "android"
39
39
  ],
40
- "repository": "https://github.com/RMabroukS/react-native-hyperpay",
40
+ "repository": "https://github.com/RMabroukS/react-native-hyperpay-sdk",
41
41
  "author": "RMabroukS <r.mabrouk.sayed@gmail.com> (https://github.com/RMabroukS)",
42
42
  "license": "MIT",
43
43
  "bugs": {
44
- "url": "https://github.com/RMabroukS/react-native-hyperpay/issues"
44
+ "url": "https://github.com/RMabroukS/react-native-hyperpay-sdk/issues"
45
45
  },
46
- "homepage": "https://github.com/RMabroukS/react-native-hyperpay#readme",
46
+ "homepage": "https://github.com/RMabroukS/react-native-hyperpay-sdk#readme",
47
47
  "publishConfig": {
48
48
  "registry": "https://registry.npmjs.org/"
49
49
  },
@@ -3,14 +3,14 @@ require "json"
3
3
  package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
4
 
5
5
  Pod::Spec.new do |s|
6
- s.name = "react-native-hyperpay"
6
+ s.name = "react-native-hyperpay-sdk"
7
7
  s.version = package["version"]
8
8
  s.summary = package["description"]
9
9
  s.homepage = package["homepage"]
10
10
  s.license = package["license"]
11
11
  s.authors = package["author"]
12
12
  s.platforms = { :ios => "10.0" }
13
- s.source = { :git => "https://github.com/RMabroukS/react-native-hyperpay.git", :tag => "#{s.version}" }
13
+ s.source = { :git => "https://github.com/RMabroukS/react-native-hyperpay-sdk.git", :tag => "#{s.version}" }
14
14
  s.source_files = "ios/**/*.{h,m,mm}"
15
15
  s.dependency "React-Core"
16
16
  s.requires_arc = true
package/src/index.tsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import { NativeModules, Platform } from 'react-native';
2
2
  import type { CreateTransactionResponseType, CreateTransactionParams, ConfigType } from '../lib/typescript'
3
3
  const LINKING_ERROR =
4
- `The package 'react-native-hyperpay' doesn't seem to be linked. Make sure: \n\n` +
4
+ `The package 'react-native-hyperpay-sdk' doesn't seem to be linked. Make sure: \n\n` +
5
5
  Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
6
6
  '- You rebuilt the app after installing the package\n' +
7
7
  '- You are not using Expo managed workflow\n';