Sha256: 1e95b418291efa459c3a76e2721762ada9cb3a77dc4f55a39a32608d3f3eafc0
Contents?: true
Size: 807 Bytes
Versions: 1
Compression:
Stored size: 807 Bytes
Contents
module Workarea decorate Payment, with: :afterpay do decorated do embeds_one :afterpay, class_name: 'Workarea::Payment::Tender::Afterpay' end def afterpay? afterpay.present? end def set_afterpay(attrs) build_afterpay unless afterpay afterpay.attributes = attrs.slice( :token ) save end def clear_afterpay self.afterpay = nil save end def set_credit_card(*) self.afterpay = nil super end def authorize!(options = {}) transactions = tenders.map { |t| t.build_transaction(action: payment_action(t)) } perform_operation(transactions, options) end private def payment_action(tender) tender.slug == :afterpay ? 'purchase' : 'authorize' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
workarea-afterpay-2.0.2 | app/models/workarea/payment.decorator |