Skip to content

Instantly share code, notes, and snippets.

@altamic
Created February 1, 2010 21:57
Show Gist options
  • Save altamic/292072 to your computer and use it in GitHub Desktop.
Save altamic/292072 to your computer and use it in GitHub Desktop.
class PaypalPayment
def initialize(hash=nil)
hash.each_pair { |k,v| self.instance_variable_set("@#{k}".to_sym, v) } if hash.respond_to? :each_pair
end
attr_accessor :payment_gross, :mc_gross, :mc_currency, :payment_status, :pending_reason, #payment
:discount, :tax,
#transaction
:txn_type, :transaction_subject,
# payer
:payer_id, :first_name, :last_name, :payer_email, :payment_date, :residence_country, :payer_status,
# receiver
:business, :receiver_id, :receiver_email, :protection_eligibility,
# item
:item_name, :item_number, :option_selection1, :quantity,
# shipping
:shipping_method, :shipping, :handling_amount, :insurance_amount, :shipping_discount,
#details
:custom, :charset, :notify_version, :test_ipn, :verify_sign
end
# h = {
# "protection_eligibility"=>"Ineligible",
# "tax"=>"0.00",
# "payment_status"=>"Completed",
# "business"=>"[email protected]",
# "payer_email"=>"[email protected]",
# "insurance_amount"=>"0.00",
# "receiver_id"=>"9C2WBR5JCR2Y",
# "residence_country"=>"IT",
# "handling_amount"=>"0.00",
# "payment_gross"=>"",
# "receiver_email"=>"[email protected]",
# "discount"=>"0.0",
# "verify_sign"=>"ATs.NXp4TKApd5AVAa78fffxR4dpl1VozwGHGxfuDXRBkWPDkMviMO8v",
# "option_selection1"=>"Base",
# "quantity"=>"1",
# "txn_type"=>"web_accept",
# "mc_currency"=>"EUR",
# "transaction_subject"=>"Credit",
# "charset"=>"windows-1252",
# "txn_id"=>"68030893P0721223F",
# "item_name"=>"Credit",
# "notify_version"=>"2.9",
# "payer_status"=>"verified",
# "option_name1"=>"Amount",
# "payment_fee"=>"",
# "payment_date"=>"06:25:22 Feb 01, 2010 PST",
# "mc_fee"=>"0.55",
# "shipping_discount"=>"0.00",
# "shipping_method"=>"Default",
# "shipping"=>"0.00",
# "first_name"=>"Test",
# "payment_type"=>"instant",
# "btn_id"=>"1101956",
# "test_ipn"=>"1",
# "mc_gross"=>"5.00",
# "payer_id"=>"CMLRQB74JSAL6",
# "last_name"=>"User",
# "custom"=>"",
# "item_number"=>""
# }
#
# p = PaypalPayment.new(h)
#
# p.mc_gross
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment