app/models/spree/gateway/authorize_net_cim.rb
# Update billing address on the CIM payment profile
Update billing address on the CIM payment profile
Update billing address on the CIM payment profile
def update_payment_profile(payment)
      if payment.source.has_payment_profile?
        if hash = get_payment_profile(payment)
          hash[:bill_to] = generate_address_hash(payment.order.bill_address)
          if hash[:payment][:credit_card]
            payment.source.define_singleton_method(:number) { "XXXXXXXXX#{payment.source.last_digits}" }
            hash[:payment][:credit_card] = payment.source
          end
          cim_gateway.update_customer_payment_profile({
            customer_profile_id: payment.source.gateway_customer_profile_id,
            payment_profile: hash
          })
        end
      end
    end
def update_payment_profile ( payment ) if payment . source . has_payment_profile? if hash = get_payment_profile ( payment ) hash [ :bill_to ] = generate_address_hash ( payment . order . bill_address ) if hash [ :payment ] [ :credit_card ] payment . source . define_singleton_method ( :number ) { "XXXXXXXXX#{payment.source.last_digits}" } hash [ :payment ] [ :credit_card ] = payment . source end cim_gateway . update_customer_payment_profile ( { customer_profile_id : payment . source . gateway_customer_profile_id , payment_profile : hash } ) end end end
Update billing address on the CIM payment profile
Update billing address on the CIM payment profile
# activemerchant expects a credit card object with 'number', 'year', 'month', and 'verification_value?' defined
payment