Sha256: 24e8cdfef264068c861c1cf1e0c4629e8e6abc90ee459967f2321910c4c380e4
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
module Workarea decorate Payment::Purchase::CreditCard, with: :checkoutdotcom do decorated do delegate :address, to: :tender end def complete! transaction.response = handle_active_merchant_errors do gateway.purchase( transaction.amount.cents, tender.to_token_or_active_merchant, transaction_options ) end if transaction.response.success? && tender.token.blank? tender.token = transaction.response.params["source"]["id"] tender.save! end transaction.response end private def transaction_options options = { reference: tender.payment.id, customer: { email: tender.profile.email, name: address.first_name + ' ' + address.last_name }, billing_address: { address1: address.street, address2: address.street_2, city: address.city, state: address.region, country: address.country.alpha2, zip: address.postal_code } } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
workarea-checkoutdotcom-1.2.0 | app/models/workarea/payment/purchase/credit_card.decorator |