diff --git a/lib/invoiced/charge.rb b/lib/invoiced/charge.rb index 0b3a969..43dbaa8 100644 --- a/lib/invoiced/charge.rb +++ b/lib/invoiced/charge.rb @@ -1,7 +1,12 @@ module Invoiced class Charge < Object - include Invoiced::Operations::Create - OBJECT_NAME = 'charge' + + def create(body={}, opts={}) + response = @client.request(:post, endpoint(), body, opts) + + payment = Payment.new(@client) + Util.convert_to_object(payment, response[:body]) + end end end \ No newline at end of file diff --git a/test/invoiced/charge_test.rb b/test/invoiced/charge_test.rb index df12ac5..f4af97a 100644 --- a/test/invoiced/charge_test.rb +++ b/test/invoiced/charge_test.rb @@ -18,7 +18,7 @@ class ChargeTest < Test::Unit::TestCase charge = Charge.new(@client, 1234) charge = charge.create(:amount => 100, :payment_source_type => "card") - assert_instance_of(Invoiced::Charge, charge) + assert_instance_of(Invoiced::Payment, charge) assert_equal(charge.id, "a1b2c3") end end