fnando / paypal-recurring

PayPal Express Checkout API Client for recurring billing.
256 stars 124 forks source link

IPN request handling? #13

Closed daliborfilus closed 11 years ago

daliborfilus commented 12 years ago

Hello, at first, I would like to say thank you for this gem.

But I have one problem/question... how I should handle automatic recurring IPN requests? I currently call .valid? and .recurring_payment? on the request, but .valid? returns false... Version currently used is 0.1.6.

Started POST "/paypal/ipn" for 173.0.81.1 at 2012-09-02 19:08:11 +0200
Processing by PaymentsController#ipn as HTML
  Parameters: {"mc_gross"=>"1200.00", "period_type"=>" Regular", "outstanding_balance"=>"0.00",
  "next_payment_date"=>"03:00:00 Oct 02, 2012 PDT", "protection_eligibility"=>"Ineligible", "payment_cycle"=>"Monthly", "tax"=>"0.00", "payer_id"=>"[removed]", "payment_date"=>"10:07:51 Sep 02, 2012 PDT", "payment_status"=>"Completed", "product_name"=>"P\u001Aedplatn\xE9 pro 15000 adres", 
"charset"=>"windows-1252", "recurring_payment_id"=>"[removed]", "first_name"=>"[removed]", "mc_fee"=>"62.80", "notify_version"=>"3.6", "amount_per_cycle"=>"1200.00", "payer_status"=>"verified", "currency_code"=>"CZK", "business"=>"[removed]", "verify_sign"=>"[removed]", "payer_email"=>"[removed]",
"initial_payment_amount"=>"0.00", "profile_status"=>"Active", "amount"=>"1200.00", "txn_id"=>"[removed]",
"payment_type"=>"instant", "payer_business_name"=>"[removed]", "last_name"=>"[removed]",
"receiver_email"=>"[removed]", "payment_fee"=>"", "receiver_id"=>"[removed]",
"txn_type"=>"recurring_payment", "mc_currency"=>"CZK", "residence_country"=>"CZ",
"transaction_subject"=>"...", "payment_gross"=>"", "shipping"=>"0.00", "product_type"=>"1",
"time_created"=>"03:09:02 Jun 02, 2012 PDT", "ipn_track_id"=>"[removed]"}
    response = PayPal::Recurring::Notification.new(params)
    logger.info "completed?: #{response.completed?}"
    logger.info "verified?: #{response.verified?}"
    logger.info "valid?: #{response.valid?}"
    logger.info "amount: #{response.amount.inspect}" if response.respond_to?(:amount)
    logger.info "raw params: #{response.params.inspect}"
logger output:
completed?: true
verified?: true
valid?: false

Am I doing this right? Thanks in advance.

daliborfilus commented 11 years ago

Bump? If you need more info, let me know. I could "fix" it and submit pull request, if you want me to, but I just need little guidance, like if it's really a bug, or I just did something wrong...

daliborfilus commented 11 years ago

According to this:

https://github.com/fnando/paypal-recurring/blob/master/lib/paypal/recurring/notification.rb#L60

and this: https://github.com/fnando/paypal-recurring/blob/master/lib/paypal/recurring.rb#L55

it looks like that I'm just missing email and seller_id in Paypal::Recurring.configure {} block? Is that right?

daliborfilus commented 11 years ago

To respond to myself - yes, I was right.