module StripeWrapper class Charge < ApplicationRecord belongs_to :stripe_customer, class_name: 'Customer', foreign_key: 'customer_id' has_one :user, through: :stripe_customer def self.build_stripe_charge(stripe_charge) return Charge.new(Charge.white_params(stripe_charge)) end private def self.white_params(stripe_charge) params = ActionController::Parameters.new(stripe_charge.as_json) params.permit(:object, :amount, :application, :application_fee,:balance_transaction,:captured,:created,:currency,:customer,:description,:cvc_check,:failure_code,:failude_message) end end end