paygate 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +78 -12
  3. data/lib/paygate/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 232d87a64dfd59cef35bf921574a0eb3b970e8a5dcc23c2e37a8a8598e324c38
4
- data.tar.gz: c4e7c16015478bbaf36cd812c766a6fb9cb0c1e9edf3ba924f44425198cea57a
3
+ metadata.gz: 963fcce432a7eb25241914533cfb84a385ad8722d697919249acf5fca3250455
4
+ data.tar.gz: 30085d8c15b97f38de147015ab3c25916517f5afbd594bf1d1d17a30076234ba
5
5
  SHA512:
6
- metadata.gz: 9c428fbe663d8581a0101cfd4a0bf5f4e1ffc6661e36d414610ca9d3484fc97c012238b0e05f72cb83f0c91e0f0c92be8f60d02d5f76fadb5efc1b7197c749f9
7
- data.tar.gz: 9519f84f991b6465496cd49bca521d564fb5a80687eef80bf489df842be20b29ff9b833eb284f52ebd67295bcb3a74479025ebf3dc29e9ca43835d10f60bf4af
6
+ metadata.gz: 4292b53ce576616625d23fb4c909454b7795e332f8c2ff394689728371ad2509b8de7b64b5eeb7cf2caabebce7d39c13043c1a928080c58d1de1884cdca13828
7
+ data.tar.gz: cb65428191f9fdfb78ca42e8045dcba1538ba66a2ca37ad75f6362a92300fa556a2c0ee881d6f026e0b76404301de282db231ca5faf15500b3a60a61c75d7ff6
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
- # Paygate
1
+ # PayGate Ruby Library
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/paygate`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ The Paygate Ruby library provides convenient access to the [PayGate PayWeb 3 API](http://docs.paygate.co.za/#payweb-3) from applications written in the Ruby language.
6
4
 
7
5
  ## Installation
8
6
 
@@ -20,15 +18,87 @@ Or install it yourself as:
20
18
 
21
19
  $ gem install paygate
22
20
 
21
+ ## Process Flow
22
+
23
+ Process flow description:
24
+
25
+ 1. The merchant begins the process by posting a detailed request to PayWeb.
26
+ 2. PayWeb responds immediately with a unique `pay_request_id` field.
27
+ 3. The merchant redirects the client to PayWeb and passes limited information incliding the `pay_request_id` field returned by PayWeb in step 1. PayWeb displays a meny of active payment methods to the client (if appropriate) and process the transaction to the relevant financial service provider.
28
+ 4. PayWeb redirects the client back to the `return_url` provided by the merchant in step 1.
29
+
23
30
  ## Usage
24
31
 
25
- TODO: Write usage instructions here
32
+ The first step is to initiate the transaction.
33
+
34
+ ```ruby
35
+ require 'paygate'
36
+
37
+ paygate_response = Paygate.initiate_transaction(
38
+ paygate_id,
39
+ encription_key,
40
+ reference_number,
41
+ amount,
42
+ currency,
43
+ return_url,
44
+ locale,
45
+ country,
46
+ recepient,
47
+ pay_method)
48
+ ```
49
+
50
+ paygate_response will return two values:
51
+
52
+ 1. pay_request_id
53
+ 2. checksum_from_response
26
54
 
27
- ## Development
55
+ You will use both values in HTML form to redirect user to PayGate hosted page, where they can enter credit card information and finalize the payment.
56
+
57
+ Here is an example of the form:
58
+
59
+ ```html
60
+ <form action="https://secure.paygate.co.za/payweb3/process.trans" method="POST">
61
+ <input type="hidden" name="PAY_REQUEST_ID" value="#{@pay_request_id}" />
62
+ <input type="hidden" name="CHECKSUM" value="#{@checkusm_from_response}" />
63
+ <input type="submit" value="PAY NOW" className="button" />
64
+ </form>
65
+ ```
28
66
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
67
+ After finalize the payment on PayGate hosted page, it will redirect them back to your application, to the page defined in `return_url`. If you have `paygate_result` page, add this to your routes: `post '/paygate_result' => 'pages#paygate_result'` and paygate will return 3 values to this page:
30
68
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
69
+ 1. PAY_REQUEST_ID
70
+ 2. TRANSACTION_STATUS
71
+ 3. CHECKSUM.
72
+
73
+ You can define those in your controller like this:
74
+
75
+ ```ruby
76
+ def paygate_result
77
+ @pay_request_id = params[:PAY_REQUEST_ID]
78
+ @transaction_status = params[:TRANSACTION_STATUS]
79
+ @checksum = params[:CHECKSUM]
80
+ end
81
+ ```
82
+
83
+ and use them in your `paygate_result` page to display status of the transaction.
84
+
85
+ ## Fields explained
86
+
87
+ `paygate_id`: a unique ID obtained from PayGate (test value: 10011072130).
88
+ `encription_key`: password obtained by PayGate (test: secret).
89
+ `reference_number`: this is your reference number for use by your internal systems.
90
+ `amount`: transaction amount in cents. e.g. 32.99 is specified as 3299.
91
+ `currency`: currency code of the currency the customer is paying in. Refer to [Currency Codes](http://docs.paygate.co.za/#country-codes).
92
+ `return_url`: once the transaction is completed, PayWeb will return the customer to a page on your web site. The page the customer must see is specified in this field.
93
+ `locale`: the locale code identifies to PayGate the customer’s language, country and any special variant preferences (such as Date/Time format) which may be applied to the user interface. Please contact PayGate support to check if your locale is supported. If the locale passed is not supported, then PayGate will default to the “en” locale.
94
+ `country`: Country code of the country the customer is paying from. Refer to [Country Codes](http://docs.paygate.co.za/#country-codes).
95
+ `recepient`: if the transaction is approved, PayWeb will email a payment confirmation to this email address – unless this is overridden at a gateway level by using the Payment Confirmation setting. This field remains compulsory but the sending of the confirmation email can be blocked .
96
+ `pay_method`: Refer to [PAY_METHOD](http://docs.paygate.co.za/#payment-method-codes).
97
+
98
+ ## Other
99
+
100
+ You can find official documentation for PayGate PayWeb 3 [here](http://docs.paygate.co.za/).
101
+ You can find more about error codes [here](http://docs.paygate.co.za/#error-codes).
32
102
 
33
103
  ## Contributing
34
104
 
@@ -37,7 +107,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
37
107
  ## License
38
108
 
39
109
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
-
41
- ## Code of Conduct
42
-
43
- Everyone interacting in the Paygate project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/paygate/blob/master/CODE_OF_CONDUCT.md).
@@ -1,3 +1,3 @@
1
1
  module Paygate
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paygate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marko Manojlovic