Class: PayjpMock::Response::Resource::Charge

Inherits:
Base
  • Object
show all
Defined in:
lib/payjp_mock/response/resource/charge.rb

Constant Summary collapse

PREFIX =
'ch'.freeze
OBJECT =
'charge'.freeze

Instance Attribute Summary

Attributes inherited from Base

#attributes

Instance Method Summary collapse

Methods inherited from Base

#initialize, #status

Methods included from Util

#generate_fingerprint, #generate_resource_id

Methods inherited from Base

#body, #exception, #status, #to_h

Constructor Details

This class inherits a constructor from PayjpMock::Response::Resource::Base

Instance Method Details

#default_attributesObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/payjp_mock/response/resource/charge.rb', line 6

def default_attributes
  now = Time.now.to_i

  {
    amount:          3500,
    amount_refunded: 0,
    captured:        true,
    captured_at:     now,
    card:            Card.new.to_h,
    created:         now,
    currency:        'jpy',
    customer:        nil,
    description:     nil,
    expired_at:      nil,
    failure_code:    nil,
    failure_message: nil,
    id:              generate_resource_id(PREFIX),
    livemode:        false,
    metadata:        nil,
    object:          OBJECT,
    paid:            true,
    refund_reason:   nil,
    refunded:        false,
    subscription:    nil
  }
end