Class: Jackpot::Payment
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Jackpot::Payment
- Defined in:
- app/models/jackpot/payment.rb
Instance Attribute Summary collapse
-
#credit_card ⇒ Object
Returns the value of attribute credit_card.
-
#credit_card_token ⇒ Object
Returns the value of attribute credit_card_token.
Instance Method Summary collapse
Instance Attribute Details
#credit_card ⇒ Object
Returns the value of attribute credit_card.
5 6 7 |
# File 'app/models/jackpot/payment.rb', line 5 def credit_card @credit_card end |
#credit_card_token ⇒ Object
Returns the value of attribute credit_card_token.
6 7 8 |
# File 'app/models/jackpot/payment.rb', line 6 def credit_card_token @credit_card_token end |
Instance Method Details
#customer_email ⇒ Object
29 30 31 |
# File 'app/models/jackpot/payment.rb', line 29 def customer_email customer.email end |
#perform_payment ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/jackpot/payment.rb', line 13 def perform_payment credit_card_token = customer.credit_card_token if credit_card_token self.amount = self.subscription.price response = Jackpot::Payment.gateway. self.amount, credit_card_token if response.success? billing_response = Jackpot::Payment.gateway.capture(self.amount, response.) self.payment_transaction_token = billing_response.params['transactionid'] else raise Jackpot::Errors::UnauthorizedPayment.new end end end |