Class: Lightrail::LightrailCharge

Inherits:
LightrailObject
  • Object
show all
Defined in:
lib/lightrail_stripe/wrappers/lightrail_charge.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cardIdObject

Returns the value of attribute cardId.



3
4
5
# File 'lib/lightrail_stripe/wrappers/lightrail_charge.rb', line 3

def cardId
  @cardId
end

#codeLastFourObject

Returns the value of attribute codeLastFour.



3
4
5
# File 'lib/lightrail_stripe/wrappers/lightrail_charge.rb', line 3

def codeLastFour
  @codeLastFour
end

#currencyObject

Returns the value of attribute currency.



3
4
5
# File 'lib/lightrail_stripe/wrappers/lightrail_charge.rb', line 3

def currency
  @currency
end

#dateCreatedObject

Returns the value of attribute dateCreated.



3
4
5
# File 'lib/lightrail_stripe/wrappers/lightrail_charge.rb', line 3

def dateCreated
  @dateCreated
end

#giftbitUserIdObject

Returns the value of attribute giftbitUserId.



3
4
5
# File 'lib/lightrail_stripe/wrappers/lightrail_charge.rb', line 3

def giftbitUserId
  @giftbitUserId
end

#metadataObject

Returns the value of attribute metadata.



3
4
5
# File 'lib/lightrail_stripe/wrappers/lightrail_charge.rb', line 3

def 
  @metadata
end

#transactionAccessMethodObject

Returns the value of attribute transactionAccessMethod.



3
4
5
# File 'lib/lightrail_stripe/wrappers/lightrail_charge.rb', line 3

def transactionAccessMethod
  @transactionAccessMethod
end

#transactionIdObject

Returns the value of attribute transactionId.



3
4
5
# File 'lib/lightrail_stripe/wrappers/lightrail_charge.rb', line 3

def transactionId
  @transactionId
end

#transactionTypeObject

Returns the value of attribute transactionType.



3
4
5
# File 'lib/lightrail_stripe/wrappers/lightrail_charge.rb', line 3

def transactionType
  @transactionType
end

#userSuppliedIdObject

Returns the value of attribute userSuppliedId.



3
4
5
# File 'lib/lightrail_stripe/wrappers/lightrail_charge.rb', line 3

def userSuppliedId
  @userSuppliedId
end

#valueObject

Returns the value of attribute value.



3
4
5
# File 'lib/lightrail_stripe/wrappers/lightrail_charge.rb', line 3

def value
  @value
end

Class Method Details

.create(charge_params) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/lightrail_stripe/wrappers/lightrail_charge.rb', line 5

def self.create (charge_params)
  Lightrail::Validator.validate_charge_object! (charge_params)
  charge_params_to_send_to_lightrail = Lightrail::Translator.charge_params_stripe_to_lightrail(charge_params)

  charge_method = charge_params_to_send_to_lightrail[:code] ? 'code' : 'cardId'

  response = (charge_method == 'code') ?
      Lightrail::Code.charge(charge_params_to_send_to_lightrail) :
      Lightrail::Card.charge(charge_params_to_send_to_lightrail)

  self.new(response)
end

.simulate(charge_params) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/lightrail_stripe/wrappers/lightrail_charge.rb', line 18

def self.simulate (charge_params)
  Lightrail::Validator.validate_charge_object! (charge_params)
  charge_params_to_send_to_lightrail = Lightrail::Translator.charge_params_stripe_to_lightrail(charge_params)

  charge_method = charge_params_to_send_to_lightrail[:code] ? 'code' : 'cardId'

  response = (charge_method == 'code') ?
      Lightrail::Code.simulate_charge(charge_params_to_send_to_lightrail) :
      Lightrail::Card.simulate_charge(charge_params_to_send_to_lightrail)

  self.new(response)
end

Instance Method Details

#cancel!(new_request_body = nil) ⇒ Object



31
32
33
# File 'lib/lightrail_stripe/wrappers/lightrail_charge.rb', line 31

def cancel! (new_request_body=nil)
  handle_pending(self, 'void', new_request_body)
end

#capture!(new_request_body = nil) ⇒ Object



35
36
37
# File 'lib/lightrail_stripe/wrappers/lightrail_charge.rb', line 35

def capture! (new_request_body=nil)
  handle_pending(self, 'capture', new_request_body)
end