wepay-api 0.1.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 +7 -0
- data/.gitignore +21 -0
- data/.travis.yml +6 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +118 -0
- data/Rakefile +7 -0
- data/lib/wepay-api.rb +2 -0
- data/lib/wepay.rb +23 -0
- data/lib/wepay/api.rb +27 -0
- data/lib/wepay/api/account.rb +86 -0
- data/lib/wepay/api/base.rb +25 -0
- data/lib/wepay/api/checkout.rb +68 -0
- data/lib/wepay/api/preapproval.rb +50 -0
- data/lib/wepay/api/subscription.rb +50 -0
- data/lib/wepay/api/subscription_plan.rb +59 -0
- data/lib/wepay/api/withdrawal.rb +41 -0
- data/lib/wepay/client.rb +63 -0
- data/lib/wepay/client/data.rb +31 -0
- data/lib/wepay/client/token.rb +30 -0
- data/lib/wepay/configuration.rb +34 -0
- data/lib/wepay/error.rb +28 -0
- data/lib/wepay/middleware.rb +44 -0
- data/lib/wepay/oauth.rb +32 -0
- data/lib/wepay/version.rb +3 -0
- data/spec/fixtures/vcr_cassettes/Wepay_Middleware/Wepay_Middleware_CheckStatus/raises_a_Wepay_ApiError_with_proper_error_type_message_and_code.yml +35 -0
- data/spec/fixtures/vcr_cassettes/wepay_account.yml +38 -0
- data/spec/fixtures/vcr_cassettes/wepay_account_add_bank.yml +38 -0
- data/spec/fixtures/vcr_cassettes/wepay_account_balance.yml +38 -0
- data/spec/fixtures/vcr_cassettes/wepay_account_create.yml +46 -0
- data/spec/fixtures/vcr_cassettes/wepay_account_delete.yml +48 -0
- data/spec/fixtures/vcr_cassettes/wepay_account_find.yml +43 -0
- data/spec/fixtures/vcr_cassettes/wepay_account_get_tax.yml +38 -0
- data/spec/fixtures/vcr_cassettes/wepay_account_modify.yml +49 -0
- data/spec/fixtures/vcr_cassettes/wepay_account_set_tax.yml +38 -0
- data/spec/fixtures/vcr_cassettes/wepay_checkout.yml +40 -0
- data/spec/fixtures/vcr_cassettes/wepay_checkout_cancel.yml +38 -0
- data/spec/fixtures/vcr_cassettes/wepay_checkout_capture.yml +38 -0
- data/spec/fixtures/vcr_cassettes/wepay_checkout_create.yml +38 -0
- data/spec/fixtures/vcr_cassettes/wepay_checkout_find.yml +51 -0
- data/spec/fixtures/vcr_cassettes/wepay_checkout_modify.yml +40 -0
- data/spec/fixtures/vcr_cassettes/wepay_checkout_refund.yml +38 -0
- data/spec/fixtures/vcr_cassettes/wepay_preapproval.yml +39 -0
- data/spec/fixtures/vcr_cassettes/wepay_preapproval_cancel.yml +38 -0
- data/spec/fixtures/vcr_cassettes/wepay_preapproval_create.yml +38 -0
- data/spec/fixtures/vcr_cassettes/wepay_preapproval_find.yml +39 -0
- data/spec/fixtures/vcr_cassettes/wepay_preapproval_modify.yml +39 -0
- data/spec/fixtures/vcr_cassettes/wepay_subscription.yml +38 -0
- data/spec/fixtures/vcr_cassettes/wepay_subscription_cancel.yml +36 -0
- data/spec/fixtures/vcr_cassettes/wepay_subscription_create.yml +48 -0
- data/spec/fixtures/vcr_cassettes/wepay_subscription_find.yml +38 -0
- data/spec/fixtures/vcr_cassettes/wepay_subscription_modify.yml +38 -0
- data/spec/fixtures/vcr_cassettes/wepay_subscription_plan.yml +39 -0
- data/spec/fixtures/vcr_cassettes/wepay_subscription_plan_create.yml +48 -0
- data/spec/fixtures/vcr_cassettes/wepay_subscription_plan_delete.yml +48 -0
- data/spec/fixtures/vcr_cassettes/wepay_subscription_plan_find.yml +39 -0
- data/spec/fixtures/vcr_cassettes/wepay_subscription_plan_get_button.yml +48 -0
- data/spec/fixtures/vcr_cassettes/wepay_subscription_plan_modify.yml +49 -0
- data/spec/fixtures/vcr_cassettes/wepay_withdrawal.yml +38 -0
- data/spec/fixtures/vcr_cassettes/wepay_withdrawal_create.yml +38 -0
- data/spec/fixtures/vcr_cassettes/wepay_withdrawal_find.yml +38 -0
- data/spec/fixtures/vcr_cassettes/wepay_withdrawal_modify.yml +38 -0
- data/spec/settings.yml.example +6 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/support/matchers.rb +5 -0
- data/spec/support/rspec_helper.rb +30 -0
- data/spec/support/settings.rb +14 -0
- data/spec/support/vcr.rb +17 -0
- data/spec/wepay/api/account_spec.rb +110 -0
- data/spec/wepay/api/checkout_spec.rb +86 -0
- data/spec/wepay/api/preapproval_spec.rb +69 -0
- data/spec/wepay/api/subscription_plan_spec.rb +83 -0
- data/spec/wepay/api/subscription_spec.rb +65 -0
- data/spec/wepay/api/withdrawal_spec.rb +53 -0
- data/spec/wepay/api_spec.rb +9 -0
- data/spec/wepay/configuration_spec.rb +25 -0
- data/spec/wepay/middleware_spec.rb +21 -0
- data/spec/wepay/oauth_spec.rb +23 -0
- data/wepay-api.gemspec +29 -0
- metadata +273 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 69fe9591ca7ea909e13e1301d6b93b87c2c21588
|
|
4
|
+
data.tar.gz: ce7367f286d651a7efbc83ff695118a96389602c
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 196804d90615ef5986048dedc4a5c99fd2e0a6abe73326632dcc211586021ea0ba062b336e915d2ca44d6133bdfacc945903b4fcc3d1a873808c1344aaa2d73f
|
|
7
|
+
data.tar.gz: 11402411fcd33b29c230c716d464270d0c35b928e86e325fda68a34ea0cac484bcbf1d657445f09c523f99dbdb348a2c063b3b32b40bfdbfcda9ccc7ffed76e5
|
data/.gitignore
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
.bundle
|
|
4
|
+
.config
|
|
5
|
+
.yardoc
|
|
6
|
+
Gemfile.lock
|
|
7
|
+
InstalledFiles
|
|
8
|
+
_yardoc
|
|
9
|
+
coverage
|
|
10
|
+
doc/
|
|
11
|
+
lib/bundler/man
|
|
12
|
+
pkg
|
|
13
|
+
rdoc
|
|
14
|
+
spec/reports
|
|
15
|
+
test/tmp
|
|
16
|
+
test/version_tmp
|
|
17
|
+
tmp
|
|
18
|
+
*.iml
|
|
19
|
+
.idea
|
|
20
|
+
.rvmrc
|
|
21
|
+
spec/settings.yml
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2013 Anh Nguyen
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
[](https://travis-ci.org/B-Sides/wepay-api)
|
|
2
|
+
|
|
3
|
+
# wepay-api
|
|
4
|
+
|
|
5
|
+
`wepay-api` is a Ruby wrapper for Wepay API.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add this line to your application's Gemfile:
|
|
10
|
+
|
|
11
|
+
gem 'wepay-api'
|
|
12
|
+
|
|
13
|
+
Or install it yourself as:
|
|
14
|
+
|
|
15
|
+
$ gem install wepay-api
|
|
16
|
+
|
|
17
|
+
## Configuration
|
|
18
|
+
`wepay-api` can be configured as following:
|
|
19
|
+
|
|
20
|
+
```ruby
|
|
21
|
+
Wepay.configure do |config|
|
|
22
|
+
config.client_id = ... # app id (compulsory)
|
|
23
|
+
config.client_secret = ... # app secret (compulsory)
|
|
24
|
+
config.access_token = ... # access token of the app (compulsory)
|
|
25
|
+
config.account_id = ... # caller's account id (compulsory)
|
|
26
|
+
config.scope = ... # the permission for OAuth authorization (compulsory)
|
|
27
|
+
config.using_stage = ... # set to true/false (compulsory)
|
|
28
|
+
config.open_timeout = 5 # default is 5 seconds (optional)
|
|
29
|
+
config.timeout = 10 # default is 10 seconds (optional)
|
|
30
|
+
end
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
### OAuth
|
|
36
|
+
#### OAuth authorization URL
|
|
37
|
+
To get the authorization URL for OAuth, use following method:
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
Wepay.authorization_url(redirect_uri)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Refer to [https://stage.wepay.com/developer/reference/oauth2#authorize](https://stage.wepay.com/developer/reference/oauth2#authorize) for more details.
|
|
44
|
+
|
|
45
|
+
#### User's access token
|
|
46
|
+
To get the access token from user, use following method:
|
|
47
|
+
|
|
48
|
+
```ruby
|
|
49
|
+
Wepay.get_access_token(code, redirect_uri)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Refer to [https://stage.wepay.com/developer/reference/oauth2#token](https://stage.wepay.com/developer/reference/oauth2#token) for more details.
|
|
53
|
+
|
|
54
|
+
### API
|
|
55
|
+
#### Available API
|
|
56
|
+
- [/account](lib/wepay/api/account.rb)
|
|
57
|
+
- [/checkout](lib/wepay/api/checkout.rb)
|
|
58
|
+
- [/preapproval](lib/wepay/api/preapproval.rb)
|
|
59
|
+
- [/subscription_plan](lib/wepay/api/subscription_plan.rb)
|
|
60
|
+
- [/subscription](lib/wepay/api/subscription.rb)
|
|
61
|
+
- [/withdrawal](lib/wepay/api/withdrawal.rb)
|
|
62
|
+
|
|
63
|
+
Notice: WePay is using **POST** for **ALL** the requests, **even the API method says "get_..."**
|
|
64
|
+
|
|
65
|
+
#### API calls
|
|
66
|
+
In order to make an API call, we can follow the convention for the method call:
|
|
67
|
+
|
|
68
|
+
Wepay.`api_type`.`api_method`(params)
|
|
69
|
+
|
|
70
|
+
For example, to create a checkout:
|
|
71
|
+
|
|
72
|
+
```ruby
|
|
73
|
+
Wepay.checkout.create(
|
|
74
|
+
short_description: "my description for the checkout",
|
|
75
|
+
type: "GOODS",
|
|
76
|
+
fee_payer: "payee",
|
|
77
|
+
amount: 10,
|
|
78
|
+
redirect_uri: "redirect_uri",
|
|
79
|
+
...
|
|
80
|
+
)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`params` is a Hash which captures the whole query as in Wepay API documentation, so refer to the documentation if any doubts.
|
|
84
|
+
|
|
85
|
+
Response from these API calls will be converted to `Hashied::Mash` object to make it easier for data accessing.
|
|
86
|
+
Refer to [https://github.com/intridea/hashie#mash](https://github.com/intridea/hashie#mash) for more details.
|
|
87
|
+
|
|
88
|
+
#### User's authorized calls
|
|
89
|
+
After configured, the http client from `wepay-api` will try to make use of app's `access_token` (in the configuration) as the default authorization of the api calls.
|
|
90
|
+
There are some situations that user's `access_token` need to be used, e.g. create an account for the user, so we can embed the user's `access_token`
|
|
91
|
+
in the call by adding field `access_token` to the params, for example:
|
|
92
|
+
|
|
93
|
+
```ruby
|
|
94
|
+
Wepay.account.create(
|
|
95
|
+
...
|
|
96
|
+
access_token: "user's access token"
|
|
97
|
+
)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
#### Error/ Exception
|
|
101
|
+
If an API call has errors, it will raise an Wepay::ApiError with following fields:
|
|
102
|
+
- type, e.g. invalid_request
|
|
103
|
+
- code, e.g. 1001
|
|
104
|
+
- message
|
|
105
|
+
|
|
106
|
+
Give a rescue block to the API calls to make sure the error is handled in any situation.
|
|
107
|
+
|
|
108
|
+
## Development notes
|
|
109
|
+
- Copy `spec/settings.yml.example` into `spec/settings.yml` and replace with your credentials to make record the requests for testing using VCR
|
|
110
|
+
- Before committing VCR fixtures, remember to remove any sensitive data from the fixtures: account id, client secret, ...
|
|
111
|
+
|
|
112
|
+
## Contributing
|
|
113
|
+
|
|
114
|
+
1. Fork it
|
|
115
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
116
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
117
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
118
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lib/wepay-api.rb
ADDED
data/lib/wepay.rb
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'wepay/error'
|
|
2
|
+
require 'wepay/configuration'
|
|
3
|
+
require 'wepay/oauth'
|
|
4
|
+
|
|
5
|
+
require 'wepay/middleware'
|
|
6
|
+
require 'wepay/client'
|
|
7
|
+
require 'wepay/client/data'
|
|
8
|
+
require 'wepay/client/token'
|
|
9
|
+
|
|
10
|
+
require 'wepay/api'
|
|
11
|
+
require 'wepay/api/base'
|
|
12
|
+
require 'wepay/api/checkout'
|
|
13
|
+
require 'wepay/api/account'
|
|
14
|
+
require 'wepay/api/preapproval'
|
|
15
|
+
require 'wepay/api/withdrawal'
|
|
16
|
+
require 'wepay/api/subscription_plan'
|
|
17
|
+
require 'wepay/api/subscription'
|
|
18
|
+
|
|
19
|
+
module Wepay
|
|
20
|
+
extend Wepay::Configuration
|
|
21
|
+
extend Wepay::Api
|
|
22
|
+
extend Wepay::OAuth
|
|
23
|
+
end
|
data/lib/wepay/api.rb
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Wepay
|
|
2
|
+
module Api
|
|
3
|
+
def account
|
|
4
|
+
Wepay::Api::Account.new
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def checkout
|
|
8
|
+
Wepay::Api::Checkout.new
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def preapproval
|
|
12
|
+
Wepay::Api::Preapproval.new
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def withdrawal
|
|
16
|
+
Wepay::Api::Withdrawal.new
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def subscription_plan
|
|
20
|
+
Wepay::Api::SubscriptionPlan.new
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def subscription
|
|
24
|
+
Wepay::Api::Subscription.new
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
module Wepay
|
|
2
|
+
module Api
|
|
3
|
+
class Account < Base
|
|
4
|
+
##
|
|
5
|
+
# @param params [Hash] See documentation below
|
|
6
|
+
# @return [Hashie::Mash]
|
|
7
|
+
# @docs [/account](https://www.wepay.com/developer/reference/account#lookup)
|
|
8
|
+
#
|
|
9
|
+
def show(params)
|
|
10
|
+
post 'account', params
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
##
|
|
14
|
+
# @param params [Hash] See documentation below
|
|
15
|
+
# @return [Hashie::Mash]
|
|
16
|
+
# @docs [/account/find](https://www.wepay.com/developer/reference/account#find)
|
|
17
|
+
#
|
|
18
|
+
def find(params)
|
|
19
|
+
post 'account/find', params
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
##
|
|
23
|
+
# @param params [Hash] See documentation below
|
|
24
|
+
# @return [Hashie::Mash]
|
|
25
|
+
# @docs [/account/create](https://www.wepay.com/developer/reference/account#create)
|
|
26
|
+
#
|
|
27
|
+
def create(params)
|
|
28
|
+
post 'account/create', params
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
##
|
|
32
|
+
# @param params [Hash] See documentation below
|
|
33
|
+
# @return [Hashie::Mash]
|
|
34
|
+
# @docs [/account/modify](https://www.wepay.com/developer/reference/account#modify)
|
|
35
|
+
#
|
|
36
|
+
def modify(params)
|
|
37
|
+
post 'account/modify', params
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
##
|
|
41
|
+
# @param params [Hash] See documentation below
|
|
42
|
+
# @return [Hashie::Mash]
|
|
43
|
+
# @docs [/account/delete](https://www.wepay.com/developer/reference/account#delete)
|
|
44
|
+
#
|
|
45
|
+
def delete(params)
|
|
46
|
+
post 'account/delete', params
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
##
|
|
50
|
+
# @param params [Hash] See documentation below
|
|
51
|
+
# @return [Hashie::Mash]
|
|
52
|
+
# @docs [/account/balance](https://www.wepay.com/developer/reference/account#balance)
|
|
53
|
+
#
|
|
54
|
+
def balance(params)
|
|
55
|
+
post 'account/balance', params
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
##
|
|
59
|
+
# @param params [Hash] See documentation below
|
|
60
|
+
# @return [Hashie::Mash]
|
|
61
|
+
# @docs [/account/add_bank](https://www.wepay.com/developer/reference/account#add_bank)
|
|
62
|
+
#
|
|
63
|
+
def add_bank(params)
|
|
64
|
+
post 'account/add_bank', params
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
##
|
|
68
|
+
# @param params [Hash] See documentation below
|
|
69
|
+
# @return [Hashie::Mash]
|
|
70
|
+
# @docs [/account/set_tax](https://www.wepay.com/developer/reference/account#set_tax)
|
|
71
|
+
#
|
|
72
|
+
def set_tax(params)
|
|
73
|
+
post 'account/set_tax', params
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
##
|
|
77
|
+
# @param params [Hash] See documentation below
|
|
78
|
+
# @return [Hashie::Mash]
|
|
79
|
+
# @docs [/account/get_tax](https://www.wepay.com/developer/reference/account#get_tax)
|
|
80
|
+
#
|
|
81
|
+
def get_tax(params)
|
|
82
|
+
post 'account/get_tax', params
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Wepay
|
|
2
|
+
module Api
|
|
3
|
+
class Base
|
|
4
|
+
def initialize
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
private
|
|
8
|
+
def get(path, params = {})
|
|
9
|
+
make_request(:get, path, params)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def post(path, params = {})
|
|
13
|
+
make_request(:post, path, params)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def make_request(http_method, path, params = {})
|
|
17
|
+
client.send(http_method, path, params)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def client
|
|
21
|
+
@client ||= ::Wepay::Client::Data.new
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
module Wepay
|
|
2
|
+
module Api
|
|
3
|
+
class Checkout < Base
|
|
4
|
+
##
|
|
5
|
+
# @param params [Hash] See documentation below
|
|
6
|
+
# @return [Hashie::Mash]
|
|
7
|
+
# @docs [/checkout](https://www.wepay.com/developer/reference/checkout#lookup)
|
|
8
|
+
#
|
|
9
|
+
def show(params)
|
|
10
|
+
post 'checkout', params
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
##
|
|
14
|
+
# @param params [Hash] See documentation below
|
|
15
|
+
# @return [Hashie::Mash]
|
|
16
|
+
# @docs [/checkout/find](https://www.wepay.com/developer/reference/checkout#find)
|
|
17
|
+
#
|
|
18
|
+
def find(params)
|
|
19
|
+
post 'checkout/find', params
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
##
|
|
23
|
+
# @param params [Hash] See documentation below
|
|
24
|
+
# @return [Hashie::Mash]
|
|
25
|
+
# @docs [/checkout/create](https://www.wepay.com/developer/reference/checkout#create)
|
|
26
|
+
#
|
|
27
|
+
def create(params)
|
|
28
|
+
post 'checkout/create', params
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
##
|
|
32
|
+
# @param params [Hash] See documentation below
|
|
33
|
+
# @return [Hashie::Mash]
|
|
34
|
+
# @docs [/checkout/cancel](https://www.wepay.com/developer/reference/checkout#cancel)
|
|
35
|
+
#
|
|
36
|
+
def cancel(params)
|
|
37
|
+
post 'checkout/cancel', params
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
##
|
|
41
|
+
# @param params [Hash] See documentation below
|
|
42
|
+
# @return [Hashie::Mash]
|
|
43
|
+
# @docs [/checkout/refund](https://www.wepay.com/developer/reference/checkout#refund)
|
|
44
|
+
#
|
|
45
|
+
def refund(params)
|
|
46
|
+
post 'checkout/refund', params
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
##
|
|
50
|
+
# @param params [Hash] See documentation below
|
|
51
|
+
# @return [Hashie::Mash]
|
|
52
|
+
# @docs [/checkout/capture](https://www.wepay.com/developer/reference/checkout#capture)
|
|
53
|
+
#
|
|
54
|
+
def capture(params)
|
|
55
|
+
post 'checkout/capture', params
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
##
|
|
59
|
+
# @param params [Hash] See documentation below
|
|
60
|
+
# @return [Hashie::Mash]
|
|
61
|
+
# @docs [/checkout/modify](https://www.wepay.com/developer/reference/checkout#modify)
|
|
62
|
+
#
|
|
63
|
+
def modify(params)
|
|
64
|
+
post 'checkout/modify', params
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
module Wepay
|
|
2
|
+
module Api
|
|
3
|
+
class Preapproval < Base
|
|
4
|
+
##
|
|
5
|
+
# @param params [Hash] See documentation below
|
|
6
|
+
# @return [Hashie::Mash]
|
|
7
|
+
# @docs [/preapproval](https://www.wepay.com/developer/reference/preapproval#lookup)
|
|
8
|
+
#
|
|
9
|
+
def show(params)
|
|
10
|
+
post 'preapproval', params
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
##
|
|
14
|
+
# @param params [Hash] See documentation below
|
|
15
|
+
# @return [Hashie::Mash]
|
|
16
|
+
# @docs [/preapproval/find](https://www.wepay.com/developer/reference/preapproval#find)
|
|
17
|
+
#
|
|
18
|
+
def find(params)
|
|
19
|
+
post 'preapproval/find', params
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
##
|
|
23
|
+
# @param params [Hash] See documentation below
|
|
24
|
+
# @return [Hashie::Mash]
|
|
25
|
+
# @docs [/preapproval/create](https://www.wepay.com/developer/reference/preapproval#create)
|
|
26
|
+
#
|
|
27
|
+
def create(params)
|
|
28
|
+
post 'preapproval/create', params
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
##
|
|
32
|
+
# @param params [Hash] See documentation below
|
|
33
|
+
# @return [Hashie::Mash]
|
|
34
|
+
# @docs [/preapproval/cancel](https://www.wepay.com/developer/reference/preapproval#cancel)
|
|
35
|
+
#
|
|
36
|
+
def cancel(params)
|
|
37
|
+
post 'preapproval/cancel', params
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
##
|
|
41
|
+
# @param params [Hash] See documentation below
|
|
42
|
+
# @return [Hashie::Mash]
|
|
43
|
+
# @docs [/preapproval/modify](https://www.wepay.com/developer/reference/preapproval#modify)
|
|
44
|
+
#
|
|
45
|
+
def modify(params)
|
|
46
|
+
post 'preapproval/modify', params
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|