Skip to content

Commit a68277d

Browse files
committed
deploy sdk PG
0 parents  commit a68277d

40 files changed

Lines changed: 1277 additions & 0 deletions

.gitignore

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# .DS_Store banished!
30+
.DS_Store
31+
32+
# PyInstaller
33+
# Usually these files are written by a python script from a template
34+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
35+
*.manifest
36+
*.spec
37+
38+
# Installer logs
39+
pip-log.txt
40+
pip-delete-this-directory.txt
41+
42+
# Unit test / coverage reports
43+
htmlcov/
44+
.tox/
45+
.nox/
46+
.coverage
47+
.coverage.*
48+
.cache
49+
nosetests.xml
50+
coverage.xml
51+
*.cover
52+
*.py,cover
53+
.hypothesis/
54+
.pytest_cache/
55+
cover/
56+
57+
# Translations
58+
*.mo
59+
*.pot
60+
61+
# Django stuff:
62+
*.log
63+
local_settings.py
64+
db.sqlite3
65+
db.sqlite3-journal
66+
67+
# Flask stuff:
68+
instance/
69+
.webassets-cache
70+
71+
# Scrapy stuff:
72+
.scrapy
73+
74+
# Sphinx documentation
75+
docs/_build/
76+
77+
# PyBuilder
78+
.pybuilder/
79+
target/
80+
cool.md
81+
# Jupyter Notebook
82+
.ipynb_checkpoints
83+
84+
# IPython
85+
profile_default/
86+
ipython_config.py
87+
88+
# pyenv
89+
# For a library or package, you might want to ignore these files since the code is
90+
# intended to run in multiple environments; otherwise, check them in:
91+
# .python-version
92+
93+
# pipenv
94+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
96+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
97+
# install all needed dependencies.
98+
#Pipfile.lock
99+
100+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
101+
__pypackages__/
102+
103+
# Celery stuff
104+
celerybeat-schedule
105+
celerybeat.pid
106+
107+
# SageMath parsed files
108+
*.sage.py
109+
110+
# Environments
111+
.env
112+
.venv
113+
env/
114+
venv/
115+
ENV/
116+
env.bak/
117+
venv.bak/
118+
119+
# Spyder project settings
120+
.spyderproject
121+
.spyproject
122+
123+
# Rope project settings
124+
.ropeproject
125+
126+
# mkdocs documentation
127+
/site
128+
129+
# mypy
130+
.mypy_cache/
131+
.dmypy.json
132+
dmypy.json
133+
134+
# Pyre type checker
135+
.pyre/
136+
137+
# pytype static type analyzer
138+
.pytype/
139+
140+
# Cython debug symbols
141+
cython_debug/
142+
143+
# idea editor file
144+
.idea/
145+
146+
#example.py file
147+
example.py
148+
sdk_dev.py

.pylintrc

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
[MASTER]
2+
3+
# Specify a configuration file.
4+
#rcfile=
5+
6+
7+
[MESSAGES CONTROL]
8+
9+
# Enable the message, report, category or checker with the given id(s). You can
10+
# either give multiple identifier separated by comma (,) or put this option
11+
# multiple time. See also the "--disable" option for examples.
12+
enable=indexing-exception,old-raise-syntax
13+
# Disable the message, report, category or checker with the given id(s). You
14+
# can either give multiple identifiers separated by comma (,) or put this
15+
# option multiple times (only on the command line, not in the configuration
16+
# file where it should appear only once).You can also use "--disable=all" to
17+
# disable everything first and then reenable specific checks. For example, if
18+
# you want to run only the similarities checker, you can use "--disable=all
19+
# --enable=similarities". If you want to run only the classes checker, but have
20+
# no Warning level messages displayed, use"--disable=all --enable=classes
21+
# --disable=W"
22+
disable=design,similarities,no-self-use,attribute-defined-outside-init,locally-disabled,star-args,pointless-except,bad-option-value,global-statement,fixme,suppressed-message,useless-suppression,locally-enabled,no-member,no-name-in-module,import-error,unsubscriptable-object,unbalanced-tuple-unpacking,undefined-variable,not-context-manager
23+
24+
25+
[REPORTS]
26+
27+
# Set the output format. Available formats are text, parseable, colorized, msvs
28+
# (visual studio) and html. You can also give a reporter class, eg
29+
# mypackage.mymodule.MyReporterClass.
30+
output-format=text
31+
32+
# Put messages in a separate file for each module / package specified on the
33+
# command line instead of printing them on stdout. Reports (if any) will be
34+
# written in a file name "pylint_global.[txt|html]". This option is deprecated
35+
# and it will be removed in Pylint 2.0.
36+
files-output=no
37+
38+
# Tells whether to display a full report or only the messages
39+
reports=yes
40+
41+
# Python expression which should return a note less than 10 (10 is the highest
42+
# note). You have access to the variables errors warning, statement which
43+
# respectively contain the number of errors / warnings messages and the total
44+
# number of statements analyzed. This is used by the global evaluation report
45+
# (RP0004).
46+
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
47+
48+
# Template used to display messages. This is a python new-style format string
49+
# used to format the message information. See doc for all details
50+
#msg-template=
51+
52+
53+
[LOGGING]
54+
55+
# Logging modules to check that the string format arguments are in logging
56+
# function parameter format
57+
logging-modules=logging
58+
59+
60+
[EXCEPTIONS]
61+
62+
# Exceptions that will emit a warning when being caught. Defaults to
63+
# "Exception"
64+
overgeneral-exceptions=Exception

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Stanley Castin <stanleycastin19@gmail.com>

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Stanley Castin
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.

README.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# PG Rewards SDK - Python
2+
3+
So you are a developer and will start accepting payments with moncash. The PG Rewards Payments SDK is the easiest way to complete the integration in record time. With the PG Rewards Payment SDK, you can create a payment process through moncash to meet the unique needs of your projects.
4+
5+
## Getting an API Key
6+
7+
![](https://3711139374-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNoNIWRBSpPI3RWl7Qz-1703796690%2Fuploads%2FJtcX4LUHzKUrW3CcgJtI%2FDeveloper%20Credentials.png?alt=media&token=3bb83868-6cd5-40f5-9be3-129f08f93cb7)
8+
before we start the integration make sure you have:
9+
10+
- [Registered](https://devtopup.pgecom.com) for a PG Rewards developer Account
11+
- Navigate to Settings > Developer Setting
12+
- Click on Generate New Credentials to get new credentials
13+
14+
### Install pip package
15+
16+
```sh
17+
$ pip install pgrwpy
18+
```
19+
20+
## Getting Started
21+
22+
You need to setup your key and secret using the following:
23+
24+
To work in production mode you need to specify your production userID & secretKey along with a production_mode True boolean flag
25+
26+
```py
27+
import pgrwpy
28+
29+
client = pgrwpy.Client(auth=(userID, secretKey),
30+
production_mode=True)
31+
```
32+
33+
or
34+
35+
To work in sandbox mode you need to specify your sandbox userID & secretKey keys along with a False boolean flag or you could just omit the production_mode flag since it defaults to False if not specified
36+
37+
```py
38+
import pgrwpy
39+
40+
client = pgrwpy.Client(auth=(API_KEY, API_SECRET),
41+
production_mode=False)
42+
```
43+
44+
After setting up the client instance you can get the current pgrwpy SDK version using the following:
45+
46+
```py
47+
print(client.get_version())
48+
```
49+
50+
### Create a paymet with Mon Cash
51+
52+
In order to receive payments using this flow, first of all you will need to create a Moncash payment. Following are the important parameters that you can provide for this method:
53+
54+
| Field | Required | Type | Description |
55+
| ----------- | -------- | ------ | --------------------------------------------------------------------- |
56+
| amount | Yes | number | Amount in Haitian Currency (gourdes) |
57+
| referenceId | Yes | string | Your internal reference ID into your own system for tracking purposes |
58+
| successUrl | Yes | string | Send the user back once the transaction is successfully complete |
59+
| errorUrl | Yes | string | Send the user back if there is an error with the transaction |
60+
61+
For details of all the request and response parameters , check our [PG API Documentation guide](https://docs.pgecom.com/api-endpoint/mon-cash/mon-cash-schema)
62+
63+
```py
64+
data = {
65+
"amount": 500,
66+
"referenceId": "12345test",
67+
"successUrl": "https://example.com",
68+
"errorUrl": "https://example.com"
69+
}
70+
71+
client.Payment.moncash(data)
72+
```
73+
74+
Did you get a **HTTP 201** response, if yes then you are all set for the next step.
75+
76+
<hr>
77+
78+
### Get Payment Details
79+
80+
Now that you have created a payment, the next step is to implement polling to get Payment Details. We recommend a 4-5 second interval between requests. Following are the important parameters that you can provide for this method:
81+
82+
| Field | Required | Type | Description |
83+
| ------- | -------- | ------ | --------------------------------------------------------------------- |
84+
| orderId | Yes | string | Your internal reference ID into your own system for tracking purposes |
85+
86+
### Fetch a particular Moncash payment details
87+
88+
```py
89+
client.Payment.get_payment_details("<orderId>")
90+
```
91+
92+
For details of all the request and response parameters , check our [PG API Documentation guide](https://docs.pgecom.com/api-endpoint/mon-cash/retrieve-an-order-id)
93+
On successful payment, the status in the response will change to **COMPLETED**
94+
In case of a pending for Payment, the status in the response will change to **PENDING**
95+
96+
<hr>
97+
98+
### Task | workflow
99+
100+
- [x] Moncash
101+
- [x] Payment details
102+
- [ ] Card
103+
104+
<hr>

SECURITY.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
| Version | Supported |
6+
| ------- | ------------------ |
7+
| 0.x.x | :white_check_mark: |
8+
9+
10+
11+
## Reporting a Vulnerability
12+
13+
Please create an issue or if the issue is sensitive or critical, please reach us to the email address mentioned in the github organisation page

0 commit comments

Comments
 (0)