diff --git a/.travis.yml b/.travis.yml index 0a101f364..976e144af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ notifications: env: global: # If changing this number, please also change it in `test/test_helper.rb`. - - STRIPE_MOCK_VERSION=0.103.0 + - STRIPE_MOCK_VERSION=0.105.0 cache: directories: diff --git a/lib/stripe/object_types.rb b/lib/stripe/object_types.rb index 2883ded29..58d0cf938 100644 --- a/lib/stripe/object_types.rb +++ b/lib/stripe/object_types.rb @@ -41,6 +41,8 @@ def self.object_names_to_classes File::OBJECT_NAME => File, File::OBJECT_NAME_ALT => File, FileLink::OBJECT_NAME => FileLink, + Identity::VerificationReport::OBJECT_NAME => Identity::VerificationReport, + Identity::VerificationSession::OBJECT_NAME => Identity::VerificationSession, Invoice::OBJECT_NAME => Invoice, InvoiceItem::OBJECT_NAME => InvoiceItem, InvoiceLineItem::OBJECT_NAME => InvoiceLineItem, diff --git a/lib/stripe/resources.rb b/lib/stripe/resources.rb index 1f78267c1..50dae4fbc 100644 --- a/lib/stripe/resources.rb +++ b/lib/stripe/resources.rb @@ -30,6 +30,8 @@ require "stripe/resources/exchange_rate" require "stripe/resources/file" require "stripe/resources/file_link" +require "stripe/resources/identity/verification_report" +require "stripe/resources/identity/verification_session" require "stripe/resources/invoice" require "stripe/resources/invoice_item" require "stripe/resources/invoice_line_item" diff --git a/lib/stripe/resources/identity/verification_report.rb b/lib/stripe/resources/identity/verification_report.rb new file mode 100644 index 000000000..3235e4d40 --- /dev/null +++ b/lib/stripe/resources/identity/verification_report.rb @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Identity + class VerificationReport < APIResource + extend Stripe::APIOperations::List + + OBJECT_NAME = "identity.verification_report" + end + end +end diff --git a/lib/stripe/resources/identity/verification_session.rb b/lib/stripe/resources/identity/verification_session.rb new file mode 100644 index 000000000..2170d8985 --- /dev/null +++ b/lib/stripe/resources/identity/verification_session.rb @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Identity + class VerificationSession < APIResource + extend Stripe::APIOperations::Create + extend Stripe::APIOperations::List + include Stripe::APIOperations::Save + + OBJECT_NAME = "identity.verification_session" + + custom_method :cancel, http_verb: :post + custom_method :redact, http_verb: :post + + def cancel(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: resource_url + "/cancel", + params: params, + opts: opts + ) + end + + def redact(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: resource_url + "/redact", + params: params, + opts: opts + ) + end + end + end +end diff --git a/test/stripe/identity/verification_report_test.rb b/test/stripe/identity/verification_report_test.rb new file mode 100644 index 000000000..014362aa6 --- /dev/null +++ b/test/stripe/identity/verification_report_test.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +require ::File.expand_path("../../test_helper", __dir__) + +module Stripe + module Identity + class VerificationReportTest < Test::Unit::TestCase + should "be listable" do + verification_reports = Stripe::Identity::VerificationReport.list + assert_requested :get, "#{Stripe.api_base}/v1/identity/verification_reports" + assert verification_reports.data.is_a?(Array) + assert verification_reports.data[0].is_a?(Stripe::Identity::VerificationReport) + end + + should "be retrievable" do + verification_report = Stripe::Identity::VerificationReport.retrieve("vs_123") + assert_requested :get, "#{Stripe.api_base}/v1/identity/verification_reports/vs_123" + assert verification_report.is_a?(Stripe::Identity::VerificationReport) + end + end + end +end diff --git a/test/stripe/identity/verification_session_test.rb b/test/stripe/identity/verification_session_test.rb new file mode 100644 index 000000000..254a7e84a --- /dev/null +++ b/test/stripe/identity/verification_session_test.rb @@ -0,0 +1,72 @@ +# frozen_string_literal: true + +require ::File.expand_path("../../test_helper", __dir__) + +module Stripe + module Identity + class VerificationSessionTest < Test::Unit::TestCase + should "be listable" do + verification_sessions = Stripe::Identity::VerificationSession.list + assert_requested :get, "#{Stripe.api_base}/v1/identity/verification_sessions" + assert verification_sessions.data.is_a?(Array) + assert verification_sessions.data[0].is_a?(Stripe::Identity::VerificationSession) + end + + should "be retrievable" do + verification_session = Stripe::Identity::VerificationSession.retrieve("vs_123") + assert_requested :get, "#{Stripe.api_base}/v1/identity/verification_sessions/vs_123" + assert verification_session.is_a?(Stripe::Identity::VerificationSession) + end + + should "be saveable" do + verification_session = Stripe::Identity::VerificationSession.retrieve("vs_123") + verification_session.metadata["key"] = "value" + verification_session.save + assert_requested :post, "#{Stripe.api_base}/v1/identity/verification_sessions/#{verification_session.id}" + assert verification_session.is_a?(Stripe::Identity::VerificationSession) + end + + should "be updateable" do + verification_session = Stripe::Identity::VerificationSession.update("vs_123", metadata: { foo: "bar" }) + assert_requested :post, "#{Stripe.api_base}/v1/identity/verification_sessions/vs_123" + assert verification_session.is_a?(Stripe::Identity::VerificationSession) + end + + context ".cancel" do + should "cancel an verification_session" do + payment_intent = Stripe::Identity::VerificationSession.cancel("vs_123") + + assert_requested :post, "#{Stripe.api_base}/v1/identity/verification_sessions/vs_123/cancel" + assert payment_intent.is_a?(Stripe::Identity::VerificationSession) + end + end + + context "#cancel" do + should "cancel an verification_session" do + verification_session = Stripe::Identity::VerificationSession.retrieve("vs_123") + verification_session.cancel + assert_requested :post, "#{Stripe.api_base}/v1/identity/verification_sessions/vs_123/cancel" + assert verification_session.is_a?(Stripe::Identity::VerificationSession) + end + end + + context ".redact" do + should "redact an verification_session" do + payment_intent = Stripe::Identity::VerificationSession.redact("vs_123") + + assert_requested :post, "#{Stripe.api_base}/v1/identity/verification_sessions/vs_123/redact" + assert payment_intent.is_a?(Stripe::Identity::VerificationSession) + end + end + + context "#redact" do + should "redact an verification_session" do + verification_session = Stripe::Identity::VerificationSession.retrieve("vs_123") + verification_session.redact + assert_requested :post, "#{Stripe.api_base}/v1/identity/verification_sessions/vs_123/redact" + assert verification_session.is_a?(Stripe::Identity::VerificationSession) + end + end + end + end +end diff --git a/test/test_helper.rb b/test/test_helper.rb index b57d6c6e0..13a0956f7 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -13,7 +13,7 @@ require ::File.expand_path("stripe_mock", __dir__) # If changing this number, please also change it in `.travis.yml`. -MOCK_MINIMUM_VERSION = "0.103.0" +MOCK_MINIMUM_VERSION = "0.105.0" MOCK_PORT = Stripe::StripeMock.start # Disable all real network connections except those that are outgoing to