app/controllers/v1/donations_controller.rb
# Receives person, payment and action attributes. Creates/updates a person
# creates an action, and creates a stripe single or recurring payment
# Params:
#  * person - hash - person hash
#  * employer - string - person employer
#  * occupation - string - person occupation
#  * amount_in_cents - int - donation amount in cents
#  * recurring - true - pass true if recurring donation
#  * stripe_token - token returned by Stripe.js to identify credit card
#  * template_id - action template_id
#  * utm_source - action utm_source
#  * utm_medium - action utm_medium
#  * utm_campaign - action utm_campaign
#  * source_url - action source_url
Receives person, payment and action attributes.
Receives person payment and action attributes .
def create
    person = PersonConstructor.build(person_params).tap(&:save) 
    donation = Donation.new(donation_params.merge(person: person))
    if donation.process
      render json: { status: 'success' }
    else
      render json: { error: donation.errors }
    end
  end
def create person = PersonConstructor . build ( person_params ) . tap ( & :save ) donation = Donation . new ( donation_params . merge ( person : person ) ) if donation . process render json : { status : 'success' } else render json : { error : donation . errors } end end
Receives person, payment and action attributes.
Receives person payment and action attributes .
# temporary fix