Sha256: 97a662862d549c0874cf648d1a86cf01be714154f4fa5071518ec6a4a3d46061
Contents?: true
Size: 837 Bytes
Versions: 1
Compression:
Stored size: 837 Bytes
Contents
# frozen_string_literal: true require 'active_model' module SolidusPaypalBraintree 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? SolidusPaypalBraintree::Gateway errors.add(:payment_method, 'Must be braintree') end if address && !address.valid? address.errors.each do |field, error| errors.add(:address, "#{field} #{error}") end end end def address_attributes=(attributes) self.address = TransactionAddress.new attributes end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
solidus_paypal_braintree-1.1.0 | app/models/solidus_paypal_braintree/transaction.rb |