Skip to content

Commit 1bdd488

Browse files
author
Jose Garcia
committed
first commit
0 parents  commit 1bdd488

9 files changed

+6495
-0
lines changed

Diff for: CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# 2.0.0
2+
3+
Initial Release
4+

Diff for: LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 EPREZTO
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Diff for: README.md

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# EPREZTO - YAPPY SDK
2+
3+
This is the repository for Yappy's payment button nodejs client library as ported by Eprezto's team.
4+
5+
Yappy is a payment button and wallet in Panama developed by Banco General.
6+
7+
At Eprezto we use Yappy actively, the SDK was not available in NodeJS at the time of this release so we decided to port it from their PHP SDK and share it with the community.
8+
9+
## Installation
10+
```
11+
npm install eprezto-yappy
12+
```
13+
14+
## Updating
15+
Please remember to check the changelog for important information whenever updating to the latest version! BG might update their endpoints from time to time so this might affect this SDK.
16+
17+
## Notes and Recommendations
18+
* Use environment variables for your credentials.
19+
* merchantID and secretToken are provided by BG only for business accounts.
20+
* This SDK is for backend use (NodeJS)
21+
* Include in the URLS the orderId such as https://yourdomain.com/checkout-success?orderId=12345 so that your frontend knows which order is being confirmed.
22+
* There are no webhooks yet, it'd be a nice to have whenever the Yappy team adds them, this could avoid several issues related to missed redirects.
23+
24+
## How does Yappy work
25+
1. User clicks on Yappy Button
26+
2. Frontend Sends the request to NodeJS server with parameters
27+
3. This SDK receives the parameters and generates a redirect URL
28+
4. Frontend receives the URL and redirects the user to Yappy's payment portal
29+
5. User inputs their phone number and receive a push notification at Yappy's app
30+
6. User accepts the payment at Yappy's app and is redirected to your site
31+
32+
## Parameters
33+
```
34+
secretToken : PROVIDED BY BG,
35+
merchantId : PROVIDED BY BG
36+
successUrl : URL WHERE THE USER IS REDIRECTED ON SUCCESSFUL PAYMENT
37+
failUrl : URL WHERE THE USER IS REDIRECTED ON A FAILED PAYMENT
38+
domainUrl : DOMAIN NAME OF YOUR SITE
39+
checkoutUrl : CHECKOUT URL WHERE THE USER INITIATES THE PAYMENT
40+
sandbox : SANDBOX MODE [yes, no]
41+
```
42+
43+
## API overview
44+
You can interact with the api through Yappy.Client instance
45+
```javascript
46+
var Yappy = require('eprezto-yappy');
47+
var yappy = new Yappy.Client({
48+
secretToken : process.env.YAPPY_SECRET_TOKEN,
49+
merchantId : process.env.YAPPY_MERCHANT_ID,
50+
successUrl : process.env.YAPPY_SUCCESS_URL,
51+
failUrl : process.env.YAPPY_FAIL_URL,
52+
domainUrl : process.env.YAPPY_DOMAIN_URL,
53+
checkoutUrl : process.env.YAPPY_CHECKOUT_URL,
54+
sandbox : process.env.YAPPY_SANDBOX,
55+
})
56+
```
57+
Input data:
58+
```javascript
59+
var paymentData = {
60+
orderId : 12345,
61+
total : 10,
62+
subTotal : 9,
63+
taxes : 1
64+
}
65+
66+
67+
//Save the product
68+
yappy.generate_payment_link(paymentData)
69+
.then(function(response){
70+
let redirectUrl = response.redirectUrl
71+
return redirectUrl
72+
})
73+
74+
// Returns
75+
{
76+
redirectUrl: "YAPPY_REDIRECT_URL",
77+
status: true
78+
}
79+
80+
```

Diff for: index.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* EPREZTO YAPPY NodeJS SDK
3+
* https://eprezto.com
4+
*
5+
* Copyright (c) 2021 Eprezto Tech
6+
*
7+
* For informations email us at [email protected]
8+
*
9+
*/
10+
11+
"use strict"
12+
13+
var path = require('path');
14+
15+
// Module
16+
var Yappy = {};
17+
18+
// REST client
19+
Yappy.Client = require(path.join(__dirname,'src','client'))
20+
21+
module.exports = Yappy;

0 commit comments

Comments
 (0)