webpay 2.4.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -2
- data/Rakefile +0 -6
- data/lib/webpay/account.rb +19 -24
- data/lib/webpay/api_resource.rb +5 -0
- data/lib/webpay/charge.rb +48 -27
- data/lib/webpay/customer.rb +56 -91
- data/lib/webpay/data_types.rb +2069 -0
- data/lib/webpay/error.rb +68 -0
- data/lib/webpay/event.rb +19 -16
- data/lib/webpay/recursion.rb +47 -46
- data/lib/webpay/shop.rb +37 -68
- data/lib/webpay/token.rb +19 -10
- data/lib/webpay.rb +114 -77
- data/webpay.gemspec +6 -13
- metadata +16 -179
- data/.rspec +0 -2
- data/.travis.yml +0 -12
- data/LICENSE.txt +0 -22
- data/README.md +0 -52
- data/gemfiles/no_doc_gems +0 -14
- data/lib/data/ca-certificates.crt +0 -3829
- data/lib/webpay/card.rb +0 -13
- data/lib/webpay/client.rb +0 -81
- data/lib/webpay/deleted_entity.rb +0 -8
- data/lib/webpay/entity.rb +0 -71
- data/lib/webpay/entity_list.rb +0 -25
- data/lib/webpay/fee.rb +0 -13
- data/lib/webpay/operations.rb +0 -49
- data/lib/webpay/response_converter.rb +0 -57
- data/lib/webpay/version.rb +0 -5
- data/lib/webpay/webpay_error.rb +0 -126
- data/spec/resources/account/delete.txt +0 -15
- data/spec/resources/account/retrieve.txt +0 -23
- data/spec/resources/charges/all.txt +0 -139
- data/spec/resources/charges/capture.txt +0 -49
- data/spec/resources/charges/create_with_card.txt +0 -49
- data/spec/resources/charges/create_with_customer.txt +0 -49
- data/spec/resources/charges/refund.txt +0 -57
- data/spec/resources/charges/retrieve.txt +0 -49
- data/spec/resources/charges/retrieve_not_captured.txt +0 -42
- data/spec/resources/customers/all.txt +0 -76
- data/spec/resources/customers/create.txt +0 -31
- data/spec/resources/customers/delete.txt +0 -16
- data/spec/resources/customers/retrieve.txt +0 -63
- data/spec/resources/customers/retrieve_deleted.txt +0 -16
- data/spec/resources/customers/update.txt +0 -31
- data/spec/resources/errors/bad_request.txt +0 -18
- data/spec/resources/errors/broken_json.txt +0 -16
- data/spec/resources/errors/card_error.txt +0 -19
- data/spec/resources/errors/not_found.txt +0 -18
- data/spec/resources/errors/not_found_ja.txt +0 -20
- data/spec/resources/errors/unauthorized.txt +0 -16
- data/spec/resources/errors/unknown_api_error.txt +0 -17
- data/spec/resources/events/all_with_type.txt +0 -164
- data/spec/resources/events/retrieve.txt +0 -41
- data/spec/resources/recursions/all.txt +0 -61
- data/spec/resources/recursions/create.txt +0 -26
- data/spec/resources/recursions/delete.txt +0 -16
- data/spec/resources/recursions/resume.txt +0 -26
- data/spec/resources/recursions/retrieve.txt +0 -26
- data/spec/resources/recursions/retrieve_deleted.txt +0 -16
- data/spec/resources/recursions/retrieve_suspended.txt +0 -26
- data/spec/resources/shops/all.txt +0 -122
- data/spec/resources/shops/create.txt +0 -54
- data/spec/resources/shops/retrieve.txt +0 -54
- data/spec/resources/shops/update.txt +0 -55
- data/spec/resources/tokens/create.txt +0 -30
- data/spec/resources/tokens/retrieve.txt +0 -30
- data/spec/spec_helper.rb +0 -37
- data/spec/webpay/account_spec.rb +0 -24
- data/spec/webpay/charge_spec.rb +0 -143
- data/spec/webpay/customer_spec.rb +0 -109
- data/spec/webpay/event_spec.rb +0 -30
- data/spec/webpay/recursion_spec.rb +0 -93
- data/spec/webpay/shop_spec.rb +0 -121
- data/spec/webpay/token_spec.rb +0 -33
- data/spec/webpay/webpay_error_spec.rb +0 -64
- data/spec/webpay_spec.rb +0 -40
data/lib/webpay/card.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
module WebPay
|
2
|
-
|
3
|
-
# Object for API response hash object with <code>hash['object'] = card</code>.
|
4
|
-
# Card is not accessible as an API endpoint
|
5
|
-
class Card < Entity
|
6
|
-
|
7
|
-
# Check equality with rhs
|
8
|
-
# @return [Boolean] true if rhs is the same object, or it is a Card with the same fingerprint value
|
9
|
-
def ==(other)
|
10
|
-
other.equals?(self) || (other.instance_of?(self.class) && other.fingerprint == self.fingerprint)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
data/lib/webpay/client.rb
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
require 'faraday'
|
2
|
-
require 'json'
|
3
|
-
|
4
|
-
module WebPay
|
5
|
-
|
6
|
-
# API client wrapping of Faraday.
|
7
|
-
# Not intended to use directly.
|
8
|
-
class Client
|
9
|
-
|
10
|
-
# Initialize client
|
11
|
-
#
|
12
|
-
# @param api_key [String] User's secret API key
|
13
|
-
# @param api_base [String] the URL without trailing '/'.
|
14
|
-
# @param api_version [String] the path indicating API version. `/v1`.
|
15
|
-
#
|
16
|
-
# @example Client for the default endpoint
|
17
|
-
# Client.new('test_secret_XXXX', 'https://api.webpay.jp', '/v1')
|
18
|
-
def initialize(api_key, api_base, api_version, api_proxy = nil, lang = :en)
|
19
|
-
ssl_options = {ca_file: WebPay.ssl_ca_file}
|
20
|
-
default_headers = {
|
21
|
-
'Authorization' => "Bearer #{api_key}",
|
22
|
-
'User-Agent' => "WebPay#{api_version} RubyBinding/#{WebPay::VERSION}",
|
23
|
-
'Accept-Language' => lang.to_s
|
24
|
-
}
|
25
|
-
@conn = Faraday.new(api_base, ssl: ssl_options, headers: default_headers, proxy: api_proxy) do |builder|
|
26
|
-
builder.request :url_encoded
|
27
|
-
builder.adapter Faraday.default_adapter
|
28
|
-
end
|
29
|
-
@api_version = api_version
|
30
|
-
end
|
31
|
-
|
32
|
-
# Convert faraday response to a hash by decoding JSON.
|
33
|
-
# This raises error if the response indicates error status.
|
34
|
-
#
|
35
|
-
# @api private
|
36
|
-
# @param response [Faraday::Response]
|
37
|
-
# @return [Hash] Raw object
|
38
|
-
# @raise [WebPay::WebPayError] For invalid requests (4xx) or internal server error (5xx)
|
39
|
-
def handle_response(response)
|
40
|
-
case response.status
|
41
|
-
when 200..299
|
42
|
-
begin
|
43
|
-
JSON.parse(response.body.force_encoding(infer_encoding(response)))
|
44
|
-
rescue JSON::ParserError => e
|
45
|
-
raise WebPay::APIConnectionError.new("Response JSON is broken. #{e.message}: #{response.body}", e)
|
46
|
-
end
|
47
|
-
else
|
48
|
-
raise WebPay::WebPayError.from_response(response.status, response.body)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
Faraday::Connection::METHODS.each do |method|
|
53
|
-
define_method(method) do |url, *args|
|
54
|
-
begin
|
55
|
-
response = @conn.__send__(method, @api_version + url, *args)
|
56
|
-
rescue Faraday::Error::ClientError, URI::InvalidURIError => e
|
57
|
-
raise WebPay::APIConnectionError.faraday_error(e)
|
58
|
-
end
|
59
|
-
handle_response(response)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
private
|
64
|
-
|
65
|
-
# Infer encoding from response
|
66
|
-
#
|
67
|
-
# @param response [Faraday::Response]
|
68
|
-
# @return [Encoding]
|
69
|
-
def infer_encoding(response)
|
70
|
-
unless (type = response.headers['content-type']) &&
|
71
|
-
(charset = type.split(';').find { |field| field.include?('charset=') })
|
72
|
-
return Encoding.default_external
|
73
|
-
end
|
74
|
-
|
75
|
-
encoding_string = charset.split('=', 2).last.strip
|
76
|
-
Encoding.find(encoding_string)
|
77
|
-
rescue
|
78
|
-
Encoding.default_external
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
data/lib/webpay/entity.rb
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
module WebPay
|
2
|
-
|
3
|
-
# The base class for entity objects
|
4
|
-
# @abstract
|
5
|
-
class Entity
|
6
|
-
class << self
|
7
|
-
include Operations
|
8
|
-
|
9
|
-
# Convert hash API response into an entity object
|
10
|
-
# @param [Hash] hash Raw API response
|
11
|
-
# @return [Entity] An entity object corresponds to hash
|
12
|
-
def convert(hash)
|
13
|
-
converter = ResponseConverter.new
|
14
|
-
converter.convert(hash)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
# Attributes of this object.
|
19
|
-
# <code>method_missing</code> and <code>#[]</code> are provided to access attributes
|
20
|
-
attr_reader :attributes
|
21
|
-
|
22
|
-
# Initialized by ResponseConverter
|
23
|
-
# @api private
|
24
|
-
def initialize(attributes)
|
25
|
-
@attributes = attributes
|
26
|
-
end
|
27
|
-
|
28
|
-
# @return [Boolean] true if rhs is the same object or has the same id
|
29
|
-
def ==(other)
|
30
|
-
other.equal?(self) || (other.instance_of?(self.class) && other.id == self.id)
|
31
|
-
end
|
32
|
-
|
33
|
-
# Access attribute.
|
34
|
-
# Using the attribute name as a method is recommended.
|
35
|
-
# @return [Object] The attribute's value
|
36
|
-
def [](key)
|
37
|
-
send(key)
|
38
|
-
end
|
39
|
-
|
40
|
-
# Return a hash similar to the response from API.
|
41
|
-
# @return [Hash] a hash similar to the response from API
|
42
|
-
def to_hash
|
43
|
-
Hash[@attributes.map { |k, v| [k, v.is_a?(Entity) ? v.to_hash : v] }]
|
44
|
-
end
|
45
|
-
|
46
|
-
alias_method :to_h, :to_hash
|
47
|
-
|
48
|
-
# Provide access to attributes
|
49
|
-
# @return [Object] The attribute's value
|
50
|
-
def method_missing(method_name, *args, &block)
|
51
|
-
key = method_name.to_s
|
52
|
-
if @attributes.has_key?(key)
|
53
|
-
@attributes[key]
|
54
|
-
else
|
55
|
-
super
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def respond_to_missing?(method_name, include_private = false)
|
60
|
-
@attributes.has_key?(method_name.to_s) || super
|
61
|
-
end
|
62
|
-
|
63
|
-
private
|
64
|
-
def update_attributes(attributes)
|
65
|
-
raise "unexpected object" if attributes['object'] != @attributes['object']
|
66
|
-
new_object = ResponseConverter.new.convert(attributes)
|
67
|
-
@attributes = new_object.attributes
|
68
|
-
self
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
data/lib/webpay/entity_list.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
module WebPay
|
2
|
-
|
3
|
-
# Object for API response hash object with <code>hash['object'] = list</code>.
|
4
|
-
# This enumerates containing data.
|
5
|
-
class EntityList < Entity
|
6
|
-
include Enumerable
|
7
|
-
|
8
|
-
# @return [Boolean] true if rhs is the same object or id lists of containing data are the same
|
9
|
-
def ==(other)
|
10
|
-
other.equal?(self) ||
|
11
|
-
(other.instance_of?(self.class) && other.data.map(&:id) == self.data.map(&:id))
|
12
|
-
end
|
13
|
-
|
14
|
-
# Return the all entry count, not limited by <code>limit</code>.
|
15
|
-
# This overrides <code>Enumerable#count</code>. Not necessarily equal to the data size.
|
16
|
-
def count
|
17
|
-
@attributes['count']
|
18
|
-
end
|
19
|
-
|
20
|
-
# Enumerate containing data.
|
21
|
-
def each(&block)
|
22
|
-
self.data.each(&block)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/lib/webpay/fee.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
module WebPay
|
2
|
-
|
3
|
-
# Object for API response hash object with <code>hash['object'] = fee</code>.
|
4
|
-
# Fee is not accessible as an API endpoint
|
5
|
-
class Fee < Entity
|
6
|
-
|
7
|
-
# Check equality with rhs
|
8
|
-
# @return [Boolean] true only if rhs is the same object
|
9
|
-
def ==(other)
|
10
|
-
self.equal?(other)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
data/lib/webpay/operations.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
module WebPay
|
2
|
-
|
3
|
-
# This module installs collection operations to entities.
|
4
|
-
# Some of <code>create</code>, <code>retrieve</code>, and <code>all</code> are defined as class methods.
|
5
|
-
module Operations
|
6
|
-
|
7
|
-
# Install selected operations
|
8
|
-
# @api private
|
9
|
-
def install_class_operations(*operations)
|
10
|
-
define_create if operations.include?(:create)
|
11
|
-
define_retrieve if operations.include?(:retrieve)
|
12
|
-
define_all if operations.include?(:all)
|
13
|
-
end
|
14
|
-
|
15
|
-
# Define <code>create</code> method
|
16
|
-
# @api private
|
17
|
-
def define_create
|
18
|
-
instance_eval do
|
19
|
-
def create(params = {})
|
20
|
-
convert(WebPay.client.post(path, params))
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
# Define <code>retrieve(id)</code> method
|
26
|
-
# @api private
|
27
|
-
def define_retrieve
|
28
|
-
instance_eval do
|
29
|
-
def retrieve(id)
|
30
|
-
id = id.to_s
|
31
|
-
if id.strip == ''
|
32
|
-
raise InvalidRequestError.invalid_id(id)
|
33
|
-
end
|
34
|
-
convert(WebPay.client.get([path, id].join('/')))
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
# Define <code>all</code> method
|
40
|
-
# @api private
|
41
|
-
def define_all
|
42
|
-
instance_eval do
|
43
|
-
def all(params = {})
|
44
|
-
convert(WebPay.client.get(path, params))
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
module WebPay
|
2
|
-
|
3
|
-
# Converts raw Hash response to an entity
|
4
|
-
class ResponseConverter
|
5
|
-
|
6
|
-
# Converts raw Hash response to an entity.
|
7
|
-
# This recursively changes internal objects.
|
8
|
-
# @param [Hash] attributes Raw API response
|
9
|
-
# @return [Entity] Corresponding entity
|
10
|
-
def convert(attributes)
|
11
|
-
case attributes['object']
|
12
|
-
when 'card'
|
13
|
-
Card.new(attributes)
|
14
|
-
when 'fee'
|
15
|
-
Fee.new(attributes)
|
16
|
-
when 'charge'
|
17
|
-
if attributes['card']
|
18
|
-
attributes['card'] = convert(attributes['card'])
|
19
|
-
end
|
20
|
-
if attributes['fees']
|
21
|
-
attributes['fees'] = attributes['fees'].map { |fee| convert(fee) }
|
22
|
-
end
|
23
|
-
Charge.new(attributes)
|
24
|
-
when 'customer'
|
25
|
-
if attributes['active_card']
|
26
|
-
attributes['active_card'] = convert(attributes['active_card'])
|
27
|
-
end
|
28
|
-
if attributes['recursions']
|
29
|
-
attributes['recursions'] = attributes['recursions'].map { |recursion| convert(recursion) }
|
30
|
-
end
|
31
|
-
Customer.new(attributes)
|
32
|
-
when 'token'
|
33
|
-
if attributes['card']
|
34
|
-
attributes['card'] = convert(attributes['card'])
|
35
|
-
end
|
36
|
-
Token.new(attributes)
|
37
|
-
when 'event'
|
38
|
-
if attributes['data']
|
39
|
-
attributes['data']['object'] = convert(attributes['data']['object'])
|
40
|
-
attributes['data'] = Event::Data.new(attributes['data'])
|
41
|
-
end
|
42
|
-
Event.new(attributes)
|
43
|
-
when 'shop'
|
44
|
-
Shop.new(attributes)
|
45
|
-
when 'recursion'
|
46
|
-
Recursion.new(attributes)
|
47
|
-
when 'account'
|
48
|
-
Account.new(attributes)
|
49
|
-
|
50
|
-
when 'list'
|
51
|
-
attributes['data'] ||= []
|
52
|
-
attributes['data'].map! { |line| convert(line) }
|
53
|
-
EntityList.new(attributes)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
data/lib/webpay/version.rb
DELETED
data/lib/webpay/webpay_error.rb
DELETED
@@ -1,126 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
module WebPay
|
3
|
-
|
4
|
-
# Abstract error class for WebPay errors.
|
5
|
-
# All WebPay error classes inherit this.
|
6
|
-
# This error itself is not raised.
|
7
|
-
class WebPayError < StandardError
|
8
|
-
# @api private
|
9
|
-
# @return [WebPayError]
|
10
|
-
def self.from_response(status, body)
|
11
|
-
hash =
|
12
|
-
begin
|
13
|
-
JSON.load(body)
|
14
|
-
rescue JSON::ParserError => e
|
15
|
-
return WebPay::APIConnectionError.new("Response JSON is broken. #{e.message}: #{body}", e)
|
16
|
-
end
|
17
|
-
unless hash['error']
|
18
|
-
return APIConnectionError.new("Invalid response #{body}")
|
19
|
-
end
|
20
|
-
error_hash = hash['error']
|
21
|
-
case status
|
22
|
-
when 400, 404
|
23
|
-
InvalidRequestError.new(status, error_hash)
|
24
|
-
when 401
|
25
|
-
AuthenticationError.new(status, error_hash)
|
26
|
-
when 402
|
27
|
-
CardError.new(status, error_hash)
|
28
|
-
else
|
29
|
-
APIError.new(status, error_hash)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
# @return [Integer, nil] HTTP status code
|
34
|
-
attr_reader :status
|
35
|
-
|
36
|
-
# @return [Hash, nil] Responded error object
|
37
|
-
attr_reader :error_response
|
38
|
-
|
39
|
-
def initialize(message, status = nil, error_response = nil)
|
40
|
-
@status, @error_response = status, error_response
|
41
|
-
super(message)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
# This error is raised when API request fails.
|
46
|
-
class APIConnectionError < WebPayError
|
47
|
-
# @api private
|
48
|
-
# @return [APIConnectionError]
|
49
|
-
def self.faraday_error(e)
|
50
|
-
new("Connection with WebPay API server failed. #{e.message}", e)
|
51
|
-
end
|
52
|
-
|
53
|
-
# @return [Error] The original error raised in request
|
54
|
-
attr_reader :original_error
|
55
|
-
|
56
|
-
def initialize(message, original_error = nil)
|
57
|
-
@original_error = original_error
|
58
|
-
super(message)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
# This error means WebPay service reported internal server error.
|
63
|
-
class APIError < WebPayError
|
64
|
-
|
65
|
-
# @return [String] 'api_error' or 'processing_error'
|
66
|
-
attr_reader :type
|
67
|
-
|
68
|
-
def initialize(status, error_response)
|
69
|
-
@type = error_response['type']
|
70
|
-
super(error_response['message'], status, error_response)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
# Occurs when api_key is invalid.
|
75
|
-
# Check again that a correct api_key is set
|
76
|
-
class AuthenticationError < WebPayError
|
77
|
-
def initialize(status, error_response)
|
78
|
-
super(error_response['message'], status, error_response)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
# Occurs when card information is invalid
|
83
|
-
class CardError < WebPayError
|
84
|
-
|
85
|
-
# @return [String] 'card_error'
|
86
|
-
attr_reader :type
|
87
|
-
|
88
|
-
# @return [String] Error code
|
89
|
-
attr_reader :code
|
90
|
-
|
91
|
-
# @return [String] The field where an error is detected
|
92
|
-
attr_reader :param
|
93
|
-
|
94
|
-
def initialize(status, error_response)
|
95
|
-
@type = error_response['type']
|
96
|
-
@code = error_response['code']
|
97
|
-
@param = error_response['param']
|
98
|
-
super(error_response['message'], status, error_response)
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
# Occurs when the specified entity is not found, or request parameters are
|
103
|
-
# invalid
|
104
|
-
class InvalidRequestError < WebPayError
|
105
|
-
|
106
|
-
# @return [String] 'invalid_request_error'
|
107
|
-
attr_reader :type
|
108
|
-
|
109
|
-
# @return [String] The field where an error is detected
|
110
|
-
attr_reader :param
|
111
|
-
|
112
|
-
def initialize(status, error_response)
|
113
|
-
@type = error_response['type']
|
114
|
-
@param = error_response['param']
|
115
|
-
super(error_response['message'], status, error_response)
|
116
|
-
end
|
117
|
-
|
118
|
-
# Internal
|
119
|
-
def self.invalid_id(id)
|
120
|
-
InvalidRequestError.new(nil, {
|
121
|
-
'type' => 'invalid_request_error',
|
122
|
-
'message' => "ID must not be empty",
|
123
|
-
'param' => 'id' })
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
HTTP/1.1 200 OK
|
2
|
-
Content-Type: application/json; charset=utf-8
|
3
|
-
X-Ua-Compatible: IE=Edge
|
4
|
-
Etag: "ffc2622aa8286367b501554d9625bc7e"
|
5
|
-
Cache-Control: max-age=0, private, must-revalidate
|
6
|
-
X-Request-Id: b90a98ba6c730796bb4651b30eefcf3d
|
7
|
-
X-Runtime: 0.030542
|
8
|
-
Server: WEBrick/1.3.1 (Ruby/1.9.3/2013-02-22)
|
9
|
-
Date: Wed, 11 Sep 2013 12:50:01 GMT
|
10
|
-
Content-Length: 22
|
11
|
-
Connection: Keep-Alive
|
12
|
-
|
13
|
-
{
|
14
|
-
"deleted": true
|
15
|
-
}
|
@@ -1,23 +0,0 @@
|
|
1
|
-
HTTP/1.1 200 OK
|
2
|
-
Content-Type: application/json; charset=utf-8
|
3
|
-
X-Ua-Compatible: IE=Edge
|
4
|
-
Etag: "bfda5f4ce8f4baff2dc95b81d3eeddc8"
|
5
|
-
Cache-Control: max-age=0, private, must-revalidate
|
6
|
-
X-Request-Id: ac424d922fefdd1625e41bda0e13f4b8
|
7
|
-
X-Runtime: 0.057802
|
8
|
-
Server: WEBrick/1.3.1 (Ruby/1.9.3/2013-02-22)
|
9
|
-
Date: Wed, 11 Sep 2013 12:48:50 GMT
|
10
|
-
Content-Length: 234
|
11
|
-
Connection: Keep-Alive
|
12
|
-
|
13
|
-
{
|
14
|
-
"object": "account",
|
15
|
-
"id": "acct_2Cmdexb7J2r78rz",
|
16
|
-
"email": "test-me@example.com",
|
17
|
-
"statement_descriptor": null,
|
18
|
-
"details_submitted": false,
|
19
|
-
"charge_enabled": false,
|
20
|
-
"currencies_supported": [
|
21
|
-
"jpy"
|
22
|
-
]
|
23
|
-
}
|
@@ -1,139 +0,0 @@
|
|
1
|
-
HTTP/1.1 200 OK
|
2
|
-
Content-Type: application/json; charset=utf-8
|
3
|
-
X-Ua-Compatible: IE=Edge
|
4
|
-
Etag: "d62affbd4db0c10ce2244cc7d5a05249"
|
5
|
-
Cache-Control: max-age=0, private, must-revalidate
|
6
|
-
X-Request-Id: c53aade07e31b8c4cc03c18bfe5ee086
|
7
|
-
X-Runtime: 0.013481
|
8
|
-
Server: WEBrick/1.3.1 (Ruby/1.9.3/2013-02-22)
|
9
|
-
Date: Mon, 14 Apr 2014 02:43:46 GMT
|
10
|
-
Content-Length: 3067
|
11
|
-
Connection: Keep-Alive
|
12
|
-
|
13
|
-
{
|
14
|
-
"object": "list",
|
15
|
-
"url": "/v1/charges",
|
16
|
-
"count": 4,
|
17
|
-
"data": [
|
18
|
-
{
|
19
|
-
"id": "ch_511apkasx749bfE",
|
20
|
-
"object": "charge",
|
21
|
-
"livemode": false,
|
22
|
-
"currency": "jpy",
|
23
|
-
"description": "Test Charge",
|
24
|
-
"amount": 1000,
|
25
|
-
"amount_refunded": 0,
|
26
|
-
"customer": "cus_5119ShaAgbLyfwS",
|
27
|
-
"created": 1397443228,
|
28
|
-
"paid": false,
|
29
|
-
"refunded": false,
|
30
|
-
"failure_message": null,
|
31
|
-
"card": {
|
32
|
-
"object": "card",
|
33
|
-
"exp_year": 2016,
|
34
|
-
"exp_month": 9,
|
35
|
-
"fingerprint": "215b5b2fe460809b8bb90bae6eeac0e0e0987bd7",
|
36
|
-
"name": "KEI KUBO",
|
37
|
-
"country": "JP",
|
38
|
-
"type": "Visa",
|
39
|
-
"cvc_check": "pass",
|
40
|
-
"last4": "4242"
|
41
|
-
},
|
42
|
-
"captured": false,
|
43
|
-
"expire_time": 1398048028,
|
44
|
-
"fees": [
|
45
|
-
|
46
|
-
]
|
47
|
-
},
|
48
|
-
{
|
49
|
-
"id": "ch_5119xE4mH4zA9p9",
|
50
|
-
"object": "charge",
|
51
|
-
"livemode": false,
|
52
|
-
"currency": "jpy",
|
53
|
-
"description": "Test Charge",
|
54
|
-
"amount": 1000,
|
55
|
-
"amount_refunded": 0,
|
56
|
-
"customer": "cus_5119ShaAgbLyfwS",
|
57
|
-
"created": 1397443215,
|
58
|
-
"paid": true,
|
59
|
-
"refunded": false,
|
60
|
-
"failure_message": null,
|
61
|
-
"card": {
|
62
|
-
"object": "card",
|
63
|
-
"exp_year": 2016,
|
64
|
-
"exp_month": 9,
|
65
|
-
"fingerprint": "215b5b2fe460809b8bb90bae6eeac0e0e0987bd7",
|
66
|
-
"name": "KEI KUBO",
|
67
|
-
"country": "JP",
|
68
|
-
"type": "Visa",
|
69
|
-
"cvc_check": "pass",
|
70
|
-
"last4": "4242"
|
71
|
-
},
|
72
|
-
"captured": true,
|
73
|
-
"expire_time": null,
|
74
|
-
"fees": [
|
75
|
-
{
|
76
|
-
"object": "fee",
|
77
|
-
"transaction_type": "payment",
|
78
|
-
"transaction_fee": 0,
|
79
|
-
"rate": 35.0,
|
80
|
-
"amount": 350,
|
81
|
-
"created": 1397443216
|
82
|
-
}
|
83
|
-
]
|
84
|
-
},
|
85
|
-
{
|
86
|
-
"id": "ch_5112dr0Mu5Kyd2I",
|
87
|
-
"object": "charge",
|
88
|
-
"livemode": false,
|
89
|
-
"currency": "jpy",
|
90
|
-
"description": "Test Charge",
|
91
|
-
"amount": 1000,
|
92
|
-
"amount_refunded": 400,
|
93
|
-
"customer": null,
|
94
|
-
"created": 1397442849,
|
95
|
-
"paid": true,
|
96
|
-
"refunded": false,
|
97
|
-
"failure_message": null,
|
98
|
-
"card": {
|
99
|
-
"object": "card",
|
100
|
-
"exp_year": 2015,
|
101
|
-
"exp_month": 12,
|
102
|
-
"fingerprint": "215b5b2fe460809b8bb90bae6eeac0e0e0987bd7",
|
103
|
-
"name": "YUUKO SHIONJI",
|
104
|
-
"country": "JP",
|
105
|
-
"type": "Visa",
|
106
|
-
"cvc_check": "pass",
|
107
|
-
"last4": "4242"
|
108
|
-
},
|
109
|
-
"captured": true,
|
110
|
-
"expire_time": null,
|
111
|
-
"fees": [
|
112
|
-
{
|
113
|
-
"object": "fee",
|
114
|
-
"transaction_type": "payment",
|
115
|
-
"transaction_fee": 0,
|
116
|
-
"rate": 35.0,
|
117
|
-
"amount": 350,
|
118
|
-
"created": 1397442849
|
119
|
-
},
|
120
|
-
{
|
121
|
-
"object": "fee",
|
122
|
-
"transaction_type": "refund",
|
123
|
-
"transaction_fee": 0,
|
124
|
-
"rate": 35.0,
|
125
|
-
"amount": -350,
|
126
|
-
"created": 1397443154
|
127
|
-
},
|
128
|
-
{
|
129
|
-
"object": "fee",
|
130
|
-
"transaction_type": "payment",
|
131
|
-
"transaction_fee": 0,
|
132
|
-
"rate": 35.0,
|
133
|
-
"amount": 210,
|
134
|
-
"created": 1397443154
|
135
|
-
}
|
136
|
-
]
|
137
|
-
}
|
138
|
-
]
|
139
|
-
}
|
@@ -1,49 +0,0 @@
|
|
1
|
-
HTTP/1.1 200 OK
|
2
|
-
Content-Type: application/json; charset=utf-8
|
3
|
-
X-Ua-Compatible: IE=Edge
|
4
|
-
Etag: "55751ab0623ce3649f648ce9161a340e"
|
5
|
-
Cache-Control: max-age=0, private, must-revalidate
|
6
|
-
X-Request-Id: e57b763f56b9212d2aac3d5204303b59
|
7
|
-
X-Runtime: 0.471463
|
8
|
-
Server: WEBrick/1.3.1 (Ruby/1.9.3/2013-02-22)
|
9
|
-
Date: Mon, 14 Apr 2014 02:58:16 GMT
|
10
|
-
Content-Length: 785
|
11
|
-
Connection: Keep-Alive
|
12
|
-
|
13
|
-
{
|
14
|
-
"id": "ch_5113hA4L51yj8TF",
|
15
|
-
"object": "charge",
|
16
|
-
"livemode": false,
|
17
|
-
"currency": "jpy",
|
18
|
-
"description": "Test Charge",
|
19
|
-
"amount": 1000,
|
20
|
-
"amount_refunded": 0,
|
21
|
-
"customer": "cus_5119ShaAgbLyfwS",
|
22
|
-
"created": 1397444145,
|
23
|
-
"paid": true,
|
24
|
-
"refunded": false,
|
25
|
-
"failure_message": null,
|
26
|
-
"card": {
|
27
|
-
"object": "card",
|
28
|
-
"exp_year": 2016,
|
29
|
-
"exp_month": 9,
|
30
|
-
"fingerprint": "215b5b2fe460809b8bb90bae6eeac0e0e0987bd7",
|
31
|
-
"name": "KEI KUBO",
|
32
|
-
"country": "JP",
|
33
|
-
"type": "Visa",
|
34
|
-
"cvc_check": "pass",
|
35
|
-
"last4": "4242"
|
36
|
-
},
|
37
|
-
"captured": true,
|
38
|
-
"expire_time": 1398048945,
|
39
|
-
"fees": [
|
40
|
-
{
|
41
|
-
"object": "fee",
|
42
|
-
"transaction_type": "payment",
|
43
|
-
"transaction_fee": 0,
|
44
|
-
"rate": 3.25,
|
45
|
-
"amount": 33,
|
46
|
-
"created": 1397444296
|
47
|
-
}
|
48
|
-
]
|
49
|
-
}
|