react-native-hyperpay-sdk 0.13.0 → 0.14.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 +13 -0
- package/lib/typescript/PaymentStatus.d.ts +39 -0
- package/package.json +1 -1
- package/src/index.tsx +18 -4
- package/src/paymentStatus/groups.ts +37 -0
- package/src/paymentStatus/index.ts +21 -0
- package/src/paymentStatus/paymentStatus.ts +3106 -0
- package/src/paymentStatus/script.js +16 -0
- package/src/paymentStatus/status.json +2460 -0
package/README.md
CHANGED
|
@@ -39,8 +39,21 @@ const result = await hyperPay.applePay("CheckoutId")
|
|
|
39
39
|
checkoutID: `${res.data?.checkout_id}`,
|
|
40
40
|
shopperResultURL: "[YOUR_APP_IDENTIFIER]://[URL_SCHEMES]"
|
|
41
41
|
})
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
// get payment status
|
|
45
|
+
const result=await hyperPay.getPaymentStatus("000.000.000")
|
|
46
|
+
// result={
|
|
47
|
+
// "code": "000.000.000",
|
|
48
|
+
// "description": "Transaction succeeded",
|
|
49
|
+
// "status": "successfully"
|
|
50
|
+
// }
|
|
42
51
|
```
|
|
43
52
|
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
44
57
|
## Contributing
|
|
45
58
|
|
|
46
59
|
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export type PaymentStatusType =
|
|
4
|
+
{
|
|
5
|
+
code: string,
|
|
6
|
+
description: string,
|
|
7
|
+
status: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export type PaymentStatusesGroups =
|
|
12
|
+
"successfully" |
|
|
13
|
+
"manuallyReviewed" |
|
|
14
|
+
"pending" |
|
|
15
|
+
"rejection3DsecureAndIntercardRiskChecks" |
|
|
16
|
+
"rejectionsByTheExternalBank" |
|
|
17
|
+
"rejectionsDueToCommunicationErrors" |
|
|
18
|
+
"rejectionsDueToSystemErrors" |
|
|
19
|
+
"rejectionsDueToErrorInAsynchonousWorkflow" |
|
|
20
|
+
"softDeclines" |
|
|
21
|
+
"rejectionsDueToChecksByExternalRiskSystems" |
|
|
22
|
+
"rejectionsDueToAddressValidation" |
|
|
23
|
+
"rejectionsDueTo3Dsecure" |
|
|
24
|
+
"rejectionsDueToBlacklistValidation" |
|
|
25
|
+
"rejectionsDueToRiskValidation" |
|
|
26
|
+
"rejectionsDueToConfigurationValidation" |
|
|
27
|
+
"rejectionsDueToRegistrationValidation" |
|
|
28
|
+
"rejectionsDueToJobValidation" |
|
|
29
|
+
"rejectionsDueToReferenceValidation" |
|
|
30
|
+
"rejectionsDueToFormatValidation" |
|
|
31
|
+
"rejectionsDueToAddressValidation" |
|
|
32
|
+
"rejectionsDueToContactValidation" |
|
|
33
|
+
"rejectionsDueToAccountValidation" |
|
|
34
|
+
"rejectionsDueToAmountValidation" |
|
|
35
|
+
"rejectionsDueToRiskManagement" |
|
|
36
|
+
"chargebackRelatedResultCodes"
|
|
37
|
+
|
|
38
|
+
export declare function getPaymentStatus(status: string): PaymentStatusType
|
|
39
|
+
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
NativeModules,
|
|
3
|
+
Platform
|
|
4
|
+
} from 'react-native';
|
|
5
|
+
import type {
|
|
6
|
+
CreateTransactionResponseType,
|
|
7
|
+
CreateTransactionParams,
|
|
8
|
+
ConfigType
|
|
9
|
+
} from '../lib/typescript'
|
|
10
|
+
import {
|
|
11
|
+
getPaymentStatus
|
|
12
|
+
} from './paymentStatus'
|
|
13
|
+
|
|
14
|
+
|
|
3
15
|
const LINKING_ERROR =
|
|
4
16
|
`The package 'react-native-hyperpay-sdk' doesn't seem to be linked. Make sure: \n\n` +
|
|
5
17
|
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
@@ -18,7 +30,8 @@ const HyperPay = NativeModules.HyperPay
|
|
|
18
30
|
);
|
|
19
31
|
|
|
20
32
|
|
|
21
|
-
export function createPaymentTransaction(params: CreateTransactionParams):
|
|
33
|
+
export function createPaymentTransaction(params: CreateTransactionParams):
|
|
34
|
+
Promise<CreateTransactionResponseType> {
|
|
22
35
|
return HyperPay.createPaymentTransaction(params);
|
|
23
36
|
}
|
|
24
37
|
|
|
@@ -33,6 +46,7 @@ export function applePay(checkoutID: string): Promise<any> {
|
|
|
33
46
|
const hyperpay = {
|
|
34
47
|
applePay,
|
|
35
48
|
setConfig,
|
|
36
|
-
createPaymentTransaction
|
|
49
|
+
createPaymentTransaction,
|
|
50
|
+
getPaymentStatus
|
|
37
51
|
}
|
|
38
52
|
export default hyperpay
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
PaymentStatusesGroups
|
|
3
|
+
} from "../../lib/typescript/PaymentStatus"
|
|
4
|
+
|
|
5
|
+
export const groups: {
|
|
6
|
+
group: PaymentStatusesGroups,
|
|
7
|
+
reg: RegExp,
|
|
8
|
+
status: "successfully" | "rejected" | "Chargeback" | "pending"
|
|
9
|
+
}[] =
|
|
10
|
+
[
|
|
11
|
+
{ group: "successfully", reg: /^(000\.000\.|000\.100\.1|000\.[36])/, status: "successfully" },
|
|
12
|
+
{ group: "manuallyReviewed", reg: /^(000\.400\.0[^3]|000\.400\.[0-1]{2}0)/, status: "successfully" },
|
|
13
|
+
{ group: "pending", reg: /^(000\.200)/, status: "pending" },
|
|
14
|
+
{ group: "pending", reg: /^(800\.400\.5|100\.400\.500)/, status: "pending" },
|
|
15
|
+
{ group: "rejection3DsecureAndIntercardRiskChecks", reg: /^(000\.400\.[1][0-9][1-9]|000\.400\.2)/, status: "rejected" },
|
|
16
|
+
{ group: "rejectionsByTheExternalBank", reg: /^(800\.[17]00|800\.800\.[123])/, status: "rejected" },
|
|
17
|
+
{ group: "rejectionsDueToCommunicationErrors", reg: /^(900\.[1234]00|000\.400\.030)/, status: "rejected" },
|
|
18
|
+
{ group: "rejectionsDueToSystemErrors", reg: /^(800\.[56]|999\.|600\.1|800\.800\.[84])/, status: "rejected" },
|
|
19
|
+
{ group: "rejectionsDueToErrorInAsynchonousWorkflow", reg: /^(100\.39[765])/, status: "rejected" },
|
|
20
|
+
{ group: "softDeclines", reg: /^(300\.100\.100)/, status: "rejected" },
|
|
21
|
+
{ group: "rejectionsDueToChecksByExternalRiskSystems", reg: /^(100\.400\.[0-3]|100\.38|100\.370\.100|100\.370\.11)/, status: "rejected" },
|
|
22
|
+
{ group: "rejectionsDueToAddressValidation", reg: /^(800\.400\.1)/, status: "rejected" },
|
|
23
|
+
{ group: "rejectionsDueTo3Dsecure", reg: /^(800\.400\.2|100\.380\.4|100\.390)/, status: "rejected" },
|
|
24
|
+
{ group: "rejectionsDueToBlacklistValidation", reg: /^(100\.100\.701|800\.[32])/, status: "rejected" },
|
|
25
|
+
{ group: "rejectionsDueToRiskValidation", reg: /^(800\.1[123456]0)/, status: "rejected" },
|
|
26
|
+
{ group: "rejectionsDueToConfigurationValidation", reg: /^(600\.[23]|500\.[12]|800\.121)/, status: "rejected" },
|
|
27
|
+
{ group: "rejectionsDueToRegistrationValidation", reg: /^(100\.[13]50)/, status: "rejected" },
|
|
28
|
+
{ group: "rejectionsDueToJobValidation", reg: /^(100\.250|100\.360)/, status: "rejected" },
|
|
29
|
+
{ group: "rejectionsDueToReferenceValidation", reg: /^(700\.[1345][05]0)/, status: "rejected" },
|
|
30
|
+
{ group: "rejectionsDueToFormatValidation", reg: /^(200\.[123]|100\.[53][07]|800\.900|100\.[69]00\.500)/, status: "rejected" },
|
|
31
|
+
{ group: "rejectionsDueToAddressValidation", reg: /^(100\.800)/, status: "rejected" },
|
|
32
|
+
{ group: "rejectionsDueToContactValidation", reg: /^(100\.[97]00)/, status: "rejected" },
|
|
33
|
+
{ group: "rejectionsDueToAccountValidation", reg: /^(100\.100|100.2[01])/, status: "rejected" },
|
|
34
|
+
{ group: "rejectionsDueToAmountValidation", reg: /^(100\.55)/, status: "rejected" },
|
|
35
|
+
{ group: "rejectionsDueToRiskManagement", reg: /^(100\.380\.[23]|100\.380\.101)/, status: "rejected" },
|
|
36
|
+
{ group: "chargebackRelatedResultCodes", reg: /^(000\.100\.2)/, status: "Chargeback" },
|
|
37
|
+
]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
groups
|
|
3
|
+
} from './groups';
|
|
4
|
+
import type {
|
|
5
|
+
PaymentStatusType,
|
|
6
|
+
} from '../../lib/typescript/PaymentStatus'
|
|
7
|
+
import {
|
|
8
|
+
PaymentStatus
|
|
9
|
+
} from './paymentStatus'
|
|
10
|
+
|
|
11
|
+
export const getPaymentStatus = (code: string): PaymentStatusType => {
|
|
12
|
+
const selectedGroup = groups.find((group) => group.reg.test(code))
|
|
13
|
+
if (selectedGroup)
|
|
14
|
+
return PaymentStatus[selectedGroup.group][code]
|
|
15
|
+
else
|
|
16
|
+
return {
|
|
17
|
+
code,
|
|
18
|
+
description: "This status code is invalid",
|
|
19
|
+
status: "error"
|
|
20
|
+
}
|
|
21
|
+
}
|