react-native-hyperpay-sdk 0.12.0 → 0.13.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.
package/README.md CHANGED
@@ -11,23 +11,25 @@ npm i react-native-hyperpay-sdk
11
11
  ## Usage
12
12
 
13
13
  ```js
14
- import { setConfig } from "react-native-hyperpay-sdk";
14
+ import hyperPay from 'react-native-hyperpay-sdk'
15
+
15
16
 
16
17
  // the firt step , set default configiration
17
18
  // 1- shopperResultURL to redirect to this url after the payment completed
18
19
  // 2- select your country code from list
19
20
  // 3- merchantIdentifier is for apply pay only
20
- setConfig({
21
+ hyperPay.setConfig({
21
22
  shopperResultURL:"shopperResultURL",
22
23
  countryCode:"SA",
23
- merchantIdentifier:"merchantIdentifier"
24
+ merchantIdentifier:"merchantIdentifier",
25
+ mode:"TestMode"
24
26
  })
25
27
  // ...
26
28
  // to pay with apple
27
- const result = await applePay("CheckoutId")
29
+ const result = await hyperPay.applePay("CheckoutId")
28
30
 
29
31
  // to pay with any brand
30
- const result=await createPaymentTransaction(
32
+ const result=await hyperPay.createPaymentTransaction(
31
33
  { paymentBrand: "VISA",
32
34
  holderName: "Test Test",
33
35
  cardNumber: '4111111111111111',
package/ios/HyperPay.m CHANGED
@@ -9,19 +9,16 @@ OPPPaymentProvider *provider;
9
9
  NSString *shopperResultURL = @"";
10
10
  NSString *merchantIdentifier = @"";
11
11
  NSString *countryCode = @"";
12
- NSString *mode=@"Test";
12
+ NSString *mode=@"TestMode";
13
13
 
14
14
  RCT_EXPORT_MODULE(HyperPay)
15
15
 
16
16
  -(instancetype)init
17
17
  {
18
18
 
19
-
20
-
21
19
  self = [super init];
22
20
  if (self) {
23
- // #ifdef DEBUG
24
- if ([mode isEqual:@"Test"])
21
+ if ([mode isEqual:@"TestMode"])
25
22
  provider = [OPPPaymentProvider paymentProviderWithMode:OPPProviderModeTest];
26
23
  else
27
24
  provider = [OPPPaymentProvider paymentProviderWithMode:OPPProviderModeLive];
@@ -12,17 +12,17 @@ export type CreateTransactionResponseType = {
12
12
 
13
13
  export type ConfigType = {
14
14
  shopperResultURL: string
15
- /**
16
- * required for apple pay
17
- */
15
+ /**
16
+ * required for apple pay
17
+ */
18
18
  countryCode?: keyof CountryCodes
19
19
  /**
20
20
  * required for apple pay
21
21
  */
22
22
  merchantIdentifier?: string
23
-
24
- mode:"Test"|"Live"
25
-
23
+
24
+ mode?: "TestMode" | "LiveMode"
25
+
26
26
  }
27
27
 
28
28
  export type CreateTransactionParams = {
@@ -33,15 +33,13 @@ export type CreateTransactionParams = {
33
33
  expiryMonth: string,
34
34
  cvv: string,
35
35
  checkoutID: string,
36
- shopperResultURL: string
36
+ shopperResultURL?: string
37
37
  }
38
38
 
39
39
  export declare function
40
40
  createPaymentTransaction(params: CreateTransactionParams):
41
41
  Promise<CreateTransactionResponseType>;
42
42
 
43
-
44
43
  export declare function setConfig(params: ConfigType): ConfigType
45
44
 
46
45
  export declare function applePay(checkoutID: string): Promise<any>;
47
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-hyperpay-sdk",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "hyperpay",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
package/src/index.tsx CHANGED
@@ -26,7 +26,13 @@ export function setConfig(params: ConfigType): ConfigType {
26
26
  return HyperPay.setConfig(params);
27
27
  }
28
28
 
29
-
30
29
  export function applePay(checkoutID: string): Promise<any> {
31
30
  return HyperPay.applePay(checkoutID);
32
31
  }
32
+
33
+ const hyperpay = {
34
+ applePay,
35
+ setConfig,
36
+ createPaymentTransaction
37
+ }
38
+ export default hyperpay