Class: PayjpMock::Response::Resource::Card

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

Constant Summary collapse

PREFIX =
'car'.freeze
OBJECT =
'card'.freeze

Instance Attribute Summary

Attributes inherited from Base

#attributes

Instance Method Summary collapse

Methods inherited from Base

#initialize, #set, #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

#canonicalize(key, value) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/payjp_mock/response/resource/card.rb', line 32

def canonicalize(key, value)
  case key
  when :number
    { last4: value[-4..-1] }
  when :cvc
    {}
  else
    super
  end
end

#default_attributesObject



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

def default_attributes
  {
    address_city:      nil,
    address_line1:     nil,
    address_line2:     nil,
    address_state:     nil,
    address_zip:       nil,
    address_zip_check: 'unchecked',
    brand:             'Visa',
    country:           nil,
    created:           Time.now.to_i,
    customer:          generate_resource_id(Customer::PREFIX),
    cvc_check:         'unchecked',
    exp_month:         2,
    exp_year:          2020,
    fingerprint:       generate_fingerprint,
    id:                generate_resource_id(PREFIX),
    last4:             '4242',
    livemode:          false,
    metadata:          nil,
    name:              nil,
    object:            OBJECT
  }
end