Sha256: 11e07c4668e783012a177c576088d738c7802eb86032fc914c82bc0efef194a4
Contents?: true
Size: 813 Bytes
Versions: 1
Compression:
Stored size: 813 Bytes
Contents
# frozen_string_literal: true require 'active_model' module SolidusPaypalBraintree class Transaction include ActiveModel::Model attr_accessor :nonce, :payment_method, :payment_type, :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.0.0 | app/models/solidus_paypal_braintree/transaction.rb |