ecocash 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0c8ebac975bbc7e9a427c34e38853f829ea0c89c118db4c50494905cd6b60e6
4
- data.tar.gz: d54e8177603ea06064de132af2589059a00893018d763021d6bbbc457be4883e
3
+ metadata.gz: 721a42b256abe5bf70c784a85fa40a3e8ccb12d45296df596d3ed12026a26fb8
4
+ data.tar.gz: bb346238071229f8e4a796f4981874bcb3ada5f6412474e1f50a8b7f1a830252
5
5
  SHA512:
6
- metadata.gz: 3da1de1ab76cf05ce6f3e9f80d733ec3ffcee1d5c79064491a48c72162500fef590c1a93ddfb1d174b38da4cb43347041bcc45f4cd3d19bb0ebf6a8fd5692389
7
- data.tar.gz: ece47ab1ac200a3381b01a0ef005735b84e2179de78fc13f8ab6e0dba06c8675c3914b65b2b27015eb96f52770c78b58ba03a6056f94ea9490da8c0af7184782
6
+ metadata.gz: 1da95e90829fce195368efd0660c62d4c770eede057a2d569811b361e499101dfae5f1dea89ae6a9975df1fb9008f6cb09bd599253a825ec5b46462451945b12
7
+ data.tar.gz: 18aa68a07344c842736e42b3c81974e183861f15fe3adae3dceb61ab7b4bd84e14eb0fd6f6caa829ed7baa2684a0ac0ddc3b3e5471d2632d31d870babc2cedc5
@@ -0,0 +1,19 @@
1
+ CONTRIBUTING
2
+ ============
3
+
4
+ Recommended steps when submitting a pull request:
5
+
6
+ 1. Fork the repository.
7
+ 2. Create a topic branch.
8
+ 3. Implement your feature or bug fix.
9
+ 4. Write a failing test(using Minitest) to capture existing bug or lack of feature.
10
+ 5. Check that tests pass locally.
11
+ 6. Commit changes (see [how to write good commits][1]).
12
+ 7. Push changes to GitHub.
13
+ 8. Check if tests pass on CI.
14
+ 9. Submit a Pull Request.
15
+ 10. You will get some feedback and may need to push additional commits
16
+ with more fixes to the same branch; this will update your pull request
17
+ automatically.
18
+
19
+ [1]: http://chris.beams.io/posts/git-commit/
@@ -1,14 +1,18 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ecocash (1.0.0)
4
+ ecocash (1.2.0)
5
5
  httparty (~> 0.16.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- httparty (0.16.2)
10
+ httparty (0.16.4)
11
+ mime-types (~> 3.0)
11
12
  multi_xml (>= 0.5.2)
13
+ mime-types (3.3.1)
14
+ mime-types-data (~> 3.2015)
15
+ mime-types-data (3.2019.1009)
12
16
  minitest (5.11.3)
13
17
  multi_xml (0.6.0)
14
18
  rake (10.5.0)
@@ -23,4 +27,4 @@ DEPENDENCIES
23
27
  rake (~> 10.0)
24
28
 
25
29
  BUNDLED WITH
26
- 1.16.6
30
+ 1.17.3
data/README.md CHANGED
@@ -1,2 +1,107 @@
1
1
  # EcoCash Ruby Library
2
- This library provides developers with convenient access to the EcoCash Instant Payments(EIP) API from applications written in Ruby.
2
+
3
+ This library provides developers with convenient access to the EcoCash Instant Payments(EIP) API from applications written in Ruby. The EcoCash Online API provides functionality to receive payments directly on your website or easily refund transactions to your customers.
4
+
5
+ ## Documentation
6
+
7
+ See the [Ruby API docs](https://www.rubydoc.info/gems/ecocash/1.0.0)
8
+
9
+ ## Requirements
10
+ To use the EcoCash Online API, the following things are required:
11
+ + Get yourself a Merchant account from [EcoCash](https://www.ecocash.co.zw/)
12
+ + Apply to be an Online Merchant(This is subject to approval)
13
+ + Now you're ready to use EcoCash Online API
14
+ + In order to accept payments in production mode, your integration will need to be verified by EcoCash.
15
+
16
+ ## Installing
17
+
18
+ This package is available in RubyGems and can be installed with:
19
+ ```shell
20
+ gem install ecocash
21
+ ```
22
+ Or import it to your Gemfile
23
+ ```ruby
24
+ gem 'ecocash'
25
+ ```
26
+
27
+ ## Usage
28
+ ```ruby
29
+ require 'ecocash'
30
+ ```
31
+ Values you will need from Ecocash
32
+ + Username and password: These are credentials to authenticate the API
33
+ + Merchant number, merchant code and pin: You change PIN on the time of activating your merchant number.
34
+
35
+ ### Configuration
36
+ The library uses a configuration block for easy setup:
37
+
38
+ ```ruby
39
+ Ecocash.configure do |config|
40
+ config.api_base_url = ENV['API_BASE_URL']
41
+ #Authentication
42
+ config.username = ENV['USERNAME']
43
+ config.password = ENV['PASSWORD']
44
+ config.merchant_number =ENV['MERCHANT_NUMBER']
45
+ config.merchant_code = ENV['MERCHANT_CODE']
46
+ config.merchant_pin = ENV['MERCHANT_PIN']
47
+ #Payment information
48
+ config.description = "Payment description"
49
+ config.on_behalf_of = "Service description"
50
+ config.payment_remarks = "Transaction description"
51
+ config.reference_code = "Transaction reference"
52
+ config.purchase_category_code = "Online Payment"
53
+ config.refund_remarks = "Refund transaction description"
54
+ #Merchant details
55
+ config.super_merchant_name = ENV['SUPER_MERCHANT_NAME']
56
+ config.merchant_name = ENV['MERCHANT_NAME']
57
+ config.terminal_id = "unique identifier"
58
+ config.location = "your business physical location"
59
+ config.notify_url = ENV['YOUR_CALLBACK_URL']
60
+
61
+ config.currency_code = "USD"
62
+ config.country_code = "ZW"
63
+ #Client Correlator Prefix
64
+ config.client_correlator_prefix = "any letter(up to 7) to prefix your client correlator"
65
+ end
66
+ ```
67
+
68
+ Initialize the API client
69
+ ```ruby
70
+ client = Ecocash::Client.new
71
+ ```
72
+
73
+ ### Charge Subscriber
74
+ ```ruby
75
+ client.charge_subscriber('subscriber_mobile_number','amount')
76
+ ```
77
+
78
+ ### Refund Subscriber
79
+ ```ruby
80
+ client.transaction_reversal('subscriber_mobile_number','transaction_id','amount')
81
+ ```
82
+
83
+ ### Transaction Status
84
+ ```ruby
85
+ client.transaction_status('subscriber_mobile_number','client_correlator')
86
+ ```
87
+
88
+ ### List Subscriber Transactions
89
+ ```ruby
90
+ client.list_transactions('subscriber_mobile_number')
91
+ ```
92
+
93
+ ## API Documentation
94
+ The API document can be obtain from EcoCash upon approval of your application.
95
+
96
+ ## Contributing
97
+
98
+ Please read [CONTRIBUTING.md](https://github.com/tusomx/ecocash/blob/master/CONTRIBUTING.md) for details and the process for submitting pull requests to us.
99
+
100
+ ## Versioning
101
+
102
+ We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/tusomx/ecocash/tags).
103
+
104
+ ## License
105
+
106
+ This project is licensed under the MIT License - see the [LICENSE](https://github.com/tusomx/ecocash/blob/master/LICENSE) file for details
107
+
@@ -45,9 +45,9 @@ module Ecocash
45
45
  end
46
46
 
47
47
  def transaction_status(msisdn, client_correlator)
48
- url = "#{Ecocash.configuration.api_base_url}/#{msisdn}/transactions/amount/#{client_correlator}}"
48
+ url = "#{Ecocash.configuration.api_base_url}/#{msisdn}/transactions/amount/#{client_correlator}"
49
49
  options = {
50
- basic_auth: self.class.auth,
50
+ basic_auth: auth,
51
51
  headers: { 'Content-Type' => 'application/json' }
52
52
  }
53
53
  response = self.class.get(url, options)
@@ -108,7 +108,9 @@ module Ecocash
108
108
  private
109
109
 
110
110
  def generated_client_correlator
111
- Time.zone.now.strftime('GD%d%m%Y%H%M%S%L%3N')
111
+ Time.now.strftime(
112
+ "#{Ecocash.configuration.client_correlator_prefix}%d%m%Y%H%M%S%L%3N"
113
+ )
112
114
  end
113
115
 
114
116
  def auth
@@ -18,7 +18,8 @@ module Ecocash
18
18
  :merchant_name,
19
19
  :purchase_category_code,
20
20
  :description,
21
- :reference_code
21
+ :reference_code,
22
+ :client_correlator_prefix
22
23
 
23
24
  def initialize
24
25
  @username = nil
@@ -40,6 +41,7 @@ module Ecocash
40
41
  @purchase_category_code = nil
41
42
  @description = nil
42
43
  @reference_code = nil
44
+ @client_correlator_prefix = nil
43
45
  end
44
46
  end
45
47
  end
@@ -1,3 +1,3 @@
1
1
  module Ecocash
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecocash
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kudzai Tuso
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-04 00:00:00.000000000 Z
11
+ date: 2020-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -77,6 +77,7 @@ files:
77
77
  - ".gitignore"
78
78
  - ".rubocop.yml"
79
79
  - ".travis.yml"
80
+ - CONTRIBUTING.md
80
81
  - Gemfile
81
82
  - Gemfile.lock
82
83
  - LICENSE
@@ -110,8 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
111
  - !ruby/object:Gem::Version
111
112
  version: '0'
112
113
  requirements: []
113
- rubyforge_project:
114
- rubygems_version: 2.7.6
114
+ rubygems_version: 3.0.6
115
115
  signing_key:
116
116
  specification_version: 4
117
117
  summary: Ruby wrapper for EcoCash API