Skip to content

Commit

Permalink
create contributing guide and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
pavinduLakshan committed Apr 26, 2021
1 parent 12d39b8 commit 01cd4b3
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 14 deletions.
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Contributing Guide - Payhere JS SDK

## How to contribute

- First pick an issue that you want to work on. If the issue that you want to fix is not listed already, please don't hesitate to create one.

- Fork the repository and clone it into your computer.

- Create a new branch off the `development` branch, using the following naming convention for the branch name.
`{issue_no}_{short phrase which briefly explains the purpose of the branch}`
Eg: #8_retry_subscription_function

- Install dependencies using `npm install` or `yarn`.

- Run `npm run build` to compile the TypeScript code.

- Run `npm link` to create a symlink in the global npm folder

- Then run `npm link payhere-js-sdk`, to install the package locally in any single page app,
43 changes: 29 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,6 @@ Payhere.init("12xxxxx",AccountCategory.SANDBOX)
Payhere.init("12xxxxx",AccountCategory.LIVE)
```

If you plan to use the Retrieval API, Charging API or Subscription Manager API,remember to initialize the Payhere object with an authorization code as follows.

```
// Replace this sample value with your authorization code
const authCode = "NE9WeDMzUlZPUGc0RHpkWlV6cTRBOTREMjo4bjRWQ2oyNU1YcDRKTERGeXZzRTloNGE4cWdiUGFaVUk0SkVXSzRGQ3ZvcA=="
Payhere.init("12xxxxx",AccountCategory.SANDBOX,authCode)
```

To understand how to generate the authorization code, please refer to [the official docs](https://support.payhere.lk/api-&-mobile-sdk/payhere-subscription#2-generate-an-authorization-code).

### Checkout

```
Expand Down Expand Up @@ -85,7 +75,7 @@ function checkout() {
}
```

#### Subscription
### Subscription

```
import {PayhereSubscription,SubscriptionParams, Customer, Month,CurrencyType} from 'payhere-js-sdk'
Expand Down Expand Up @@ -126,7 +116,7 @@ function initSubscription() {
}
```

#### Preapproval
### Preapproval

```
import {PayherePreapproval,PreapprovalParams, Customer, CurrencyType} from 'payhere-js-sdk'
Expand Down Expand Up @@ -156,7 +146,7 @@ function preApprove() {
}
```

#### Charge Pre approvals
### Charge Pre approvals

Coming soon

Expand Down Expand Up @@ -190,4 +180,29 @@ Coming soon

#### Cancel a subscription

Coming soon
Coming soon

## Roadmap

- Implement unit tests for each functionality using Jest

- Implement automated charging functionality

- Implement payment data retrieval functionality

- Implement subscription data retrieval functionality

- Implement retry subscription functionality

- Implement cancel subscription functionality

- Break down the repository into several NPM packages based on the environment
- `payhere-js-sdk/client` - checkout, subscription, preapproval
- `payhere-js-sdk/server` - automated charging, payment data retrieval, manage subscriptions, verify webhook responses

- Create a authorized dashboard in server npm package to view payment information and manage subscriptions

## Contributing

This package is still in its early stages. All conributions are highly welcome.
Please read the [contributing guide](CONTRIBUTING.md) to get started.

0 comments on commit 01cd4b3

Please sign in to comment.