Sha256: 1bcda22fd22ba5bb0aa89b40e9fc1368a1c3073f4fa64bddaafa9e25b569a585
Contents?: true
Size: 1.56 KB
Versions: 2
Compression:
Stored size: 1.56 KB
Contents
module Killbill::Litle class PrivatePaymentPlugin include Singleton def register_token!(kb_account_id, paypage_registration_id, options = {}) litle_response = gateway.store paypage_registration_id, options response = save_response litle_response, :register_token if response.success # Create the payment method (not associated to a Killbill payment method yet) LitlePaymentMethod.create! :kb_account_id => kb_account_id, :kb_payment_method_id => nil, :litle_token => response.litle_token else raise response.message end end def get_currency(kb_account_id_s) kb_account_id = Killbill::Plugin::Model::UUID.new(kb_account_id_s) account = kb_apis.get_account_by_id(kb_account_id) account.currency.enum rescue Killbill::Plugin::JKillbillApi::APINotAvailableError 'USD' end private def save_response(litle_response, api_call) logger.warn "Unsuccessful #{api_call}: #{litle_response.message}" unless litle_response.success? # Save the response to our logs response = LitleResponse.from_response(api_call, nil, litle_response) response.save! response end def gateway # The gateway should have been configured when the plugin started Killbill::Litle::Gateway.instance end def logger # The logger should have been configured when the plugin started Killbill::Litle.logger end def kb_apis # The logger should have been configured when the plugin started Killbill::Litle.kb_apis end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
killbill-litle-1.1.1 | lib/litle/private_api.rb |
killbill-litle-1.1.0 | lib/litle/private_api.rb |