Created
July 1, 2009 10:22
-
-
Save tekin/138716 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
@credit_card = ActiveMerchant::Billing::CreditCard.new(params[:credit_card]) | |
@billing_address = Address.new(params[:address]) | |
@payment = @order.payments.create(:credit_card => @credit_card, :address => @billing_address) | |
if @payment.success? | |
redirect_to complete_order_url(@order) | |
elsif @payment.requires_authentication? | |
# A view with an iframe from which the user is redirected to the authentication page | |
render :action => 'three_d_iframe' | |
else | |
flash[:notice] = 'Your payment was unsuccessful' | |
render :action => 'new', | |
end | |
end | |
# the redirect form that loads into the iframe | |
def three_d_form | |
render :layout => false | |
end | |
# the action where users are redirected to once they have completed authentication | |
def three_d_complete | |
@response = @order.complete_three_d_secure(params[:PaRes], params[:MD]) | |
if @response.success? | |
render :action => 'verification_complete', layout => false | |
else | |
render :action => 'verification_failed', :layout => false | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment