Skip to content

Commit

Permalink
feat: Add docz and the respective configurations for the documentatio…
Browse files Browse the repository at this point in the history
…n and add the documentation
  • Loading branch information
AnisioMandlate committed Oct 20, 2020
1 parent 1c1558e commit d2e6294
Show file tree
Hide file tree
Showing 24 changed files with 4,794 additions and 145 deletions.
493 changes: 493 additions & 0 deletions .docz/app/db.json

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- AUTO-GENERATED-CONTENT:START (STARTER) -->
<p align="center">
<a href="https://www.gatsbyjs.com">
<img alt="Gatsby" src="https://www.gatsbyjs.com/Gatsby-Monogram.svg" width="60" />
Expand Down Expand Up @@ -95,5 +94,3 @@ Looking for more guidance? Full documentation for Gatsby lives [on the website](
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/gatsbyjs/gatsby-starter-default)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/gatsbyjs/gatsby-starter-default)
<!-- AUTO-GENERATED-CONTENT:END -->
30 changes: 30 additions & 0 deletions docs/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Getting Started
route: /docs
---

## Overview

PaymentsDS is a service that lets developers integrate their businesses/products with [M-Pesa](https://developer.mpesa.vm.co.mz/) API to facilitate transactions.

## Quickstart

These quickstart guides will teach you how to integrate PaymentsDS to your service.

Choose your programming language below:

- [Java](/docs-java-usage)
- [JavaScript](/docs-javascript-usage)
- [PHP](/docs-php-usage)
- [Python](/docs-python-usage)
- [Ruby](/docs-ruby-usage)

## Features

PaymentsDS can be used to:

- Receive money from a mobile account to a business account
- Send money from a business account to a mobile account
- Send money from a business account to a another business account
- Revert a transaction
- Query the status of a transaction
19 changes: 19 additions & 0 deletions docs/java/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Installation
menu: Java
---

You can install the Ruby SDK using RubyGems or Bundler with the commands listed below:

#### Using RubyGems

```bash
gem install paymentsds-mpesa
```

#### Using Bundler

```ruby
#Gemfile
gem 'paymentsds-mpesa'
```
131 changes: 131 additions & 0 deletions docs/java/usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
---
name: Usage
menu: Java
---

### Prerequisites

To use PaymentsDS with the Ruby SDK you need to have:

- [Ruby 2.5+](https://www.ruby-lang.org)
- [RubyGems](https://rubygems.org)
- [Bundler](https://bundler.io)

### Receive money from a mobile account to a business account

```ruby
require 'paymentsds/mpesa'

client = Paymentsds::MPesa::Client.new do |config|
config.api_key = '<REPLACE>' # API Key
config.public_key = '<REPLACE>' # Public Key
config.service_provider_code = '<REPLACE>' # input_ServiceProviderCode
end

begin
payment_data = {
from: '841234567', # input_CustomerMSISDN
reference: '11114', # input_ThirdPartyReference
transaction: 'T12344CC', # input_TransactionReference
amount: '10' # input_Amount
}

result = client.receive(payment_data)

if result.success?
puts result.data
end
rescue
puts 'Operation failed'
end
```

### Send money from a business account to a mobile account

```ruby
require 'paymentsds/mpesa'

client = Paymentsds::MPesa::Client.new do |config|
config.api_key = '<REPLACE>' # API Key
config.public_key = '<REPLACE>' # Public Key
config.service_provider_code = '<REPLACE>' # input_ServiceProviderCode
end

begin
payment_data = {
to: '841234567', # input_CustomerMSISDN
reference: '11114', # input_ThirdPartyReference
transaction: 'T12344CC', # input_TransactionReference
amount: '10' # input_Amount
}

result = client.send(payment_data)

if result.success?
puts result.data
end
rescue
puts 'Operation failed'
end
```

### Send money from a business account to a another business account

```ruby
require 'paymentsds/mpesa'

client = Paymentsds::MPesa::Client.new do |config|
config.api_key = '<REPLACE>' # API Key
config.public_key = '<REPLACE>' # Public Key
config.service_provider_code = '<REPLACE>' # input_ServiceProviderCode
end

begin
payment_data = {
to: '979797', # input_ReceiverPartyCode
reference: '11114', # input_ThirdPartyReference
transaction: 'T12344CC', # input_TransactionReference
amount: '10' # input_Amount
}

result = client.send(payment_data)

if result.success?
puts result.data
end
rescue
puts 'Operation failed'
end
```

### Revert a transaction

```ruby
require 'paymentsds/mpesa'

client = Paymentsds::MPesa::Client.new do |config|
config.api_key = '<REPLACE>' # API Key
config.public_key = '<REPLACE>' # Public Key
config.service_provider_code = '<REPLACE>' # input_ServiceProviderCode
config.initiator_identifier = '<REPLACE>' # input_InitiatorIdentifier,
config.security_identifier = '<REPLACE>' # input_SecurityCredential
end

begin
reversion_data = {
reference: '11114', # input_ThirdPartyReference
transaction: 'T12344CC', # input_TransactionReference
amount: '10' # input_ReversalAmounts
}

result = client.reversion(payment_data)

if result.success?
# Handle success scenario
end
rescue
# Handle failure scenario
end
```

### Query the status of a transaction
37 changes: 37 additions & 0 deletions docs/javascript/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Configuration
menu: JavaScript
---

The examples below show you how you can configure the PaymentsDS JavaScript SDK

```javascript
import { Client } from "@paymentsds/mpesa"

const client = new Client({
apiKey: "<REPLACE>", // API Key
publicKey: "<REPLACE>", // Public Key
serviceProviderCode: "<REPLACE>", // input_ServiceProviderCode,
initiatorIdentifier: "<REPLACE>", // input_InitiatorIdentifier,
securityIdentifier: "<REPLACE>", // input_SecurityCredential
timeout: "<REPLACE>", // time in seconds
debugging: true,
verifySSL: false,
userAgent: "<REPLACE>",
})
```

```javascript
import { Client } from "@paymentsds/mpesa"

const client = new Client({
accessToken: "<REPLACE>", // Precomputed access token
serviceProviderCode: "<REPLACE>", // input_ServiceProviderCode,
initiatorIdentifier: "<REPLACE>", // input_InitiatorIdentifier,
securityIdentifier: "<REPLACE>", // input_SecurityCredential
timeout: "<REPLACE>", // time in seconds
debugging: true,
verifySSL: false,
userAgent: "<REPLACE>",
})
```
18 changes: 18 additions & 0 deletions docs/javascript/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Installation
menu: JavaScript
---

You can install the JavaScript SDK using NPM or Yarn with the commands listed below:

#### Using NPM

```bash
npm install --save @paymentsds/mpesa
```

#### Using Yarn

```bash
yarn add @paymentsds/mpesa
```
Loading

0 comments on commit d2e6294

Please sign in to comment.