Skip to content

Commit

Permalink
certifications, vbank api feature add
Browse files Browse the repository at this point in the history
  • Loading branch information
seungjae-lee committed Dec 3, 2016
1 parent 868ab59 commit f253a62
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 14 deletions.
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ iamport.payment.getByStatus({

## Available resources & methods
*Where you see `params` it is a plain JavaScript object*
- certification
* [`get(params)`](https://api.iamport.kr/#!/certifications/getCertification)
* [`delete(params)`](https://api.iamport.kr/#!/certifications/deleteCertification)
- payment
* [`getByImpUid(params)`](https://api.iamport.kr/#!/payments/getPaymentByImpUid)
* [`getByMerchant(params)`](https://api.iamport.kr/#!/payments/getPaymentByMerchantUid)
Expand All @@ -57,14 +60,16 @@ iamport.payment.getByStatus({
* [`prepare(params)`](https://api.iamport.kr/#!/payments.validation/preparePayment)
* [`getPrepare(params)`](https://api.iamport.kr/#!/payments.validation/getPaymentPrepareByMerchantUid)
- subscribe
* [`onetime(params)`](https://api.iamport.kr/#!/subscribe/onetime)
* [`again(params)`](https://api.iamport.kr/#!/subscribe/again)
* [`schedule(params)`](https://api.iamport.kr/#!/subscribe/schedule)
* [`unschedule(params)`](https://api.iamport.kr/#!/subscribe/unschedule)
* [`onetime(params)`](https://api.iamport.kr/#!/subscribe/payments/onetime)
* [`again(params)`](https://api.iamport.kr/#!/subscribe/payments/again)
* [`schedule(params)`](https://api.iamport.kr/#!/subscribe/payments/schedule)
* [`unschedule(params)`](https://api.iamport.kr/#!/subscribe/payments/unschedule)
- subscribe_customer
* [`getCustomers(params)`](https://api.iamport.kr/#!/subscribe.customer/customer_view)
* [`createCustomers(params)`](https://api.iamport.kr/#!/subscribe.customer/customer_save)
* [`deleteCustomers(params)`](https://api.iamport.kr/#!/subscribe.customer/customer_delete)
* [`get(params)`](https://api.iamport.kr/#!/subscribe.customer/customer_view)
* [`create(params)`](https://api.iamport.kr/#!/subscribe.customer/customer_save)
* [`delete(params)`](https://api.iamport.kr/#!/subscribe.customer/customer_delete)
- vbank
* [`create(params)`](https://api.iamport.kr/#!/vbanks)

## Contribution
- 이 프로젝트는 누구나 참여 가능합니다.
Expand Down
4 changes: 3 additions & 1 deletion lib/iamport.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ Iamport.DEFAULT_SECRET = 'ekKoeW8RyKuT0zgaZsUtXXTLQ4AhPFW3ZGseDA6bkA5lamv9OqDMnx
var resources = {
Payment : require('./resources/Payments'),
Subscribe : require('./resources/Subscribe'),
Subscribe_customer: require('./resources/Subscribe_customer')
Subscribe_customer: require('./resources/Subscribe_customer'),
Certification: require('./resources/Certifications'),
Vbank : require('./resources/Vbank')
};

Iamport.resources = resources;
Expand Down
48 changes: 48 additions & 0 deletions lib/resources/Certifications.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*!
* iamport
* MIT Licensed
*/

'use strict';

var resource = require('../resource'),
iamportMethod = resource.iamportMethod;

/**
* Module exports.
* @public
*/
module.exports = resource.extend({

path: 'certifications',

/** method 생성
* SMS본인인증 결과정보를 아임포트에서 완전히 삭제하고 싶을 때 요청합니다.
* @see {@link https://api.iamport.kr/#!/certifications/deleteCertification}
*
* @returns {promise} json 결제 정보
* @public
*/
delete: iamportMethod({
method: 'DELETE',
command: null ,
urlParam: 'imp_uid'
}),


/** method 생성
* SMS본인인증된 결과를 조회할 때 사용합니다.
*
* @see {@link https://api.iamport.kr/#!/certifications/getCertification}
*
* @param {Object}
* @returns {promise}
* @public
*/
get: iamportMethod({
method: 'GET',
command: null,
urlParam: 'imp_uid'
})

});
8 changes: 4 additions & 4 deletions lib/resources/Subscribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = resource.extend({

/** method 생성
* 비인증 결제요청
* @see {@link https://api.iamport.kr/#!/subscribe/onetime}
* @see {@link https://api.iamport.kr/#!/subscribe/payments/onetime}
*
* @returns {promise} json 결제 정보
* @public
Expand All @@ -32,7 +32,7 @@ module.exports = resource.extend({

/** method 생성
* 비인증 결제요청
* @see {@link https://api.iamport.kr/#!/subscribe/again}
* @see {@link https://api.iamport.kr/#!/subscribe/payments/again}
*
* @returns {promise} json 결제 정보
* @public
Expand All @@ -46,7 +46,7 @@ module.exports = resource.extend({

/** method 생성
* 비인증 결제요청예약
* @see {@link https://api.iamport.kr/#!/subscribe/schedule}
* @see {@link https://api.iamport.kr/#!/subscribe/payments/schedule}
*
* @returns {promise} json 결제 정보
* @public
Expand All @@ -60,7 +60,7 @@ module.exports = resource.extend({

/** method 생성
* 비인증 결제요청예약 취소
* @see {@link https://api.iamport.kr/#!/subscribe/unschedule}
* @see {@link https://api.iamport.kr/#!/subscribe/payments/unschedule}
*
* @returns {promise} json 결제 정보
* @public
Expand Down
20 changes: 20 additions & 0 deletions lib/resources/Subscribe_customer.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ module.exports = resource.extend({
* @returns {promise} json 결제 정보
* @public
*/

get: iamportMethod({
method: 'GET',
command: 'customers',
urlParam: 'customer_uid'
}),
// legacy
getCustomers: iamportMethod({
method: 'GET',
command: 'customers',
Expand All @@ -36,6 +43,13 @@ module.exports = resource.extend({
* @returns {promise} json 결제 정보
* @public
*/
create: iamportMethod({
method: 'POST',
command: 'customers',
urlParam: 'customer_uid',
require: ['card_number','expiry','birth','pwd_2digit']
}),
// legacy
createCustomers: iamportMethod({
method: 'POST',
command: 'customers',
Expand All @@ -50,6 +64,12 @@ module.exports = resource.extend({
* @returns {promise} json 결제 정보
* @public
*/
delete: iamportMethod({
method: 'DELETE',
command: 'customers',
urlParam: 'customer_uid'
}),
// legacy
deleteCustomers: iamportMethod({
method: 'DELETE',
command: 'customers',
Expand Down
33 changes: 33 additions & 0 deletions lib/resources/Vbank.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*!
* iamport
* MIT Licensed
*/

'use strict';

var resource = require('../resource'),
iamportMethod = resource.iamportMethod;

/**
* Module exports.
* @public
*/
module.exports = resource.extend({

path: 'vbanks',

/** method 생성
* 희망하시는 은행, 예금주명으로 입금이 가능한 가상계좌를 생성할 수 있습니다.
* @see {@link https://api.iamport.kr/#!/vbanks/createVbank}
*
* @returns {promise} json 결제 정보
* @public
*/
create: iamportMethod({
method: 'POST',
command: null ,
urlParam: null,
require: ['merchant_uid','amount','vbank_code','vbank_due','vbank_holder']
})

});
4 changes: 2 additions & 2 deletions test/resources/Subscribe.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
var iamport = new require('../../lib/iamport')()
, expect = require('chai').expect;

describe('subscribe.createCustomers', function(){
describe('subscribe_customer.create', function(){
it('create customer param check', function(done){
iamport.subscribe_customer.createCustomers()
iamport.subscribe_customer.create()
.then(function(result){
expect(result).to.be.empty;
done();
Expand Down

0 comments on commit f253a62

Please sign in to comment.