File tree Expand file tree Collapse file tree 6 files changed +46
-2
lines changed Expand file tree Collapse file tree 6 files changed +46
-2
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ sudo: false
17
17
env :
18
18
global :
19
19
# If changing this number, please also change it in `test/test_helper.rb`.
20
- - STRIPE_MOCK_VERSION=0.39 .0
20
+ - STRIPE_MOCK_VERSION=0.40 .0
21
21
22
22
cache :
23
23
directories :
Original file line number Diff line number Diff line change 49
49
require "stripe/bitcoin_transaction"
50
50
require "stripe/card"
51
51
require "stripe/charge"
52
+ require "stripe/checkout_session"
52
53
require "stripe/country_spec"
53
54
require "stripe/coupon"
54
55
require "stripe/customer"
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ module Stripe
4
+ class CheckoutSession < APIResource
5
+ extend Stripe ::APIOperations ::Create
6
+
7
+ OBJECT_NAME = "checkout_session" . freeze
8
+ end
9
+ end
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ def self.object_classes # rubocop:disable Metrics/MethodLength
58
58
BitcoinTransaction ::OBJECT_NAME => BitcoinTransaction ,
59
59
Card ::OBJECT_NAME => Card ,
60
60
Charge ::OBJECT_NAME => Charge ,
61
+ CheckoutSession ::OBJECT_NAME => CheckoutSession ,
61
62
CountrySpec ::OBJECT_NAME => CountrySpec ,
62
63
Coupon ::OBJECT_NAME => Coupon ,
63
64
Customer ::OBJECT_NAME => Customer ,
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ require ::File . expand_path ( "../../test_helper" , __FILE__ )
4
+
5
+ module Stripe
6
+ class CheckoutSessionTest < Test ::Unit ::TestCase
7
+ should "be creatable" do
8
+ session = Stripe ::CheckoutSession . create (
9
+ allowed_source_types : [ "card" ] ,
10
+ cancel_url : "https://stripe.com/cancel" ,
11
+ client_reference_id : "1234" ,
12
+ line_items : [
13
+ {
14
+ amount : 123 ,
15
+ currency : "usd" ,
16
+ description : "item 1" ,
17
+ images : [
18
+ "https://stripe.com/img1" ,
19
+ ] ,
20
+ name : "name" ,
21
+ quantity : 2 ,
22
+ } ,
23
+ ] ,
24
+ payment_intent_data : [
25
+ receipt_email :
"[email protected] " ,
26
+ ] ,
27
+ success_url : "https://stripe.com/success"
28
+ )
29
+ assert_requested :post , "#{ Stripe . api_base } /v1/checkout_sessions"
30
+ assert session . is_a? ( Stripe ::CheckoutSession )
31
+ end
32
+ end
33
+ end
Original file line number Diff line number Diff line change 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.39 .0" . freeze
19
+ MOCK_MINIMUM_VERSION = "0.40 .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
You can’t perform that action at this time.
0 commit comments