stripe 3.17.2 → 3.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +2 -2
- data/.travis.yml +1 -1
- data/CHANGELOG.md +3 -0
- data/VERSION +1 -1
- data/lib/stripe.rb +6 -0
- data/lib/stripe/issuing/authorization.rb +22 -0
- data/lib/stripe/issuing/card.rb +18 -0
- data/lib/stripe/issuing/card_details.rb +9 -0
- data/lib/stripe/issuing/cardholder.rb +13 -0
- data/lib/stripe/issuing/dispute.rb +13 -0
- data/lib/stripe/issuing/transaction.rb +12 -0
- data/lib/stripe/util.rb +51 -45
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/api_operations_test.rb +2 -0
- data/test/stripe/issuing/authorization_test.rb +50 -0
- data/test/stripe/issuing/card_test.rb +53 -0
- data/test/stripe/issuing/cardholder_test.rb +53 -0
- data/test/stripe/issuing/dispute_test.rb +45 -0
- data/test/stripe/issuing/transaction_test.rb +48 -0
- data/test/test_helper.rb +1 -1
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95c81f1261a59a454760e88f4f32eac24ae2918d
|
4
|
+
data.tar.gz: b40f14450495e9d069668691ec67f199be98b4ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14dd0e4457a6f2049d296500c05fb8e9028f5c3ca992c5fb3bc8a7c98ad567722ced091bece4ecfdda21474dc3e2cf7ea27606c4715a4797503b669779639c6f
|
7
|
+
data.tar.gz: f549db4c303ce3004db020c71dead12c7f5a626df88d149362ae5f3e794bd45a4ff2b53a35043025c315c39fc5d228e88c9174ece2830292e62db79d85a6cab3
|
data/.rubocop_todo.yml
CHANGED
@@ -33,12 +33,12 @@ Metrics/LineLength:
|
|
33
33
|
# Offense count: 32
|
34
34
|
# Configuration parameters: CountComments.
|
35
35
|
Metrics/MethodLength:
|
36
|
-
Max:
|
36
|
+
Max: 54
|
37
37
|
|
38
38
|
# Offense count: 1
|
39
39
|
# Configuration parameters: CountComments.
|
40
40
|
Metrics/ModuleLength:
|
41
|
-
Max:
|
41
|
+
Max: 314
|
42
42
|
|
43
43
|
# Offense count: 6
|
44
44
|
# Configuration parameters: CountKeywordArgs.
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 3.18.0 - 2018-07-26
|
4
|
+
* [#665](https://github.com/stripe/stripe-ruby/pull/665) Add support for Stripe Issuing
|
5
|
+
|
3
6
|
## 3.17.2 - 2018-07-19
|
4
7
|
* [#664](https://github.com/stripe/stripe-ruby/pull/664) Don't colorize log output being sent to a configured logger
|
5
8
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.18.0
|
data/lib/stripe.rb
CHANGED
@@ -60,6 +60,12 @@ require "stripe/invoice"
|
|
60
60
|
require "stripe/invoice_item"
|
61
61
|
require "stripe/invoice_line_item"
|
62
62
|
require "stripe/issuer_fraud_record"
|
63
|
+
require "stripe/issuing/authorization"
|
64
|
+
require "stripe/issuing/card"
|
65
|
+
require "stripe/issuing/cardholder"
|
66
|
+
require "stripe/issuing/card_details"
|
67
|
+
require "stripe/issuing/dispute"
|
68
|
+
require "stripe/issuing/transaction"
|
63
69
|
require "stripe/login_link"
|
64
70
|
require "stripe/order"
|
65
71
|
require "stripe/order_return"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
module Issuing
|
5
|
+
class Authorization < Stripe::APIResource
|
6
|
+
extend Stripe::APIOperations::List
|
7
|
+
include Stripe::APIOperations::Save
|
8
|
+
|
9
|
+
OBJECT_NAME = "issuing.authorization".freeze
|
10
|
+
|
11
|
+
def approve(params = {}, opts = {})
|
12
|
+
resp, opts = request(:post, resource_url + "/approve", params, opts)
|
13
|
+
initialize_from(resp.data, opts)
|
14
|
+
end
|
15
|
+
|
16
|
+
def decline(params = {}, opts = {})
|
17
|
+
resp, opts = request(:post, resource_url + "/decline", params, opts)
|
18
|
+
initialize_from(resp.data, opts)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
module Issuing
|
5
|
+
class Card < Stripe::APIResource
|
6
|
+
extend Stripe::APIOperations::Create
|
7
|
+
extend Stripe::APIOperations::List
|
8
|
+
include Stripe::APIOperations::Save
|
9
|
+
|
10
|
+
OBJECT_NAME = "issuing.card".freeze
|
11
|
+
|
12
|
+
def details(params = {}, opts = {})
|
13
|
+
resp, opts = request(:get, resource_url + "/details", params, opts)
|
14
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
module Issuing
|
5
|
+
class Cardholder < Stripe::APIResource
|
6
|
+
extend Stripe::APIOperations::Create
|
7
|
+
extend Stripe::APIOperations::List
|
8
|
+
include Stripe::APIOperations::Save
|
9
|
+
|
10
|
+
OBJECT_NAME = "issuing.cardholder".freeze
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
module Issuing
|
5
|
+
class Dispute < Stripe::APIResource
|
6
|
+
extend Stripe::APIOperations::Create
|
7
|
+
extend Stripe::APIOperations::List
|
8
|
+
include Stripe::APIOperations::Save
|
9
|
+
|
10
|
+
OBJECT_NAME = "issuing.dispute".freeze
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/stripe/util.rb
CHANGED
@@ -45,51 +45,57 @@ module Stripe
|
|
45
45
|
ListObject::OBJECT_NAME => ListObject,
|
46
46
|
|
47
47
|
# business objects
|
48
|
-
Account::OBJECT_NAME
|
49
|
-
AlipayAccount::OBJECT_NAME
|
50
|
-
ApplePayDomain::OBJECT_NAME
|
51
|
-
ApplicationFee::OBJECT_NAME
|
52
|
-
ApplicationFeeRefund::OBJECT_NAME
|
53
|
-
Balance::OBJECT_NAME
|
54
|
-
BalanceTransaction::OBJECT_NAME
|
55
|
-
BankAccount::OBJECT_NAME
|
56
|
-
BitcoinReceiver::OBJECT_NAME
|
57
|
-
BitcoinTransaction::OBJECT_NAME
|
58
|
-
Card::OBJECT_NAME
|
59
|
-
Charge::OBJECT_NAME
|
60
|
-
CountrySpec::OBJECT_NAME
|
61
|
-
Coupon::OBJECT_NAME
|
62
|
-
Customer::OBJECT_NAME
|
63
|
-
Dispute::OBJECT_NAME
|
64
|
-
EphemeralKey::OBJECT_NAME
|
65
|
-
Event::OBJECT_NAME
|
66
|
-
ExchangeRate::OBJECT_NAME
|
67
|
-
FileUpload::OBJECT_NAME
|
68
|
-
Invoice::OBJECT_NAME
|
69
|
-
InvoiceItem::OBJECT_NAME
|
70
|
-
InvoiceLineItem::OBJECT_NAME
|
71
|
-
IssuerFraudRecord::OBJECT_NAME
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
48
|
+
Account::OBJECT_NAME => Account,
|
49
|
+
AlipayAccount::OBJECT_NAME => AlipayAccount,
|
50
|
+
ApplePayDomain::OBJECT_NAME => ApplePayDomain,
|
51
|
+
ApplicationFee::OBJECT_NAME => ApplicationFee,
|
52
|
+
ApplicationFeeRefund::OBJECT_NAME => ApplicationFeeRefund,
|
53
|
+
Balance::OBJECT_NAME => Balance,
|
54
|
+
BalanceTransaction::OBJECT_NAME => BalanceTransaction,
|
55
|
+
BankAccount::OBJECT_NAME => BankAccount,
|
56
|
+
BitcoinReceiver::OBJECT_NAME => BitcoinReceiver,
|
57
|
+
BitcoinTransaction::OBJECT_NAME => BitcoinTransaction,
|
58
|
+
Card::OBJECT_NAME => Card,
|
59
|
+
Charge::OBJECT_NAME => Charge,
|
60
|
+
CountrySpec::OBJECT_NAME => CountrySpec,
|
61
|
+
Coupon::OBJECT_NAME => Coupon,
|
62
|
+
Customer::OBJECT_NAME => Customer,
|
63
|
+
Dispute::OBJECT_NAME => Dispute,
|
64
|
+
EphemeralKey::OBJECT_NAME => EphemeralKey,
|
65
|
+
Event::OBJECT_NAME => Event,
|
66
|
+
ExchangeRate::OBJECT_NAME => ExchangeRate,
|
67
|
+
FileUpload::OBJECT_NAME => FileUpload,
|
68
|
+
Invoice::OBJECT_NAME => Invoice,
|
69
|
+
InvoiceItem::OBJECT_NAME => InvoiceItem,
|
70
|
+
InvoiceLineItem::OBJECT_NAME => InvoiceLineItem,
|
71
|
+
IssuerFraudRecord::OBJECT_NAME => IssuerFraudRecord,
|
72
|
+
Issuing::Authorization::OBJECT_NAME => Issuing::Authorization,
|
73
|
+
Issuing::Card::OBJECT_NAME => Issuing::Card,
|
74
|
+
Issuing::CardDetails::OBJECT_NAME => Issuing::CardDetails,
|
75
|
+
Issuing::Cardholder::OBJECT_NAME => Issuing::Cardholder,
|
76
|
+
Issuing::Dispute::OBJECT_NAME => Issuing::Dispute,
|
77
|
+
Issuing::Transaction::OBJECT_NAME => Issuing::Transaction,
|
78
|
+
LoginLink::OBJECT_NAME => LoginLink,
|
79
|
+
Order::OBJECT_NAME => Order,
|
80
|
+
OrderReturn::OBJECT_NAME => OrderReturn,
|
81
|
+
PaymentIntent::OBJECT_NAME => PaymentIntent,
|
82
|
+
Payout::OBJECT_NAME => Payout,
|
83
|
+
Plan::OBJECT_NAME => Plan,
|
84
|
+
Product::OBJECT_NAME => Product,
|
85
|
+
Recipient::OBJECT_NAME => Recipient,
|
86
|
+
RecipientTransfer::OBJECT_NAME => RecipientTransfer,
|
87
|
+
Refund::OBJECT_NAME => Refund,
|
88
|
+
Reversal::OBJECT_NAME => Reversal,
|
89
|
+
SKU::OBJECT_NAME => SKU,
|
90
|
+
Source::OBJECT_NAME => Source,
|
91
|
+
SourceTransaction::OBJECT_NAME => SourceTransaction,
|
92
|
+
Subscription::OBJECT_NAME => Subscription,
|
93
|
+
SubscriptionItem::OBJECT_NAME => SubscriptionItem,
|
94
|
+
ThreeDSecure::OBJECT_NAME => ThreeDSecure,
|
95
|
+
Token::OBJECT_NAME => Token,
|
96
|
+
Topup::OBJECT_NAME => Topup,
|
97
|
+
Transfer::OBJECT_NAME => Transfer,
|
98
|
+
UsageRecord::OBJECT_NAME => UsageRecord,
|
93
99
|
}
|
94
100
|
end
|
95
101
|
|
data/lib/stripe/version.rb
CHANGED
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.expand_path("../../../test_helper", __FILE__)
|
4
|
+
|
5
|
+
module Stripe
|
6
|
+
module Issuing
|
7
|
+
class AuthorizationTest < Test::Unit::TestCase
|
8
|
+
should "be listable" do
|
9
|
+
authorizations = Stripe::Issuing::Authorization.list
|
10
|
+
assert_requested :get, "#{Stripe.api_base}/v1/issuing/authorizations"
|
11
|
+
assert authorizations.data.is_a?(Array)
|
12
|
+
assert authorizations.data[0].is_a?(Stripe::Issuing::Authorization)
|
13
|
+
end
|
14
|
+
|
15
|
+
should "be retrievable" do
|
16
|
+
authorization = Stripe::Issuing::Authorization.retrieve("iauth_123")
|
17
|
+
assert_requested :get, "#{Stripe.api_base}/v1/issuing/authorizations/iauth_123"
|
18
|
+
assert authorization.is_a?(Stripe::Issuing::Authorization)
|
19
|
+
end
|
20
|
+
|
21
|
+
should "be saveable" do
|
22
|
+
authorization = Stripe::Issuing::Authorization.retrieve("iauth_123")
|
23
|
+
authorization.metadata["key"] = "value"
|
24
|
+
authorization.save
|
25
|
+
assert_requested :post, "#{Stripe.api_base}/v1/issuing/authorizations/#{authorization.id}"
|
26
|
+
assert authorization.is_a?(Stripe::Issuing::Authorization)
|
27
|
+
end
|
28
|
+
|
29
|
+
should "be updateable" do
|
30
|
+
authorization = Stripe::Issuing::Authorization.update("iauth_123", metadata: { foo: "bar" })
|
31
|
+
assert_requested :post, "#{Stripe.api_base}/v1/issuing/authorizations/iauth_123"
|
32
|
+
assert authorization.is_a?(Stripe::Issuing::Authorization)
|
33
|
+
end
|
34
|
+
|
35
|
+
should "be approveable" do
|
36
|
+
authorization = Stripe::Issuing::Authorization.retrieve("iauth_123")
|
37
|
+
authorization.approve
|
38
|
+
assert_requested :post, "#{Stripe.api_base}/v1/issuing/authorizations/iauth_123/approve"
|
39
|
+
assert authorization.is_a?(Stripe::Issuing::Authorization)
|
40
|
+
end
|
41
|
+
|
42
|
+
should "be declineable" do
|
43
|
+
authorization = Stripe::Issuing::Authorization.retrieve("iauth_123")
|
44
|
+
authorization.decline
|
45
|
+
assert_requested :post, "#{Stripe.api_base}/v1/issuing/authorizations/iauth_123/decline"
|
46
|
+
assert authorization.is_a?(Stripe::Issuing::Authorization)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.expand_path("../../../test_helper", __FILE__)
|
4
|
+
|
5
|
+
module Stripe
|
6
|
+
module Issuing
|
7
|
+
class CardTest < Test::Unit::TestCase
|
8
|
+
should "be creatable" do
|
9
|
+
card = Stripe::Issuing::Card.create(
|
10
|
+
currency: "usd",
|
11
|
+
type: "physical"
|
12
|
+
)
|
13
|
+
assert_requested :post, "#{Stripe.api_base}/v1/issuing/cards"
|
14
|
+
assert card.is_a?(Stripe::Issuing::Card)
|
15
|
+
end
|
16
|
+
|
17
|
+
should "be listable" do
|
18
|
+
cards = Stripe::Issuing::Card.list
|
19
|
+
assert_requested :get, "#{Stripe.api_base}/v1/issuing/cards"
|
20
|
+
assert cards.data.is_a?(Array)
|
21
|
+
assert cards.data[0].is_a?(Stripe::Issuing::Card)
|
22
|
+
end
|
23
|
+
|
24
|
+
should "be retrievable" do
|
25
|
+
card = Stripe::Issuing::Card.retrieve("ic_123")
|
26
|
+
assert_requested :get, "#{Stripe.api_base}/v1/issuing/cards/ic_123"
|
27
|
+
assert card.is_a?(Stripe::Issuing::Card)
|
28
|
+
end
|
29
|
+
|
30
|
+
should "be saveable" do
|
31
|
+
card = Stripe::Issuing::Card.retrieve("ic_123")
|
32
|
+
card.metadata["key"] = "value"
|
33
|
+
card.save
|
34
|
+
assert_requested :post, "#{Stripe.api_base}/v1/issuing/cards/ic_123"
|
35
|
+
assert card.is_a?(Stripe::Issuing::Card)
|
36
|
+
end
|
37
|
+
|
38
|
+
should "be updateable" do
|
39
|
+
card = Stripe::Issuing::Card.update("ic_123", metadata: { foo: "bar" })
|
40
|
+
assert_requested :post, "#{Stripe.api_base}/v1/issuing/cards/ic_123"
|
41
|
+
assert card.is_a?(Stripe::Issuing::Card)
|
42
|
+
end
|
43
|
+
|
44
|
+
should "be able to retrieve card details" do
|
45
|
+
card = Stripe::Issuing::Card.retrieve("ic_123")
|
46
|
+
|
47
|
+
card_details = card.details
|
48
|
+
assert_requested :get, "#{Stripe.api_base}/v1/issuing/cards/ic_123/details"
|
49
|
+
assert card_details.is_a?(Stripe::Issuing::CardDetails)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.expand_path("../../../test_helper", __FILE__)
|
4
|
+
|
5
|
+
module Stripe
|
6
|
+
module Issuing
|
7
|
+
class CardholderTest < Test::Unit::TestCase
|
8
|
+
should "be creatable" do
|
9
|
+
cardholder = Stripe::Issuing::Cardholder.create(
|
10
|
+
billing: {
|
11
|
+
address: {
|
12
|
+
city: "city",
|
13
|
+
country: "US",
|
14
|
+
line1: "line1",
|
15
|
+
postal_code: "postal_code",
|
16
|
+
},
|
17
|
+
},
|
18
|
+
name: "Jenny Rosen",
|
19
|
+
type: "individual"
|
20
|
+
)
|
21
|
+
assert_requested :post, "#{Stripe.api_base}/v1/issuing/cardholders"
|
22
|
+
assert cardholder.is_a?(Stripe::Issuing::Cardholder)
|
23
|
+
end
|
24
|
+
|
25
|
+
should "be listable" do
|
26
|
+
cardholders = Stripe::Issuing::Cardholder.list
|
27
|
+
assert_requested :get, "#{Stripe.api_base}/v1/issuing/cardholders"
|
28
|
+
assert cardholders.data.is_a?(Array)
|
29
|
+
assert cardholders.data[0].is_a?(Stripe::Issuing::Cardholder)
|
30
|
+
end
|
31
|
+
|
32
|
+
should "be retrievable" do
|
33
|
+
cardholder = Stripe::Issuing::Cardholder.retrieve("ich_123")
|
34
|
+
assert_requested :get, "#{Stripe.api_base}/v1/issuing/cardholders/ich_123"
|
35
|
+
assert cardholder.is_a?(Stripe::Issuing::Cardholder)
|
36
|
+
end
|
37
|
+
|
38
|
+
should "be saveable" do
|
39
|
+
cardholder = Stripe::Issuing::Cardholder.retrieve("ich_123")
|
40
|
+
cardholder.metadata["key"] = "value"
|
41
|
+
cardholder.save
|
42
|
+
assert_requested :post, "#{Stripe.api_base}/v1/issuing/cardholders/#{cardholder.id}"
|
43
|
+
assert cardholder.is_a?(Stripe::Issuing::Cardholder)
|
44
|
+
end
|
45
|
+
|
46
|
+
should "be updateable" do
|
47
|
+
cardholder = Stripe::Issuing::Cardholder.update("ich_123", metadata: { foo: "bar" })
|
48
|
+
assert_requested :post, "#{Stripe.api_base}/v1/issuing/cardholders/ich_123"
|
49
|
+
assert cardholder.is_a?(Stripe::Issuing::Cardholder)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.expand_path("../../../test_helper", __FILE__)
|
4
|
+
|
5
|
+
module Stripe
|
6
|
+
module Issuing
|
7
|
+
class DisputeTest < Test::Unit::TestCase
|
8
|
+
should "be creatable" do
|
9
|
+
dispute = Stripe::Issuing::Dispute.create(
|
10
|
+
reason: "fraudulent",
|
11
|
+
transaction: "ipi_123"
|
12
|
+
)
|
13
|
+
assert_requested :post, "#{Stripe.api_base}/v1/issuing/disputes"
|
14
|
+
assert dispute.is_a?(Stripe::Issuing::Dispute)
|
15
|
+
end
|
16
|
+
|
17
|
+
should "be listable" do
|
18
|
+
disputes = Stripe::Issuing::Dispute.list
|
19
|
+
assert_requested :get, "#{Stripe.api_base}/v1/issuing/disputes"
|
20
|
+
assert disputes.data.is_a?(Array)
|
21
|
+
assert disputes.data[0].is_a?(Stripe::Issuing::Dispute)
|
22
|
+
end
|
23
|
+
|
24
|
+
should "be retrievable" do
|
25
|
+
dispute = Stripe::Issuing::Dispute.retrieve("ich_123")
|
26
|
+
assert_requested :get, "#{Stripe.api_base}/v1/issuing/disputes/ich_123"
|
27
|
+
assert dispute.is_a?(Stripe::Issuing::Dispute)
|
28
|
+
end
|
29
|
+
|
30
|
+
should "be saveable" do
|
31
|
+
dispute = Stripe::Issuing::Dispute.retrieve("ich_123")
|
32
|
+
dispute.metadata["key"] = "value"
|
33
|
+
dispute.save
|
34
|
+
assert_requested :post, "#{Stripe.api_base}/v1/issuing/disputes/#{dispute.id}"
|
35
|
+
assert dispute.is_a?(Stripe::Issuing::Dispute)
|
36
|
+
end
|
37
|
+
|
38
|
+
should "be updateable" do
|
39
|
+
dispute = Stripe::Issuing::Dispute.update("ich_123", metadata: { foo: "bar" })
|
40
|
+
assert_requested :post, "#{Stripe.api_base}/v1/issuing/disputes/ich_123"
|
41
|
+
assert dispute.is_a?(Stripe::Issuing::Dispute)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.expand_path("../../../test_helper", __FILE__)
|
4
|
+
|
5
|
+
module Stripe
|
6
|
+
module Issuing
|
7
|
+
class TransactionTest < Test::Unit::TestCase
|
8
|
+
should "be listable" do
|
9
|
+
stub_request(:get, "#{Stripe.api_base}/v1/issuing/transactions")
|
10
|
+
.to_return(body: JSON.generate(object: "list", data: [{ id: "ipi_123", object: "issuing.transaction" }]))
|
11
|
+
|
12
|
+
transactions = Stripe::Issuing::Transaction.list
|
13
|
+
assert_requested :get, "#{Stripe.api_base}/v1/issuing/transactions"
|
14
|
+
assert transactions.data.is_a?(Array)
|
15
|
+
assert transactions.data[0].is_a?(Stripe::Issuing::Transaction)
|
16
|
+
end
|
17
|
+
|
18
|
+
should "be retrievable" do
|
19
|
+
stub_request(:get, "#{Stripe.api_base}/v1/issuing/transactions/ipi_123")
|
20
|
+
.to_return(body: JSON.generate(id: "ipi_123", object: "issuing.transaction"))
|
21
|
+
|
22
|
+
transaction = Stripe::Issuing::Transaction.retrieve("ipi_123")
|
23
|
+
assert_requested :get, "#{Stripe.api_base}/v1/issuing/transactions/ipi_123"
|
24
|
+
assert transaction.is_a?(Stripe::Issuing::Transaction)
|
25
|
+
end
|
26
|
+
|
27
|
+
should "be saveable" do
|
28
|
+
stub_request(:post, "#{Stripe.api_base}/v1/issuing/transactions/ipi_123")
|
29
|
+
.to_return(body: JSON.generate(id: "ipi_123", object: "issuing.transaction"))
|
30
|
+
|
31
|
+
transaction = Stripe::Issuing::Transaction.construct_from(id: "ipi_123", object: "issuing.transaction", metadata: {})
|
32
|
+
transaction.metadata["key"] = "value"
|
33
|
+
transaction.save
|
34
|
+
assert_requested :post, "#{Stripe.api_base}/v1/issuing/transactions/#{transaction.id}"
|
35
|
+
assert transaction.is_a?(Stripe::Issuing::Transaction)
|
36
|
+
end
|
37
|
+
|
38
|
+
should "be updateable" do
|
39
|
+
stub_request(:post, "#{Stripe.api_base}/v1/issuing/transactions/ipi_123")
|
40
|
+
.to_return(body: JSON.generate(id: "ipi_123", object: "issuing.transaction"))
|
41
|
+
|
42
|
+
transaction = Stripe::Issuing::Transaction.update("ipi_123", metadata: { foo: "bar" })
|
43
|
+
assert_requested :post, "#{Stripe.api_base}/v1/issuing/transactions/ipi_123"
|
44
|
+
assert transaction.is_a?(Stripe::Issuing::Transaction)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -16,7 +16,7 @@ PROJECT_ROOT = File.expand_path("../../", __FILE__)
|
|
16
16
|
require File.expand_path("../test_data", __FILE__)
|
17
17
|
|
18
18
|
# If changing this number, please also change it in `.travis.yml`.
|
19
|
-
MOCK_MINIMUM_VERSION = "0.
|
19
|
+
MOCK_MINIMUM_VERSION = "0.23.0".freeze
|
20
20
|
MOCK_PORT = ENV["STRIPE_MOCK_PORT"] || 12_111
|
21
21
|
|
22
22
|
# Disable all real network connections except those that are outgoing to
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -81,6 +81,12 @@ files:
|
|
81
81
|
- lib/stripe/invoice_item.rb
|
82
82
|
- lib/stripe/invoice_line_item.rb
|
83
83
|
- lib/stripe/issuer_fraud_record.rb
|
84
|
+
- lib/stripe/issuing/authorization.rb
|
85
|
+
- lib/stripe/issuing/card.rb
|
86
|
+
- lib/stripe/issuing/card_details.rb
|
87
|
+
- lib/stripe/issuing/cardholder.rb
|
88
|
+
- lib/stripe/issuing/dispute.rb
|
89
|
+
- lib/stripe/issuing/transaction.rb
|
84
90
|
- lib/stripe/list_object.rb
|
85
91
|
- lib/stripe/login_link.rb
|
86
92
|
- lib/stripe/oauth.rb
|
@@ -140,6 +146,11 @@ files:
|
|
140
146
|
- test/stripe/invoice_line_item_test.rb
|
141
147
|
- test/stripe/invoice_test.rb
|
142
148
|
- test/stripe/issuer_fraud_record_test.rb
|
149
|
+
- test/stripe/issuing/authorization_test.rb
|
150
|
+
- test/stripe/issuing/card_test.rb
|
151
|
+
- test/stripe/issuing/cardholder_test.rb
|
152
|
+
- test/stripe/issuing/dispute_test.rb
|
153
|
+
- test/stripe/issuing/transaction_test.rb
|
143
154
|
- test/stripe/list_object_test.rb
|
144
155
|
- test/stripe/login_link_test.rb
|
145
156
|
- test/stripe/oauth_test.rb
|
@@ -223,6 +234,11 @@ test_files:
|
|
223
234
|
- test/stripe/invoice_line_item_test.rb
|
224
235
|
- test/stripe/invoice_test.rb
|
225
236
|
- test/stripe/issuer_fraud_record_test.rb
|
237
|
+
- test/stripe/issuing/authorization_test.rb
|
238
|
+
- test/stripe/issuing/card_test.rb
|
239
|
+
- test/stripe/issuing/cardholder_test.rb
|
240
|
+
- test/stripe/issuing/dispute_test.rb
|
241
|
+
- test/stripe/issuing/transaction_test.rb
|
226
242
|
- test/stripe/list_object_test.rb
|
227
243
|
- test/stripe/login_link_test.rb
|
228
244
|
- test/stripe/oauth_test.rb
|