forked from stripe/stripe-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c9492b
commit 04ae411
Showing
17 changed files
with
399 additions
and
49 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
module Stripe | ||
module Issuing | ||
class Authorization < Stripe::APIResource | ||
extend Stripe::APIOperations::List | ||
include Stripe::APIOperations::Save | ||
|
||
OBJECT_NAME = "issuing.authorization".freeze | ||
|
||
def approve(params = {}, opts = {}) | ||
resp, opts = request(:post, resource_url + "/approve", params, opts) | ||
initialize_from(resp.data, opts) | ||
end | ||
|
||
def decline(params = {}, opts = {}) | ||
resp, opts = request(:post, resource_url + "/decline", params, opts) | ||
initialize_from(resp.data, opts) | ||
end | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# frozen_string_literal: true | ||
|
||
module Stripe | ||
module Issuing | ||
class Card < Stripe::APIResource | ||
extend Stripe::APIOperations::Create | ||
extend Stripe::APIOperations::List | ||
include Stripe::APIOperations::Save | ||
|
||
OBJECT_NAME = "issuing.card".freeze | ||
|
||
def details(params = {}, opts = {}) | ||
resp, opts = request(:get, resource_url + "/details", params, opts) | ||
Util.convert_to_stripe_object(resp.data, opts) | ||
end | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
module Stripe | ||
module Issuing | ||
class CardDetails < Stripe::StripeObject | ||
OBJECT_NAME = "issuing.card_details".freeze | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
module Stripe | ||
module Issuing | ||
class Cardholder < Stripe::APIResource | ||
extend Stripe::APIOperations::Create | ||
extend Stripe::APIOperations::List | ||
include Stripe::APIOperations::Save | ||
|
||
OBJECT_NAME = "issuing.cardholder".freeze | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
module Stripe | ||
module Issuing | ||
class Dispute < Stripe::APIResource | ||
extend Stripe::APIOperations::Create | ||
extend Stripe::APIOperations::List | ||
include Stripe::APIOperations::Save | ||
|
||
OBJECT_NAME = "issuing.dispute".freeze | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
module Stripe | ||
module Issuing | ||
class Transaction < Stripe::APIResource | ||
extend Stripe::APIOperations::List | ||
include Stripe::APIOperations::Save | ||
|
||
OBJECT_NAME = "issuing.transaction".freeze | ||
end | ||
end | ||
end |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# frozen_string_literal: true | ||
|
||
require File.expand_path("../../../test_helper", __FILE__) | ||
|
||
module Stripe | ||
module Issuing | ||
class AuthorizationTest < Test::Unit::TestCase | ||
should "be listable" do | ||
authorizations = Stripe::Issuing::Authorization.list | ||
assert_requested :get, "#{Stripe.api_base}/v1/issuing/authorizations" | ||
assert authorizations.data.is_a?(Array) | ||
assert authorizations.data[0].is_a?(Stripe::Issuing::Authorization) | ||
end | ||
|
||
should "be retrievable" do | ||
authorization = Stripe::Issuing::Authorization.retrieve("iauth_123") | ||
assert_requested :get, "#{Stripe.api_base}/v1/issuing/authorizations/iauth_123" | ||
assert authorization.is_a?(Stripe::Issuing::Authorization) | ||
end | ||
|
||
should "be saveable" do | ||
authorization = Stripe::Issuing::Authorization.retrieve("iauth_123") | ||
authorization.metadata["key"] = "value" | ||
authorization.save | ||
assert_requested :post, "#{Stripe.api_base}/v1/issuing/authorizations/#{authorization.id}" | ||
assert authorization.is_a?(Stripe::Issuing::Authorization) | ||
end | ||
|
||
should "be updateable" do | ||
authorization = Stripe::Issuing::Authorization.update("iauth_123", metadata: { foo: "bar" }) | ||
assert_requested :post, "#{Stripe.api_base}/v1/issuing/authorizations/iauth_123" | ||
assert authorization.is_a?(Stripe::Issuing::Authorization) | ||
end | ||
|
||
should "be approveable" do | ||
authorization = Stripe::Issuing::Authorization.retrieve("iauth_123") | ||
authorization.approve | ||
assert_requested :post, "#{Stripe.api_base}/v1/issuing/authorizations/iauth_123/approve" | ||
assert authorization.is_a?(Stripe::Issuing::Authorization) | ||
end | ||
|
||
should "be declineable" do | ||
authorization = Stripe::Issuing::Authorization.retrieve("iauth_123") | ||
authorization.decline | ||
assert_requested :post, "#{Stripe.api_base}/v1/issuing/authorizations/iauth_123/decline" | ||
assert authorization.is_a?(Stripe::Issuing::Authorization) | ||
end | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# frozen_string_literal: true | ||
|
||
require File.expand_path("../../../test_helper", __FILE__) | ||
|
||
module Stripe | ||
module Issuing | ||
class CardTest < Test::Unit::TestCase | ||
should "be creatable" do | ||
card = Stripe::Issuing::Card.create( | ||
currency: "usd", | ||
type: "physical" | ||
) | ||
assert_requested :post, "#{Stripe.api_base}/v1/issuing/cards" | ||
assert card.is_a?(Stripe::Issuing::Card) | ||
end | ||
|
||
should "be listable" do | ||
cards = Stripe::Issuing::Card.list | ||
assert_requested :get, "#{Stripe.api_base}/v1/issuing/cards" | ||
assert cards.data.is_a?(Array) | ||
assert cards.data[0].is_a?(Stripe::Issuing::Card) | ||
end | ||
|
||
should "be retrievable" do | ||
card = Stripe::Issuing::Card.retrieve("ic_123") | ||
assert_requested :get, "#{Stripe.api_base}/v1/issuing/cards/ic_123" | ||
assert card.is_a?(Stripe::Issuing::Card) | ||
end | ||
|
||
should "be saveable" do | ||
card = Stripe::Issuing::Card.retrieve("ic_123") | ||
card.metadata["key"] = "value" | ||
card.save | ||
assert_requested :post, "#{Stripe.api_base}/v1/issuing/cards/ic_123" | ||
assert card.is_a?(Stripe::Issuing::Card) | ||
end | ||
|
||
should "be updateable" do | ||
card = Stripe::Issuing::Card.update("ic_123", metadata: { foo: "bar" }) | ||
assert_requested :post, "#{Stripe.api_base}/v1/issuing/cards/ic_123" | ||
assert card.is_a?(Stripe::Issuing::Card) | ||
end | ||
|
||
should "be able to retrieve card details" do | ||
card = Stripe::Issuing::Card.retrieve("ic_123") | ||
|
||
card_details = card.details | ||
assert_requested :get, "#{Stripe.api_base}/v1/issuing/cards/ic_123/details" | ||
assert card_details.is_a?(Stripe::Issuing::CardDetails) | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.