UNPKG

2.93 kBMarkdownView Raw
1# GMO Client Library for Node.js
2
3[![npm (scoped)](https://img.shields.io/npm/v/@motionpicture/gmo-service.svg)](https://www.npmjs.com/package/@motionpicture/gmo-service)
4[![CircleCI](https://circleci.com/gh/motionpicture/gmo-service.svg?style=shield)](https://circleci.com/gh/motionpicture/gmo-service)
5[![Coverage Status](https://coveralls.io/repos/github/motionpicture/gmo-service/badge.svg)](https://coveralls.io/github/motionpicture/gmo-service)
6[![Dependency Status](https://img.shields.io/david/motionpicture/gmo-service.svg)](https://david-dm.org/motionpicture/gmo-service)
7[![Known Vulnerabilities](https://snyk.io/test/github/motionpicture/gmo-service/badge.svg)](https://snyk.io/test/github/motionpicture/gmo-service)
8[![npm](https://img.shields.io/npm/dm/@motionpicture/gmo-service.svg)](https://nodei.co/npm/@motionpicture/gmo-service/)
9
10node.jsでGMOサービスを使うためのパッケージです。
11
12
13## Table of contents
14
15* [Usage](#usage)
16* [Example](#code-samples)
17* [Jsdoc](#jsdoc)
18* [License](#license)
19
20
21## Usage
22
23```sh
24npm install @motionpicture/gmo-service
25```
26
27```js
28var GMO = require('@motionpicture/gmo-service');
29```
30
31When using the GMO Service SDK, you must provide connection information. This can be provided using:
32
33### set environment variables - For example,
34```shell
35set GMO_ENDPOINT=*****
36```
37
38for test
39```shell
40set TEST_GMO_SHOP_ID=*****
41set TEST_GMO_SHOP_PASS=*****
42set TEST_GMO_SITE_ID=*****
43set TEST_GMO_SITE_PASS=*****
44```
45
46### Debug
47
48DEBUG環境変数をセットすることでリクエストのIN,OUTをデバッグできます。
49
50```shell
51set DEBUG=gmo-service:*
52```
53
54### クレジットカード決済(即時売上)の例
55
56```js
57const GMO = require('@motionpicture/gmo-service');
58
59const orderId ='orderId';
60GMO.services.credit.entryTran({
61 shopId: 'your shopId',
62 shopPass: 'sour shopPass',
63 orderId: orderId,
64 jobCd: GMO.utils.util.JobCd.Auth,
65 amount: 1234
66}).then((entryTranResult) => {
67 GMO.services.credit.execTran({
68 accessId: entryTranResult.accessId,
69 accessPass: entryTranResult.accessPass,
70 orderId: orderId,
71 method: GMO.utils.util.Method.Lump,
72 cardNo: '1234123412341234',
73 expire: '2024',
74 securityCode: '123'
75 }).then((execTranResult) => {
76 console.log(execTranResult);
77
78 GMO.services.credit.alterTran({
79 shopId: 'your shopId',
80 shopPass: 'sour shopPass',
81 accessId: entryTranResult.accessId,
82 accessPass: entryTranResult.accessPass,
83 jobCd: GMO.utils.util.JobCd.Sales,
84 amount: amount
85 }).then((result) => {
86 console.log(result);
87 });
88 });
89});
90```
91
92## Code Samples
93
94コードサンプルは [example](https://github.com/motionpicture/gmo-service/tree/master/example) にあります。
95
96
97## Jsdoc
98
99`npm run doc`でjsdocを作成できます。./docに出力されます。
100
101## License
102
103ISC