Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Payfast Passphrase issue #295

Open
lesliepoolman opened this issue May 13, 2018 · 4 comments
Open

Payfast Passphrase issue #295

lesliepoolman opened this issue May 13, 2018 · 4 comments

Comments

@lesliepoolman
Copy link

Hello all,

This is the first time I am creating an issue on github so please be gentle 😄

I have a Rails 4.2.9 store app where i have been using the Payfast payment system successfully for a while and now i want to add a passphrase to use the recurring billing on the same Payfast account on a different site.

When I test in my local env using ngrok and payfasts sandbox with a passphrase i get a http 400 error code. When I remove the passphrase from the sandbox the payments go through and my controller acknowledges them

This is the code I am using at the moment based off of the example from payfasts sample code.

Please let me know if you have any suggestions or questions

class PayfastController < ApplicationController
  include OffsitePayments::Integrations
  
  def success
  end
  
  def fail
  end
    
  def itn
    create_notification 'main'

    if @notification.acknowledge
      # binding.pry
        if @notification.complete? and @order.vcs_formatted_total == @notification.gross
          find_order_by_reference_and_complete_asynchronously @notification.item_id
          PaymentResponse.log_response @notification.params, "m_payment_id"
        end
    else
      head :bad_request
    end
  end

private

  def create_notification(password)
    @notification = OffsitePayments.integration(:pay_fast).notification(request.raw_post, secret: Settings.payfast_pass[password])
    find_payment
  end


  def find_payment
    @order = Order.find_by_reference @notification.item_id
  end
end
@JGPage
Copy link

JGPage commented May 31, 2018

Hi @lesliepoolman

Active merchant plugin isn't maintained anymore. If you use the newer one then you should be able to transact as you want.

@lesliepoolman
Copy link
Author

hi @JGPage

Thanks for the response!
I do not have an active_merchant gem on my rails app and I based this payfast integration off of other comments i found here in the offsite_payments issues.
Can you please expand and explain your comment to me?

@JGPage
Copy link

JGPage commented Jun 4, 2018

Hi @lesliepoolman

Apologies, thought you were using the PayFast code that was in use previously, found in pay_fast.rb or are you using it?

If so, you would need to make some modifications as it doesn't incorporate the passphrase from what I remember. This would explain the behaviour you are seeing when removing the passphrase from the sandbox system.

Could you provide me with the email address you are transacting with on Sandbox? I'll then see if I can see anything.

@lesliepoolman
Copy link
Author

lesliepoolman commented Jun 4, 2018

I based my code off of this from payfast: https://github.com/pawel2105/payfast_rails_example and issue #80 and i read through the code in pay_fast.rb as well, so kind of a jigsaw of pieces that made sense to be put together in my case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants