payjp-react-native 0.6.3 → 0.8.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/android/build.gradle +4 -11
- package/android/src/main/java/jp/pay/reactnative/PayjpCardFormModule.kt +24 -1
- package/ios/Classes/RNPAY.m +1 -1
- package/ios/Classes/RNPAYCardForm.m +22 -3
- package/lib/{src/ApplePay.d.ts → ApplePay.d.ts} +6 -6
- package/lib/{src/ApplePay.js → ApplePay.js} +22 -32
- package/lib/{src/CardForm.d.ts → CardForm.d.ts} +34 -9
- package/lib/{src/CardForm.js → CardForm.js} +26 -36
- package/lib/{src/Core.d.ts → Core.d.ts} +1 -1
- package/lib/Core.js +18 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +6 -0
- package/lib/{src/models → models}/Card.d.ts +13 -1
- package/lib/models/Card.js +86 -0
- package/lib/{src/models → models}/CardBrand.d.ts +10 -9
- package/lib/models/CardBrand.js +44 -0
- package/lib/{src/models → models}/ErrorResponse.js +5 -12
- package/lib/{src/models → models}/ModelError.js +7 -14
- package/lib/{src/models → models}/Token.d.ts +1 -1
- package/lib/{src/models → models}/Token.js +12 -19
- package/lib/models/index.d.ts +5 -0
- package/lib/models/index.js +6 -0
- package/package.json +31 -54
- package/payjp-react-native.podspec +3 -1
- package/sdkconfig.json +3 -3
- package/src/ApplePay.ts +8 -8
- package/src/CardForm.ts +40 -10
- package/src/Core.ts +1 -1
- package/src/index.ts +4 -4
- package/src/models/Card.ts +37 -21
- package/src/models/CardBrand.ts +19 -8
- package/src/models/ErrorResponse.ts +1 -1
- package/src/models/ModelError.ts +3 -3
- package/src/models/Token.ts +7 -7
- package/src/models/index.ts +7 -6
- package/lib/src/ApplePay.js.map +0 -1
- package/lib/src/CardForm.js.map +0 -1
- package/lib/src/Core.js +0 -32
- package/lib/src/Core.js.map +0 -1
- package/lib/src/index.d.ts +0 -5
- package/lib/src/index.js +0 -34
- package/lib/src/index.js.map +0 -1
- package/lib/src/models/Card.js +0 -89
- package/lib/src/models/Card.js.map +0 -1
- package/lib/src/models/CardBrand.js +0 -43
- package/lib/src/models/CardBrand.js.map +0 -1
- package/lib/src/models/ErrorResponse.js.map +0 -1
- package/lib/src/models/ModelError.js.map +0 -1
- package/lib/src/models/Token.js.map +0 -1
- package/lib/src/models/TokenForm.d.ts +0 -51
- package/lib/src/models/TokenForm.js +0 -58
- package/lib/src/models/TokenForm.js.map +0 -1
- package/lib/src/models/index.d.ts +0 -6
- package/lib/src/models/index.js +0 -19
- package/lib/src/models/index.js.map +0 -1
- package/src/models/TokenForm.ts +0 -95
- /package/lib/{src/models → models}/ErrorResponse.d.ts +0 -0
- /package/lib/{src/models → models}/ModelError.d.ts +0 -0
|
@@ -12,16 +12,17 @@
|
|
|
12
12
|
/**
|
|
13
13
|
*
|
|
14
14
|
* @export
|
|
15
|
-
* @enum {string}
|
|
16
15
|
*/
|
|
17
|
-
export declare
|
|
18
|
-
Visa
|
|
19
|
-
MasterCard
|
|
20
|
-
|
|
21
|
-
AmericanExpress
|
|
22
|
-
DinersClub
|
|
23
|
-
Discover
|
|
24
|
-
}
|
|
16
|
+
export declare const CardBrand: {
|
|
17
|
+
readonly Visa: "Visa";
|
|
18
|
+
readonly MasterCard: "MasterCard";
|
|
19
|
+
readonly Jcb: "JCB";
|
|
20
|
+
readonly AmericanExpress: "American Express";
|
|
21
|
+
readonly DinersClub: "Diners Club";
|
|
22
|
+
readonly Discover: "Discover";
|
|
23
|
+
};
|
|
24
|
+
export type CardBrand = (typeof CardBrand)[keyof typeof CardBrand];
|
|
25
|
+
export declare function instanceOfCardBrand(value: any): boolean;
|
|
25
26
|
export declare function CardBrandFromJSON(json: any): CardBrand;
|
|
26
27
|
export declare function CardBrandFromJSONTyped(json: any, ignoreDiscriminator: boolean): CardBrand;
|
|
27
28
|
export declare function CardBrandToJSON(value?: CardBrand | null): any;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* PAY.JP Token API
|
|
5
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.1.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @export
|
|
17
|
+
*/
|
|
18
|
+
export const CardBrand = {
|
|
19
|
+
Visa: 'Visa',
|
|
20
|
+
MasterCard: 'MasterCard',
|
|
21
|
+
Jcb: 'JCB',
|
|
22
|
+
AmericanExpress: 'American Express',
|
|
23
|
+
DinersClub: 'Diners Club',
|
|
24
|
+
Discover: 'Discover',
|
|
25
|
+
};
|
|
26
|
+
export function instanceOfCardBrand(value) {
|
|
27
|
+
for (const key in CardBrand) {
|
|
28
|
+
if (Object.prototype.hasOwnProperty.call(CardBrand, key)) {
|
|
29
|
+
if (CardBrand[key] === value) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
export function CardBrandFromJSON(json) {
|
|
37
|
+
return CardBrandFromJSONTyped(json, false);
|
|
38
|
+
}
|
|
39
|
+
export function CardBrandFromJSONTyped(json, ignoreDiscriminator) {
|
|
40
|
+
return json;
|
|
41
|
+
}
|
|
42
|
+
export function CardBrandToJSON(value) {
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/* tslint:disable */
|
|
3
2
|
/* eslint-disable */
|
|
4
3
|
/**
|
|
@@ -12,30 +11,26 @@
|
|
|
12
11
|
* https://openapi-generator.tech
|
|
13
12
|
* Do not edit the class manually.
|
|
14
13
|
*/
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.ErrorResponseToJSON = exports.ErrorResponseFromJSONTyped = exports.ErrorResponseFromJSON = void 0;
|
|
17
14
|
// import { exists, mapValues } from '../runtime';
|
|
18
15
|
function exists(json, key) {
|
|
19
16
|
const value = json[key];
|
|
20
17
|
return value !== null && value !== undefined;
|
|
21
18
|
}
|
|
22
19
|
function mapValues(data, fn) {
|
|
23
|
-
return Object.keys(data).reduce((acc, key) => (
|
|
20
|
+
return Object.keys(data).reduce((acc, key) => ({ ...acc, [key]: fn(data[key]) }), {});
|
|
24
21
|
}
|
|
25
|
-
function ErrorResponseFromJSON(json) {
|
|
22
|
+
export function ErrorResponseFromJSON(json) {
|
|
26
23
|
return ErrorResponseFromJSONTyped(json, false);
|
|
27
24
|
}
|
|
28
|
-
|
|
29
|
-
function ErrorResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
25
|
+
export function ErrorResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
30
26
|
if (json === undefined || json === null) {
|
|
31
27
|
return json;
|
|
32
28
|
}
|
|
33
29
|
return {
|
|
34
|
-
error: json[
|
|
30
|
+
error: json['error'],
|
|
35
31
|
};
|
|
36
32
|
}
|
|
37
|
-
|
|
38
|
-
function ErrorResponseToJSON(value) {
|
|
33
|
+
export function ErrorResponseToJSON(value) {
|
|
39
34
|
if (value === undefined) {
|
|
40
35
|
return undefined;
|
|
41
36
|
}
|
|
@@ -46,5 +41,3 @@ function ErrorResponseToJSON(value) {
|
|
|
46
41
|
error: value.error,
|
|
47
42
|
};
|
|
48
43
|
}
|
|
49
|
-
exports.ErrorResponseToJSON = ErrorResponseToJSON;
|
|
50
|
-
//# sourceMappingURL=ErrorResponse.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/* tslint:disable */
|
|
3
2
|
/* eslint-disable */
|
|
4
3
|
/**
|
|
@@ -12,32 +11,28 @@
|
|
|
12
11
|
* https://openapi-generator.tech
|
|
13
12
|
* Do not edit the class manually.
|
|
14
13
|
*/
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.ModelErrorToJSON = exports.ModelErrorFromJSONTyped = exports.ModelErrorFromJSON = void 0;
|
|
17
14
|
// import { exists, mapValues } from '../runtime';
|
|
18
15
|
function exists(json, key) {
|
|
19
16
|
const value = json[key];
|
|
20
17
|
return value !== null && value !== undefined;
|
|
21
18
|
}
|
|
22
19
|
function mapValues(data, fn) {
|
|
23
|
-
return Object.keys(data).reduce((acc, key) => (
|
|
20
|
+
return Object.keys(data).reduce((acc, key) => ({ ...acc, [key]: fn(data[key]) }), {});
|
|
24
21
|
}
|
|
25
|
-
function ModelErrorFromJSON(json) {
|
|
22
|
+
export function ModelErrorFromJSON(json) {
|
|
26
23
|
return ModelErrorFromJSONTyped(json, false);
|
|
27
24
|
}
|
|
28
|
-
|
|
29
|
-
function ModelErrorFromJSONTyped(json, ignoreDiscriminator) {
|
|
25
|
+
export function ModelErrorFromJSONTyped(json, ignoreDiscriminator) {
|
|
30
26
|
if (json === undefined || json === null) {
|
|
31
27
|
return json;
|
|
32
28
|
}
|
|
33
29
|
return {
|
|
34
|
-
code: !exists(json,
|
|
35
|
-
message: json[
|
|
36
|
-
type: json[
|
|
30
|
+
code: !exists(json, 'code') ? undefined : json['code'],
|
|
31
|
+
message: json['message'],
|
|
32
|
+
type: json['type'],
|
|
37
33
|
};
|
|
38
34
|
}
|
|
39
|
-
|
|
40
|
-
function ModelErrorToJSON(value) {
|
|
35
|
+
export function ModelErrorToJSON(value) {
|
|
41
36
|
if (value === undefined) {
|
|
42
37
|
return undefined;
|
|
43
38
|
}
|
|
@@ -50,5 +45,3 @@ function ModelErrorToJSON(value) {
|
|
|
50
45
|
type: value.type,
|
|
51
46
|
};
|
|
52
47
|
}
|
|
53
|
-
exports.ModelErrorToJSON = ModelErrorToJSON;
|
|
54
|
-
//# sourceMappingURL=ModelError.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/* tslint:disable */
|
|
3
2
|
/* eslint-disable */
|
|
4
3
|
/**
|
|
@@ -12,36 +11,32 @@
|
|
|
12
11
|
* https://openapi-generator.tech
|
|
13
12
|
* Do not edit the class manually.
|
|
14
13
|
*/
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.TokenToJSON = exports.TokenFromJSONTyped = exports.TokenFromJSON = void 0;
|
|
17
14
|
// import { exists, mapValues } from '../runtime';
|
|
18
15
|
function exists(json, key) {
|
|
19
16
|
const value = json[key];
|
|
20
17
|
return value !== null && value !== undefined;
|
|
21
18
|
}
|
|
22
19
|
function mapValues(data, fn) {
|
|
23
|
-
return Object.keys(data).reduce((acc, key) => (
|
|
20
|
+
return Object.keys(data).reduce((acc, key) => ({ ...acc, [key]: fn(data[key]) }), {});
|
|
24
21
|
}
|
|
25
|
-
|
|
26
|
-
function TokenFromJSON(json) {
|
|
22
|
+
import { CardFromJSON, CardToJSON } from './';
|
|
23
|
+
export function TokenFromJSON(json) {
|
|
27
24
|
return TokenFromJSONTyped(json, false);
|
|
28
25
|
}
|
|
29
|
-
|
|
30
|
-
function TokenFromJSONTyped(json, ignoreDiscriminator) {
|
|
26
|
+
export function TokenFromJSONTyped(json, ignoreDiscriminator) {
|
|
31
27
|
if (json === undefined || json === null) {
|
|
32
28
|
return json;
|
|
33
29
|
}
|
|
34
30
|
return {
|
|
35
|
-
id: json[
|
|
36
|
-
card:
|
|
37
|
-
created: json[
|
|
38
|
-
livemode: json[
|
|
39
|
-
object: json[
|
|
40
|
-
used: json[
|
|
31
|
+
id: json['id'],
|
|
32
|
+
card: CardFromJSON(json['card']),
|
|
33
|
+
created: json['created'],
|
|
34
|
+
livemode: json['livemode'],
|
|
35
|
+
object: json['object'],
|
|
36
|
+
used: json['used'],
|
|
41
37
|
};
|
|
42
38
|
}
|
|
43
|
-
|
|
44
|
-
function TokenToJSON(value) {
|
|
39
|
+
export function TokenToJSON(value) {
|
|
45
40
|
if (value === undefined) {
|
|
46
41
|
return undefined;
|
|
47
42
|
}
|
|
@@ -50,12 +45,10 @@ function TokenToJSON(value) {
|
|
|
50
45
|
}
|
|
51
46
|
return {
|
|
52
47
|
id: value.id,
|
|
53
|
-
card:
|
|
48
|
+
card: CardToJSON(value.card),
|
|
54
49
|
created: value.created,
|
|
55
50
|
livemode: value.livemode,
|
|
56
51
|
object: value.object,
|
|
57
52
|
used: value.used,
|
|
58
53
|
};
|
|
59
54
|
}
|
|
60
|
-
exports.TokenToJSON = TokenToJSON;
|
|
61
|
-
//# sourceMappingURL=Token.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payjp-react-native",
|
|
3
3
|
"description": "A React Native plugin for PAY.JP SDK",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "PAY.JP",
|
|
7
7
|
"email": "support@pay.jp",
|
|
@@ -27,35 +27,37 @@
|
|
|
27
27
|
]
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@babel/core": "^7.
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"prettier": "^2.
|
|
46
|
-
"react": "
|
|
47
|
-
"react-native": "0.
|
|
48
|
-
"react-test-renderer": "
|
|
49
|
-
"rimraf": "^
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"typescript": "^3.8.3"
|
|
30
|
+
"@babel/core": "^7.20.0",
|
|
31
|
+
"@babel/preset-env": "^7.20.0",
|
|
32
|
+
"@babel/runtime": "^7.20.0",
|
|
33
|
+
"@react-native/babel-preset": "0.74.87",
|
|
34
|
+
"@react-native/eslint-config": "0.74.87",
|
|
35
|
+
"@react-native/metro-config": "0.74.87",
|
|
36
|
+
"@react-native/typescript-config": "0.74.87",
|
|
37
|
+
"@types/jest": "^29.5.12",
|
|
38
|
+
"@types/react": "~18.2.45",
|
|
39
|
+
"@types/react-test-renderer": "^18.0.7",
|
|
40
|
+
"babel-jest": "^29.6.3",
|
|
41
|
+
"eslint": "^8.19.0",
|
|
42
|
+
"husky": "^9.1.5",
|
|
43
|
+
"jest": "^29.6.3",
|
|
44
|
+
"lint-staged": "^15.2.9",
|
|
45
|
+
"prettier": "^2.8.8",
|
|
46
|
+
"react": "18.2.0",
|
|
47
|
+
"react-native": "0.74.5",
|
|
48
|
+
"react-test-renderer": "18.2.0",
|
|
49
|
+
"rimraf": "^6.0.1",
|
|
50
|
+
"typedoc": "^0.26.6",
|
|
51
|
+
"typescript": "~5.6.2"
|
|
53
52
|
},
|
|
54
53
|
"directories": {
|
|
55
54
|
"test": "test"
|
|
56
55
|
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=18"
|
|
58
|
+
},
|
|
57
59
|
"files": [
|
|
58
|
-
"lib
|
|
60
|
+
"lib",
|
|
59
61
|
"src",
|
|
60
62
|
"android",
|
|
61
63
|
"ios",
|
|
@@ -69,34 +71,13 @@
|
|
|
69
71
|
"pre-commit": "lint-staged"
|
|
70
72
|
}
|
|
71
73
|
},
|
|
72
|
-
"jest": {
|
|
73
|
-
"preset": "react-native",
|
|
74
|
-
"transform": {
|
|
75
|
-
"^.+\\.ts$": "ts-jest",
|
|
76
|
-
"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
|
|
77
|
-
},
|
|
78
|
-
"testPathIgnorePatterns": [
|
|
79
|
-
"<rootDir>/lib/",
|
|
80
|
-
"<rootDir>/node_modules/",
|
|
81
|
-
"<rootDir>/example/"
|
|
82
|
-
],
|
|
83
|
-
"globals": {
|
|
84
|
-
"ts-jest": {
|
|
85
|
-
"babelConfig": true,
|
|
86
|
-
"tsConfig": "tsconfig.json"
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
"testMatch": [
|
|
90
|
-
"**/test/**/*.test.ts"
|
|
91
|
-
]
|
|
92
|
-
},
|
|
93
74
|
"keywords": [
|
|
94
75
|
"PAY.JP",
|
|
95
76
|
"payment processing",
|
|
96
77
|
"react native"
|
|
97
78
|
],
|
|
98
79
|
"license": "MIT",
|
|
99
|
-
"main": "lib/
|
|
80
|
+
"main": "lib/index.js",
|
|
100
81
|
"peerDependencies": {
|
|
101
82
|
"react": ">= 16.8.6",
|
|
102
83
|
"react-native": ">= 0.60.0"
|
|
@@ -105,19 +86,15 @@
|
|
|
105
86
|
"type": "git",
|
|
106
87
|
"url": "git+https://github.com/payjp/payjp-react-native-plugin.git"
|
|
107
88
|
},
|
|
108
|
-
"resolutions": {
|
|
109
|
-
"minimist": ">= 0.2.1",
|
|
110
|
-
"node-fetch": "^2.6.1",
|
|
111
|
-
"@hapi/hoek": "^8.5.1"
|
|
112
|
-
},
|
|
113
89
|
"scripts": {
|
|
114
90
|
"build": "tsc -p .",
|
|
115
91
|
"clean": "rimraf lib/",
|
|
116
92
|
"dev-sync": "npm run build && cp -r *podspec lib android ios example/node_modules/payjp-react-native/",
|
|
117
93
|
"docs": "typedoc --out docs src/",
|
|
118
94
|
"lint": "eslint --cache \"{src,test}/**/*.{ts,tsx}\"",
|
|
95
|
+
"lint-staged": "lint-staged",
|
|
119
96
|
"lint:fix": "eslint --fix --cache \"{src,test}/**/*.{ts,tsx}\"",
|
|
120
|
-
"prepare": "
|
|
97
|
+
"prepare": "husky",
|
|
121
98
|
"prepublishOnly": "npm run clean && npm run build",
|
|
122
99
|
"prettier": "prettier --write '**/*.{js,jsx,ts,tsx}'",
|
|
123
100
|
"preversion": "npm test",
|
|
@@ -125,5 +102,5 @@
|
|
|
125
102
|
"version": "scripts/sync_version_ios.sh && npm run docs && touch docs/.nojekyll && git add .",
|
|
126
103
|
"watch": "tsc -p . --watch"
|
|
127
104
|
},
|
|
128
|
-
"types": "lib/
|
|
105
|
+
"types": "lib/index.d.ts"
|
|
129
106
|
}
|
|
@@ -19,7 +19,9 @@ Pod::Spec.new do |s|
|
|
|
19
19
|
|
|
20
20
|
s.dependency "React-Core"
|
|
21
21
|
s.dependency 'PAYJP', "~> #{payjp_sdk['ios']}"
|
|
22
|
-
|
|
22
|
+
# NOTE: If you need to scan card in your card form, please add the following dependency to your Podfile directly.
|
|
23
|
+
# as default, we don't include this dependency because it causes a issue in arm64 simulator build.
|
|
24
|
+
# s.dependency 'CardIO', '~> 5.4.1'
|
|
23
25
|
s.dependency 'GoogleUtilities/AppDelegateSwizzler', '~> 7.2'
|
|
24
26
|
|
|
25
27
|
end
|
package/sdkconfig.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"ios": "1.
|
|
3
|
-
"android": "1.
|
|
4
|
-
}
|
|
2
|
+
"ios": "2.1.0",
|
|
3
|
+
"android": "2.1.0"
|
|
4
|
+
}
|
package/src/ApplePay.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// LICENSE : MIT
|
|
2
|
-
import { NativeModules, NativeEventEmitter } from
|
|
3
|
-
import { Token } from
|
|
2
|
+
import { NativeModules, NativeEventEmitter } from 'react-native';
|
|
3
|
+
import { Token } from './models';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* エラー情報
|
|
@@ -130,14 +130,14 @@ export const onApplePayUpdate = (observer: {
|
|
|
130
130
|
};
|
|
131
131
|
|
|
132
132
|
const connectApplePayEvent = (): (() => void) => {
|
|
133
|
-
const onApplePayProducedToken = applePayEventEmitter.addListener(
|
|
134
|
-
onApplePayProducedTokenSet.forEach(
|
|
133
|
+
const onApplePayProducedToken = applePayEventEmitter.addListener('onApplePayProducedToken', token => {
|
|
134
|
+
onApplePayProducedTokenSet.forEach(observer => observer(token));
|
|
135
135
|
});
|
|
136
|
-
const onApplePayFailedRequestToken = applePayEventEmitter.addListener(
|
|
137
|
-
onApplePayFailedRequestTokenSet.forEach(
|
|
136
|
+
const onApplePayFailedRequestToken = applePayEventEmitter.addListener('onApplePayFailedRequestToken', error => {
|
|
137
|
+
onApplePayFailedRequestTokenSet.forEach(observer => observer(error));
|
|
138
138
|
});
|
|
139
|
-
const onApplePayCompleted = applePayEventEmitter.addListener(
|
|
140
|
-
onApplePayCompletedSet.forEach(
|
|
139
|
+
const onApplePayCompleted = applePayEventEmitter.addListener('onApplePayCompleted', () => {
|
|
140
|
+
onApplePayCompletedSet.forEach(observer => observer());
|
|
141
141
|
});
|
|
142
142
|
return (): void => {
|
|
143
143
|
onApplePayProducedToken.remove();
|
package/src/CardForm.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// LICENSE : MIT
|
|
2
|
-
import { NativeModules, NativeEventEmitter, ColorValue, processColor, ProcessedColorValue } from
|
|
3
|
-
import { Token } from
|
|
2
|
+
import { NativeModules, NativeEventEmitter, ColorValue, processColor, ProcessedColorValue } from 'react-native';
|
|
3
|
+
import { Token } from './models';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* カードフォームがキャンセルされたときに実行されるリスナー
|
|
@@ -35,8 +35,14 @@ export type IOSCardFormStyle = {
|
|
|
35
35
|
/**
|
|
36
36
|
* カードフォームの表示タイプ
|
|
37
37
|
*/
|
|
38
|
-
export type CardFormType =
|
|
38
|
+
export type CardFormType = 'multiLine' | 'cardDisplay';
|
|
39
39
|
|
|
40
|
+
type ExtraAttributeEmail = { type: 'email'; preset?: string };
|
|
41
|
+
type ExtraAttributePhone = { type: 'phone'; presetRegion?: string; presetNumber?: string };
|
|
42
|
+
/**
|
|
43
|
+
* カードフォームの追加属性
|
|
44
|
+
*/
|
|
45
|
+
export type ExtraAttribute = ExtraAttributeEmail | ExtraAttributePhone;
|
|
40
46
|
/**
|
|
41
47
|
* カードフォームのオプション
|
|
42
48
|
*/
|
|
@@ -49,6 +55,18 @@ type CardFormOption = {
|
|
|
49
55
|
* カードフォームの表示タイプ(デフォルトはmultiLine)
|
|
50
56
|
*/
|
|
51
57
|
cardFormType?: CardFormType;
|
|
58
|
+
/**
|
|
59
|
+
* カードフォームに追加の属性項目を設定できます。デフォルトはメールアドレスと電話番号が表示されます。
|
|
60
|
+
* 入力した内容はカードオブジェクトにセットされ、 3Dセキュア認証実施時に送信されます。
|
|
61
|
+
*
|
|
62
|
+
* 3Dセキュア認証実施時の連携項目追加については以下のドキュメントを参照してください。
|
|
63
|
+
* https://help.pay.jp/ja/articles/9556161
|
|
64
|
+
*/
|
|
65
|
+
extraAttributes?: ExtraAttribute[];
|
|
66
|
+
/**
|
|
67
|
+
* 3-D セキュア認証の実施可否を設定します。デフォルトはfalseです。
|
|
68
|
+
*/
|
|
69
|
+
useThreeDSecure?: boolean;
|
|
52
70
|
};
|
|
53
71
|
|
|
54
72
|
const { RNPAYCardForm } = NativeModules;
|
|
@@ -64,7 +82,19 @@ const onCardFormProducedTokenSet: Set<OnCardFormProducedToken> = new Set();
|
|
|
64
82
|
* @param options カードフォームのオプション
|
|
65
83
|
*/
|
|
66
84
|
export const startCardForm = async (options?: CardFormOption): Promise<void> => {
|
|
67
|
-
|
|
85
|
+
const extraAttributes = options?.extraAttributes ?? [{ type: 'email' }, { type: 'phone' }];
|
|
86
|
+
const extraAttributeEmail = extraAttributes.find(attribute => attribute.type === 'email') as ExtraAttributeEmail;
|
|
87
|
+
const extraAttributePhone = extraAttributes.find(attribute => attribute.type === 'phone') as ExtraAttributePhone;
|
|
88
|
+
await RNPAYCardForm.startCardForm(
|
|
89
|
+
options?.tenantId,
|
|
90
|
+
options?.cardFormType,
|
|
91
|
+
!!extraAttributeEmail,
|
|
92
|
+
!!extraAttributePhone,
|
|
93
|
+
extraAttributeEmail?.preset,
|
|
94
|
+
extraAttributePhone?.presetRegion,
|
|
95
|
+
extraAttributePhone?.presetNumber,
|
|
96
|
+
options?.useThreeDSecure ?? false,
|
|
97
|
+
);
|
|
68
98
|
};
|
|
69
99
|
|
|
70
100
|
/**
|
|
@@ -137,14 +167,14 @@ export const onCardFormUpdate = (observer: {
|
|
|
137
167
|
};
|
|
138
168
|
|
|
139
169
|
const connectCardForm = (): (() => void) => {
|
|
140
|
-
const onCardFormCanceled = cardFormEventEmitter.addListener(
|
|
141
|
-
onCardFormCanceledSet.forEach(
|
|
170
|
+
const onCardFormCanceled = cardFormEventEmitter.addListener('onCardFormCanceled', () => {
|
|
171
|
+
onCardFormCanceledSet.forEach(observer => observer());
|
|
142
172
|
});
|
|
143
|
-
const onCardFormCompleted = cardFormEventEmitter.addListener(
|
|
144
|
-
onCardFormCompletedSet.forEach(
|
|
173
|
+
const onCardFormCompleted = cardFormEventEmitter.addListener('onCardFormCompleted', () => {
|
|
174
|
+
onCardFormCompletedSet.forEach(observer => observer());
|
|
145
175
|
});
|
|
146
|
-
const onCardFormProducedToken = cardFormEventEmitter.addListener(
|
|
147
|
-
onCardFormProducedTokenSet.forEach(
|
|
176
|
+
const onCardFormProducedToken = cardFormEventEmitter.addListener('onCardFormProducedToken', token => {
|
|
177
|
+
onCardFormProducedTokenSet.forEach(observer => observer(token));
|
|
148
178
|
});
|
|
149
179
|
return (): void => {
|
|
150
180
|
onCardFormCanceled.remove();
|
package/src/Core.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// LICENSE : MIT
|
|
2
|
-
import * as PayjpApplePay from
|
|
3
|
-
import * as PayjpCardForm from
|
|
4
|
-
import * as PayjpCore from
|
|
2
|
+
import * as PayjpApplePay from './ApplePay';
|
|
3
|
+
import * as PayjpCardForm from './CardForm';
|
|
4
|
+
import * as PayjpCore from './Core';
|
|
5
5
|
|
|
6
6
|
export { PayjpCore, PayjpCardForm, PayjpApplePay };
|
|
7
|
-
export * from
|
|
7
|
+
export * from './models';
|
package/src/models/Card.ts
CHANGED
|
@@ -23,7 +23,7 @@ function mapValues(data: any, fn: (item: any) => any) {
|
|
|
23
23
|
return Object.keys(data).reduce((acc, key) => ({ ...acc, [key]: fn(data[key]) }), {});
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
import { CardBrand, CardBrandFromJSON, CardBrandFromJSONTyped, CardBrandToJSON } from
|
|
26
|
+
import { CardBrand, CardBrandFromJSON, CardBrandFromJSONTyped, CardBrandToJSON } from './';
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
*
|
|
@@ -97,6 +97,18 @@ export interface Card {
|
|
|
97
97
|
* @memberof Card
|
|
98
98
|
*/
|
|
99
99
|
fingerprint?: string;
|
|
100
|
+
/**
|
|
101
|
+
* メールアドレス 2024年8月以降、3Dセキュア認証の際にphoneまたはemailのデータ入力が求められます。
|
|
102
|
+
* @type {string}
|
|
103
|
+
* @memberof Card
|
|
104
|
+
*/
|
|
105
|
+
email?: string | null;
|
|
106
|
+
/**
|
|
107
|
+
* E.164形式の電話番号 (e.g. 090-0123-4567(日本) => \"+819001234567\") 2024年8月以降、3Dセキュア認証の際にphoneまたはemailのデータ入力が求められます。
|
|
108
|
+
* @type {string}
|
|
109
|
+
* @memberof Card
|
|
110
|
+
*/
|
|
111
|
+
phone?: string | null;
|
|
100
112
|
/**
|
|
101
113
|
* 都道府県
|
|
102
114
|
* @type {string}
|
|
@@ -162,26 +174,28 @@ export function CardFromJSONTyped(json: any, ignoreDiscriminator: boolean): Card
|
|
|
162
174
|
return json;
|
|
163
175
|
}
|
|
164
176
|
return {
|
|
165
|
-
id: json[
|
|
166
|
-
object: !exists(json,
|
|
167
|
-
created: !exists(json,
|
|
168
|
-
name: !exists(json,
|
|
169
|
-
last4: !exists(json,
|
|
170
|
-
expMonth: !exists(json,
|
|
171
|
-
expYear: !exists(json,
|
|
172
|
-
brand: !exists(json,
|
|
173
|
-
cvcCheck: !exists(json,
|
|
174
|
-
threeDSecureStatus: !exists(json,
|
|
175
|
-
fingerprint: !exists(json,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
177
|
+
id: json['id'],
|
|
178
|
+
object: !exists(json, 'object') ? undefined : json['object'],
|
|
179
|
+
created: !exists(json, 'created') ? undefined : json['created'],
|
|
180
|
+
name: !exists(json, 'name') ? undefined : json['name'],
|
|
181
|
+
last4: !exists(json, 'last4') ? undefined : json['last4'],
|
|
182
|
+
expMonth: !exists(json, 'exp_month') ? undefined : json['exp_month'],
|
|
183
|
+
expYear: !exists(json, 'exp_year') ? undefined : json['exp_year'],
|
|
184
|
+
brand: !exists(json, 'brand') ? undefined : CardBrandFromJSON(json['brand']),
|
|
185
|
+
cvcCheck: !exists(json, 'cvc_check') ? undefined : json['cvc_check'],
|
|
186
|
+
threeDSecureStatus: !exists(json, 'three_d_secure_status') ? undefined : json['three_d_secure_status'],
|
|
187
|
+
fingerprint: !exists(json, 'fingerprint') ? undefined : json['fingerprint'],
|
|
188
|
+
email: !exists(json, 'email') ? undefined : json['email'],
|
|
189
|
+
phone: !exists(json, 'phone') ? undefined : json['phone'],
|
|
190
|
+
addressState: !exists(json, 'address_state') ? undefined : json['address_state'],
|
|
191
|
+
addressCity: !exists(json, 'address_city') ? undefined : json['address_city'],
|
|
192
|
+
addressLine1: !exists(json, 'address_line1') ? undefined : json['address_line1'],
|
|
193
|
+
addressLine2: !exists(json, 'address_line2') ? undefined : json['address_line2'],
|
|
194
|
+
country: !exists(json, 'country') ? undefined : json['country'],
|
|
195
|
+
addressZip: !exists(json, 'address_zip') ? undefined : json['address_zip'],
|
|
196
|
+
addressZipCheck: !exists(json, 'address_zip_check') ? undefined : json['address_zip_check'],
|
|
197
|
+
customer: !exists(json, 'customer') ? undefined : json['customer'],
|
|
198
|
+
metadata: !exists(json, 'metadata') ? undefined : json['metadata'],
|
|
185
199
|
};
|
|
186
200
|
}
|
|
187
201
|
|
|
@@ -204,6 +218,8 @@ export function CardToJSON(value?: Card | null): any {
|
|
|
204
218
|
cvc_check: value.cvcCheck,
|
|
205
219
|
three_d_secure_status: value.threeDSecureStatus,
|
|
206
220
|
fingerprint: value.fingerprint,
|
|
221
|
+
email: value.email,
|
|
222
|
+
phone: value.phone,
|
|
207
223
|
address_state: value.addressState,
|
|
208
224
|
address_city: value.addressCity,
|
|
209
225
|
address_line1: value.addressLine1,
|