signup-login-module-with-authorizedotnet-gateway
Version:
User Signup-login-module-with-AuthorizedotNet payment gateway
234 lines (187 loc) • 5.08 kB
Markdown
The signup-login-module-with-authorizedotnet-gateway module is a Node.js based loopback script and it provides a fastest way to create user signup and login services with authentication and payment subscription with Authorize.net.
Node.js , and the platform-specific tools needed to compile native NPM modules (which you may already have):
## Installation
To install the signup-login-with-authorizedotnet module, simply run the following command within your app's directory:
```sh
npm i signup-login-module-with-authorizedotnet-gateway --save
```
## Development
```sh
var loopback = require("signup-login-module-with-authorizedotnet-gateway");
```
```sh
var dbConfig = {
"name":""
"host": "",
"port": ,
"url": "",
"database": "",
"password": "",
"user": "",
"connector": "" // connector name ex. mongodb or mysql
};
loopback.config.datasourceset(dbConfig);
```
```sh
var modelConfig = {
"properties":[
{
"name": "firstname",
"type": "string",
"required": true
},
{
"name": "lastname",
"type": "string",
"required": true
},
{
"name": "username",
"type": "string",
"required": true
},
{
"name": "email",
"type": "string",
"required": true
},
{
"name": "password",
"type": "string",
"required": true
},
{
"name": "address",
"type": "string",
"required": false
},
{
"name": "city",
"type": "string",
"required": false
},
{
"name": "state",
"type": "string",
"required": false
},
{
"name": "country",
"type": "string",
"required": false
},
{
"name": "zip",
"type": "number",
"required": false
},
{
"name": "phone",
"type": "number",
"required": false
},
{
"name": "cardcode",
"type": "number",
"required": true
},
{
"name": "expiredate",
"type": "string",
"required": true
},
{
"name": "cardnumber",
"type": "number",
"required": true
},
{
"name": "subscription_id",
"type": "string",
"required": false
},
{
"name": "subscription_status",
"type": "string",
"required": false
}
]}
loopback.modelConfiguration.modelConfiguration(modelConfig);
```
```sh
var authorizekeys = {
"apiLoginKey":"", //Authorize.net APIloginkey
"transactionKey":"" //Authorize.net transactionKey
}
loopback.paymentKeysConfig.paymentKeysConfig(authorizekeys)
```
```sh
var paymentconfig = {
"amount":"50", // Amount of subscription
"trail_amount":"0", // Trail Amount of subscription
"interval_length":"1", // The measurement of time, in association with unit, that is used to define the frequency of the billing occurrences.(For a unit of days, use an integer between 7 and 365, inclusive. For a unit of months, use an integer between 1 and 12, inclusive.)
"interval_unit":"months" // The unit of time, in association with the length, between each billing occurrence.(days or moths)
}
loopback.paymentConfiguration.paymentConfiguration(paymentconfig)
```
```sh
var emailkeys = {
"service":"" // Gmail or Yahoo
"email":"" // if gmail(ex:abc@gmail.com)
"password":"" // email password
}
loopback.constants.constants(emailkeys)
```
```sh
loopback.getstart();
```
```sh
npm start
```
Verify the deployment by navigating to your server address in your preferred browser.
```sh
http://localhost:3000/ping
POST Services:
http://localhost:3000/users/signup //Signup and subscription creation will be happend with this service
http://localhost:3000/users/login // Login post body contains email and password
http://localhost:3000/users/updateSubscription
example:
{
"expiredate": "2025-08",
"cardcode": 123,
"cardnumber": 4111111111111111,
"user_id":""
}
http://localhost:3000/users/getSubscriptionStatus
example:
{
"user_id":""
}
http://localhost:3000/users/getSubscriptionDetails
example:
{
"user_id":""
}
http://localhost:3000/users/cancelSubscription
example:
{
"user_id":""
}
Get Services:
http://localhost:3000/users/
http://localhost:3000/users?id= // get user by id service, pass id here
```
MIT