payfast 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -6
- data/lib/payfast/onsite_payments.rb +8 -11
- data/lib/payfast/version.rb +5 -0
- metadata +17 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7881858525522efec041474ecc6b4ee78bb427e75cc22fc2137638491c17f687
|
4
|
+
data.tar.gz: 2f391494ef6d8758c149ebed0b2cf955e2554abf5edde05bcb6774d6f8fbf4f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd69900dbb2bef5c308bbd3e6358008aed5462b7003340211f4d3fcc3471976f2f9ac0ad7de7e01588d9c12473053d545fe7924c8390f13df9c5f49616c260fb
|
7
|
+
data.tar.gz: 0bed2c849e943af30df1e9812e7e712464976a05fae61613559a043e384bfe943c861d62fcb2fe062211e3192e5927e606f50fd9b37fe9f0ab23f4b34c0a6a6c
|
data/README.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
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
4
|
|
5
|
+
## Demo
|
6
|
+
![Peek 2023-08-24 12-15](https://github.com/mactunechy/payfast/assets/37017264/270cf0ab-d453-43ca-9a9a-8b8195dc6b8f)
|
7
|
+
|
8
|
+
|
5
9
|
## Installation
|
6
10
|
|
7
11
|
Add this line to your application's Gemfile:
|
@@ -9,12 +13,6 @@ Add this line to your application's Gemfile:
|
|
9
13
|
```bash
|
10
14
|
bundle add payfast
|
11
15
|
```
|
12
|
-
Or install it yourseld as:
|
13
|
-
|
14
|
-
|
15
|
-
```bash
|
16
|
-
gem install payfast
|
17
|
-
```
|
18
16
|
|
19
17
|
## Usage
|
20
18
|
|
@@ -1,17 +1,16 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'net/http'
|
2
|
+
require 'uri'
|
3
3
|
|
4
4
|
module Payfast
|
5
|
+
# Encaspulates the utils for makeing payfast payments using their onsite feature
|
5
6
|
class OnsitePayments
|
6
7
|
def self.generate_signature(payload)
|
7
8
|
passphrase = Rails.application.config_for(:payfast).passphrase
|
8
9
|
|
9
|
-
if passphrase
|
10
|
-
payload[:passphrase] = passphrase
|
11
|
-
end
|
10
|
+
payload[:passphrase] = passphrase if passphrase
|
12
11
|
|
13
12
|
url_encoded = data_to_string(payload)
|
14
|
-
create_hash(url_encoded,
|
13
|
+
create_hash(url_encoded, 'md5')
|
15
14
|
end
|
16
15
|
|
17
16
|
def self.requestPayment(payload)
|
@@ -20,7 +19,7 @@ module Payfast
|
|
20
19
|
merchant_key: Rails.application.config_for(:payfast).merchant_key,
|
21
20
|
return_url: Rails.application.config_for(:payfast).return_url,
|
22
21
|
cancel_url: Rails.application.config_for(:payfast).cancel_url,
|
23
|
-
notify_url: Rails.application.config_for(:payfast).notify_url
|
22
|
+
notify_url: Rails.application.config_for(:payfast).notify_url
|
24
23
|
}.merge(payload)
|
25
24
|
|
26
25
|
puts payload_with_config
|
@@ -35,7 +34,7 @@ module Payfast
|
|
35
34
|
|
36
35
|
uri = URI.parse(base_url)
|
37
36
|
http = Net::HTTP.new(uri.host, uri.port)
|
38
|
-
http.use_ssl = true if uri.scheme ==
|
37
|
+
http.use_ssl = true if uri.scheme == 'https'
|
39
38
|
|
40
39
|
request = Net::HTTP::Post.new(uri.path)
|
41
40
|
request.body = pf_param_string
|
@@ -45,12 +44,10 @@ module Payfast
|
|
45
44
|
JSON.parse(response.body)
|
46
45
|
rescue StandardError => e
|
47
46
|
puts "Error: #{e.message}"
|
48
|
-
|
47
|
+
false
|
49
48
|
end
|
50
49
|
end
|
51
50
|
|
52
|
-
private
|
53
|
-
|
54
51
|
def self.data_to_string(payload)
|
55
52
|
URI.encode_www_form(payload)
|
56
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dellan Muchengapadare
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -55,14 +55,14 @@ dependencies:
|
|
55
55
|
description: "# Payfast\n\nPayfast is a Ruby gem that simplifies the process of integrating
|
56
56
|
the PayFast payment gateway into your Ruby on Rails application. It provides a generator
|
57
57
|
that helps scaffold the necessary configuration, routes, models, and controllers
|
58
|
-
required to integrate PayFast seamlessly.\n\n##
|
59
|
-
your application's Gemfile:\n\n```bash\n bundle
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
\ create app/views/carts/
|
64
|
-
\ create
|
65
|
-
\ create
|
58
|
+
required to integrate PayFast seamlessly.\n\n## Demo \n![Peek 2023-08-24 12-15](https://github.com/mactunechy/payfast/assets/37017264/270cf0ab-d453-43ca-9a9a-8b8195dc6b8f)\n\n\n##
|
59
|
+
Installation\n\nAdd this line to your application's Gemfile:\n\n```bash\n bundle
|
60
|
+
add payfast\n```\n\n## Usage\n\n```bash\n rails generate payfast:install\n```\n\n##
|
61
|
+
This generator will perform the following actions:\n\n insert config/routes.rb\n
|
62
|
+
\ create app/controllers/carts_controller.rb\n create app/views/carts/index.html.erb\n
|
63
|
+
\ create app/views/carts/make_payment.html.erb\n create app/helpers/carts_helper.rb\n
|
64
|
+
\ create db/migrate/20230824105530_create_carts.rb\n create config/payfast.yml\n
|
65
|
+
\ create app/models/cart.rb\n insert app/views/layouts/application.html.erb\n
|
66
66
|
\ insert config/environments/development.rb\n\n\n\n## Additional configuration\n\nSetup
|
67
67
|
payfast credentials for your environment\n\n rails EDITOR=\"code --wait\" bin/rails
|
68
68
|
credentials:edit\n \n This will allow you to securely edit and store your credentials.
|
@@ -119,11 +119,12 @@ files:
|
|
119
119
|
- lib/generators/payfast/templates/model.rb
|
120
120
|
- lib/generators/payfast/templates/routes.rb
|
121
121
|
- lib/payfast/onsite_payments.rb
|
122
|
-
|
122
|
+
- lib/payfast/version.rb
|
123
|
+
homepage: https://github.com/mactunechy/payfast
|
123
124
|
licenses:
|
124
125
|
- MIT
|
125
126
|
metadata: {}
|
126
|
-
post_install_message:
|
127
|
+
post_install_message:
|
127
128
|
rdoc_options: []
|
128
129
|
require_paths:
|
129
130
|
- lib
|
@@ -131,15 +132,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
131
132
|
requirements:
|
132
133
|
- - ">="
|
133
134
|
- !ruby/object:Gem::Version
|
134
|
-
version:
|
135
|
+
version: 2.7.0
|
135
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
137
|
requirements:
|
137
138
|
- - ">="
|
138
139
|
- !ruby/object:Gem::Version
|
139
140
|
version: '0'
|
140
141
|
requirements: []
|
141
|
-
rubygems_version: 3.3.
|
142
|
-
signing_key:
|
142
|
+
rubygems_version: 3.3.27
|
143
|
+
signing_key:
|
143
144
|
specification_version: 4
|
144
145
|
summary: A light weight gem to setup payfast payment gateway
|
145
146
|
test_files: []
|