search for: payment_method

Displaying 9 results from an estimated 9 matches for "payment_method".

2011 Nov 02
2
Specify and validate requirements on an ActiveRecord association
Looking for some guidance/support on what feels like might not be an uncommon use-case. `User.has_many accounts` `User.has_many payment_methods` `Account.belongs_to :user` `Account.belongs_to :payment_method` `PaymentMethod.has_many :accounts` There are lots of `Accounts`. When I (a `User`) want to assign accounts to a `PaymentMethod`, I really don''t want to scope against all of them, but rather only those that I own. While this...
2008 Jul 16
2
belongs_to causing endless loop on first call to save!
...Funny thing is, when I was incrementally saving the data, this issue never arose--another way to put it, those relationships never caused a problem when saving/retrieving already-existing rows. In the model tier, I have the following classes defined: class PrimaryAccount < Account has_many :payment_methods, :foreign_key => "account_id" #using single table inheritance, which is why foreign key is not "primary_account_id" belongs_to :current_payment_method, :class_name => "PaymentMethod", :foreign_key => "current_payment_method_id" #points to same tab...
2009 Feb 26
1
Problem w/ActionWebService and Inheritance in Service Params
...ice doesn''t seem to know that the parameter is really a CreditCard or PayPal. Here''s some sample code that illustrates what I''m talking about more concretely: class PaymentsApi < ActionWebService::API::Base api_method( :create_payment, :expects => [ { :payment_method => PaymentMethod } ], :returns => [ :payment_id => :string ] ) end class PaymentMethod < ActionWebService::Struct # ... end class CreditCard < PaymentMethod # ... end class PayPal < PaymentMethod # ... end I see in the request XML that it knows that the payment_metho...
2007 Apr 20
7
Stubbing Model.new w/ block?
Ok, I followed the advice of the list and moved more code into my model from my controller. When developing tests for this new code, I ran into a problem... My model code creates a receipt object and sets some values on it: @receipt = Receipt.new do |r| r.x = 1 r.y = 2 # etc end I wanted to be able to stub out Receipt.new so that I could set expectations on the methods called on the
2005 Dec 19
0
Re: Rails Digest, Vol 15, Issue 392
...an "attachment" method that can be invoked from within a subclass of ActionMailer::Base. This sounded pretty good, but I was a bit worried about the results (and rightly so, it turned out. I ended up doing something like this in my mail method: def confirmation_message(order, person, payment_method, label) @subject = "Confirming order ##{order.id}" @from = ''orders-NKvcMekWyJVWk0Htik3J/w@public.gmane.org'' @recipients = person.email_address attachment(:content_type => ''application/pdf'', :filename => &q...
2009 Oct 07
1
output validations errors form causing type error?
...;BigDecimal: 105d33ed8,''0.0'',9(18)>, shipping_ca: #<BigDecimal:105d33ac8,''0.0'',9(18) >, shipping_us: #<BigDecimal:105bfb840,''0.7E1'',9(18)>, currency: "USD", status: nil, comments: nil, customer_ip: "127.0.0.1", payment_method: "Credit Card", downloaded: nil, express_token: nil, express_payer_id: nil, card_type: "visa", card_expires_on: "2009-10-01">> If anyone has any idea where I can start looking to debug this error, I would appreciated it very much. Thanks, Sean
2007 Jun 21
2
expects with returns that returns the return value of the actual method
...ed purchase method. Is this possible? def test_charge gateway = ActiveMerchant::Billing::Base.gateway(:bogus).new ActiveMerchant::Billing::Base.mode = :test member = Member.new member.credit_card_number = "1" member.expiration_date = "9/19/2007" member.payment_method = "bogus" member.first_name = "Steve" member.last_name = "Eichert" member.expects(:active_merchant_gateway).returns(gateway) # gateway.expects(:purchase).returns(:non_mocked_return) member.charge assert member.paid end
2007 Jun 21
3
only checking certain parameters for a method
...ny value for a parameter which I don''t care about is valid? I''m thinking something like: def test_charge_is_for_10_bucks gateway = test_gateway member = Member.new member.credit_card_number = "1" member.expiration_date = "9/19/2007" member.payment_method = "bogus" member.first_name = "Steve" member.last_name = "Eichert" member.expects(:active_merchant_gateway).returns(gateway) member.expects(:purchase).with(1000, :any).returns(TestResponse.new) member.charge end On a slightly unrelated note, I was...
2009 Aug 28
2
Association extension method
In my application a user working at a dropzone can manipulate transactions against customer accounts. Here''s my models: class Transaction < ActiveRecord::Base belongs_to :account end class Account < ActiveRecord::Base belongs_to :dropzone has_many :transactions end class Dropzone < ActiveRecord::Base has_many :transactions, :through => :accounts do def