mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-11-29 00:01:18 -05:00
Added support for 3D Secure
This commit is contained in:
parent
7ed6e48b48
commit
be8c56458f
@ -55,6 +55,7 @@ require 'stripe/sku'
|
|||||||
require 'stripe/order'
|
require 'stripe/order'
|
||||||
require 'stripe/order_return'
|
require 'stripe/order_return'
|
||||||
require 'stripe/alipay_account'
|
require 'stripe/alipay_account'
|
||||||
|
require 'stripe/three_d_secure'
|
||||||
|
|
||||||
# Errors
|
# Errors
|
||||||
require 'stripe/errors/stripe_error'
|
require 'stripe/errors/stripe_error'
|
||||||
|
|||||||
13
lib/stripe/three_d_secure.rb
Normal file
13
lib/stripe/three_d_secure.rb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
module Stripe
|
||||||
|
class ThreeDSecure < APIResource
|
||||||
|
extend Stripe::APIOperations::Create
|
||||||
|
|
||||||
|
def self.resource_url
|
||||||
|
"/v1/3d_secure"
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.retrieve(id, opts=nil)
|
||||||
|
raise NotImplementedError.new("3D Secure objects cannot be retrieved")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -53,6 +53,7 @@ module Stripe
|
|||||||
'sku' => SKU,
|
'sku' => SKU,
|
||||||
'order' => Order,
|
'order' => Order,
|
||||||
'order_return' => OrderReturn,
|
'order_return' => OrderReturn,
|
||||||
|
'three_d_secure' => ThreeDSecure,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
16
test/stripe/three_d_secure_test.rb
Normal file
16
test/stripe/three_d_secure_test.rb
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
require File.expand_path('../../test_helper', __FILE__)
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class ThreeDSecureTest < Test::Unit::TestCase
|
||||||
|
should "create should return a new 3D Secure object" do
|
||||||
|
@mock.expects(:post).once.returns(make_response(make_three_d_secure))
|
||||||
|
tds = Stripe::ThreeDSecure.create(
|
||||||
|
:card => "tok_test",
|
||||||
|
:amount => 1500,
|
||||||
|
:currency => "usd",
|
||||||
|
:return_url => "https://example.org/3d-secure-result"
|
||||||
|
)
|
||||||
|
assert_equal "tdsrc_test", tds.id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -833,5 +833,20 @@ module Stripe
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def make_three_d_secure(params={})
|
||||||
|
{
|
||||||
|
:id => 'tdsrc_test',
|
||||||
|
:object => 'three_d_secure',
|
||||||
|
:amount => 1500,
|
||||||
|
:authenticate => true,
|
||||||
|
:card => make_card,
|
||||||
|
:created => 1456908210,
|
||||||
|
:currency => 'usd',
|
||||||
|
:livemode => false,
|
||||||
|
:redirect_url => nil,
|
||||||
|
:status => 'succeeded',
|
||||||
|
}.merge(params)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user