payfast 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +131 -0
- metadata +51 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cf7c91d5a3d8983594082c4f5d6e1e7839bb0cdf854a13690656f6a03090c92
|
4
|
+
data.tar.gz: 9c349a4f2635aea5e9e27e933db69af130d042e0e1a72ac4d1b109d9638e73cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c9142b1ca87dcc581e69d17dde7c0b54936da0d62f382f8d65fbc66ba38707f4d53fefb96da850aecb232219f7d2ed224cc4fab5bd89f8c3024fe2e4c4bb916
|
7
|
+
data.tar.gz: 2f8e3f20457989abcc522d4fcbda3d0935cc88f749630db51e34b84a5295b998cd241a6bbff189a57022330eab65589eca36ab5df03a099bb979e1a2e5513d78
|
data/README.md
CHANGED
@@ -0,0 +1,131 @@
|
|
1
|
+
# Payfast
|
2
|
+
|
3
|
+
Payfast is a Ruby gem that simplifies the process of integrating the PayFast payment gateway into your Ruby on Rails application. It provides a generator that helps scaffold the necessary configuration, routes, models, and controllers required to integrate PayFast seamlessly.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
bundle add payfast
|
11
|
+
```
|
12
|
+
Or install it yourseld as:
|
13
|
+
|
14
|
+
|
15
|
+
```bash
|
16
|
+
gem install payfast
|
17
|
+
```
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
```bash
|
22
|
+
rails generate payfast:install
|
23
|
+
```
|
24
|
+
|
25
|
+
## This generator will perform the following actions:
|
26
|
+
|
27
|
+
insert config/routes.rb
|
28
|
+
create app/controllers/carts_controller.rb
|
29
|
+
create app/views/carts/index.html.erb
|
30
|
+
create app/views/carts/make_payment.html.erb
|
31
|
+
create app/helpers/carts_helper.rb
|
32
|
+
create db/migrate/20230824105530_create_carts.rb
|
33
|
+
create config/payfast.yml
|
34
|
+
create app/models/cart.rb
|
35
|
+
insert app/views/layouts/application.html.erb
|
36
|
+
insert config/environments/development.rb
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
## Additional configuration
|
41
|
+
|
42
|
+
Setup payfast credentials for your environment
|
43
|
+
|
44
|
+
rails EDITOR="code --wait" bin/rails credentials:edit
|
45
|
+
|
46
|
+
This will allow you to securely edit and store your credentials. once you save and exit the file, the credentials will be encrypted and can only be accessed withe rails master key.
|
47
|
+
|
48
|
+
payfast:
|
49
|
+
merchant_id: {your_merchant_id}
|
50
|
+
merchant_key: {your_merchant_key}
|
51
|
+
passphrase: {{your_passphrase}}
|
52
|
+
|
53
|
+
## Update your `payfast.yml` config file
|
54
|
+
- setup the credentials to be use by the rails app
|
55
|
+
- uncomment `Rails.application.credentials.payfast.merchant_id ` and wrap it in erb tags as instructed in the comments.
|
56
|
+
|
57
|
+
|
58
|
+
## Templates
|
59
|
+
Update the `make_payment.html.erb` as instructed in the file. it should look like so:
|
60
|
+
|
61
|
+
```js
|
62
|
+
<script>
|
63
|
+
// set the uuid to uuid = @cart.payment_uid. surround @carts.payment_uid with erb tags
|
64
|
+
const uuid = `<%= @cart.payment_uuid %>`
|
65
|
+
window.payfast_do_onsite_payment({uuid}, function (result) {
|
66
|
+
if (result === true) {
|
67
|
+
// redirect success_path(@cart)
|
68
|
+
window.location.href = `<%= success_cart_path(@cart) %>`
|
69
|
+
}
|
70
|
+
else {
|
71
|
+
// Redirect to failure_path(@cart)
|
72
|
+
window.location.href = `<%= failure_cart_path(@cart) %>`
|
73
|
+
}
|
74
|
+
});
|
75
|
+
</script>
|
76
|
+
```
|
77
|
+
|
78
|
+
## Testing
|
79
|
+
- payfast api allows only SSL communication from your server. inorder to test locally. you will have to use a tunneling service that allows you to expose your local development server to the internet.
|
80
|
+
|
81
|
+
your rails development config has was modified by the generator to allow ngrok hosts to hit your rails server
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
config.hosts << /[a-z0-9-]+\.ngrok-free\.app/
|
85
|
+
```
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
## Contributing
|
94
|
+
|
95
|
+
Thank you for considering contributing to our project! We welcome contributions from the community to help improve this project and make it better for everyone.
|
96
|
+
|
97
|
+
### Issues
|
98
|
+
|
99
|
+
If you encounter any issues or bugs while using our project, please [open a new issue](https://github.com/mactunechy/payfast/issues) on GitHub. Please make sure to include detailed information about the problem, steps to reproduce it, and the environment in which you encountered it.
|
100
|
+
|
101
|
+
### Pull Requests
|
102
|
+
|
103
|
+
We encourage pull requests from the community! If you have an improvement or new feature you'd like to contribute, please follow these steps:
|
104
|
+
|
105
|
+
1. Fork the repository and create a new branch for your feature or bug fix.
|
106
|
+
2. Make your changes and write tests to cover any new functionality.
|
107
|
+
3. Ensure that the existing tests pass and write additional tests for any bug fixes.
|
108
|
+
4. Commit your changes and push the new branch to your forked repository.
|
109
|
+
5. Submit a pull request to our main repository, including a detailed description of the changes you made and any relevant information.
|
110
|
+
|
111
|
+
We will review your pull request as soon as possible and provide feedback if needed. We value your contributions and will work with you to ensure your changes are integrated smoothly.
|
112
|
+
d
|
113
|
+
|
114
|
+
Your contributions are essential to the success of this project, and we are grateful for your help in making it better for everyone. If you have any questions or need further assistance, feel free to reach out to us.
|
115
|
+
|
116
|
+
Happy coding!
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: payfast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dellan Muchengapadare
|
@@ -52,7 +52,56 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 7.0.7
|
55
|
-
description:
|
55
|
+
description: "# Payfast\n\nPayfast is a Ruby gem that simplifies the process of integrating
|
56
|
+
the PayFast payment gateway into your Ruby on Rails application. It provides a generator
|
57
|
+
that helps scaffold the necessary configuration, routes, models, and controllers
|
58
|
+
required to integrate PayFast seamlessly.\n\n## Installation\n\nAdd this line to
|
59
|
+
your application's Gemfile:\n\n```bash\n bundle add payfast\n```\nOr install
|
60
|
+
it yourseld as:\n\n\n```bash\n gem install payfast\n```\n\n## Usage\n\n```bash\n
|
61
|
+
\ rails generate payfast:install\n```\n\n## This generator will perform the following
|
62
|
+
actions:\n\n insert config/routes.rb\n create app/controllers/carts_controller.rb\n
|
63
|
+
\ create app/views/carts/index.html.erb\n create app/views/carts/make_payment.html.erb\n
|
64
|
+
\ create app/helpers/carts_helper.rb\n create db/migrate/20230824105530_create_carts.rb\n
|
65
|
+
\ create config/payfast.yml\n create app/models/cart.rb\n insert app/views/layouts/application.html.erb\n
|
66
|
+
\ insert config/environments/development.rb\n\n\n\n## Additional configuration\n\nSetup
|
67
|
+
payfast credentials for your environment\n\n rails EDITOR=\"code --wait\" bin/rails
|
68
|
+
credentials:edit\n \n This will allow you to securely edit and store your credentials.
|
69
|
+
once you save and exit the file, the credentials will be encrypted and can only
|
70
|
+
be accessed withe rails master key.\n\n payfast: \n merchant_id: {your_merchant_id}\n
|
71
|
+
\ merchant_key: {your_merchant_key}\n passphrase: {{your_passphrase}}\n\n##
|
72
|
+
Update your `payfast.yml` config file\n- setup the credentials to be use by the
|
73
|
+
rails app\n- uncomment `Rails.application.credentials.payfast.merchant_id ` and
|
74
|
+
wrap it in erb tags as instructed in the comments.\n\n\n## Templates\n Update the
|
75
|
+
`make_payment.html.erb` as instructed in the file. it should look like so:\n\n```js\n<script>\n//
|
76
|
+
set the uuid to uuid = @cart.payment_uid. surround @carts.payment_uid with erb
|
77
|
+
tags\nconst uuid = `<%= @cart.payment_uuid %>`\nwindow.payfast_do_onsite_payment({uuid},
|
78
|
+
function (result) {\n if (result === true) {\n // redirect success_path(@cart)\n
|
79
|
+
\ window.location.href = `<%= success_cart_path(@cart) %>`\n }\n else {\n //
|
80
|
+
Redirect to failure_path(@cart)\n window.location.href = `<%= failure_cart_path(@cart)
|
81
|
+
%>`\n }\n});\n</script>\n```\n\n## Testing\n- payfast api allows only SSL communication
|
82
|
+
from your server. inorder to test locally. you will have to use a tunneling service
|
83
|
+
that allows you to expose your local development server to the internet. \n\nyour
|
84
|
+
rails development config has was modified by the generator to allow ngrok hosts
|
85
|
+
to hit your rails server\n\n```ruby\n config.hosts << /[a-z0-9-]+\\.ngrok-free\\.app/\n```\n\n\n\n\n\n\n\n##
|
86
|
+
Contributing\n\nThank you for considering contributing to our project! We welcome
|
87
|
+
contributions from the community to help improve this project and make it better
|
88
|
+
for everyone.\n\n### Issues\n\nIf you encounter any issues or bugs while using our
|
89
|
+
project, please [open a new issue](https://github.com/mactunechy/payfast/issues)
|
90
|
+
on GitHub. Please make sure to include detailed information about the problem, steps
|
91
|
+
to reproduce it, and the environment in which you encountered it.\n\n### Pull Requests\n\nWe
|
92
|
+
encourage pull requests from the community! If you have an improvement or new feature
|
93
|
+
you'd like to contribute, please follow these steps:\n\n1. Fork the repository and
|
94
|
+
create a new branch for your feature or bug fix.\n2. Make your changes and write
|
95
|
+
tests to cover any new functionality.\n3. Ensure that the existing tests pass and
|
96
|
+
write additional tests for any bug fixes.\n4. Commit your changes and push the new
|
97
|
+
branch to your forked repository.\n5. Submit a pull request to our main repository,
|
98
|
+
including a detailed description of the changes you made and any relevant information.\n\nWe
|
99
|
+
will review your pull request as soon as possible and provide feedback if needed.
|
100
|
+
We value your contributions and will work with you to ensure your changes are integrated
|
101
|
+
smoothly.\nd\n\nYour contributions are essential to the success of this project,
|
102
|
+
and we are grateful for your help in making it better for everyone. If you have
|
103
|
+
any questions or need further assistance, feel free to reach out to us.\n\nHappy
|
104
|
+
coding!\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
|
56
105
|
email: mactunechy@gmail.com
|
57
106
|
executables: []
|
58
107
|
extensions: []
|