Sha256: 304a2def76c09e813d8ae6a20187979c2afd97b5915c6577734a043b29918787
Contents?: true
Size: 808 Bytes
Versions: 2
Compression:
Stored size: 808 Bytes
Contents
# frozen_string_literal: true require 'active_model' module SolidusBraintree class Transaction include ActiveModel::Model attr_accessor :nonce, :payment_method, :payment_type, :paypal_funding_source, :address, :email, :phone validates :nonce, presence: true validates :payment_method, presence: true validates :payment_type, presence: true validates :email, presence: true validate do unless payment_method.is_a? SolidusBraintree::Gateway errors.add(:payment_method, 'Must be braintree') end if address&.invalid? address.errors.each do |error| errors.add(:address, error.full_message) end end end def address_attributes=(attributes) self.address = TransactionAddress.new attributes end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
solidus_braintree-3.0.0 | app/models/solidus_braintree/transaction.rb |
solidus_braintree-2.0.0 | app/models/solidus_braintree/transaction.rb |