Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscotfmc committed May 21, 2015
1 parent d225d3a commit e395041
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 34 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# 0.0.8

- Updated: docs
- Updated: getPaymentMethods endpoint now is getPaymentData

# 0.0.7

- Updated: node modules dependencies

# 0.0.6

- Fixed: nock net connection issues
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,14 @@ $ npm test
```

## Additional docs

- [Creating charges with shippings](https://github.com/franciscotfmc/gn-api-sdk-node/tree/master/docs/charge-with-shippings.md)
- [Creating charges associated to customers](https://github.com/franciscotfmc/gn-api-sdk-node/tree/master/docs/charge-with-customer.md)
- [Creating charges with marketplace](https://github.com/franciscotfmc/gn-api-sdk-node/tree/master/docs/charge-with-marketplace.md)
- [Associating customers to charges subsequently](https://github.com/franciscotfmc/gn-api-sdk-node/tree/master/docs/associate-customer.md)
- [Subscriptions](https://github.com/franciscotfmc/gn-api-sdk-node/tree/master/docs/subscriptions.md)
- [Detailing charges and subscriptions](https://github.com/franciscotfmc/gn-api-sdk-node/tree/master/docs/detailing.md)
- [Listing installments in advance](https://github.com/franciscotfmc/gn-api-sdk-node/tree/master/docs/payment-methods.md)
- [Listing installments in advance](https://github.com/franciscotfmc/gn-api-sdk-node/tree/master/docs/payment-data.md)
- [Paying a charge](https://github.com/franciscotfmc/gn-api-sdk-node/tree/master/docs/payments.md)
- [Notifications](https://github.com/franciscotfmc/gn-api-sdk-node/tree/master/docs/notifications.md)
- [All in one](https://github.com/franciscotfmc/gn-api-sdk-node/tree/master/docs/all-in-one.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/all-in-one.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var paymentInput = {
charge_id: 223,
payment: {
credit_card: {
parcels: 1,
installments: 1,
payment_token: 'fec500b1f3eb16615ca61f7c4781f51dcde49131',
billing_address: {
street: 'Street 3',
Expand Down
2 changes: 1 addition & 1 deletion docs/charge-with-marketplace.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ gerencianet
.catch(console.log);
```

The attribute `payee_code` identifies a Gerencianet account, just like in [creating charges with shippings](https://github.com/franciscotfmc/gn-api-sdk-node/tree/master/docs/charge-with-shippings.md). In order to get someone else's `payee_code` you need to ask the account owner. There is no other way. To visualize yours, log in your Gerencianet account and search for *account code* under *Dados Cadastrais*.
The attribute `payee_code` identifies a Gerencianet account, just like in [creating charges with shippings](https://github.com/franciscotfmc/gn-api-sdk-node/tree/master/docs/charge-with-shippings.md). In order to get someone else's `payee_code` you need to ask the account owner. There is no other way. To visualize yours, log in your Gerencianet account and search for *Identificador de Conta* under *Dados Cadastrais*.

In the example above, there are two repasses, both of 25%, but each one for a different account, whereas the `payee_code` differs. The integrator account will receive, at the end, 50% of the total value. Disregarding the rates, the integrator account would receive R$5,00. The other two accounts would receive R$ 2,50 each.

Expand Down
9 changes: 2 additions & 7 deletions docs/examples/allInOne.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,12 @@ var customerInput = {
phone_number: '5044916523'
}

var paymentMethodInput = {
method: 'visa',
total: 5000
}

var paymentInput = {
charge_id: 223,
payment: {
credit_card: {
parcels: 1,
payment_token: 'fec500b1f3eb16615ca61f7c4781f51dcde49131',
installments: 1,
payment_token: '71d0821e79e5d54e17472a9ef1dce3d0a715a39d',
billing_address: {
street: 'Street 3',
number: 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var tomorrow = moment()
var paymentInput = {
charge_id: 242,
payment: {
bol: {
banking_billet: {
expire_at: tomorrow
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ var options = {
sandbox: true
}

var paymentMethodInput = {
method: 'visa',
var paymentDataInput = {
type: 'visa',
total: 5000
}

var gerencianet = new Gerencianet(options);

gerencianet
.getPaymentMethods(paymentMethodInput)
.getPaymentData(paymentDataInput)
.then(function (installments) {
console.log('Response:',
util.inspect(installments, false, null));
Expand Down
20 changes: 10 additions & 10 deletions docs/payment-methods.md → docs/payment-data.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Payment methods - listing installments
## Payment data - listing installments

If you ever need to get the total value for a charge, including rates and interests, as well as each installment value, even before the payment itself, you can.

Expand All @@ -9,15 +9,15 @@ Sometimes you need to check the total for making a discount, or simple to show a
Stop bragging about. Here is the code:

```js
var paymentMethodInput = {
method: 'visa',
var paymentDataInput = {
type: 'visa',
total: 5000
}

var gerencianet = new Gerencianet(options);

gerencianet
.getPaymentMethods(paymentMethodInput)
.getPaymentData(paymentDataInput)
.then(console.log)
.catch(console.log);
```
Expand All @@ -27,7 +27,7 @@ And the response:
```js
{
"code": 200,
"method": {
"data": {
"rate": 150,
"interest_percentage": 0,
"name": "visa",
Expand Down Expand Up @@ -109,13 +109,13 @@ And the response:
}
```

Observe that the response comes with an installments array of 12 positions. Each position matches one possible option of installment number, containing its value in currency and integer forms. Use it any way you need.
Observe that the response comes with an installments array of 12 positions at maximum. Each position matches one possible option of installment number, containing its value in currency and integer forms. The number of installments will vary according to the selected brand. Use it any way that suits your needs.

If you're curious about what would happen if you did this:

```js
var paymentMethodInput = {
method: 'bol',
var paymentDataInput = {
type: 'banking_billet',
total: 5000
}
```
Expand All @@ -125,12 +125,12 @@ Here it goes:
```js
{
"code": 200,
"method": {
"data": {
"total": 5150,
"rate": 150,
"currency": "51,50"
}
}
```

As the payment method being a boleto, the response comes with just the total value and the rate that was applied. The total value comes also parsed in currency, just in case.
As the payment type being *banking billet*, the response comes with just the total value and the rate that was applied. The total value comes also parsed in currency, just in case.
20 changes: 10 additions & 10 deletions docs/payments.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ var Gerencianet = require('gn-api-sdk-node');
var gerencianet = new Gerencianet(options);
```

There are two ways of giving sequence to a charge. One can generate a boleto so it is payable until its due date, or one can use its credit card to approve the payment.
There are two ways of giving sequence to a charge. One can generate a **banking billet** so it is payable until its due date, or one can use its **credit card** to approve the payment.

### 1. Boletos
### 1. Banking billets

Generating a bol from a charge is deadly simple. Provide the charge id and an optional expiration date:
Generating banking billets from a charge is deadly simple. Provide the charge id and an optional expiration date:

```js
var tenDaysFromNow = moment()
Expand All @@ -21,7 +21,7 @@ var tenDaysFromNow = moment()
var paymentInput = {
charge_id: 242,
payment: {
bol: {
banking_billet: {
expire_at: tenDaysFromNow
}
}
Expand All @@ -34,26 +34,26 @@ gerencianet
.done();
```

If you don't need to supply the `expire_at` attribute, keep the `bol` object empty like this:
If you don't need an expiration date, keep the `banking_billet` object empty like this:

```js
var paymentInput = {
charge_id: 242,
payment: {
bol: {}
banking_billet: {}
}
}
```

You'll receive the payment info in the callback, such as the barcode and the bol link:
You'll receive the payment info in the callback, such as the barcode and the billet link:

```js
{
"code": 200,
"response": {
"transaction": 137,
"total": 1150,
"payment": "bol",
"payment": "banking_billet",
"barcode": "00190.00009 01523.894002 00059.161182 9 64350000001150",
"link": "https://visualizacao.gerencianet.com.br/emissao/28333_2139_RRABRA7/A4XB-28333-59161-BRANAE4",
"expire_at": "2015-05-21"
Expand All @@ -63,7 +63,7 @@ You'll receive the payment info in the callback, such as the barcode and the bol

### 2. Credit card

The most common payment method is to use a credit card in order to make things happen faster. Paying a charge with a credit card in Gerencianet is as simples as generating a boleto, as seen above.
The most common payment method is to use a credit card in order to make things happen faster. Paying a charge with a credit card in Gerencianet is as simples as generating a banking billet, as seen above.

The difference here is that we need to provide some extra information, as a `billing_address` and a `payment_token`. The former is used to make an anti-fraud analyze before accepting/appoving the payment, the latter identifies a credit card at Gerencianet, so that you don't need to bother about keeping track of credit card numbers. The `installments` attribute is self-explanatory.

Expand Down Expand Up @@ -95,7 +95,7 @@ gerencianet
.done();
```

If everything went well, the response will come with the total value, installments number e the value of each installment:
If everything went well, the response will come with the total value, installments number and the value of each installment:

```js
{
Expand Down

0 comments on commit e395041

Please sign in to comment.