Sha256: 6aee4dc58a074daafe10c75da24a862e0a08c79b373f4e97cf312afa71472afc
Contents?: true
Size: 1.97 KB
Versions: 7
Compression:
Stored size: 1.97 KB
Contents
module Killbill::PaypalExpress class PaypalExpressPaymentMethod < ActiveRecord::Base attr_accessible :kb_account_id, :kb_payment_method_id, :paypal_express_payer_id, :paypal_express_baid, :paypal_express_token def self.from_kb_account_id(kb_account_id) find_all_by_kb_account_id_and_is_deleted(kb_account_id, false) end def self.from_kb_payment_method_id(kb_payment_method_id) payment_methods = find_all_by_kb_payment_method_id_and_is_deleted(kb_payment_method_id, false) raise "No payment method found for payment method #{kb_payment_method_id}" if payment_methods.empty? raise "Killbill payment method mapping to multiple active PaypalExpress tokens for payment method #{kb_payment_method_id}" if payment_methods.size > 1 payment_methods[0] end # Used to complete the checkout process def self.from_kb_account_id_and_token(kb_account_id, token) payment_methods = find_all_by_kb_account_id_and_paypal_express_token_and_is_deleted(kb_account_id, token, false) raise "No payment method found for account #{kb_account_id}" if payment_methods.empty? raise "Paypal token mapping to multiple active PaypalExpress payment methods #{kb_account_id}" if payment_methods.size > 1 payment_methods[0] end def self.mark_as_deleted!(kb_payment_method_id) payment_method = from_kb_payment_method_id(kb_payment_method_id) payment_method.is_deleted = true payment_method.save! end def to_payment_method_response external_payment_method_id = paypal_express_baid # No concept of default payment method in Paypal Express is_default = false # We don't store extra information in Paypal Express properties = [] Killbill::Plugin::Model::PaymentMethodPlugin.new(external_payment_method_id, is_default, properties, "PayPal", nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil) end end end
Version data entries
7 entries across 7 versions & 1 rubygems