├── .github ├── CODEOWNERS └── workflows │ └── pr_test.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── build.clj ├── deps.edn ├── src └── stripe_clojure │ ├── account_links.clj │ ├── accounts.clj │ ├── application_fees.clj │ ├── apps │ └── secrets.clj │ ├── balance.clj │ ├── balance_transactions.clj │ ├── billing │ ├── alerts.clj │ ├── credit_balance_summary.clj │ ├── credit_balance_transactions.clj │ ├── credit_grants.clj │ ├── meter_event_adjustments.clj │ ├── meter_events.clj │ └── meters.clj │ ├── billing_portal │ ├── configurations.clj │ └── sessions.clj │ ├── charges.clj │ ├── checkout │ └── sessions.clj │ ├── climate │ ├── orders.clj │ ├── products.clj │ └── suppliers.clj │ ├── config.clj │ ├── confirmation_tokens.clj │ ├── core.clj │ ├── coupons.clj │ ├── credit_notes.clj │ ├── crypto │ ├── onramp │ │ └── quotes.clj │ └── onramp_sessions.clj │ ├── customer_sessions.clj │ ├── customers.clj │ ├── disputes.clj │ ├── entitlements │ ├── active_entitlements.clj │ └── features.clj │ ├── ephemeral_keys.clj │ ├── events.clj │ ├── file_links.clj │ ├── files.clj │ ├── financial_connections │ ├── accounts.clj │ ├── sessions.clj │ └── transactions.clj │ ├── forwarding │ └── requests.clj │ ├── http │ ├── client.clj │ ├── events.clj │ ├── pagination.clj │ ├── request.clj │ ├── response.clj │ ├── retry.clj │ ├── throttle.clj │ └── util.clj │ ├── identity │ ├── verification_reports.clj │ └── verification_sessions.clj │ ├── invoice_items.clj │ ├── invoice_payments.clj │ ├── invoice_rendering_templates.clj │ ├── invoices.clj │ ├── issuing │ ├── authorizations.clj │ ├── cardholders.clj │ ├── cards.clj │ ├── disputes.clj │ ├── personalization_designs.clj │ ├── physical_bundles.clj │ ├── tokens.clj │ └── transactions.clj │ ├── mandates.clj │ ├── payment_intents.clj │ ├── payment_links.clj │ ├── payment_method_configurations.clj │ ├── payment_method_domains.clj │ ├── payment_methods.clj │ ├── payouts.clj │ ├── plans.clj │ ├── prices.clj │ ├── products.clj │ ├── promotion_codes.clj │ ├── quotes.clj │ ├── radar │ ├── early_fraud_warnings.clj │ ├── value_list_items.clj │ └── value_lists.clj │ ├── refunds.clj │ ├── reporting │ ├── report_runs.clj │ └── report_types.clj │ ├── reviews.clj │ ├── schemas │ ├── client.clj │ ├── common.clj │ └── request.clj │ ├── setup_attempts.clj │ ├── setup_intents.clj │ ├── shipping_rates.clj │ ├── sigma │ └── scheduled_query_runs.clj │ ├── sources.clj │ ├── subscription_items.clj │ ├── subscription_schedules.clj │ ├── subscriptions.clj │ ├── tax │ ├── calculations.clj │ ├── registrations.clj │ ├── settings.clj │ └── transactions.clj │ ├── tax_codes.clj │ ├── tax_ids.clj │ ├── tax_rates.clj │ ├── terminal │ ├── configurations.clj │ ├── connection_tokens.clj │ ├── locations.clj │ └── readers.clj │ ├── test_helpers │ ├── confirmation_tokens.clj │ └── customers.clj │ ├── tokens.clj │ ├── topups.clj │ ├── transfers.clj │ ├── treasury │ ├── credit_reversals.clj │ ├── debit_reversals.clj │ ├── financial_accounts.clj │ ├── inbound_transfers.clj │ ├── outbound_payments.clj │ ├── outbound_transfers.clj │ ├── received_credits.clj │ ├── received_debits.clj │ ├── transaction_entries.clj │ └── transactions.clj │ ├── webhook_endpoints.clj │ └── webhooks.clj └── test └── stripe_clojure ├── mock ├── account_links_test.clj ├── accounts_test.clj ├── application_fees_test.clj ├── apps │ └── secrets_test.clj ├── balance_test.clj ├── balance_transactions_test.clj ├── billing │ ├── alerts_test.clj │ ├── credit_balance_summary_test.clj │ ├── credit_balance_transactions_test.clj │ ├── credit_grants_test.clj │ ├── meter_event_adjustments_test.clj │ ├── meter_events_test.clj │ └── meters_test.clj ├── billing_portal │ ├── configurations_test.clj │ └── sessions_test.clj ├── charges_test.clj ├── checkout │ └── sessions_test.clj ├── climate │ ├── orders_test.clj │ ├── products_test.clj │ └── suppliers_test.clj ├── confirmation_tokens_test.clj ├── coupons_test.clj ├── credit_notes_test.clj ├── crypto │ └── onramp │ │ └── quotes_test.clj ├── customer_sessions_test.clj ├── customers_test.clj ├── disputes_test.clj ├── entitlements │ ├── active_entitlements_test.clj │ └── features_test.clj ├── ephemeral_keys_test.clj ├── events_test.clj ├── file_links_test.clj ├── files_test.clj ├── financial_connections │ ├── accounts_test.clj │ ├── sessions_test.clj │ └── transactions_test.clj ├── forwarding │ └── requests_test.clj ├── identity │ ├── verification_reports_test.clj │ └── verification_sessions_test.clj ├── invoice_items_test.clj ├── invoice_payments_test.clj ├── invoice_rendering_templates_test.clj ├── invoices_test.clj ├── issuing │ ├── authorizations_test.clj │ ├── cardholders_test.clj │ ├── cards_test.clj │ ├── disputes_test.clj │ ├── personalization_designs_test.clj │ ├── physical_bundles_test.clj │ ├── tokens_test.clj │ └── transactions_test.clj ├── mandates_test.clj ├── payment_intents_test.clj ├── payment_links_test.clj ├── payment_method_configurations_test.clj ├── payment_method_domains_test.clj ├── payment_methods_test.clj ├── payouts_test.clj ├── plans_test.clj ├── prices_test.clj ├── products_test.clj ├── promotion_codes_test.clj ├── quotes_test.clj ├── radar │ ├── early_fraud_warnings_test.clj │ ├── value_list_items_test.clj │ └── value_lists_test.clj ├── refunds_test.clj ├── reporting │ ├── report_runs_test.clj │ └── report_types_test.clj ├── reviews_test.clj ├── setup_attempts_test.clj ├── setup_intents_test.clj ├── shipping_rates_test.clj ├── sigma │ └── scheduled_query_runs_test.clj ├── sources_test.clj ├── subscription_items_test.clj ├── subscription_schedules_test.clj ├── subscriptions_test.clj ├── tax │ ├── calculations_test.clj │ ├── registrations_test.clj │ ├── settings_test.clj │ └── transactions_test.clj ├── tax_codes_test.clj ├── tax_ids_test.clj ├── tax_rates_test.clj ├── terminal │ ├── configurations_test.clj │ ├── connection_tokens_test.clj │ ├── locations_test.clj │ └── readers_test.clj ├── tokens_test.clj ├── topups_test.clj ├── transfers_test.clj ├── treasury │ ├── credit_reversals_test.clj │ ├── debit_reversals_test.clj │ ├── financial_accounts_test.clj │ ├── inbound_transfers_test.clj │ ├── outbound_payments_test.clj │ ├── outbound_transfers_test.clj │ ├── received_credits_test.clj │ ├── received_debits_test.clj │ ├── transaction_entries_test.clj │ └── transactions_test.clj ├── webhook_endpoints_test.clj └── webhooks_test.clj └── test_util.clj /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # These owners will be the default owners for everything in 2 | # the repo. They will be requested for review when someone 3 | # opens a pull request. 4 | * @yonureker -------------------------------------------------------------------------------- /.github/workflows/pr_test.yml: -------------------------------------------------------------------------------- 1 | name: PR Tests 2 | 3 | on: 4 | pull_request: 5 | branches: [ develop ] 6 | paths: 7 | - 'src/**' 8 | - 'test/**' 9 | - 'deps.edn' 10 | - '.github/workflows/**' 11 | 12 | jobs: 13 | test: 14 | runs-on: ubuntu-latest 15 | 16 | services: 17 | stripe-mock: 18 | image: stripe/stripe-mock:latest 19 | ports: 20 | - 12111:12111 21 | - 12112:12112 22 | 23 | container: 24 | image: clojure:temurin-17-tools-deps 25 | env: 26 | STRIPE_TEST_API_KEY: ${{ secrets.STRIPE_TEST_API_KEY }} 27 | STRIPE_MOCK_HOST: stripe-mock 28 | 29 | steps: 30 | - uses: actions/checkout@v3 31 | 32 | - name: Cache dependencies 33 | uses: actions/cache@v3 34 | with: 35 | path: ~/.m2/repository 36 | key: ${{ runner.os }}-deps-${{ hashFiles('**/deps.edn') }} 37 | restore-keys: ${{ runner.os }}-deps- 38 | 39 | - name: Run single test file 40 | run: clj -M:test -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /classes 3 | /checkouts 4 | profiles.clj 5 | pom.xml 6 | pom.xml.asc 7 | settings.xml 8 | *.jar 9 | *.class 10 | /.lein-* 11 | /.nrepl-port 12 | .hgignore 13 | .hg/ 14 | .DS_Store 15 | 16 | # Dependency caches 17 | /.cpcache/ 18 | /.m2/ 19 | 20 | #dev 21 | .calva 22 | .lsp 23 | .vscode 24 | .clj-kondo 25 | *.iml 26 | /.idea/ 27 | 28 | #hidden test files 29 | /test/stripe_clojure/unit/ -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## [0.3.0] - 2025-05-04 4 | 5 | - [#17](https://github.com/yonureker/stripe-clojure/issues/17): Fixed flattening params issue with vector payload 6 | - [#18](https://github.com/yonureker/stripe-clojure/pull/18): Bumped stripe version to `2025-04-30.basil`. 7 | - [#19](https://github.com/yonureker/stripe-clojure/pull/19): Adds support for invoice payment resources. 8 | - [#20](https://github.com/yonureker/stripe-clojure/pull/20): Remove support for `list-upcoming-line-items` and `retrieve-upcoming` methods on Invoice resource. 9 | - [#21](https://github.com/yonureker/stripe-clojure/pull/21): Remove support for `create-usage-record` and `list-usage-record-summaries` methods on Subscription items. 10 | - [#23](https://github.com/yonureker/stripe-clojure/pull/23): Fixes a mock test with invoices. 11 | - [#16](https://github.com/yonureker/stripe-clojure/pull/16): Stripe docs API url fix in `create-session` docstring. 12 | 13 | ## [0.2.2] - 2025-04-15 14 | 15 | - Fixes a version issue 16 | - Improved util functions with Java 17 | - Used clj-http features instead of manual formatting of request headers 18 | 19 | ## [0.2.1] - 2025-03-12 20 | 21 | - Replaced project.clj with deps.edn 22 | - Implemented automated testing for pull requests using GitHub Actions. 23 | - Added malli schemas 24 | - Params for Stripe client initialization and request opts are now validated 25 | - Idempotency keys are auto generated if missing 26 | - Cleaned up logic for max network retries (now either from client config or opts) 27 | 28 | ## [0.1.4] - 2025-02-23 29 | 30 | ### Added 31 | 32 | - Added `kebabify-keys?` to client initialization options. 33 | - Added `on` and `off` event listeners to the `stripe-client`. 34 | 35 | ### Changed 36 | 37 | - Updated the Stripe API version to `2025-01-27.acacia`. 38 | - Optimized the performance of functions in `util` namespace. 39 | 40 | 41 | ## [0.0.1] - 2025-02-16 42 | 43 | ### Added 44 | 45 | - Initial release of the Stripe Clojure library. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Onur Eker 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /build.clj: -------------------------------------------------------------------------------- 1 | (ns build 2 | (:require [clojure.tools.build.api :as b])) 3 | 4 | ;; Project configuration 5 | (def lib 'io.github.yonureker/stripe-clojure) 6 | (def version "0.3.0") 7 | (def class-dir "target/classes") 8 | (def basis (b/create-basis {:project "deps.edn"})) 9 | (def jar-file (format "target/%s-%s.jar" (name lib) version)) 10 | 11 | ;; Clean target directory 12 | (defn clean [_] 13 | (println "Cleaning target directory...") 14 | (b/delete {:path "target"})) 15 | 16 | ;; Build JAR file 17 | (defn jar [_] 18 | (println "Building JAR file...") 19 | (clean nil) 20 | (b/write-pom {:class-dir class-dir 21 | :lib lib 22 | :version version 23 | :basis basis 24 | :src-dirs ["src"] 25 | :scm {:url "https://github.com/yonureker/stripe-clojure"} 26 | :description "Clojure library for Stripe API" 27 | :licenses [{:name "MIT License" 28 | :url "https://opensource.org/licenses/MIT"}]}) 29 | (b/copy-dir {:src-dirs ["src" "resources"] 30 | :target-dir class-dir}) 31 | (b/jar {:class-dir class-dir 32 | :jar-file jar-file}) 33 | (println "Created" jar-file)) 34 | 35 | ;; Install to local Maven repository 36 | (defn install [_] 37 | (println "Installing to local Maven repository...") 38 | (jar nil) 39 | (b/install {:basis basis 40 | :lib lib 41 | :version version 42 | :jar-file jar-file 43 | :class-dir class-dir}) 44 | (println "Installed" (str lib) version "to local Maven repository")) -------------------------------------------------------------------------------- /deps.edn: -------------------------------------------------------------------------------- 1 | {:paths ["src"] 2 | 3 | :deps {org.clojure/clojure {:mvn/version "1.11.0"} 4 | cheshire/cheshire {:mvn/version "5.10.0"} 5 | clj-http/clj-http {:mvn/version "3.12.3"} 6 | metosin/malli {:mvn/version "0.9.0"}} 7 | 8 | :aliases 9 | {:test {:extra-paths ["test"] 10 | :extra-deps {org.clojure/test.check {:mvn/version "1.1.1"} 11 | io.github.cognitect-labs/test-runner 12 | {:git/tag "v0.5.1" :git/sha "dfb30dd"}} 13 | :main-opts ["-m" "cognitect.test-runner"]} 14 | 15 | :dev {:extra-deps {org.clojure/tools.namespace {:mvn/version "1.4.4"} 16 | org.clojure/tools.nrepl {:mvn/version "0.2.13"} 17 | cider/cider-nrepl {:mvn/version "0.28.5"}}} 18 | 19 | :build {:deps {io.github.clojure/tools.build {:mvn/version "0.10.7"}} 20 | :ns-default build} 21 | 22 | :deploy {:extra-deps {slipset/deps-deploy {:mvn/version "RELEASE"}} 23 | :exec-fn deps-deploy.deps-deploy/deploy 24 | :exec-args {:installer :remote 25 | :artifact "target/stripe-clojure-0.3.0.jar"}}}} -------------------------------------------------------------------------------- /src/stripe_clojure/account_links.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.account-links 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-account-links-endpoint (config/stripe-endpoints :account-links)) 6 | 7 | (defn create-account-link 8 | "Creates a single-use account link for an Express or Custom account to onboard with Stripe. 9 | \nStripe API docs: https://stripe.com/docs/api/account_links/create" 10 | ([stripe-client params] 11 | (create-account-link stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-account-links-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/apps/secrets.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.apps.secrets 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-apps-secrets-endpoint (config/stripe-endpoints :apps-secrets)) 6 | 7 | (defn set-secret 8 | "Create or replace a secret in the Stripe Apps secret store. 9 | \nStripe API docs: https://stripe.com/docs/api/apps/secret_store/set" 10 | ([stripe-client params] 11 | (set-secret stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-apps-secrets-endpoint params opts))) 14 | 15 | (defn list-secrets 16 | "List all secrets stored on the given scope. 17 | \nStripe API docs: https://stripe.com/docs/api/apps/secret_store/list" 18 | ([stripe-client] 19 | (list-secrets stripe-client {} {})) 20 | ([stripe-client params] 21 | (list-secrets stripe-client params {})) 22 | ([stripe-client params opts] 23 | (request stripe-client :get stripe-apps-secrets-endpoint params opts))) 24 | 25 | (defn delete-secret 26 | "Deletes a secret from the Stripe Apps secret store by name. 27 | \nStripe API docs: https://stripe.com/docs/api/apps/secret_store/delete" 28 | ([stripe-client params] 29 | (delete-secret stripe-client params {})) 30 | ([stripe-client params opts] 31 | (request stripe-client :post 32 | (str stripe-apps-secrets-endpoint "/delete") 33 | params 34 | opts))) 35 | 36 | (defn find-secret 37 | "Finds a secret in the Stripe Apps secret store by name. 38 | \nStripe API docs: https://stripe.com/docs/api/apps/secret_store/find" 39 | ([stripe-client params] 40 | (find-secret stripe-client params {})) 41 | ([stripe-client params opts] 42 | (request stripe-client :get 43 | (str stripe-apps-secrets-endpoint "/find" ) 44 | params 45 | opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/balance.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.balance 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-balance-endpoint (:balance config/stripe-endpoints)) 6 | 7 | (defn retrieve-balance 8 | "Retrieves the current account balance. 9 | \nStripe API docs: https://stripe.com/docs/api/balance/balance_retrieve" 10 | ([stripe-client] 11 | (retrieve-balance stripe-client {})) 12 | ([stripe-client opts] 13 | (request stripe-client :get stripe-balance-endpoint {} opts))) 14 | -------------------------------------------------------------------------------- /src/stripe_clojure/balance_transactions.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.balance-transactions 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-balance-transactions-endpoint (:balance-transactions config/stripe-endpoints)) 6 | 7 | (defn retrieve-balance-transaction 8 | "Retrieves the balance transaction with the given ID. 9 | \nStripe API docs: https://stripe.com/docs/api/balance_transactions/retrieve" 10 | ([stripe-client transaction-id] 11 | (retrieve-balance-transaction stripe-client transaction-id {})) 12 | ([stripe-client transaction-id opts] 13 | (request stripe-client :get (str stripe-balance-transactions-endpoint "/" transaction-id) {} opts))) 14 | 15 | (defn list-balance-transactions 16 | "Returns a list of balance transactions. 17 | \nStripe API docs: https://stripe.com/docs/api/balance_transactions/list" 18 | ([stripe-client] 19 | (list-balance-transactions stripe-client {})) 20 | ([stripe-client params] 21 | (list-balance-transactions stripe-client params {})) 22 | ([stripe-client params opts] 23 | (request stripe-client :get stripe-balance-transactions-endpoint params opts))) 24 | -------------------------------------------------------------------------------- /src/stripe_clojure/billing/credit_balance_summary.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.billing.credit-balance-summary 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-billing-credit-balance-summary-endpoint (config/stripe-endpoints :billing-credit-balance-summary)) 6 | 7 | (defn retrieve-credit-balance-summary 8 | "Retrieves a credit balance summary. 9 | \nStripe API docs: https://stripe.com/docs/api/billing/credit-balance-summary/retrieve" 10 | ([stripe-client params] 11 | (retrieve-credit-balance-summary stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :get stripe-billing-credit-balance-summary-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/billing/credit_balance_transactions.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.billing.credit-balance-transactions 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-billing-credit-balance-transactions-endpoint (config/stripe-endpoints :billing-credit-balance-transactions)) 6 | 7 | (defn list-credit-balance-transactions 8 | "Lists all credit balance transactions. 9 | \nStripe API docs: https://stripe.com/docs/api/billing/credit-balance-transaction/list" 10 | ([stripe-client] 11 | (list-credit-balance-transactions stripe-client {} {})) 12 | ([stripe-client params] 13 | (list-credit-balance-transactions stripe-client params {})) 14 | ([stripe-client params opts] 15 | (request stripe-client :get stripe-billing-credit-balance-transactions-endpoint params opts))) 16 | 17 | (defn retrieve-credit-balance-transaction 18 | "Retrieves a credit balance transaction. 19 | \nStripe API docs: https://stripe.com/docs/api/billing/credit-balance-transaction/retrieve" 20 | ([stripe-client transaction-id] 21 | (retrieve-credit-balance-transaction stripe-client transaction-id {})) 22 | ([stripe-client transaction-id opts] 23 | (request stripe-client :get 24 | (str stripe-billing-credit-balance-transactions-endpoint "/" transaction-id) 25 | {} 26 | opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/billing/meter_event_adjustments.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.billing.meter-event-adjustments 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-billing-meter-event-adjustments-endpoint (config/stripe-endpoints :billing-meter-event-adjustments)) 6 | 7 | (defn create-meter-event-adjustment 8 | "Creates a new meter event adjustment. 9 | \nStripe API docs: https://stripe.com/docs/api/billing/meter-event-adjustment/create" 10 | ([stripe-client params] 11 | (create-meter-event-adjustment stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-billing-meter-event-adjustments-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/billing/meter_events.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.billing.meter-events 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-billing-meter-events-endpoint (config/stripe-endpoints :billing-meter-events)) 6 | 7 | (defn create-meter-event 8 | "Creates a new meter event. 9 | \nStripe API docs: https://stripe.com/docs/api/billing/meter-event/create" 10 | ([stripe-client params] 11 | (create-meter-event stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-billing-meter-events-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/billing_portal/sessions.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.billing-portal.sessions 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-billing-portal-sessions-endpoint (:billing-portal-sessions config/stripe-endpoints)) 6 | 7 | (defn create-session 8 | "Creates a session for a customer to manage their subscription and billing details. 9 | \nStripe API docs: https://stripe.com/docs/api/customer_portal/sessions/create" 10 | ([stripe-client params] 11 | (create-session stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-billing-portal-sessions-endpoint params opts))) 14 | -------------------------------------------------------------------------------- /src/stripe_clojure/climate/orders.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.climate.orders 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-climate-orders-endpoint (config/stripe-endpoints :climate-orders)) 6 | 7 | (defn create-order 8 | "Creates a new climate order. 9 | \nStripe API docs: https://stripe.com/docs/api/climate/order/create" 10 | ([stripe-client params] 11 | (create-order stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-climate-orders-endpoint params opts))) 14 | 15 | (defn retrieve-order 16 | "Retrieves a climate order. 17 | \nStripe API docs: https://stripe.com/docs/api/climate/order/retrieve" 18 | ([stripe-client order-id] 19 | (retrieve-order stripe-client order-id {})) 20 | ([stripe-client order-id opts] 21 | (request stripe-client :get 22 | (str stripe-climate-orders-endpoint "/" order-id) 23 | {} 24 | opts))) 25 | 26 | (defn update-order 27 | "Updates a climate order. 28 | \nStripe API docs: https://stripe.com/docs/api/climate/order/update" 29 | ([stripe-client order-id params] 30 | (update-order stripe-client order-id params {})) 31 | ([stripe-client order-id params opts] 32 | (request stripe-client :post 33 | (str stripe-climate-orders-endpoint "/" order-id) 34 | params 35 | opts))) 36 | 37 | (defn list-orders 38 | "Lists all climate orders. 39 | \nStripe API docs: https://stripe.com/docs/api/climate/order/list" 40 | ([stripe-client] 41 | (list-orders stripe-client {} {})) 42 | ([stripe-client params] 43 | (list-orders stripe-client params {})) 44 | ([stripe-client params opts] 45 | (request stripe-client :get stripe-climate-orders-endpoint params opts))) 46 | 47 | (defn cancel-order 48 | "Cancels a climate order. 49 | \nStripe API docs: https://stripe.com/docs/api/climate/order/cancel" 50 | ([stripe-client order-id] 51 | (cancel-order stripe-client order-id {})) 52 | ([stripe-client order-id opts] 53 | (request stripe-client :post 54 | (str stripe-climate-orders-endpoint "/" order-id "/cancel") 55 | {} 56 | opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/climate/products.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.climate.products 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-climate-products-endpoint (config/stripe-endpoints :climate-products)) 6 | 7 | (defn retrieve-product 8 | "Retrieves a climate product. 9 | \nStripe API docs: https://stripe.com/docs/api/climate/product/retrieve" 10 | ([stripe-client product-id] 11 | (retrieve-product stripe-client product-id {})) 12 | ([stripe-client product-id opts] 13 | (request stripe-client :get 14 | (str stripe-climate-products-endpoint "/" product-id) 15 | {} 16 | opts))) 17 | 18 | (defn list-products 19 | "Lists all climate products. 20 | \nStripe API docs: https://stripe.com/docs/api/climate/product/list" 21 | ([stripe-client] 22 | (list-products stripe-client {} {})) 23 | ([stripe-client params] 24 | (list-products stripe-client params {})) 25 | ([stripe-client params opts] 26 | (request stripe-client :get stripe-climate-products-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/climate/suppliers.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.climate.suppliers 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-climate-suppliers-endpoint (config/stripe-endpoints :climate-suppliers)) 6 | 7 | (defn retrieve-supplier 8 | "Retrieves a climate supplier. 9 | \nStripe API docs: https://stripe.com/docs/api/climate/supplier/retrieve" 10 | ([stripe-client supplier-id] 11 | (retrieve-supplier stripe-client supplier-id {})) 12 | ([stripe-client supplier-id opts] 13 | (request stripe-client :get 14 | (str stripe-climate-suppliers-endpoint "/" supplier-id) 15 | {} 16 | opts))) 17 | 18 | (defn list-suppliers 19 | "Lists all climate suppliers. 20 | \nStripe API docs: https://stripe.com/docs/api/climate/supplier/list" 21 | ([stripe-client] 22 | (list-suppliers stripe-client {} {})) 23 | ([stripe-client params] 24 | (list-suppliers stripe-client params {})) 25 | ([stripe-client params opts] 26 | (request stripe-client :get stripe-climate-suppliers-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/confirmation_tokens.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.confirmation-tokens 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-confirmation-tokens-endpoint (:confirmation-tokens config/stripe-endpoints)) 6 | 7 | (defn retrieve-confirmation-token 8 | "Retrieves an existing ConfirmationToken object. 9 | \nStripe API docs: https://stripe.com/docs/api/confirmation_tokens/retrieve" 10 | ([stripe-client token-id] 11 | (retrieve-confirmation-token stripe-client token-id {})) 12 | ([stripe-client token-id opts] 13 | (request stripe-client :get (str stripe-confirmation-tokens-endpoint "/" token-id) {} opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/coupons.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.coupons 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-coupons-endpoint (:coupons config/stripe-endpoints)) 6 | 7 | (defn create-coupon 8 | "Creates a new coupon that can be applied to subscriptions or invoices. 9 | \nStripe API docs: https://stripe.com/docs/api/coupons/create" 10 | ([stripe-client params] 11 | (create-coupon stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-coupons-endpoint params opts))) 14 | 15 | (defn retrieve-coupon 16 | "Retrieves the coupon with the given ID. 17 | \nStripe API docs: https://stripe.com/docs/api/coupons/retrieve" 18 | ([stripe-client coupon-id] 19 | (retrieve-coupon stripe-client coupon-id {})) 20 | ([stripe-client coupon-id opts] 21 | (request stripe-client :get (str stripe-coupons-endpoint "/" coupon-id) {} opts))) 22 | 23 | (defn update-coupon 24 | "Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable. 25 | \nStripe API docs: https://stripe.com/docs/api/coupons/update" 26 | ([stripe-client coupon-id params] 27 | (update-coupon stripe-client coupon-id params {})) 28 | ([stripe-client coupon-id params opts] 29 | (request stripe-client :post (str stripe-coupons-endpoint "/" coupon-id) params opts))) 30 | 31 | (defn delete-coupon 32 | "Deletes the coupon with the given ID. 33 | \nStripe API docs: https://stripe.com/docs/api/coupons/delete" 34 | ([stripe-client coupon-id] 35 | (delete-coupon stripe-client coupon-id {})) 36 | ([stripe-client coupon-id opts] 37 | (request stripe-client :delete (str stripe-coupons-endpoint "/" coupon-id) nil opts))) 38 | 39 | (defn list-coupons 40 | "Returns a list of your coupons. 41 | \nStripe API docs: https://stripe.com/docs/api/coupons/list" 42 | ([stripe-client] 43 | (list-coupons stripe-client {})) 44 | ([stripe-client params] 45 | (list-coupons stripe-client params {})) 46 | ([stripe-client params opts] 47 | (request stripe-client :get stripe-coupons-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/crypto/onramp/quotes.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.crypto.onramp.quotes 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-crypto-onramp-quotes-endpoint (config/stripe-endpoints :crypto-onramp-quotes)) 6 | 7 | (defn list-quotes 8 | "Lists all crypto onramp quotes. 9 | \nStripe API docs: https://stripe.com/docs/api/crypto/onramp_quotes" 10 | ([stripe-client] 11 | (list-quotes stripe-client {} {})) 12 | ([stripe-client params] 13 | (list-quotes stripe-client params {})) 14 | ([stripe-client params opts] 15 | (request stripe-client :get stripe-crypto-onramp-quotes-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/crypto/onramp_sessions.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.crypto.onramp-sessions 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-crypto-onramp-sessions-endpoint (config/stripe-endpoints :crypto-onramp-sessions)) 6 | 7 | (defn create-onramp-session 8 | "Creates a new crypto onramp session. 9 | \nStripe API docs: https://stripe.com/docs/api/crypto/onramp_sessions/create" 10 | ([stripe-client params] 11 | (create-onramp-session stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-crypto-onramp-sessions-endpoint params opts))) 14 | 15 | (defn retrieve-onramp-session 16 | "Retrieves a crypto onramp session. 17 | \nStripe API docs: https://stripe.com/docs/api/crypto/onramp_sessions/retrieve" 18 | ([stripe-client session-id] 19 | (retrieve-onramp-session stripe-client session-id {})) 20 | ([stripe-client session-id opts] 21 | (request stripe-client :get 22 | (str stripe-crypto-onramp-sessions-endpoint "/" session-id) 23 | {} 24 | opts))) 25 | 26 | (defn list-onramp-sessions 27 | "Lists all crypto onramp sessions. 28 | \nStripe API docs: https://stripe.com/docs/api/crypto/onramp_sessions/list" 29 | ([stripe-client] 30 | (list-onramp-sessions stripe-client {} {})) 31 | ([stripe-client params] 32 | (list-onramp-sessions stripe-client params {})) 33 | ([stripe-client params opts] 34 | (request stripe-client :get stripe-crypto-onramp-sessions-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/customer_sessions.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.customer-sessions 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-customer-sessions-endpoint (:customer-sessions config/stripe-endpoints)) 6 | 7 | (defn create-customer-session 8 | "Creates a Customer Session. 9 | \nStripe API docs: https://stripe.com/docs/api/customer_sessions/create" 10 | ([stripe-client params] 11 | (create-customer-session stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-customer-sessions-endpoint params opts))) 14 | -------------------------------------------------------------------------------- /src/stripe_clojure/disputes.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.disputes 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-disputes-endpoint (:disputes config/stripe-endpoints)) 6 | 7 | (defn retrieve-dispute 8 | "Retrieves the dispute with the given ID. 9 | \nStripe API docs: https://stripe.com/docs/api/disputes/retrieve" 10 | ([stripe-client dispute-id] 11 | (retrieve-dispute stripe-client dispute-id {})) 12 | ([stripe-client dispute-id opts] 13 | (request stripe-client :get (str stripe-disputes-endpoint "/" dispute-id) {} opts))) 14 | 15 | (defn update-dispute 16 | "Updates the specified dispute. 17 | \nStripe API docs: https://stripe.com/docs/api/disputes/update" 18 | ([stripe-client dispute-id params] 19 | (update-dispute stripe-client dispute-id params {})) 20 | ([stripe-client dispute-id params opts] 21 | (request stripe-client :post (str stripe-disputes-endpoint "/" dispute-id) params opts))) 22 | 23 | (defn list-disputes 24 | "Returns a list of disputes. 25 | \nStripe API docs: https://stripe.com/docs/api/disputes/list" 26 | ([stripe-client] 27 | (list-disputes stripe-client {})) 28 | ([stripe-client params] 29 | (list-disputes stripe-client params {})) 30 | ([stripe-client params opts] 31 | (request stripe-client :get stripe-disputes-endpoint params opts))) 32 | 33 | (defn close-dispute 34 | "Closes the dispute with the given ID. 35 | \nStripe API docs: https://stripe.com/docs/api/disputes/close" 36 | ([stripe-client dispute-id] 37 | (close-dispute stripe-client dispute-id {})) 38 | ([stripe-client dispute-id opts] 39 | (request stripe-client :post (str stripe-disputes-endpoint "/" dispute-id "/close") {} opts))) 40 | -------------------------------------------------------------------------------- /src/stripe_clojure/entitlements/active_entitlements.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.entitlements.active-entitlements 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-entitlements-active-entitlements-endpoint (config/stripe-endpoints :entitlements-active-entitlements)) 6 | 7 | (defn retrieve-active-entitlement 8 | "Retrieves an active entitlement. 9 | \nStripe API docs: https://stripe.com/docs/api/entitlements/active-entitlement/retrieve" 10 | ([stripe-client id] 11 | (retrieve-active-entitlement stripe-client id {})) 12 | ([stripe-client id opts] 13 | (request stripe-client :get 14 | (str stripe-entitlements-active-entitlements-endpoint "/" id) 15 | {} 16 | opts))) 17 | 18 | (defn list-active-entitlements 19 | "Lists all active entitlements. 20 | \nStripe API docs: https://stripe.com/docs/api/entitlements/active-entitlement/list" 21 | ([stripe-client params] 22 | (list-active-entitlements stripe-client params {})) 23 | ([stripe-client params opts] 24 | (request stripe-client :get stripe-entitlements-active-entitlements-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/entitlements/features.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.entitlements.features 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-entitlements-features-endpoint (config/stripe-endpoints :entitlements-features)) 6 | 7 | (defn create-feature 8 | "Creates a new feature. 9 | \nStripe API docs: https://stripe.com/docs/api/entitlements/feature/create" 10 | ([stripe-client params] 11 | (create-feature stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-entitlements-features-endpoint params opts))) 14 | 15 | (defn update-feature 16 | "Updates a feature. 17 | \nStripe API docs: https://stripe.com/docs/api/entitlements/feature/update" 18 | ([stripe-client id params] 19 | (update-feature stripe-client id params {})) 20 | ([stripe-client id params opts] 21 | (request stripe-client :post 22 | (str stripe-entitlements-features-endpoint "/" id) 23 | params 24 | opts))) 25 | 26 | (defn list-features 27 | "Lists all features. 28 | \nStripe API docs: https://stripe.com/docs/api/entitlements/feature/list" 29 | ([stripe-client] 30 | (list-features stripe-client {} {})) 31 | ([stripe-client params] 32 | (list-features stripe-client params {})) 33 | ([stripe-client params opts] 34 | (request stripe-client :get stripe-entitlements-features-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/ephemeral_keys.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.ephemeral-keys 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-ephemeral-keys-endpoint (config/stripe-endpoints :ephemeral-keys)) 6 | 7 | (defn create-ephemeral-key 8 | "Creates a new ephemeral key. 9 | Note: Requires a Stripe API version (either configured globally or passed in opts as :stripe-version)." 10 | ([stripe-client params] 11 | (create-ephemeral-key stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-ephemeral-keys-endpoint params opts))) 14 | 15 | (defn delete-ephemeral-key 16 | "Deletes an ephemeral key." 17 | ([stripe-client key-id] 18 | (delete-ephemeral-key stripe-client key-id {})) 19 | ([stripe-client key-id opts] 20 | (request stripe-client :delete 21 | (str stripe-ephemeral-keys-endpoint "/" key-id) 22 | nil 23 | opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/events.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.events 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-events-endpoint (:events config/stripe-endpoints)) 6 | 7 | (defn retrieve-event 8 | "Retrieves the details of an event. 9 | \nStripe API docs: https://stripe.com/docs/api/events/retrieve" 10 | ([stripe-client event-id] 11 | (retrieve-event stripe-client event-id {})) 12 | ([stripe-client event-id opts] 13 | (request stripe-client :get (str stripe-events-endpoint "/" event-id) {} opts))) 14 | 15 | (defn list-events 16 | "List events, going back up to 30 days. 17 | \nStripe API docs: https://stripe.com/docs/api/events/list" 18 | ([stripe-client] 19 | (list-events stripe-client {})) 20 | ([stripe-client params] 21 | (list-events stripe-client params {})) 22 | ([stripe-client params opts] 23 | (request stripe-client :get stripe-events-endpoint params opts))) 24 | -------------------------------------------------------------------------------- /src/stripe_clojure/file_links.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.file-links 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-file-links-endpoint (:file-links config/stripe-endpoints)) 6 | 7 | (defn create-file-link 8 | "Creates a new file link. 9 | \nStripe API docs: https://stripe.com/docs/api/file_links/create" 10 | ([stripe-client params] 11 | (create-file-link stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-file-links-endpoint params opts))) 14 | 15 | (defn retrieve-file-link 16 | "Retrieves a file link by ID. 17 | \nStripe API docs: https://stripe.com/docs/api/file_links/retrieve" 18 | ([stripe-client file-link-id] 19 | (retrieve-file-link stripe-client file-link-id {})) 20 | ([stripe-client file-link-id opts] 21 | (request stripe-client :get 22 | (str stripe-file-links-endpoint "/" file-link-id) 23 | {} 24 | opts))) 25 | 26 | (defn update-file-link 27 | "Updates a file link. 28 | \nStripe API docs: https://stripe.com/docs/api/file_links/update" 29 | ([stripe-client file-link-id params] 30 | (update-file-link stripe-client file-link-id params {})) 31 | ([stripe-client file-link-id params opts] 32 | (request stripe-client :post 33 | (str stripe-file-links-endpoint "/" file-link-id) 34 | params 35 | opts))) 36 | 37 | (defn list-file-links 38 | "Lists all file links. 39 | \nStripe API docs: https://stripe.com/docs/api/file_links/list" 40 | ([stripe-client] 41 | (list-file-links stripe-client {})) 42 | ([stripe-client params] 43 | (list-file-links stripe-client params {})) 44 | ([stripe-client params opts] 45 | (request stripe-client :get stripe-file-links-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/financial_connections/sessions.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.financial-connections.sessions 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-financial-connections-sessions-endpoint (config/stripe-endpoints :financial-connections-sessions)) 6 | 7 | (defn create-session 8 | "Creates a new financial connections session. 9 | \nStripe API docs: https://stripe.com/docs/api/financial_connections/sessions/create" 10 | ([stripe-client params] 11 | (create-session stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-financial-connections-sessions-endpoint params opts))) 14 | 15 | (defn retrieve-session 16 | "Retrieves a financial connections session. 17 | \nStripe API docs: https://stripe.com/docs/api/financial_connections/sessions/retrieve" 18 | ([stripe-client session-id] 19 | (retrieve-session stripe-client session-id {})) 20 | ([stripe-client session-id opts] 21 | (request stripe-client :get 22 | (str stripe-financial-connections-sessions-endpoint "/" session-id) 23 | {} 24 | opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/financial_connections/transactions.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.financial-connections.transactions 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-financial-connections-transactions-endpoint (config/stripe-endpoints :financial-connections-transactions)) 6 | 7 | (defn retrieve-transaction 8 | "Retrieves a financial connections transaction. 9 | \nStripe API docs: https://stripe.com/docs/api/financial_connections/transaction/retrieve" 10 | ([stripe-client transaction-id] 11 | (retrieve-transaction stripe-client transaction-id {})) 12 | ([stripe-client transaction-id opts] 13 | (request stripe-client :get 14 | (str stripe-financial-connections-transactions-endpoint "/" transaction-id) 15 | {} 16 | opts))) 17 | 18 | (defn list-transactions 19 | "Lists all financial connections transactions. 20 | \nStripe API docs: https://stripe.com/docs/api/financial_connections/transactions/list" 21 | ([stripe-client params] 22 | (list-transactions stripe-client params {})) 23 | ([stripe-client params opts] 24 | (request stripe-client :get stripe-financial-connections-transactions-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/forwarding/requests.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.forwarding.requests 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-forwarding-requests-endpoint (config/stripe-endpoints :forwarding-requests)) 6 | 7 | (defn create-request 8 | "Creates a new forwarding request. 9 | \nStripe API docs: https://stripe.com/docs/api/forwarding/forwarding_requests/create" 10 | ([stripe-client params] 11 | (create-request stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-forwarding-requests-endpoint params opts))) 14 | 15 | (defn retrieve-request 16 | "Retrieves a forwarding request. 17 | \nStripe API docs: https://stripe.com/docs/api/forwarding/forwarding_requests/retrieve" 18 | ([stripe-client request-id] 19 | (retrieve-request stripe-client request-id {})) 20 | ([stripe-client request-id opts] 21 | (request stripe-client :get 22 | (str stripe-forwarding-requests-endpoint "/" request-id) 23 | {} 24 | opts))) 25 | 26 | (defn list-requests 27 | "Lists all forwarding requests. 28 | \nStripe API docs: https://stripe.com/docs/api/forwarding/forwarding_requests/list" 29 | ([stripe-client] 30 | (list-requests stripe-client {} {})) 31 | ([stripe-client params] 32 | (list-requests stripe-client params {})) 33 | ([stripe-client params opts] 34 | (request stripe-client :get stripe-forwarding-requests-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/http/pagination.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.http.pagination) 2 | 3 | (defn- get-next-page-params 4 | "Extract parameters for the next page from a Stripe API response." 5 | [response] 6 | (when (:has_more response) 7 | {:starting-after (-> response :data last :id)})) 8 | 9 | (defn is-paginated-endpoint? 10 | "Determines if the given URL represents a paginated endpoint. 11 | 12 | For auto-pagination we want to include: 13 | - All GET calls to a base resource listing endpoint 14 | (which typically have a form like `/v1/` or with a trailing slash) 15 | - All endpoints ending with `/search`. 16 | 17 | This function assumes that `full-url` includes the base URL (e.g. 'https://api.stripe.com'). 18 | Adjust the regex as needed if your API domain is different." 19 | [url] 20 | (or (re-matches #".*/search/?$" url) 21 | (re-matches #".*/v1/[\w-]+/?$" url))) 22 | 23 | (defn paginate 24 | "Handles pagination for Stripe API requests. 25 | 26 | Parameters: 27 | - method: The HTTP method (:get, :post, etc.) 28 | - url: The API endpoint URL 29 | - params: The request parameters 30 | - options: Additional options, including :auto-paginate? 31 | - make-request-fn: A function that makes a single API request 32 | 33 | Returns: 34 | If :auto-paginate? is true, returns a lazy sequence of all items across all pages. 35 | Otherwise, returns the result of a single API call." 36 | [method url params options make-request-fn] 37 | (if (:auto-paginate? options) 38 | (lazy-seq 39 | (let [response (make-request-fn) 40 | items (:data response)] 41 | (if-let [next-page-params (get-next-page-params response)] 42 | (concat items (paginate method url (merge params next-page-params) options make-request-fn)) 43 | items))) 44 | (make-request-fn))) 45 | -------------------------------------------------------------------------------- /src/stripe_clojure/http/response.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.http.response 2 | (:require [stripe-clojure.http.util :as util] 3 | [cheshire.core :as json])) 4 | 5 | (defn- parse-body 6 | "Parses the error body if it's a string, otherwise returns it as-is." 7 | [body] 8 | (if (string? body) 9 | (try 10 | (json/parse-string body true) 11 | (catch Exception _ 12 | {:error {:message "Failed to parse error response body"}})) 13 | body)) 14 | 15 | 16 | (defn create-error-response 17 | "Creates a structured error response from the original response. 18 | Optionally transforms keys to kebab-case based on the config." 19 | [response full-response? kebabify-keys?] 20 | (let [parsed-body (if kebabify-keys? 21 | (util/transform-keys (parse-body (:body response))) 22 | (parse-body (:body response))) 23 | error-map (get parsed-body :error parsed-body) 24 | simplified-error (merge error-map 25 | {:status (:status response) 26 | :request-id (get-in response [:headers "request-id"])})] 27 | (if full-response? 28 | (if kebabify-keys? 29 | (assoc response :body parsed-body) 30 | (assoc response :body (parse-body (:body response)))) 31 | (if kebabify-keys? 32 | (util/transform-keys simplified-error) 33 | simplified-error)))) 34 | 35 | (defn process-response 36 | "Process the response based on its status and the full-response flag. 37 | Optionally transforms keys to kebab-case based on the config." 38 | [response full-response? kebabify-keys?] 39 | (let [transformed-response 40 | (cond-> response 41 | kebabify-keys? 42 | (-> (update :headers #(util/transform-keys (into {} %))) 43 | (update :body #(-> % parse-body util/transform-keys))))] 44 | (if (>= (:status transformed-response) 400) 45 | (create-error-response transformed-response full-response? kebabify-keys?) 46 | (if full-response? 47 | transformed-response 48 | (:body transformed-response))))) -------------------------------------------------------------------------------- /src/stripe_clojure/identity/verification_reports.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.identity.verification-reports 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-identity-verification-reports-endpoint (config/stripe-endpoints :identity-verification-reports)) 6 | 7 | (defn retrieve-verification-report 8 | "Retrieves an identity verification report. 9 | \nStripe API docs: https://stripe.com/docs/api/identity/verification_reports/retrieve" 10 | ([stripe-client report-id] 11 | (retrieve-verification-report stripe-client report-id {})) 12 | ([stripe-client report-id opts] 13 | (request stripe-client :get 14 | (str stripe-identity-verification-reports-endpoint "/" report-id) 15 | {} 16 | opts))) 17 | 18 | (defn list-verification-reports 19 | "Lists all identity verification reports. 20 | \nStripe API docs: https://stripe.com/docs/api/identity/verification_reports/list" 21 | ([stripe-client] 22 | (list-verification-reports stripe-client {} {})) 23 | ([stripe-client params] 24 | (list-verification-reports stripe-client params {})) 25 | ([stripe-client params opts] 26 | (request stripe-client :get stripe-identity-verification-reports-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/invoice_items.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.invoice-items 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-invoice-items-endpoint (:invoice-items config/stripe-endpoints)) 6 | 7 | (defn create-invoice-item 8 | "Creates a new invoice item. 9 | \nStripe API docs: https://stripe.com/docs/api/invoiceitems/create" 10 | ([stripe-client params] 11 | (create-invoice-item stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-invoice-items-endpoint params opts))) 14 | 15 | (defn retrieve-invoice-item 16 | "Retrieves an invoice item. 17 | \nStripe API docs: https://stripe.com/docs/api/invoiceitems/retrieve" 18 | ([stripe-client invoice-item-id] 19 | (retrieve-invoice-item stripe-client invoice-item-id {})) 20 | ([stripe-client invoice-item-id opts] 21 | (request stripe-client :get (str stripe-invoice-items-endpoint "/" invoice-item-id) {} opts))) 22 | 23 | (defn update-invoice-item 24 | "Updates an invoice item. 25 | \nStripe API docs: https://stripe.com/docs/api/invoiceitems/update" 26 | ([stripe-client invoice-item-id params] 27 | (update-invoice-item stripe-client invoice-item-id params {})) 28 | ([stripe-client invoice-item-id params opts] 29 | (request stripe-client :post (str stripe-invoice-items-endpoint "/" invoice-item-id) params opts))) 30 | 31 | (defn delete-invoice-item 32 | "Deletes an invoice item. 33 | \nStripe API docs: https://stripe.com/docs/api/invoiceitems/delete" 34 | ([stripe-client invoice-item-id] 35 | (delete-invoice-item stripe-client invoice-item-id {})) 36 | ([stripe-client invoice-item-id opts] 37 | (request stripe-client :delete (str stripe-invoice-items-endpoint "/" invoice-item-id) nil opts))) 38 | 39 | (defn list-invoice-items 40 | "Lists all invoice items. 41 | \nStripe API docs: https://stripe.com/docs/api/invoiceitems/list" 42 | ([stripe-client] 43 | (list-invoice-items stripe-client {})) 44 | ([stripe-client params] 45 | (list-invoice-items stripe-client params {})) 46 | ([stripe-client params opts] 47 | (request stripe-client :get stripe-invoice-items-endpoint params opts))) 48 | -------------------------------------------------------------------------------- /src/stripe_clojure/invoice_payments.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.invoice-payments 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-invoice-payments-endpoint (:invoice-payments config/stripe-endpoints)) 6 | 7 | (defn retrieve-invoice-payment 8 | "Retrieves an invoice payment. 9 | \nStripe API docs: https://docs.stripe.com/api/invoice-payment/retrieve" 10 | ([stripe-client invoice-payment-id] 11 | (retrieve-invoice-payment stripe-client invoice-payment-id {})) 12 | ([stripe-client invoice-payment-id opts] 13 | (request stripe-client :get (str stripe-invoice-payments-endpoint "/" invoice-payment-id) {} opts))) 14 | 15 | (defn list-invoice-payments 16 | "List all invoice payments. 17 | \nStripe API docs: https://docs.stripe.com/api/invoice-payment/list" 18 | ([stripe-client] 19 | (list-invoice-payments stripe-client {})) 20 | ([stripe-client opts] 21 | (request stripe-client :get stripe-invoice-payments-endpoint {} opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/issuing/cardholders.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.issuing.cardholders 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-issuing-cardholders-endpoint (config/stripe-endpoints :issuing-cardholders)) 6 | 7 | (defn create-cardholder 8 | "Creates a new issuing cardholder. 9 | \nStripe API docs: https://stripe.com/docs/api/issuing/cardholders/create" 10 | ([stripe-client params] 11 | (create-cardholder stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-issuing-cardholders-endpoint params opts))) 14 | 15 | (defn retrieve-cardholder 16 | "Retrieves an issuing cardholder. 17 | \nStripe API docs: https://stripe.com/docs/api/issuing/cardholders/retrieve" 18 | ([stripe-client cardholder-id] 19 | (retrieve-cardholder stripe-client cardholder-id {})) 20 | ([stripe-client cardholder-id opts] 21 | (request stripe-client :get 22 | (str stripe-issuing-cardholders-endpoint "/" cardholder-id) 23 | {} 24 | opts))) 25 | 26 | (defn update-cardholder 27 | "Updates an issuing cardholder. 28 | \nStripe API docs: https://stripe.com/docs/api/issuing/cardholders/update" 29 | ([stripe-client cardholder-id params] 30 | (update-cardholder stripe-client cardholder-id params {})) 31 | ([stripe-client cardholder-id params opts] 32 | (request stripe-client :post 33 | (str stripe-issuing-cardholders-endpoint "/" cardholder-id) 34 | params 35 | opts))) 36 | 37 | (defn list-cardholders 38 | "Lists all issuing cardholders. 39 | \nStripe API docs: https://stripe.com/docs/api/issuing/cardholders/list" 40 | ([stripe-client] 41 | (list-cardholders stripe-client {} {})) 42 | ([stripe-client params] 43 | (list-cardholders stripe-client params {})) 44 | ([stripe-client params opts] 45 | (request stripe-client :get stripe-issuing-cardholders-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/issuing/cards.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.issuing.cards 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-issuing-cards-endpoint (config/stripe-endpoints :issuing-cards)) 6 | 7 | (defn create-card 8 | "Creates a new issuing card. 9 | \nStripe API docs: https://stripe.com/docs/api/issuing/cards/create" 10 | ([stripe-client params] 11 | (create-card stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-issuing-cards-endpoint params opts))) 14 | 15 | (defn retrieve-card 16 | "Retrieves an issuing card. 17 | \nStripe API docs: https://stripe.com/docs/api/issuing/cards/retrieve" 18 | ([stripe-client card-id] 19 | (retrieve-card stripe-client card-id {})) 20 | ([stripe-client card-id opts] 21 | (request stripe-client :get 22 | (str stripe-issuing-cards-endpoint "/" card-id) 23 | {} 24 | opts))) 25 | 26 | (defn update-card 27 | "Updates an issuing card. 28 | \nStripe API docs: https://stripe.com/docs/api/issuing/cards/update" 29 | ([stripe-client card-id params] 30 | (update-card stripe-client card-id params {})) 31 | ([stripe-client card-id params opts] 32 | (request stripe-client :post 33 | (str stripe-issuing-cards-endpoint "/" card-id) 34 | params 35 | opts))) 36 | 37 | (defn list-cards 38 | "Lists all issuing cards. 39 | \nStripe API docs: https://stripe.com/docs/api/issuing/cards/list" 40 | ([stripe-client] 41 | (list-cards stripe-client {} {})) 42 | ([stripe-client params] 43 | (list-cards stripe-client params {})) 44 | ([stripe-client params opts] 45 | (request stripe-client :get stripe-issuing-cards-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/issuing/personalization_designs.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.issuing.personalization-designs 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-issuing-personalization-designs-endpoint (config/stripe-endpoints :issuing-personalization-designs)) 6 | 7 | (defn create-personalization-design 8 | "Creates a new issuing personalization design. 9 | \nStripe API docs: https://stripe.com/docs/api/issuing/personalization_designs/create" 10 | ([stripe-client params] 11 | (create-personalization-design stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-issuing-personalization-designs-endpoint params opts))) 14 | 15 | (defn retrieve-personalization-design 16 | "Retrieves an issuing personalization design. 17 | \nStripe API docs: https://stripe.com/docs/api/issuing/personalization_designs/retrieve" 18 | ([stripe-client design-id] 19 | (retrieve-personalization-design stripe-client design-id {})) 20 | ([stripe-client design-id opts] 21 | (request stripe-client :get 22 | (str stripe-issuing-personalization-designs-endpoint "/" design-id) 23 | {} 24 | opts))) 25 | 26 | (defn update-personalization-design 27 | "Updates an issuing personalization design. 28 | \nStripe API docs: https://stripe.com/docs/api/issuing/personalization_designs/update" 29 | ([stripe-client design-id params] 30 | (update-personalization-design stripe-client design-id params {})) 31 | ([stripe-client design-id params opts] 32 | (request stripe-client :post 33 | (str stripe-issuing-personalization-designs-endpoint "/" design-id) 34 | params 35 | opts))) 36 | 37 | (defn list-personalization-designs 38 | "Lists all issuing personalization designs. 39 | \nStripe API docs: https://stripe.com/docs/api/issuing/personalization_designs/list" 40 | ([stripe-client] 41 | (list-personalization-designs stripe-client {} {})) 42 | ([stripe-client params] 43 | (list-personalization-designs stripe-client params {})) 44 | ([stripe-client params opts] 45 | (request stripe-client :get stripe-issuing-personalization-designs-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/issuing/physical_bundles.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.issuing.physical-bundles 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-issuing-physical-bundles-endpoint (config/stripe-endpoints :issuing-physical-bundles)) 6 | 7 | (defn retrieve-physical-bundle 8 | "Retrieves an issuing physical bundle. 9 | \nStripe API docs: https://stripe.com/docs/api/issuing/physical_bundles/retrieve" 10 | ([stripe-client bundle-id] 11 | (retrieve-physical-bundle stripe-client bundle-id {})) 12 | ([stripe-client bundle-id opts] 13 | (request stripe-client :get 14 | (str stripe-issuing-physical-bundles-endpoint "/" bundle-id) 15 | {} 16 | opts))) 17 | 18 | (defn list-physical-bundles 19 | "Lists all issuing physical bundles. 20 | \nStripe API docs: https://stripe.com/docs/api/issuing/physical_bundles/list" 21 | ([stripe-client] 22 | (list-physical-bundles stripe-client {} {})) 23 | ([stripe-client params] 24 | (list-physical-bundles stripe-client params {})) 25 | ([stripe-client params opts] 26 | (request stripe-client :get stripe-issuing-physical-bundles-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/issuing/tokens.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.issuing.tokens 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-issuing-tokens-endpoint (config/stripe-endpoints :issuing-tokens)) 6 | 7 | (defn retrieve-token 8 | "Retrieves an issuing token by ID. 9 | \nStripe API docs: https://stripe.com/docs/api/issuing/tokens/retrieve" 10 | ([stripe-client token-id] 11 | (retrieve-token stripe-client token-id {})) 12 | ([stripe-client token-id opts] 13 | (request stripe-client :get 14 | (str stripe-issuing-tokens-endpoint "/" token-id) 15 | {} 16 | opts))) 17 | 18 | (defn update-token 19 | "Updates an issuing token. 20 | \nStripe API docs: https://stripe.com/docs/api/issuing/tokens/update" 21 | ([stripe-client token-id params] 22 | (update-token stripe-client token-id params {})) 23 | ([stripe-client token-id params opts] 24 | (request stripe-client :post 25 | (str stripe-issuing-tokens-endpoint "/" token-id) 26 | params 27 | opts))) 28 | 29 | (defn list-tokens 30 | "Lists all issuing tokens. 31 | \nStripe API docs: https://stripe.com/docs/api/issuing/tokens/list" 32 | ([stripe-client params] 33 | (list-tokens stripe-client params {})) 34 | ([stripe-client params opts] 35 | (request stripe-client :get stripe-issuing-tokens-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/issuing/transactions.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.issuing.transactions 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-issuing-transactions-endpoint (config/stripe-endpoints :issuing-transactions)) 6 | 7 | (defn retrieve-transaction 8 | "Retrieves an issuing transaction. 9 | \nStripe API docs: https://stripe.com/docs/api/issuing/transactions/retrieve" 10 | ([stripe-client transaction-id] 11 | (retrieve-transaction stripe-client transaction-id {})) 12 | ([stripe-client transaction-id opts] 13 | (request stripe-client :get 14 | (str stripe-issuing-transactions-endpoint "/" transaction-id) 15 | {} 16 | opts))) 17 | 18 | (defn update-transaction 19 | "Updates an issuing transaction. 20 | \nStripe API docs: https://stripe.com/docs/api/issuing/transactions/update" 21 | ([stripe-client transaction-id params] 22 | (update-transaction stripe-client transaction-id params {})) 23 | ([stripe-client transaction-id params opts] 24 | (request stripe-client :post 25 | (str stripe-issuing-transactions-endpoint "/" transaction-id) 26 | params 27 | opts))) 28 | 29 | (defn list-transactions 30 | "Lists all issuing transactions. 31 | \nStripe API docs: https://stripe.com/docs/api/issuing/transactions/list" 32 | ([stripe-client] 33 | (list-transactions stripe-client {} {})) 34 | ([stripe-client params] 35 | (list-transactions stripe-client params {})) 36 | ([stripe-client params opts] 37 | (request stripe-client :get stripe-issuing-transactions-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/mandates.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mandates 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-mandates-endpoint (:mandates config/stripe-endpoints)) 6 | 7 | (defn retrieve-mandate 8 | "Retrieves a mandate by ID. 9 | \nStripe API docs: https://stripe.com/docs/api/mandates/retrieve" 10 | ([stripe-client mandate-id] 11 | (retrieve-mandate stripe-client mandate-id {})) 12 | ([stripe-client mandate-id opts] 13 | (request stripe-client :get (str stripe-mandates-endpoint "/" mandate-id) {} opts))) 14 | -------------------------------------------------------------------------------- /src/stripe_clojure/payment_method_configurations.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.payment-method-configurations 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-payment-method-configurations-endpoint (:payment-method-configurations config/stripe-endpoints)) 6 | 7 | (defn create-payment-method-configuration 8 | "Creates a payment method configuration. 9 | \nStripe API docs: https://stripe.com/docs/api/payment_method_configurations/create" 10 | ([stripe-client params] 11 | (create-payment-method-configuration stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-payment-method-configurations-endpoint params opts))) 14 | 15 | (defn retrieve-payment-method-configuration 16 | "Retrieves a payment method configuration. 17 | \nStripe API docs: https://stripe.com/docs/api/payment_method_configurations/retrieve" 18 | ([stripe-client configuration-id] 19 | (retrieve-payment-method-configuration stripe-client configuration-id {})) 20 | ([stripe-client configuration-id opts] 21 | (request stripe-client :get (str stripe-payment-method-configurations-endpoint "/" configuration-id) {} opts))) 22 | 23 | (defn update-payment-method-configuration 24 | "Updates a payment method configuration. 25 | \nStripe API docs: https://stripe.com/docs/api/payment_method_configurations/update" 26 | ([stripe-client configuration-id params] 27 | (update-payment-method-configuration stripe-client configuration-id params {})) 28 | ([stripe-client configuration-id params opts] 29 | (request stripe-client :post (str stripe-payment-method-configurations-endpoint "/" configuration-id) params opts))) 30 | 31 | (defn list-payment-method-configurations 32 | "Lists all payment method configurations. 33 | \nStripe API docs: https://stripe.com/docs/api/payment_method_configurations/list" 34 | ([stripe-client] 35 | (list-payment-method-configurations stripe-client {})) 36 | ([stripe-client params] 37 | (list-payment-method-configurations stripe-client params {})) 38 | ([stripe-client params opts] 39 | (request stripe-client :get stripe-payment-method-configurations-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/plans.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.plans 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-plans-endpoint (config/stripe-endpoints :plans)) 6 | 7 | (defn create-plan 8 | "Creates a new plan. 9 | \nStripe API docs: https://stripe.com/docs/api/plans/create" 10 | ([stripe-client params] 11 | (create-plan stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-plans-endpoint params opts))) 14 | 15 | (defn retrieve-plan 16 | "Retrieves a plan. 17 | \nStripe API docs: https://stripe.com/docs/api/plans/retrieve" 18 | ([stripe-client plan-id] 19 | (retrieve-plan stripe-client plan-id {})) 20 | ([stripe-client plan-id opts] 21 | (request stripe-client :get (str stripe-plans-endpoint "/" plan-id) {} opts))) 22 | 23 | (defn update-plan 24 | "Updates a plan. 25 | \nStripe API docs: https://stripe.com/docs/api/plans/update" 26 | ([stripe-client plan-id params] 27 | (update-plan stripe-client plan-id params {})) 28 | ([stripe-client plan-id params opts] 29 | (request stripe-client :post (str stripe-plans-endpoint "/" plan-id) params opts))) 30 | 31 | (defn list-plans 32 | "Lists all plans. 33 | \nStripe API docs: https://stripe.com/docs/api/plans/list" 34 | ([stripe-client] 35 | (list-plans stripe-client {})) 36 | ([stripe-client params] 37 | (list-plans stripe-client params {})) 38 | ([stripe-client params opts] 39 | (request stripe-client :get stripe-plans-endpoint params opts))) 40 | 41 | (defn delete-plan 42 | "Deletes a plan. 43 | \nStripe API docs: https://stripe.com/docs/api/plans/delete" 44 | ([stripe-client plan-id] 45 | (delete-plan stripe-client plan-id {})) 46 | ([stripe-client plan-id opts] 47 | (request stripe-client :delete (str stripe-plans-endpoint "/" plan-id) nil opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/prices.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.prices 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-prices-endpoint (:prices config/stripe-endpoints)) 6 | 7 | (defn create-price 8 | "Creates a new price for an existing product. 9 | \nStripe API docs: https://stripe.com/docs/api/prices/create" 10 | ([stripe-client params] 11 | (create-price stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-prices-endpoint params opts))) 14 | 15 | (defn retrieve-price 16 | "Retrieves the price with the given ID. 17 | \nStripe API docs: https://stripe.com/docs/api/prices/retrieve" 18 | ([stripe-client price-id] 19 | (retrieve-price stripe-client price-id {})) 20 | ([stripe-client price-id opts] 21 | (request stripe-client :get (str stripe-prices-endpoint "/" price-id) {} opts))) 22 | 23 | (defn update-price 24 | "Updates the specified price by setting the values of the parameters passed. 25 | \nStripe API docs: https://stripe.com/docs/api/prices/update" 26 | ([stripe-client price-id params] 27 | (update-price stripe-client price-id params {})) 28 | ([stripe-client price-id params opts] 29 | (request stripe-client :post (str stripe-prices-endpoint "/" price-id) params opts))) 30 | 31 | (defn list-prices 32 | "Lists all prices. 33 | \nStripe API docs: https://stripe.com/docs/api/prices/list" 34 | ([stripe-client] 35 | (list-prices stripe-client {})) 36 | ([stripe-client params] 37 | (list-prices stripe-client params {})) 38 | ([stripe-client params opts] 39 | (request stripe-client :get stripe-prices-endpoint params opts))) 40 | 41 | (defn search-prices 42 | "Searches for prices that match the given criteria. 43 | \nStripe API docs: https://stripe.com/docs/api/prices/search" 44 | ([stripe-client params] 45 | (search-prices stripe-client params {})) 46 | ([stripe-client params opts] 47 | (request stripe-client :get 48 | (str stripe-prices-endpoint "/search") 49 | params 50 | opts))) 51 | -------------------------------------------------------------------------------- /src/stripe_clojure/promotion_codes.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.promotion-codes 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-promotion-codes-endpoint (:promotion-codes config/stripe-endpoints)) 6 | 7 | (defn create-promotion-code 8 | "Creates a new promotion code. 9 | \nStripe API docs: https://stripe.com/docs/api/promotion_codes/create" 10 | ([stripe-client params] 11 | (create-promotion-code stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-promotion-codes-endpoint params opts))) 14 | 15 | (defn retrieve-promotion-code 16 | "Retrieves the promotion code with the given ID. 17 | \nStripe API docs: https://stripe.com/docs/api/promotion_codes/retrieve" 18 | ([stripe-client promotion-code-id] 19 | (retrieve-promotion-code stripe-client promotion-code-id {})) 20 | ([stripe-client promotion-code-id opts] 21 | (request stripe-client :get (str stripe-promotion-codes-endpoint "/" promotion-code-id) {} opts))) 22 | 23 | (defn update-promotion-code 24 | "Updates the specified promotion code by setting the values of the parameters passed. 25 | \nStripe API docs: https://stripe.com/docs/api/promotion_codes/update" 26 | ([stripe-client promotion-code-id params] 27 | (update-promotion-code stripe-client promotion-code-id params {})) 28 | ([stripe-client promotion-code-id params opts] 29 | (request stripe-client :post (str stripe-promotion-codes-endpoint "/" promotion-code-id) params opts))) 30 | 31 | (defn list-promotion-codes 32 | "Returns a list of your promotion codes. 33 | \nStripe API docs: https://stripe.com/docs/api/promotion_codes/list" 34 | ([stripe-client] 35 | (list-promotion-codes stripe-client {})) 36 | ([stripe-client params] 37 | (list-promotion-codes stripe-client params {})) 38 | ([stripe-client params opts] 39 | (request stripe-client :get stripe-promotion-codes-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/radar/early_fraud_warnings.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.radar.early-fraud-warnings 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-radar-early-fraud-warnings-endpoint (config/stripe-endpoints :radar-early-fraud-warnings)) 6 | 7 | (defn retrieve-early-fraud-warning 8 | "Retrieves a radar early fraud warning. 9 | \nStripe API docs: https://stripe.com/docs/api/radar/early_fraud_warnings/retrieve" 10 | ([stripe-client warning-id] 11 | (retrieve-early-fraud-warning stripe-client warning-id {})) 12 | ([stripe-client warning-id opts] 13 | (request stripe-client :get 14 | (str stripe-radar-early-fraud-warnings-endpoint "/" warning-id) 15 | {} 16 | opts))) 17 | 18 | (defn list-early-fraud-warnings 19 | "Lists all radar early fraud warnings. 20 | \nStripe API docs: https://stripe.com/docs/api/radar/early_fraud_warnings/list" 21 | ([stripe-client] 22 | (list-early-fraud-warnings stripe-client {} {})) 23 | ([stripe-client params] 24 | (list-early-fraud-warnings stripe-client params {})) 25 | ([stripe-client params opts] 26 | (request stripe-client :get stripe-radar-early-fraud-warnings-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/radar/value_list_items.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.radar.value-list-items 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-radar-value-list-items-endpoint (config/stripe-endpoints :radar-value-list-items)) 6 | 7 | (defn create-value-list-item 8 | "Creates a new radar value list item. 9 | \nStripe API docs: https://stripe.com/docs/api/radar/value_list_items/create" 10 | ([stripe-client params] 11 | (create-value-list-item stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-radar-value-list-items-endpoint params opts))) 14 | 15 | (defn retrieve-value-list-item 16 | "Retrieves a radar value list item. 17 | \nStripe API docs: https://stripe.com/docs/api/radar/value_list_items/retrieve" 18 | ([stripe-client item-id] 19 | (retrieve-value-list-item stripe-client item-id {})) 20 | ([stripe-client item-id opts] 21 | (request stripe-client :get 22 | (str stripe-radar-value-list-items-endpoint "/" item-id) 23 | {} 24 | opts))) 25 | 26 | (defn list-value-list-items 27 | "Lists all radar value list items. 28 | \nStripe API docs: https://stripe.com/docs/api/radar/value_list_items/list" 29 | ([stripe-client params] 30 | (list-value-list-items stripe-client params {})) 31 | ([stripe-client params opts] 32 | (request stripe-client :get stripe-radar-value-list-items-endpoint params opts))) 33 | 34 | (defn delete-value-list-item 35 | "Deletes a radar value list item. 36 | \nStripe API docs: https://stripe.com/docs/api/radar/value_list_items/delete" 37 | ([stripe-client item-id] 38 | (delete-value-list-item stripe-client item-id {})) 39 | ([stripe-client item-id opts] 40 | (request stripe-client :delete 41 | (str stripe-radar-value-list-items-endpoint "/" item-id) 42 | nil 43 | opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/refunds.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.refunds 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-refunds-endpoint (:refunds config/stripe-endpoints)) 6 | 7 | (defn create-refund 8 | "Creates a refund for a charge, with optional partial amount. 9 | \nStripe API docs: https://stripe.com/docs/api/refunds/create" 10 | ([stripe-client params] 11 | (create-refund stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-refunds-endpoint params opts))) 14 | 15 | (defn retrieve-refund 16 | "Retrieves the details of an existing refund. 17 | \nStripe API docs: https://stripe.com/docs/api/refunds/retrieve" 18 | ([stripe-client refund-id] 19 | (retrieve-refund stripe-client refund-id {})) 20 | ([stripe-client refund-id opts] 21 | (request stripe-client :get (str stripe-refunds-endpoint "/" refund-id) {} opts))) 22 | 23 | (defn update-refund 24 | "Updates the specified refund by setting the values of the parameters passed. 25 | \nStripe API docs: https://stripe.com/docs/api/refunds/update" 26 | ([stripe-client refund-id params] 27 | (update-refund stripe-client refund-id params {})) 28 | ([stripe-client refund-id params opts] 29 | (request stripe-client :post (str stripe-refunds-endpoint "/" refund-id) params opts))) 30 | 31 | (defn list-refunds 32 | "Returns a list of all refunds you've previously created. 33 | \nStripe API docs: https://stripe.com/docs/api/refunds/list" 34 | ([stripe-client] 35 | (list-refunds stripe-client {})) 36 | ([stripe-client params] 37 | (list-refunds stripe-client params {})) 38 | ([stripe-client params opts] 39 | (request stripe-client :get stripe-refunds-endpoint params opts))) 40 | 41 | (defn cancel-refund 42 | "Cancels a refund with a status of requires_action. 43 | \nStripe API docs: https://stripe.com/docs/api/refunds/cancel" 44 | ([stripe-client refund-id] 45 | (cancel-refund stripe-client refund-id {})) 46 | ([stripe-client refund-id opts] 47 | (request stripe-client :post (str stripe-refunds-endpoint "/" refund-id "/cancel") {} opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/reporting/report_runs.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.reporting.report-runs 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-reporting-report-runs-endpoint (config/stripe-endpoints :reporting-report-runs)) 6 | 7 | (defn create-report-run 8 | "Creates a new report run. 9 | \nStripe API docs: https://stripe.com/docs/api/reporting/report_run/create" 10 | ([stripe-client params] 11 | (create-report-run stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-reporting-report-runs-endpoint params opts))) 14 | 15 | (defn retrieve-report-run 16 | "Retrieves a report run. 17 | \nStripe API docs: https://stripe.com/docs/api/reporting/report_run/retrieve" 18 | ([stripe-client report-run-id] 19 | (retrieve-report-run stripe-client report-run-id {})) 20 | ([stripe-client report-run-id opts] 21 | (request stripe-client :get 22 | (str stripe-reporting-report-runs-endpoint "/" report-run-id) 23 | {} 24 | opts))) 25 | 26 | (defn list-report-runs 27 | "Lists all report runs. 28 | \nStripe API docs: https://stripe.com/docs/api/reporting/report_run/list" 29 | ([stripe-client] 30 | (list-report-runs stripe-client {} {})) 31 | ([stripe-client params] 32 | (list-report-runs stripe-client params {})) 33 | ([stripe-client params opts] 34 | (request stripe-client :get stripe-reporting-report-runs-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/reporting/report_types.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.reporting.report-types 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-reporting-report-types-endpoint (config/stripe-endpoints :reporting-report-types)) 6 | 7 | (defn retrieve-report-type 8 | "Retrieves a report type. 9 | \nStripe API docs: https://stripe.com/docs/api/reporting/report_type/retrieve" 10 | ([stripe-client report-type-id] 11 | (retrieve-report-type stripe-client report-type-id {})) 12 | ([stripe-client report-type-id opts] 13 | (request stripe-client :get 14 | (str stripe-reporting-report-types-endpoint "/" report-type-id) 15 | {} 16 | opts))) 17 | 18 | (defn list-report-types 19 | "Lists all report types. 20 | \nStripe API docs: https://stripe.com/docs/api/reporting/report_type/list" 21 | ([stripe-client] 22 | (list-report-types stripe-client {})) 23 | ([stripe-client opts] 24 | (request stripe-client :get stripe-reporting-report-types-endpoint {} opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/reviews.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.reviews 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-reviews-endpoint (config/stripe-endpoints :reviews)) 6 | 7 | (defn retrieve-review 8 | "Retrieves a Review object. 9 | \nStripe API docs: https://stripe.com/docs/api/radar/reviews/retrieve" 10 | ([stripe-client review-id] 11 | (retrieve-review stripe-client review-id {})) 12 | ([stripe-client review-id opts] 13 | (request stripe-client :get (str stripe-reviews-endpoint "/" review-id) {} opts))) 14 | 15 | (defn list-reviews 16 | "Lists all reviews. 17 | \nStripe API docs: https://stripe.com/docs/api/radar/reviews/list" 18 | ([stripe-client] 19 | (list-reviews stripe-client {})) 20 | ([stripe-client params] 21 | (list-reviews stripe-client params {})) 22 | ([stripe-client params opts] 23 | (request stripe-client :get stripe-reviews-endpoint params opts))) 24 | 25 | (defn approve-review 26 | "Approves a review. 27 | \nStripe API docs: https://stripe.com/docs/api/radar/reviews/approve" 28 | ([stripe-client review-id] 29 | (approve-review stripe-client review-id {})) 30 | ([stripe-client review-id opts] 31 | (request stripe-client :post (str stripe-reviews-endpoint "/" review-id "/approve") {} opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/schemas/client.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.schemas.client 2 | (:require [stripe-clojure.schemas.common :refer [SharedOptions NonNegativeInt]] 3 | [malli.util :as mu])) 4 | 5 | ;; Rate limits schemas 6 | 7 | (def RateLimitItem 8 | [:map {:closed true} 9 | [:read {:optional true} NonNegativeInt] 10 | [:write {:optional true} NonNegativeInt]]) 11 | 12 | (def RateLimitCategory 13 | [:map {:closed true} 14 | [:default {:optional true} RateLimitItem] 15 | [:files {:optional true} RateLimitItem] 16 | [:search {:optional true} RateLimitItem] 17 | [:meter {:optional true} RateLimitItem]]) 18 | 19 | (def RateLimits 20 | [:map-of 21 | [:enum :live :test] 22 | RateLimitCategory]) 23 | 24 | ;; Connection pool schemas 25 | 26 | (def ConnectionPoolOptions 27 | [:map {:closed true} 28 | [:timeout {:optional true} NonNegativeInt] 29 | [:threads {:optional true} [:and int? [:>= 1]]] 30 | [:default-per-route {:optional true} [:and int? [:>= 1]]] 31 | [:insecure? {:optional true} boolean?]]) 32 | 33 | ;; Stripe client schemas 34 | 35 | (def StripeClient 36 | (mu/merge 37 | SharedOptions 38 | [:map {:closed true} 39 | [:api-key string?] 40 | [:protocol {:optional true} [:enum "http" "https"]] 41 | [:host {:optional true} string?] 42 | [:port {:optional true} pos-int?] 43 | [:rate-limits {:optional true} RateLimits] 44 | [:use-connection-pool? {:optional true} boolean?] 45 | [:pool-options {:optional true} ConnectionPoolOptions] 46 | [:kebabify-keys? {:optional true} boolean?]])) 47 | -------------------------------------------------------------------------------- /src/stripe_clojure/schemas/common.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.schemas.common) 2 | 3 | (def NonNegativeInt [:and int? [:>= 0]]) 4 | 5 | (def SharedOptions 6 | [:map {:closed true} 7 | [:api-version {:optional true} string?] 8 | [:stripe-account {:optional true} string?] 9 | [:max-network-retries {:optional true} NonNegativeInt] 10 | [:timeout {:optional true} NonNegativeInt] 11 | [:full-response? {:optional true} boolean?]]) -------------------------------------------------------------------------------- /src/stripe_clojure/schemas/request.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.schemas.request 2 | (:require [stripe-clojure.schemas.common :refer [SharedOptions]] 3 | [malli.util :as mu])) 4 | 5 | (def RequestOpts 6 | (mu/merge 7 | SharedOptions 8 | [:map {:closed true} 9 | [:idempotency-key {:optional true} string?] 10 | [:expand {:optional true} [:or 11 | string? 12 | [:vector string?]]] 13 | [:auto-paginate? {:optional true} boolean?] 14 | [:test-clock {:optional true} string?] 15 | [:custom-headers {:optional true} [:map-of string? string?]]])) -------------------------------------------------------------------------------- /src/stripe_clojure/setup_attempts.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.setup-attempts 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-setup-attempts-endpoint (:setup-attempts config/stripe-endpoints)) 6 | 7 | (defn list-setup-attempts 8 | "Returns a list of SetupAttempts associated with a SetupIntent. 9 | \nStripe API docs: https://stripe.com/docs/api/setup_attempts/list" 10 | ([stripe-client] 11 | (list-setup-attempts stripe-client {})) 12 | ([stripe-client params] 13 | (list-setup-attempts stripe-client params {})) 14 | ([stripe-client params opts] 15 | (request stripe-client :get stripe-setup-attempts-endpoint params opts))) 16 | -------------------------------------------------------------------------------- /src/stripe_clojure/shipping_rates.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.shipping-rates 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-shipping-rates-endpoint (:shipping-rates config/stripe-endpoints)) 6 | 7 | (defn create-shipping-rate 8 | "Creates a new shipping rate object. 9 | \nStripe API docs: https://stripe.com/docs/api/shipping_rates/create" 10 | ([stripe-client params] 11 | (create-shipping-rate stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-shipping-rates-endpoint params opts))) 14 | 15 | (defn retrieve-shipping-rate 16 | "Returns the shipping rate object with the given ID. 17 | \nStripe API docs: https://stripe.com/docs/api/shipping_rates/retrieve" 18 | ([stripe-client shipping-rate-id] 19 | (retrieve-shipping-rate stripe-client shipping-rate-id {})) 20 | ([stripe-client shipping-rate-id opts] 21 | (request stripe-client :get (str stripe-shipping-rates-endpoint "/" shipping-rate-id) {} opts))) 22 | 23 | (defn update-shipping-rate 24 | "Updates an existing shipping rate object. 25 | \nStripe API docs: https://stripe.com/docs/api/shipping_rates/update" 26 | ([stripe-client shipping-rate-id params] 27 | (update-shipping-rate stripe-client shipping-rate-id params {})) 28 | ([stripe-client shipping-rate-id params opts] 29 | (request stripe-client :post (str stripe-shipping-rates-endpoint "/" shipping-rate-id) params opts))) 30 | 31 | (defn list-shipping-rates 32 | "Returns a list of your shipping rates. 33 | \nStripe API docs: https://stripe.com/docs/api/shipping_rates/list" 34 | ([stripe-client] 35 | (list-shipping-rates stripe-client {})) 36 | ([stripe-client params] 37 | (list-shipping-rates stripe-client params {})) 38 | ([stripe-client params opts] 39 | (request stripe-client :get stripe-shipping-rates-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/sigma/scheduled_query_runs.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.sigma.scheduled-query-runs 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-sigma-scheduled-query-runs-endpoint (config/stripe-endpoints :sigma-scheduled-query-runs)) 6 | 7 | (defn retrieve-scheduled-query-run 8 | "Retrieves a sigma scheduled query run. 9 | \nStripe API docs: https://stripe.com/docs/api/sigma/scheduled_queries/retrieve" 10 | ([stripe-client scheduled-query-run-id] 11 | (retrieve-scheduled-query-run stripe-client scheduled-query-run-id {})) 12 | ([stripe-client scheduled-query-run-id opts] 13 | (request stripe-client :get 14 | (str stripe-sigma-scheduled-query-runs-endpoint "/" scheduled-query-run-id) 15 | {} 16 | opts))) 17 | 18 | (defn list-scheduled-query-runs 19 | "Lists all sigma scheduled query runs. 20 | \nStripe API docs: https://stripe.com/docs/api/sigma/scheduled_queries/list" 21 | ([stripe-client] 22 | (list-scheduled-query-runs stripe-client {} {})) 23 | ([stripe-client params] 24 | (list-scheduled-query-runs stripe-client params {})) 25 | ([stripe-client params opts] 26 | (request stripe-client :get stripe-sigma-scheduled-query-runs-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/sources.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.sources 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-sources-endpoint (:sources config/stripe-endpoints)) 6 | 7 | (defn create-source 8 | "Creates a new source object. 9 | \nStripe API docs: https://stripe.com/docs/api/sources/create" 10 | ([stripe-client params] 11 | (create-source stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-sources-endpoint params opts))) 14 | 15 | (defn retrieve-source 16 | "Retrieves an existing source object. 17 | \nStripe API docs: https://stripe.com/docs/api/sources/retrieve" 18 | ([stripe-client source-id] 19 | (retrieve-source stripe-client source-id {})) 20 | ([stripe-client source-id opts] 21 | (request stripe-client :get (str stripe-sources-endpoint "/" source-id) {} opts))) 22 | 23 | (defn update-source 24 | "Updates the specified source by setting the values of the parameters passed. 25 | \nStripe API docs: https://stripe.com/docs/api/sources/update" 26 | ([stripe-client source-id params] 27 | (update-source stripe-client source-id params {})) 28 | ([stripe-client source-id params opts] 29 | (request stripe-client :post (str stripe-sources-endpoint "/" source-id) params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/tax/calculations.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.tax.calculations 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-tax-calculations-endpoint (config/stripe-endpoints :tax-calculations)) 6 | 7 | (defn create-calculation 8 | "Creates a new tax calculation. 9 | \nStripe API docs: https://stripe.com/docs/api/tax/calculations/create" 10 | ([stripe-client params] 11 | (create-calculation stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-tax-calculations-endpoint params opts))) 14 | 15 | (defn retrieve-calculation 16 | "Retrieves a tax calculation. 17 | \nStripe API docs: https://stripe.com/docs/api/tax/calculations/retrieve" 18 | ([stripe-client calculation-id] 19 | (retrieve-calculation stripe-client calculation-id {})) 20 | ([stripe-client calculation-id opts] 21 | (request stripe-client :get 22 | (str stripe-tax-calculations-endpoint "/" calculation-id) 23 | {} 24 | opts))) 25 | 26 | (defn list-line-items 27 | "Lists all line items for a tax calculation. 28 | \nStripe API docs: https://stripe.com/docs/api/tax/calculations/line_items" 29 | ([stripe-client calculation-id] 30 | (list-line-items stripe-client calculation-id {} {})) 31 | ([stripe-client calculation-id params] 32 | (list-line-items stripe-client calculation-id params {})) 33 | ([stripe-client calculation-id params opts] 34 | (request stripe-client :get 35 | (str stripe-tax-calculations-endpoint "/" calculation-id "/line_items") 36 | params 37 | opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/tax/registrations.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.tax.registrations 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-tax-registrations-endpoint (config/stripe-endpoints :tax-registrations)) 6 | 7 | (defn create-registration 8 | "Creates a new tax registration. 9 | \nStripe API docs: https://stripe.com/docs/api/tax/registrations/create" 10 | ([stripe-client params] 11 | (create-registration stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-tax-registrations-endpoint params opts))) 14 | 15 | (defn retrieve-registration 16 | "Retrieves a tax registration. 17 | \nStripe API docs: https://stripe.com/docs/api/tax/registrations/retrieve" 18 | ([stripe-client registration-id] 19 | (retrieve-registration stripe-client registration-id {})) 20 | ([stripe-client registration-id opts] 21 | (request stripe-client :get 22 | (str stripe-tax-registrations-endpoint "/" registration-id) 23 | {} 24 | opts))) 25 | 26 | (defn update-registration 27 | "Updates a tax registration. 28 | \nStripe API docs: https://stripe.com/docs/api/tax/registrations/update" 29 | ([stripe-client registration-id params] 30 | (update-registration stripe-client registration-id params {})) 31 | ([stripe-client registration-id params opts] 32 | (request stripe-client :post 33 | (str stripe-tax-registrations-endpoint "/" registration-id) 34 | params 35 | opts))) 36 | 37 | (defn list-registrations 38 | "Lists all tax registrations. 39 | \nStripe API docs: https://stripe.com/docs/api/tax/registrations/all" 40 | ([stripe-client] 41 | (list-registrations stripe-client {} {})) 42 | ([stripe-client params] 43 | (list-registrations stripe-client params {})) 44 | ([stripe-client params opts] 45 | (request stripe-client :get stripe-tax-registrations-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/tax/settings.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.tax.settings 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-tax-settings-endpoint (config/stripe-endpoints :tax-settings)) 6 | 7 | (defn retrieve-settings 8 | "Retrieves tax settings. 9 | \nStripe API docs: https://stripe.com/docs/api/tax/settings/retrieve" 10 | ([stripe-client] 11 | (retrieve-settings stripe-client {})) 12 | ([stripe-client opts] 13 | (request stripe-client :get stripe-tax-settings-endpoint {} opts))) 14 | 15 | (defn update-settings 16 | "Updates tax settings. 17 | \nStripe API docs: https://stripe.com/docs/api/tax/settings/update" 18 | ([stripe-client params] 19 | (update-settings stripe-client params {})) 20 | ([stripe-client params opts] 21 | (request stripe-client :post stripe-tax-settings-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/tax/transactions.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.tax.transactions 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-tax-transactions-endpoint (config/stripe-endpoints :tax-transactions)) 6 | 7 | (defn retrieve-transaction 8 | "Retrieves a tax transaction. 9 | \nStripe API docs: https://stripe.com/docs/api/tax/transactions/retrieve" 10 | ([stripe-client transaction-id] 11 | (retrieve-transaction stripe-client transaction-id {})) 12 | ([stripe-client transaction-id opts] 13 | (request stripe-client :get 14 | (str stripe-tax-transactions-endpoint "/" transaction-id) 15 | {} 16 | opts))) 17 | 18 | (defn create-from-calculation 19 | "Creates a new tax transaction from a calculation. 20 | \nStripe API docs: https://stripe.com/docs/api/tax/transactions/create_from_calculation" 21 | ([stripe-client params] 22 | (create-from-calculation stripe-client params {})) 23 | ([stripe-client params opts] 24 | (request stripe-client :post 25 | (str stripe-tax-transactions-endpoint "/create_from_calculation") 26 | params 27 | opts))) 28 | 29 | (defn create-reversal 30 | "Creates a new tax transaction reversal. 31 | \nStripe API docs: https://stripe.com/docs/api/tax/transactions/create_reversal" 32 | ([stripe-client params] 33 | (create-reversal stripe-client params {})) 34 | ([stripe-client params opts] 35 | (request stripe-client :post 36 | (str stripe-tax-transactions-endpoint "/create_reversal") 37 | params 38 | opts))) 39 | 40 | (defn list-line-items 41 | "Lists all line items for a tax transaction. 42 | \nStripe API docs: https://stripe.com/docs/api/tax/transactions/line_items" 43 | ([stripe-client transaction-id] 44 | (list-line-items stripe-client transaction-id {} {})) 45 | ([stripe-client transaction-id params] 46 | (list-line-items stripe-client transaction-id params {})) 47 | ([stripe-client transaction-id params opts] 48 | (request stripe-client :get 49 | (str stripe-tax-transactions-endpoint "/" transaction-id "/line_items") 50 | params 51 | opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/tax_codes.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.tax-codes 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-tax-codes-endpoint (:tax-codes config/stripe-endpoints)) 6 | 7 | (defn retrieve-tax-code 8 | "Retrieves the details of an existing tax code. 9 | \nStripe API docs: https://stripe.com/docs/api/tax_codes/retrieve" 10 | ([stripe-client tax-code-id] 11 | (retrieve-tax-code stripe-client tax-code-id {})) 12 | ([stripe-client tax-code-id opts] 13 | (request stripe-client :get (str stripe-tax-codes-endpoint "/" tax-code-id) {} opts))) 14 | 15 | (defn list-tax-codes 16 | "Lists all tax codes. 17 | \nStripe API docs: https://stripe.com/docs/api/tax_codes/list" 18 | ([stripe-client] 19 | (list-tax-codes stripe-client {})) 20 | ([stripe-client params] 21 | (list-tax-codes stripe-client params {})) 22 | ([stripe-client params opts] 23 | (request stripe-client :get stripe-tax-codes-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/tax_ids.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.tax-ids 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-tax-ids-endpoint (config/stripe-endpoints :tax-ids)) 6 | 7 | (defn create-tax-id 8 | "Creates a new tax ID. 9 | \nStripe API docs: https://stripe.com/docs/api/tax_ids/create" 10 | ([stripe-client params] 11 | (create-tax-id stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-tax-ids-endpoint params opts))) 14 | 15 | (defn retrieve-tax-id 16 | "Retrieves the tax ID with the given ID. 17 | \nStripe API docs: https://stripe.com/docs/api/tax_ids/retrieve" 18 | ([stripe-client tax-id] 19 | (retrieve-tax-id stripe-client tax-id {})) 20 | ([stripe-client tax-id opts] 21 | (request stripe-client :get 22 | (str stripe-tax-ids-endpoint "/" tax-id) 23 | {} 24 | opts))) 25 | 26 | (defn list-tax-ids 27 | "Returns a list of tax IDs. 28 | \nStripe API docs: https://stripe.com/docs/api/tax_ids/list" 29 | ([stripe-client] 30 | (list-tax-ids stripe-client {})) 31 | ([stripe-client params] 32 | (list-tax-ids stripe-client params {})) 33 | ([stripe-client params opts] 34 | (request stripe-client :get stripe-tax-ids-endpoint params opts))) 35 | 36 | (defn delete-tax-id 37 | "Deletes an existing tax ID. 38 | \nStripe API docs: https://stripe.com/docs/api/tax_ids/delete" 39 | ([stripe-client tax-id] 40 | (delete-tax-id stripe-client tax-id {})) 41 | ([stripe-client tax-id opts] 42 | (request stripe-client :delete 43 | (str stripe-tax-ids-endpoint "/" tax-id) 44 | nil 45 | opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/tax_rates.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.tax-rates 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-tax-rates-endpoint (:tax-rates config/stripe-endpoints)) 6 | 7 | (defn create-tax-rate 8 | "Creates a new tax rate. 9 | \nStripe API docs: https://stripe.com/docs/api/tax_rates/create" 10 | ([stripe-client params] 11 | (create-tax-rate stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-tax-rates-endpoint params opts))) 14 | 15 | (defn retrieve-tax-rate 16 | "Retrieves a tax rate with the given ID. 17 | \nStripe API docs: https://stripe.com/docs/api/tax_rates/retrieve" 18 | ([stripe-client tax-rate-id] 19 | (retrieve-tax-rate stripe-client tax-rate-id {})) 20 | ([stripe-client tax-rate-id opts] 21 | (request stripe-client :get (str stripe-tax-rates-endpoint "/" tax-rate-id) {} opts))) 22 | 23 | (defn update-tax-rate 24 | "Updates an existing tax rate. 25 | \nStripe API docs: https://stripe.com/docs/api/tax_rates/update" 26 | ([stripe-client tax-rate-id params] 27 | (update-tax-rate stripe-client tax-rate-id params {})) 28 | ([stripe-client tax-rate-id params opts] 29 | (request stripe-client :post (str stripe-tax-rates-endpoint "/" tax-rate-id) params opts))) 30 | 31 | (defn list-tax-rates 32 | "Returns a list of your tax rates. 33 | \nStripe API docs: https://stripe.com/docs/api/tax_rates/list" 34 | ([stripe-client] 35 | (list-tax-rates stripe-client {})) 36 | ([stripe-client params] 37 | (list-tax-rates stripe-client params {})) 38 | ([stripe-client params opts] 39 | (request stripe-client :get stripe-tax-rates-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/terminal/connection_tokens.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.terminal.connection-tokens 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-terminal-connection-tokens-endpoint (config/stripe-endpoints :terminal-connection-tokens)) 6 | 7 | (defn create-connection-token 8 | "Creates a new terminal connection token. 9 | \nStripe API docs: https://stripe.com/docs/api/terminal/connection_tokens/create" 10 | ([stripe-client params] 11 | (create-connection-token stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-terminal-connection-tokens-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/test_helpers/confirmation_tokens.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.test-helpers.confirmation-tokens 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-test-helpers-confirmation-tokens-endpoint (:test-helpers-confirmation-tokens config/stripe-endpoints)) 6 | 7 | (defn create-confirmation-token 8 | "Creates a test-mode confirmation token. 9 | 10 | Stripe API docs: https://docs.stripe.com/api/confirmation_tokens/test_create 11 | 12 | Accepts: 13 | - params: a map of parameters to be sent in the request. 14 | - opts: an optional map for request options. 15 | 16 | Example: 17 | (create-confirmation-token {:payment_method_data {...} ...}) 18 | " 19 | ([stripe-client params] 20 | (create-confirmation-token stripe-client params {})) 21 | ([stripe-client params opts] 22 | (request stripe-client :post stripe-test-helpers-confirmation-tokens-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/test_helpers/customers.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.test-helpers.customers 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-test-helpers-customers-endpoint (:test-helpers-customers config/stripe-endpoints)) 6 | 7 | (defn fund-cash-balance 8 | "Simulates funding a customer's cash balance in test mode. 9 | Parameters: 10 | - customer-id: The ID of the customer to fund. 11 | - params: A map containing: 12 | - :amount - The amount to fund in the smallest currency unit (e.g., 100 cents to fund $1.00). 13 | - :currency - The three-letter ISO currency code (e.g., 'usd'). 14 | - opts: Optional map of additional options for the request." 15 | ([stripe-client customer-id params] 16 | (fund-cash-balance stripe-client customer-id params {})) 17 | ([stripe-client customer-id params opts] 18 | (let [endpoint (str stripe-test-helpers-customers-endpoint "/" customer-id "/fund_cash_balance")] 19 | (request stripe-client :post endpoint params opts)))) -------------------------------------------------------------------------------- /src/stripe_clojure/topups.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.topups 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-topups-endpoint (config/stripe-endpoints :topups)) 6 | 7 | (defn create-topup 8 | "Creates a new topup. 9 | \nStripe API docs: https://stripe.com/docs/api/topups/create" 10 | ([stripe-client params] 11 | (create-topup stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-topups-endpoint params opts))) 14 | 15 | (defn retrieve-topup 16 | "Retrieves the details of a topup. 17 | \nStripe API docs: https://stripe.com/docs/api/topups/retrieve" 18 | ([stripe-client topup-id] 19 | (retrieve-topup stripe-client topup-id {})) 20 | ([stripe-client topup-id opts] 21 | (request stripe-client :get 22 | (str stripe-topups-endpoint "/" topup-id) 23 | {} 24 | opts))) 25 | 26 | (defn update-topup 27 | "Updates the specified topup. 28 | \nStripe API docs: https://stripe.com/docs/api/topups/update" 29 | ([stripe-client topup-id params] 30 | (update-topup stripe-client topup-id params {})) 31 | ([stripe-client topup-id params opts] 32 | (request stripe-client :post 33 | (str stripe-topups-endpoint "/" topup-id) 34 | params 35 | opts))) 36 | 37 | (defn list-topups 38 | "Lists all topups. 39 | \nStripe API docs: https://stripe.com/docs/api/topups/list" 40 | ([stripe-client] 41 | (list-topups stripe-client {})) 42 | ([stripe-client params] 43 | (list-topups stripe-client params {})) 44 | ([stripe-client params opts] 45 | (request stripe-client :get stripe-topups-endpoint params opts))) 46 | 47 | (defn cancel-topup 48 | "Cancels a topup. 49 | \nStripe API docs: https://stripe.com/docs/api/topups/cancel" 50 | ([stripe-client topup-id] 51 | (cancel-topup stripe-client topup-id {})) 52 | ([stripe-client topup-id opts] 53 | (request stripe-client :post 54 | (str stripe-topups-endpoint "/" topup-id "/cancel") 55 | {} 56 | opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/treasury/credit_reversals.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.treasury.credit-reversals 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-treasury-credit-reversals-endpoint (config/stripe-endpoints :treasury-credit-reversals)) 6 | 7 | (defn create-credit-reversal 8 | "Creates a new treasury credit reversal. 9 | \nStripe API docs: https://stripe.com/docs/api/treasury/credit_reversals/create" 10 | ([stripe-client params] 11 | (create-credit-reversal stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-treasury-credit-reversals-endpoint params opts))) 14 | 15 | (defn retrieve-credit-reversal 16 | "Retrieves a treasury credit reversal. 17 | \nStripe API docs: https://stripe.com/docs/api/treasury/credit_reversals/retrieve" 18 | ([stripe-client credit-reversal-id] 19 | (retrieve-credit-reversal stripe-client credit-reversal-id {})) 20 | ([stripe-client credit-reversal-id opts] 21 | (request stripe-client :get 22 | (str stripe-treasury-credit-reversals-endpoint "/" credit-reversal-id) 23 | {} 24 | opts))) 25 | 26 | (defn list-credit-reversals 27 | "Lists all treasury credit reversals. 28 | \nStripe API docs: https://stripe.com/docs/api/treasury/credit_reversals/list" 29 | ([stripe-client] 30 | (list-credit-reversals stripe-client {} {})) 31 | ([stripe-client params] 32 | (list-credit-reversals stripe-client params {})) 33 | ([stripe-client params opts] 34 | (request stripe-client :get stripe-treasury-credit-reversals-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/treasury/debit_reversals.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.treasury.debit-reversals 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-treasury-debit-reversals-endpoint (config/stripe-endpoints :treasury-debit-reversals)) 6 | 7 | (defn create-debit-reversal 8 | "Creates a new treasury debit reversal. 9 | \nStripe API docs: https://stripe.com/docs/api/treasury/debit_reversals/create" 10 | ([stripe-client params] 11 | (create-debit-reversal stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-treasury-debit-reversals-endpoint params opts))) 14 | 15 | (defn retrieve-debit-reversal 16 | "Retrieves a treasury debit reversal. 17 | \nStripe API docs: https://stripe.com/docs/api/treasury/debit_reversals/retrieve" 18 | ([stripe-client debit-reversal-id] 19 | (retrieve-debit-reversal stripe-client debit-reversal-id {})) 20 | ([stripe-client debit-reversal-id opts] 21 | (request stripe-client :get 22 | (str stripe-treasury-debit-reversals-endpoint "/" debit-reversal-id) 23 | {} 24 | opts))) 25 | 26 | (defn list-debit-reversals 27 | "Lists all treasury debit reversals. 28 | \nStripe API docs: https://stripe.com/docs/api/treasury/debit_reversals/list" 29 | ([stripe-client] 30 | (list-debit-reversals stripe-client {} {})) 31 | ([stripe-client params] 32 | (list-debit-reversals stripe-client params {})) 33 | ([stripe-client params opts] 34 | (request stripe-client :get stripe-treasury-debit-reversals-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/treasury/inbound_transfers.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.treasury.inbound-transfers 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-treasury-inbound-transfers-endpoint (config/stripe-endpoints :treasury-inbound-transfers)) 6 | 7 | (defn create-inbound-transfer 8 | "Creates a new treasury inbound transfer. 9 | \nStripe API docs: https://stripe.com/docs/api/treasury/inbound_transfers/create" 10 | ([stripe-client params] 11 | (create-inbound-transfer stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-treasury-inbound-transfers-endpoint params opts))) 14 | 15 | (defn retrieve-inbound-transfer 16 | "Retrieves a treasury inbound transfer. 17 | \nStripe API docs: https://stripe.com/docs/api/treasury/inbound_transfers/retrieve" 18 | ([stripe-client inbound-transfer-id] 19 | (retrieve-inbound-transfer stripe-client inbound-transfer-id {})) 20 | ([stripe-client inbound-transfer-id opts] 21 | (request stripe-client :get 22 | (str stripe-treasury-inbound-transfers-endpoint "/" inbound-transfer-id) 23 | {} 24 | opts))) 25 | 26 | (defn list-inbound-transfers 27 | "Lists all treasury inbound transfers. 28 | \nStripe API docs: https://stripe.com/docs/api/treasury/inbound_transfers/list" 29 | ([stripe-client params] 30 | (list-inbound-transfers stripe-client params {})) 31 | ([stripe-client params opts] 32 | (request stripe-client :get stripe-treasury-inbound-transfers-endpoint params opts))) 33 | 34 | (defn cancel-inbound-transfer 35 | "Cancels a treasury inbound transfer. 36 | \nStripe API docs: https://stripe.com/docs/api/treasury/inbound_transfers/cancel" 37 | ([stripe-client inbound-transfer-id] 38 | (cancel-inbound-transfer stripe-client inbound-transfer-id {})) 39 | ([stripe-client inbound-transfer-id opts] 40 | (request stripe-client :post 41 | (str stripe-treasury-inbound-transfers-endpoint "/" inbound-transfer-id "/cancel") 42 | {} 43 | opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/treasury/outbound_payments.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.treasury.outbound-payments 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-treasury-outbound-payments-endpoint (config/stripe-endpoints :treasury-outbound-payments)) 6 | 7 | (defn create-outbound-payment 8 | "Creates a new treasury outbound payment. 9 | \nStripe API docs: https://stripe.com/docs/api/treasury/outbound_payments/create" 10 | ([stripe-client params] 11 | (create-outbound-payment stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-treasury-outbound-payments-endpoint params opts))) 14 | 15 | (defn retrieve-outbound-payment 16 | "Retrieves a treasury outbound payment. 17 | \nStripe API docs: https://stripe.com/docs/api/treasury/outbound_payments/retrieve" 18 | ([stripe-client outbound-payment-id] 19 | (retrieve-outbound-payment stripe-client outbound-payment-id {})) 20 | ([stripe-client outbound-payment-id opts] 21 | (request stripe-client :get 22 | (str stripe-treasury-outbound-payments-endpoint "/" outbound-payment-id) 23 | {} 24 | opts))) 25 | 26 | (defn list-outbound-payments 27 | "Lists all treasury outbound payments. 28 | \nStripe API docs: https://stripe.com/docs/api/treasury/outbound_payments/list" 29 | ([stripe-client params] 30 | (list-outbound-payments stripe-client params {})) 31 | ([stripe-client params opts] 32 | (request stripe-client :get stripe-treasury-outbound-payments-endpoint params opts))) 33 | 34 | (defn cancel-outbound-payment 35 | "Cancels a treasury outbound payment. 36 | \nStripe API docs: https://stripe.com/docs/api/treasury/outbound_payments/cancel" 37 | ([stripe-client outbound-payment-id] 38 | (cancel-outbound-payment stripe-client outbound-payment-id {})) 39 | ([stripe-client outbound-payment-id opts] 40 | (request stripe-client :post 41 | (str stripe-treasury-outbound-payments-endpoint "/" outbound-payment-id "/cancel") 42 | {} 43 | opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/treasury/outbound_transfers.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.treasury.outbound-transfers 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-treasury-outbound-transfers-endpoint (config/stripe-endpoints :treasury-outbound-transfers)) 6 | 7 | (defn create-outbound-transfer 8 | "Creates a new treasury outbound transfer. 9 | \nStripe API docs: https://stripe.com/docs/api/treasury/outbound_transfers/create" 10 | ([stripe-client params] 11 | (create-outbound-transfer stripe-client params {})) 12 | ([stripe-client params opts] 13 | (request stripe-client :post stripe-treasury-outbound-transfers-endpoint params opts))) 14 | 15 | (defn retrieve-outbound-transfer 16 | "Retrieves a treasury outbound transfer. 17 | \nStripe API docs: https://stripe.com/docs/api/treasury/outbound_transfers/retrieve" 18 | ([stripe-client outbound-transfer-id] 19 | (retrieve-outbound-transfer stripe-client outbound-transfer-id {})) 20 | ([stripe-client outbound-transfer-id opts] 21 | (request stripe-client :get 22 | (str stripe-treasury-outbound-transfers-endpoint "/" outbound-transfer-id) 23 | {} 24 | opts))) 25 | 26 | (defn list-outbound-transfers 27 | "Lists all treasury outbound transfers. 28 | \nStripe API docs: https://stripe.com/docs/api/treasury/outbound_transfers/list" 29 | ([stripe-client params] 30 | (list-outbound-transfers stripe-client params {})) 31 | ([stripe-client params opts] 32 | (request stripe-client :get stripe-treasury-outbound-transfers-endpoint params opts))) 33 | 34 | (defn cancel-outbound-transfer 35 | "Cancels a treasury outbound transfer. 36 | \nStripe API docs: https://stripe.com/docs/api/treasury/outbound_transfers/cancel" 37 | ([stripe-client outbound-transfer-id] 38 | (cancel-outbound-transfer stripe-client outbound-transfer-id {})) 39 | ([stripe-client outbound-transfer-id opts] 40 | (request stripe-client :post 41 | (str stripe-treasury-outbound-transfers-endpoint "/" outbound-transfer-id "/cancel") 42 | {} 43 | opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/treasury/received_credits.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.treasury.received-credits 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-treasury-received-credits-endpoint (config/stripe-endpoints :treasury-received-credits)) 6 | 7 | (defn retrieve-received-credit 8 | "Retrieves a treasury received credit. 9 | \nStripe API docs: https://stripe.com/docs/api/treasury/received_credits/retrieve" 10 | ([stripe-client received-credit-id] 11 | (retrieve-received-credit stripe-client received-credit-id {})) 12 | ([stripe-client received-credit-id opts] 13 | (request stripe-client :get 14 | (str stripe-treasury-received-credits-endpoint "/" received-credit-id) 15 | {} 16 | opts))) 17 | 18 | (defn list-received-credits 19 | "Lists all treasury received credits. 20 | \nStripe API docs: https://stripe.com/docs/api/treasury/received_credits/list" 21 | ([stripe-client] 22 | (list-received-credits stripe-client {} {})) 23 | ([stripe-client params] 24 | (list-received-credits stripe-client params {})) 25 | ([stripe-client params opts] 26 | (request stripe-client :get stripe-treasury-received-credits-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/treasury/received_debits.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.treasury.received-debits 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-treasury-received-debits-endpoint (config/stripe-endpoints :treasury-received-debits)) 6 | 7 | (defn retrieve-received-debit 8 | "Retrieves a treasury received debit. 9 | \nStripe API docs: https://stripe.com/docs/api/treasury/received_debits/retrieve" 10 | ([stripe-client received-debit-id] 11 | (retrieve-received-debit stripe-client received-debit-id {})) 12 | ([stripe-client received-debit-id opts] 13 | (request stripe-client :get 14 | (str stripe-treasury-received-debits-endpoint "/" received-debit-id) 15 | {} 16 | opts))) 17 | 18 | (defn list-received-debits 19 | "Lists all treasury received debits. 20 | \nStripe API docs: https://stripe.com/docs/api/treasury/received_debits/list" 21 | ([stripe-client params] 22 | (list-received-debits stripe-client params {})) 23 | ([stripe-client params opts] 24 | (request stripe-client :get stripe-treasury-received-debits-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/treasury/transaction_entries.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.treasury.transaction-entries 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-treasury-transaction-entries-endpoint (config/stripe-endpoints :treasury-transaction-entries)) 6 | 7 | (defn retrieve-transaction-entry 8 | "Retrieves a treasury transaction entry. 9 | \nStripe API docs: https://stripe.com/docs/api/treasury/transaction_entries/retrieve" 10 | ([stripe-client transaction-entry-id] 11 | (retrieve-transaction-entry stripe-client transaction-entry-id {})) 12 | ([stripe-client transaction-entry-id opts] 13 | (request stripe-client :get 14 | (str stripe-treasury-transaction-entries-endpoint "/" transaction-entry-id) 15 | {} 16 | opts))) 17 | 18 | (defn list-transaction-entries 19 | "Lists all treasury transaction entries. 20 | \nStripe API docs: https://stripe.com/docs/api/treasury/transaction_entries/list" 21 | ([stripe-client] 22 | (list-transaction-entries stripe-client {} {})) 23 | ([stripe-client params] 24 | (list-transaction-entries stripe-client params {})) 25 | ([stripe-client params opts] 26 | (request stripe-client :get stripe-treasury-transaction-entries-endpoint params opts))) -------------------------------------------------------------------------------- /src/stripe_clojure/treasury/transactions.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.treasury.transactions 2 | (:require [stripe-clojure.http.client :refer [request]] 3 | [stripe-clojure.config :as config])) 4 | 5 | (def stripe-treasury-transactions-endpoint (config/stripe-endpoints :treasury-transactions)) 6 | 7 | (defn retrieve-transaction 8 | "Retrieves a treasury transaction. 9 | \nStripe API docs: https://stripe.com/docs/api/treasury/transactions/retrieve" 10 | ([stripe-client transaction-id] 11 | (retrieve-transaction stripe-client transaction-id {})) 12 | ([stripe-client transaction-id opts] 13 | (request stripe-client :get 14 | (str stripe-treasury-transactions-endpoint "/" transaction-id) 15 | {} 16 | opts))) 17 | 18 | (defn list-transactions 19 | "Lists all treasury transactions. 20 | \nStripe API docs: https://stripe.com/docs/api/treasury/transactions/list" 21 | ([stripe-client] 22 | (list-transactions stripe-client {} {})) 23 | ([stripe-client params] 24 | (list-transactions stripe-client params {})) 25 | ([stripe-client params opts] 26 | (request stripe-client :get stripe-treasury-transactions-endpoint params opts))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/account_links_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.account-links-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.account-links :as account-links])) 5 | 6 | (deftest create-account-link-mock-test 7 | (testing "Create a new account link using stripe-mock" 8 | (let [params {:account "acct_mock" 9 | :refresh_url "http://localhost:12111/refresh" 10 | :return_url "http://localhost:12111/return" 11 | :type "account_onboarding"} 12 | response (account-links/create-account-link stripe-mock-client params)] 13 | (is (= "account_link" (:object response))) 14 | (is (string? (:url response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/apps/secrets_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.apps.secrets-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.apps.secrets :as secrets])) 5 | 6 | (deftest set-secret-test 7 | (testing "Set secret" 8 | (let [response (secrets/set-secret 9 | stripe-mock-client 10 | {:name "secret_test" :payload "s3cr3t" 11 | :scope {:type "account"}})] 12 | (is (map? response)) 13 | (is (string? (:id response))) 14 | (is (= "secret_test" (:name response)))))) 15 | 16 | (deftest list-secrets-test 17 | (testing "List secrets" 18 | (let [response (secrets/list-secrets 19 | stripe-mock-client 20 | {:scope {:type "account"}}) 21 | data (:data response)] 22 | (is (map? response)) 23 | (is (vector? data)) 24 | (doseq [secret data] 25 | (is (map? secret)) 26 | (is (string? (:id secret))))))) 27 | 28 | (deftest delete-secret-test 29 | (testing "Delete secret" 30 | (let [response (secrets/delete-secret 31 | stripe-mock-client 32 | {:name "secret_test" 33 | :scope {:type "account"}})] 34 | (is (map? response)) 35 | (is (string? (:id response)))))) 36 | 37 | (deftest find-secret-test 38 | (testing "Find secret" 39 | (let [response (secrets/find-secret 40 | stripe-mock-client 41 | {:name "secret_test" 42 | :scope {:type "account"}})] 43 | (is (map? response)) 44 | (is (string? (:id response))) 45 | (is (= "test-secret" (:name response)))))) 46 | -------------------------------------------------------------------------------- /test/stripe_clojure/mock/balance_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.balance-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.balance :as balance])) 5 | 6 | (deftest retrieve-balance-test 7 | (testing "Retrieve current account balance" 8 | (let [response (balance/retrieve-balance stripe-mock-client)] 9 | (is (map? response)) 10 | (is (= "balance" (:object response))) 11 | (is (contains? response :available)) 12 | (is (vector? (:available response))) 13 | (doseq [item (:available response)] 14 | (is (map? item)) 15 | (is (contains? item :amount)) 16 | (is (number? (:amount item)))) 17 | (is (contains? response :pending)) 18 | (is (vector? (:pending response))) 19 | (doseq [item (:pending response)] 20 | (is (map? item)) 21 | (is (contains? item :amount)) 22 | (is (number? (:amount item)))) 23 | (is (contains? response :livemode)) 24 | (is (boolean? (:livemode response)))))) 25 | -------------------------------------------------------------------------------- /test/stripe_clojure/mock/balance_transactions_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.balance-transactions-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.balance-transactions :as bt])) 5 | 6 | (deftest retrieve-balance-transaction-test 7 | (testing "Retrieve balance transaction" 8 | (let [response (bt/retrieve-balance-transaction stripe-mock-client "bt_mock")] 9 | (is (map? response)) 10 | (is (= "balance_transaction" (:object response))) 11 | (is (string? (:id response))) 12 | (is (contains? response :amount)) 13 | (is (number? (:amount response))) 14 | (is (contains? response :currency)) 15 | (is (string? (:currency response))) 16 | (is (contains? response :created)) 17 | (is (number? (:created response))) 18 | (is (contains? response :net)) 19 | (is (number? (:net response)))))) 20 | 21 | (deftest list-balance-transactions-test 22 | (testing "List balance transactions" 23 | (let [response (bt/list-balance-transactions stripe-mock-client {:limit 2})] 24 | (is (map? response)) 25 | (is (= "list" (:object response))) 26 | (is (vector? (:data response))) 27 | (doseq [tx (:data response)] 28 | (is (map? tx)) 29 | (is (= "balance_transaction" (:object tx))) 30 | (is (string? (:id tx))) 31 | (is (contains? tx :amount)) 32 | (is (number? (:amount tx))) 33 | (is (contains? tx :currency)) 34 | (is (string? (:currency tx))) 35 | (is (contains? tx :created)) 36 | (is (number? (:created tx))) 37 | (is (contains? tx :net)) 38 | (is (number? (:net tx))))))) 39 | -------------------------------------------------------------------------------- /test/stripe_clojure/mock/billing/credit_balance_summary_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.billing.credit-balance-summary-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.billing.credit-balance-summary :as cbs])) 5 | 6 | (deftest retrieve-credit-balance-summary-test 7 | (testing "Retrieve credit balance summary for a customer" 8 | (let [params {:customer "mock" 9 | :filter {:type "credit_grant"}} 10 | response (cbs/retrieve-credit-balance-summary stripe-mock-client params)] 11 | (is (map? response)) 12 | (is (= "billing.credit_balance_summary" (:object response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/billing/credit_balance_transactions_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.billing.credit-balance-transactions-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.billing.credit-balance-transactions :as cbt])) 5 | 6 | (def dummy-customer-id "cus_mock") 7 | 8 | (deftest list-credit-balance-transactions-test 9 | (testing "List credit balance transactions using a dummy customer id" 10 | (let [response (cbt/list-credit-balance-transactions stripe-mock-client {:customer dummy-customer-id})] 11 | (is (map? response)) 12 | (is (= "list" (:object response))) 13 | (is (vector? (:data response)))))) 14 | 15 | (deftest retrieve-credit-balance-transaction-test 16 | (testing "Retrieve a credit balance transaction if available" 17 | (let [transactions (cbt/list-credit-balance-transactions stripe-mock-client {:customer dummy-customer-id}) 18 | transaction-id (some-> (:data transactions) first :id)] 19 | (if transaction-id 20 | (let [retrieved (cbt/retrieve-credit-balance-transaction stripe-mock-client transaction-id)] 21 | (is (= transaction-id (:id retrieved))) 22 | (is (= "billing.credit_balance_transaction" (:object retrieved)))) 23 | (testing "No transactions available for retrieval (acceptable with stripe-mock)" 24 | (is true "Skipped retrieval test as no transactions were returned")))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/billing/meter_event_adjustments_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.billing.meter-event-adjustments-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.billing.meter-event-adjustments :as adjustments])) 5 | 6 | (deftest create-meter-event-adjustment-test 7 | (testing "Create a meter event adjustment using stripe‑mock" 8 | (let [params {:event_name "test_meter_event" 9 | :type "cancel" 10 | :cancel {:identifier "evt_test_id"}} 11 | response (adjustments/create-meter-event-adjustment stripe-mock-client params)] 12 | (is (map? response)) 13 | (is (= "billing.meter_event_adjustment" (:object response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/billing/meter_events_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.billing.meter-events-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.billing.meter-events :as meter-events])) 5 | 6 | (deftest create-meter-event-test 7 | (testing "Create a meter event using stripe‑mock" 8 | (let [params {:event_name "test_meter_event" 9 | :payload {:test_key "test_value"}} 10 | response (meter-events/create-meter-event stripe-mock-client params)] 11 | (is (map? response)) 12 | (is (= "billing.meter_event" (:object response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/billing_portal/sessions_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.billing-portal.sessions-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.billing-portal.sessions :as sessions])) 5 | 6 | (deftest create-session-test 7 | (testing "Create portal session using stripe‑mock with required parameters" 8 | (let [params {:customer "cus_mock" 9 | :return_url "https://example.com/account"} 10 | response (sessions/create-session stripe-mock-client params)] 11 | (is (map? response)) 12 | (is (= "billing_portal.session" (:object response))) 13 | (is (= "https://example.com/account" (:return_url response))) 14 | ;; Instead of checking for a specific id, just ensure an id is present and is a string if provided. 15 | (when (:id response) 16 | (is (string? (:id response))))))) 17 | -------------------------------------------------------------------------------- /test/stripe_clojure/mock/climate/orders_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.climate.orders-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.climate.orders :as orders])) 5 | 6 | (deftest create-order-test 7 | (testing "Create climate order using stripe‑mock with required parameters" 8 | (let [params {:product "prod_mock"} 9 | response (orders/create-order stripe-mock-client params)] 10 | (is (map? response)) 11 | (is (= "climate.order" (:object response))) 12 | (when (:id response) 13 | (is (string? (:id response))))))) 14 | 15 | (deftest retrieve-order-test 16 | (testing "Retrieve climate order using a dummy id" 17 | (let [dummy-id "order_mock" 18 | response (orders/retrieve-order stripe-mock-client dummy-id)] 19 | (is (map? response)) 20 | (is (= "climate.order" (:object response))) 21 | (when (:id response) 22 | (is (string? (:id response))))))) 23 | 24 | (deftest update-order-test 25 | (testing "Update climate order using stripe‑mock" 26 | (let [dummy-id "order_mock" 27 | params {:metadata {:description "Updated Order"}} 28 | response (orders/update-order stripe-mock-client dummy-id params)] 29 | (is (map? response)) 30 | (is (= "climate.order" (:object response))) 31 | (when (:id response) 32 | (is (string? (:id response))))))) 33 | 34 | (deftest list-orders-test 35 | (testing "List climate orders using stripe‑mock" 36 | (let [response (orders/list-orders stripe-mock-client)] 37 | (is (map? response)) 38 | (is (= "list" (:object response))) 39 | (is (vector? (:data response)))))) 40 | 41 | (deftest cancel-order-test 42 | (testing "Cancel climate order using stripe‑mock" 43 | (let [dummy-id "order_mock" 44 | response (orders/cancel-order stripe-mock-client dummy-id)] 45 | (is (map? response)) 46 | (is (= "climate.order" (:object response))) 47 | (when (:id response) 48 | (is (string? (:id response))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/climate/products_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.climate.products-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.climate.products :as products])) 5 | 6 | (deftest retrieve-product-test 7 | (testing "Retrieve a climate product using a dummy product id" 8 | (let [dummy-id "prod_mock" 9 | response (products/retrieve-product stripe-mock-client dummy-id)] 10 | (is (map? response)) 11 | (is (= "climate.product" (:object response))) 12 | (when (:id response) 13 | (is (string? (:id response))))))) 14 | 15 | (deftest list-products-test 16 | (testing "List climate products using stripe‑mock" 17 | (let [response (products/list-products stripe-mock-client)] 18 | (is (map? response)) 19 | (is (= "list" (:object response))) 20 | (is (vector? (:data response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/climate/suppliers_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.climate.suppliers-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.climate.suppliers :as suppliers])) 5 | 6 | (deftest retrieve-supplier-test 7 | (testing "Retrieve a climate supplier using a dummy supplier id" 8 | (let [dummy-id "sup_mock" 9 | response (suppliers/retrieve-supplier stripe-mock-client dummy-id)] 10 | (is (map? response)) 11 | (is (= "climate.supplier" (:object response))) 12 | (when (:id response) 13 | (is (string? (:id response))))))) 14 | 15 | (deftest list-suppliers-test 16 | (testing "List climate suppliers using stripe‑mock" 17 | (let [response (suppliers/list-suppliers stripe-mock-client)] 18 | (is (map? response)) 19 | (is (= "list" (:object response))) 20 | (is (vector? (:data response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/confirmation_tokens_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.confirmation-tokens-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.confirmation-tokens :as ct])) 5 | 6 | (deftest retrieve-confirmation-token-test 7 | (testing "Retrieve confirmation token" 8 | (let [response (ct/retrieve-confirmation-token stripe-mock-client "ct_mock")] 9 | (is (map? response)) 10 | (is (= "confirmation_token" (:object response))) 11 | (is (string? (:id response))) 12 | (is (contains? response :livemode)) 13 | (is (boolean? (:livemode response))) 14 | (is (contains? response :created)) 15 | (is (number? (:created response)))))) 16 | -------------------------------------------------------------------------------- /test/stripe_clojure/mock/coupons_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.coupons-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.coupons :as coupons])) 5 | 6 | (deftest create-coupon-test 7 | (testing "Create coupon" 8 | (let [params {:duration "once" :percent_off 25} 9 | response (coupons/create-coupon stripe-mock-client params)] 10 | (is (map? response)) 11 | (is (= "coupon" (:object response))) 12 | (is (string? (:id response))) 13 | (is (= "once" (:duration response))) 14 | (is (= 25 (:percent_off response))) 15 | (is (boolean? (:livemode response)))))) 16 | 17 | (deftest retrieve-coupon-test 18 | (testing "Retrieve coupon" 19 | (let [response (coupons/retrieve-coupon stripe-mock-client "cpn_mock")] 20 | (is (map? response)) 21 | (is (= "coupon" (:object response))) 22 | (is (string? (:id response))) 23 | (is (contains? response :duration)) 24 | (is (string? (:duration response)))))) 25 | 26 | (deftest update-coupon-test 27 | (testing "Update coupon" 28 | (let [params {:metadata {:foo "bar"}} 29 | response (coupons/update-coupon stripe-mock-client "cpn_mock" params)] 30 | (is (map? response)) 31 | (is (= "coupon" (:object response))) 32 | (is (string? (:id response)))))) 33 | 34 | (deftest delete-coupon-test 35 | (testing "Delete coupon" 36 | (let [response (coupons/delete-coupon stripe-mock-client "cpn_mock")] 37 | (is (map? response)) 38 | (is (= "coupon" (:object response))) 39 | (is (string? (:id response))) 40 | (is (true? (:deleted response)))))) 41 | 42 | (deftest list-coupons-test 43 | (testing "List coupons" 44 | (let [response (coupons/list-coupons stripe-mock-client {:limit 2})] 45 | (is (map? response)) 46 | (is (= "list" (:object response))) 47 | (is (vector? (:data response))) 48 | (doseq [c (:data response)] 49 | (is (map? c)) 50 | (is (= "coupon" (:object c))) 51 | (is (string? (:id c))) 52 | (is (contains? c :duration)) 53 | (is (string? (:duration c))))))) 54 | -------------------------------------------------------------------------------- /test/stripe_clojure/mock/crypto/onramp/quotes_test.clj: -------------------------------------------------------------------------------- 1 | ;; (ns stripe-clojure.mock.crypto.onramp.quotes-test 2 | ;; (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | ;; [clojure.test :refer [deftest is testing]] 4 | ;; [stripe-clojure.crypto.onramp.quotes :as quotes])) 5 | 6 | ;; TODO: Not available in stripe‑mock yet 7 | 8 | ;; (deftest list-quotes-test 9 | ;; (testing "List crypto onramp quotes using stripe‑mock" 10 | ;; (let [response (quotes/list-quotes stripe-mock-client)] 11 | ;; (is (map? response)) 12 | ;; (is (= "list" (:object response))) 13 | ;; (is (vector? (:data response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/customer_sessions_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.customer-sessions-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.customer-sessions :as cs])) 5 | 6 | (deftest create-customer-session-test 7 | (testing "Create customer session" 8 | (let [params {:customer "cus_mock" 9 | :components {:payment_element {:enabled true}}} 10 | response (cs/create-customer-session stripe-mock-client params)] 11 | (is (map? response)) 12 | (is (= "customer_session" (:object response))) 13 | (is (= "cus_mock" (:customer response))) 14 | (is (boolean? (:livemode response))) 15 | (is (number? (:created response)))))) 16 | -------------------------------------------------------------------------------- /test/stripe_clojure/mock/disputes_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.disputes-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.disputes :as disputes])) 5 | 6 | (deftest retrieve-dispute-test 7 | (testing "Retrieve dispute" 8 | (let [response (disputes/retrieve-dispute stripe-mock-client "dp_mock")] 9 | (is (map? response)) 10 | (is (= "dispute" (:object response))) 11 | (is (string? (:id response))) 12 | (is (contains? response :charge))))) 13 | 14 | (deftest update-dispute-test 15 | (testing "Update dispute" 16 | (let [params {:metadata {:order_id "1234567890"}} 17 | response (disputes/update-dispute stripe-mock-client "dp_mock" params)] 18 | (is (map? response)) 19 | (is (= "dispute" (:object response))) 20 | (is (string? (:id response)))))) 21 | 22 | (deftest list-disputes-test 23 | (testing "List disputes" 24 | (let [response (disputes/list-disputes stripe-mock-client {:limit 2})] 25 | (is (map? response)) 26 | (is (= "list" (:object response))) 27 | (is (vector? (:data response))) 28 | (doseq [d (:data response)] 29 | (is (map? d)) 30 | (is (= "dispute" (:object d))) 31 | (is (string? (:id d))) 32 | (is (contains? d :charge)))))) 33 | 34 | (deftest close-dispute-test 35 | (testing "Close dispute" 36 | (let [response (disputes/close-dispute stripe-mock-client "dp_mock")] 37 | (is (map? response)) 38 | (is (= "dispute" (:object response))) 39 | (is (string? (:id response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/entitlements/active_entitlements_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.entitlements.active-entitlements-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.entitlements.active-entitlements :as active-entitlements])) 5 | 6 | (deftest retrieve-active-entitlement-test 7 | (testing "Retrieve an active entitlement using a dummy id" 8 | (let [dummy-id "ae_mock" 9 | response (active-entitlements/retrieve-active-entitlement stripe-mock-client dummy-id)] 10 | (is (map? response)) 11 | (is (= "entitlements.active_entitlement" (:object response))) 12 | (when (:id response) 13 | (is (string? (:id response))))))) 14 | 15 | (deftest list-active-entitlements-test 16 | (testing "List active entitlements using stripe‑mock" 17 | (let [response (active-entitlements/list-active-entitlements stripe-mock-client {:customer "cus_mock"})] 18 | (is (map? response)) 19 | (is (= "list" (:object response))) 20 | (is (vector? (:data response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/entitlements/features_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.entitlements.features-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.entitlements.features :as features])) 5 | 6 | (deftest create-feature-test 7 | (testing "Create feature using stripe‑mock with required parameters" 8 | (let [params {:name "Test Feature" 9 | :lookup_key "my_super_awesome_feature"} 10 | response (features/create-feature stripe-mock-client params)] 11 | (is (map? response)) 12 | (is (= "entitlements.feature" (:object response))) 13 | (is (= "Test Feature" (:name response))) 14 | ;; Instead of checking for a specific id, just check that an id is present (if provided) and is a string. 15 | (when (:id response) 16 | (is (string? (:id response))))))) 17 | 18 | (deftest update-feature-test 19 | (testing "Update feature using stripe‑mock" 20 | (let [dummy-id "feat_mock" 21 | params {:active false} 22 | response (features/update-feature stripe-mock-client dummy-id params)] 23 | (is (map? response)) 24 | (is (= "entitlements.feature" (:object response))) 25 | ;; Optionally check that the updated field is echoed back. 26 | (is (= false (:active response))) 27 | (when (:id response) 28 | (is (string? (:id response))))))) 29 | 30 | (deftest list-features-test 31 | (testing "List features using stripe‑mock" 32 | (let [response (features/list-features stripe-mock-client)] 33 | (is (map? response)) 34 | (is (= "list" (:object response))) 35 | (is (vector? (:data response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/ephemeral_keys_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.ephemeral-keys-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.ephemeral-keys :as ek])) 5 | 6 | (deftest create-ephemeral-key-test 7 | (testing "Create ephemeral key" 8 | (let [params {:customer "cus_mock"} 9 | response (ek/create-ephemeral-key stripe-mock-client params)] 10 | (is (map? response)) 11 | (is (= "ephemeral_key" (:object response))) 12 | (is (string? (:id response))) 13 | (is (number? (:created response))) 14 | (is (number? (:expires response)))))) 15 | 16 | (deftest delete-ephemeral-key-test 17 | (testing "Delete ephemeral key" 18 | (let [response (ek/delete-ephemeral-key stripe-mock-client "ephkey_mock")] 19 | (is (map? response)) 20 | (is (= "ephemeral_key" (:object response))) 21 | (is (string? (:id response)))))) 22 | -------------------------------------------------------------------------------- /test/stripe_clojure/mock/events_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.events-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.events :as events])) 5 | 6 | (deftest retrieve-event-test 7 | (testing "Retrieve event" 8 | (let [response (events/retrieve-event stripe-mock-client "evt_mock")] 9 | (is (map? response)) 10 | (is (= "event" (:object response))) 11 | (is (string? (:id response))) 12 | (is (contains? response :type)) 13 | (is (string? (:type response))) 14 | (is (contains? response :created)) 15 | (is (number? (:created response))) 16 | (is (contains? response :livemode)) 17 | (is (boolean? (:livemode response))) 18 | (is (contains? response :pending_webhooks)) 19 | (is (number? (:pending_webhooks response))) 20 | (is (contains? response :data)) 21 | (is (map? (:data response)))))) 22 | 23 | (deftest list-events-test 24 | (testing "List events" 25 | (let [response (events/list-events stripe-mock-client {:limit 2})] 26 | (is (map? response)) 27 | (is (= "list" (:object response))) 28 | (is (vector? (:data response))) 29 | (doseq [evt (:data response)] 30 | (is (map? evt)) 31 | (is (= "event" (:object evt))) 32 | (is (string? (:id evt))) 33 | (is (contains? evt :type)) 34 | (is (string? (:type evt))) 35 | (is (contains? evt :created)) 36 | (is (number? (:created evt))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/file_links_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.file-links-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.file-links :as file-links])) 5 | 6 | (deftest create-file-link-test 7 | (testing "Create file link" 8 | (let [params {:file "file_mock" :metadata {:order "123"}} 9 | response (file-links/create-file-link stripe-mock-client params)] 10 | (is (map? response)) 11 | (is (= "file_link" (:object response))) 12 | (is (string? (:id response))) 13 | (is (= "file_mock" (:file response))) 14 | (is (map? (:metadata response)))))) 15 | 16 | (deftest retrieve-file-link-test 17 | (testing "Retrieve file link" 18 | (let [response (file-links/retrieve-file-link stripe-mock-client "fl_mock")] 19 | (is (map? response)) 20 | (is (= "file_link" (:object response))) 21 | (is (string? (:id response))) 22 | (is (string? (:file response))) 23 | (is (contains? response :metadata))))) 24 | 25 | (deftest update-file-link-test 26 | (testing "Update file link" 27 | (let [params {} 28 | response (file-links/update-file-link stripe-mock-client "fl_mock" params)] 29 | (is (map? response)) 30 | (is (= "file_link" (:object response))) 31 | (is (string? (:id response)))))) 32 | 33 | (deftest list-file-links-test 34 | (testing "List file links" 35 | (let [response (file-links/list-file-links stripe-mock-client {:limit 2})] 36 | (is (map? response)) 37 | (is (= "list" (:object response))) 38 | (is (vector? (:data response))) 39 | (doseq [fl (:data response)] 40 | (is (map? fl)) 41 | (is (= "file_link" (:object fl))) 42 | (is (string? (:id fl))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/files_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.files-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.files :as files])) 5 | 6 | ;; (deftest create-file-test 7 | ;; (testing "Create file" 8 | ;; (let [temp-file (io/file "test/resources/dummy.pdf") 9 | ;; _ (spit temp-file "dummy content") 10 | ;; file-path (.getAbsolutePath temp-file) 11 | ;; purpose "dispute_evidence" 12 | ;; response (files/create-file file-path purpose)] 13 | ;; (is (map? response)) 14 | ;; (is (= "file" (:object response))) 15 | ;; (is (string? (:id response))) 16 | ;; (is (= purpose (:purpose response))) 17 | ;; (is (number? (:created response)))))) 18 | 19 | (deftest retrieve-file-test 20 | (testing "Retrieve file" 21 | (let [response (files/retrieve-file stripe-mock-client "file_mock")] 22 | (is (map? response)) 23 | (is (= "file" (:object response))) 24 | (is (string? (:id response))) 25 | (is (string? (:purpose response)))))) 26 | 27 | (deftest list-files-test 28 | (testing "List files" 29 | (let [response (files/list-files stripe-mock-client {:limit 2})] 30 | (is (map? response)) 31 | (is (= "list" (:object response))) 32 | (is (vector? (:data response))) 33 | (doseq [f (:data response)] 34 | (is (map? f)) 35 | (is (= "file" (:object f))) 36 | (is (string? (:id f))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/financial_connections/sessions_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.financial-connections.sessions-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.financial-connections.sessions :as sessions])) 5 | 6 | (deftest create-session-test 7 | (testing "Create a financial connections session using stripe‑mock with required parameters" 8 | (let [params {:account_holder {:type "customer"} 9 | :permissions ["balances" "transactions"]} 10 | response (sessions/create-session stripe-mock-client params)] 11 | (is (map? response)) 12 | (is (= "financial_connections.session" (:object response))) 13 | (is (string? (:id response)))))) 14 | 15 | (deftest retrieve-session-test 16 | (testing "Retrieve a financial connections session using a dummy session id" 17 | (let [dummy-id "fcsess_mock" 18 | response (sessions/retrieve-session stripe-mock-client dummy-id)] 19 | (is (map? response)) 20 | (is (= "financial_connections.session" (:object response))) 21 | (is (string? (:id response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/financial_connections/transactions_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.financial-connections.transactions-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.financial-connections.transactions :as transactions])) 5 | 6 | (deftest retrieve-transaction-test 7 | (testing "Retrieve a financial connections transaction using stripe‑mock" 8 | (let [dummy-id "txn_mock" 9 | response (transactions/retrieve-transaction stripe-mock-client dummy-id)] 10 | (is (map? response)) 11 | (is (= "financial_connections.transaction" (:object response))) 12 | (is (string? (:id response)))))) 13 | 14 | (deftest list-transactions-test 15 | (testing "List financial connections transactions using stripe‑mock" 16 | (let [response (transactions/list-transactions stripe-mock-client {:account "acct_mock"})] 17 | (is (map? response)) 18 | (is (= "list" (:object response))) 19 | (is (vector? (:data response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/forwarding/requests_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.forwarding.requests-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.forwarding.requests :as requests])) 5 | 6 | (deftest create-request-test 7 | (testing "Create a financial connections request using stripe‑mock with required parameters" 8 | (let [params {:payment_method "pm_card_visa" 9 | :replacements ["card_number", "card_expiry"] 10 | :request {:url "https://example.com"} 11 | :url "https://example.com" 12 | :metadata {:order_id "1234567890"}} 13 | response (requests/create-request stripe-mock-client params)] 14 | (is (map? response)) 15 | (is (= "forwarding.request" (:object response))) 16 | (is (string? (:id response)))))) 17 | 18 | (deftest retrieve-request-test 19 | (testing "Retrieve a financial connections request using a dummy request id" 20 | (let [dummy-id "req_mock" 21 | response (requests/retrieve-request stripe-mock-client dummy-id)] 22 | (is (map? response)) 23 | (is (= "forwarding.request" (:object response))) 24 | (is (string? (:id response)))))) 25 | 26 | (deftest list-requests-test 27 | (testing "List financial connections requests using stripe‑mock" 28 | (let [response (requests/list-requests stripe-mock-client {})] 29 | (is (map? response)) 30 | (is (= "list" (:object response))) 31 | (is (vector? (:data response))) 32 | (doseq [req (:data response)] 33 | (is (map? req)) 34 | (is (string? (:id req))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/identity/verification_reports_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.identity.verification-reports-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.identity.verification-reports :as verification-reports])) 5 | 6 | (deftest retrieve-verification-report-test 7 | (testing "Retrieve an identity verification report using a dummy report id" 8 | (let [dummy-id "vr_mock" 9 | response (verification-reports/retrieve-verification-report stripe-mock-client dummy-id)] 10 | (is (map? response)) 11 | (is (= "identity.verification_report" (:object response))) 12 | (is (string? (:id response)))))) 13 | 14 | (deftest list-verification-reports-test 15 | (testing "List identity verification reports using stripe‑mock" 16 | (let [response (verification-reports/list-verification-reports stripe-mock-client {})] 17 | (is (map? response)) 18 | (is (= "list" (:object response))) 19 | (is (vector? (:data response))) 20 | (doseq [report (:data response)] 21 | (is (map? report)) 22 | (is (string? (:id report))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/invoice_payments_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.invoice-payments-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [stripe-clojure.invoice-payments :as invoice-payments] 4 | [clojure.test :refer [deftest is testing]])) 5 | 6 | (deftest retrieve-invoice-payment-test 7 | (testing "Retrieve invoice payment" 8 | (let [response (invoice-payments/retrieve-invoice-payment stripe-mock-client "ip_mock")] 9 | (is (map? response)) 10 | (is (= "invoice_payment" (:object response))) 11 | (is (string? (:id response)))))) 12 | 13 | (deftest list-invoice-payments-test 14 | (testing "List invoice payments" 15 | (let [response (invoice-payments/list-invoice-payments stripe-mock-client)] 16 | (is (map? response)) 17 | (is (= "list" (:object response))) 18 | (is (vector? (:data response)))))) 19 | -------------------------------------------------------------------------------- /test/stripe_clojure/mock/invoice_rendering_templates_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.invoice-rendering-templates-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.invoice-rendering-templates :as irt])) 5 | 6 | (deftest retrieve-invoice-rendering-template-test 7 | (testing "Retrieve invoice rendering template" 8 | (let [response (irt/retrieve-invoice-rendering-template stripe-mock-client "irt_mock")] 9 | (is (map? response)) 10 | (is (= "invoice_rendering_template" (:object response))) 11 | (is (string? (:id response)))))) 12 | 13 | (deftest list-invoice-rendering-templates-test 14 | (testing "List invoice rendering templates" 15 | (let [response (irt/list-invoice-rendering-templates stripe-mock-client {:limit 2})] 16 | (is (map? response)) 17 | (is (= "list" (:object response))) 18 | (is (vector? (:data response))) 19 | (doseq [tmpl (:data response)] 20 | (is (map? tmpl)) 21 | (is (= "invoice_rendering_template" (:object tmpl))) 22 | (is (string? (:id tmpl))))))) 23 | 24 | (deftest archive-invoice-rendering-template-test 25 | (testing "Archive invoice rendering template" 26 | (let [response (irt/archive-invoice-rendering-template stripe-mock-client "irt_mock")] 27 | (is (map? response)) 28 | (is (= "invoice_rendering_template" (:object response))) 29 | (is (string? (:id response)))))) 30 | 31 | (deftest unarchive-invoice-rendering-template-test 32 | (testing "Unarchive invoice rendering template" 33 | (let [response (irt/unarchive-invoice-rendering-template stripe-mock-client "irt_mock")] 34 | (is (map? response)) 35 | (is (= "invoice_rendering_template" (:object response))) 36 | (is (string? (:id response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/issuing/authorizations_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.issuing.authorizations-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.issuing.authorizations :as auth])) 5 | 6 | (deftest retrieve-authorization-test 7 | (testing "Retrieve an issuing authorization using stripe‑mock" 8 | (let [dummy-id "auth_mock" 9 | response (auth/retrieve-authorization stripe-mock-client dummy-id)] 10 | (is (map? response)) 11 | (is (= "issuing.authorization" (:object response))) 12 | (is (string? (:id response)))))) 13 | 14 | (deftest update-authorization-test 15 | (testing "Update an issuing authorization using stripe‑mock" 16 | (let [dummy-id "auth_mock" 17 | params {:metadata {:updated "true"}} 18 | response (auth/update-authorization stripe-mock-client dummy-id params)] 19 | (is (map? response)) 20 | (is (= "issuing.authorization" (:object response))) 21 | (is (string? (:id response)))))) 22 | 23 | (deftest list-authorizations-test 24 | (testing "List issuing authorizations using stripe‑mock" 25 | (let [response (auth/list-authorizations stripe-mock-client {})] 26 | (is (map? response)) 27 | (is (= "list" (:object response))) 28 | (is (vector? (:data response))) 29 | (doseq [authorization (:data response)] 30 | (is (map? authorization)) 31 | (is (string? (:id authorization))))))) 32 | 33 | (deftest approve-authorization-test 34 | (testing "Approve an issuing authorization using stripe‑mock" 35 | (let [dummy-id "auth_mock" 36 | response (auth/approve-authorization stripe-mock-client dummy-id)] 37 | (is (map? response)) 38 | (is (= "issuing.authorization" (:object response))) 39 | (is (string? (:id response)))))) 40 | 41 | (deftest decline-authorization-test 42 | (testing "Decline an issuing authorization using stripe‑mock" 43 | (let [dummy-id "auth_mock" 44 | response (auth/decline-authorization stripe-mock-client dummy-id)] 45 | (is (map? response)) 46 | (is (= "issuing.authorization" (:object response))) 47 | (is (string? (:id response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/issuing/cardholders_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.issuing.cardholders-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.issuing.cardholders :as cardholders])) 5 | 6 | (deftest create-cardholder-test 7 | (testing "Create a new issuing cardholder using stripe‑mock with required parameters" 8 | (let [params {:name "Test Cardholder" 9 | :billing {:address {:country "US" 10 | :city "San Francisco" 11 | :line1 "123 Main St" 12 | :postal_code "94101" 13 | :state "CA"}}} 14 | response (cardholders/create-cardholder stripe-mock-client params)] 15 | (is (map? response)) 16 | (is (= "issuing.cardholder" (:object response))) 17 | (is (string? (:id response)))))) 18 | 19 | (deftest retrieve-cardholder-test 20 | (testing "Retrieve an issuing cardholder using a dummy id" 21 | (let [dummy-id "cardholder_mock" 22 | response (cardholders/retrieve-cardholder stripe-mock-client dummy-id)] 23 | (is (map? response)) 24 | (is (= "issuing.cardholder" (:object response))) 25 | (is (string? (:id response)))))) 26 | 27 | (deftest update-cardholder-test 28 | (testing "Update an issuing cardholder using stripe‑mock with update parameters" 29 | (let [dummy-id "cardholder_mock" 30 | params {:metadata {:updated "true"}} 31 | response (cardholders/update-cardholder stripe-mock-client dummy-id params)] 32 | (is (map? response)) 33 | (is (= "issuing.cardholder" (:object response))) 34 | (is (string? (:id response)))))) 35 | 36 | (deftest list-cardholders-test 37 | (testing "List issuing cardholders using stripe‑mock" 38 | (let [response (cardholders/list-cardholders stripe-mock-client {})] 39 | (is (map? response)) 40 | (is (= "list" (:object response))) 41 | (is (vector? (:data response))) 42 | (doseq [ch (:data response)] 43 | (is (map? ch)) 44 | (is (string? (:id ch))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/issuing/cards_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.issuing.cards-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.issuing.cards :as cards])) 5 | 6 | (deftest create-card-test 7 | (testing "Create an issuing card using stripe‑mock with required parameters" 8 | (let [params {:currency "usd" 9 | :type "physical" 10 | :cardholder "user_mock"} 11 | response (cards/create-card stripe-mock-client params)] 12 | (is (map? response)) 13 | (is (= "issuing.card" (:object response))) 14 | (is (string? (:id response)))))) 15 | 16 | (deftest retrieve-card-test 17 | (testing "Retrieve an issuing card using a dummy card id" 18 | (let [dummy-id "card_mock" 19 | response (cards/retrieve-card stripe-mock-client dummy-id)] 20 | (is (map? response)) 21 | (is (= "issuing.card" (:object response))) 22 | (is (string? (:id response)))))) 23 | 24 | (deftest update-card-test 25 | (testing "Update an issuing card using stripe‑mock with update parameters" 26 | (let [dummy-id "card_mock" 27 | params {:metadata {:updated "true"}} 28 | response (cards/update-card stripe-mock-client dummy-id params)] 29 | (is (map? response)) 30 | (is (= "issuing.card" (:object response))) 31 | (is (string? (:id response)))))) 32 | 33 | (deftest list-cards-test 34 | (testing "List issuing cards using stripe‑mock" 35 | (let [response (cards/list-cards stripe-mock-client {})] 36 | (is (map? response)) 37 | (is (= "list" (:object response))) 38 | (is (vector? (:data response))) 39 | (doseq [card (:data response)] 40 | (is (map? card)) 41 | (is (string? (:id card))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/issuing/disputes_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.issuing.disputes-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.issuing.disputes :as disputes])) 5 | 6 | (deftest create-dispute-test 7 | (testing "Create an issuing dispute with required parameters" 8 | (let [params {:transaction "ipi_mock" 9 | :evidence {:reason "other" 10 | :other {:explanation "hello"}}} 11 | response (disputes/create-dispute stripe-mock-client params)] 12 | (is (map? response)) 13 | (is (= "issuing.dispute" (:object response))) 14 | (is (string? (:id response)))))) 15 | 16 | (deftest retrieve-dispute-test 17 | (testing "Retrieve an issuing dispute using a dummy dispute id" 18 | (let [response (disputes/retrieve-dispute stripe-mock-client "id_mock")] 19 | (is (map? response)) 20 | (is (= "issuing.dispute" (:object response))) 21 | (is (string? (:id response)))))) 22 | 23 | (deftest update-dispute-test 24 | (testing "Update an issuing dispute with update parameters" 25 | (let [response (disputes/update-dispute stripe-mock-client "id_mock" {:metadata {:updated "true"}})] 26 | (is (map? response)) 27 | (is (= "issuing.dispute" (:object response))) 28 | (is (string? (:id response)))))) 29 | 30 | (deftest list-disputes-test 31 | (testing "List issuing disputes" 32 | (let [response (disputes/list-disputes stripe-mock-client {})] 33 | (is (map? response)) 34 | (is (= "list" (:object response))) 35 | (is (vector? (:data response))) 36 | (doseq [d (:data response)] 37 | (is (map? d)) 38 | (is (= "issuing.dispute" (:object d))) 39 | (is (string? (:id d))))))) 40 | 41 | (deftest submit-dispute-test 42 | (testing "Submit an issuing dispute" 43 | (let [response (disputes/submit-dispute stripe-mock-client "id_mock")] 44 | (is (map? response)) 45 | (is (= "issuing.dispute" (:object response))) 46 | (is (string? (:id response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/issuing/personalization_designs_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.issuing.personalization-designs-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.issuing.personalization-designs :as pd])) 5 | 6 | (deftest create-personalization-design-test 7 | (testing "Create a new issuing personalization design with required parameters" 8 | (let [params {:physical_bundle "mock"} 9 | response (pd/create-personalization-design stripe-mock-client params)] 10 | (is (map? response)) 11 | (is (= "issuing.personalization_design" (:object response))) 12 | (is (string? (:id response)))))) 13 | 14 | (deftest retrieve-personalization-design-test 15 | (testing "Retrieve an issuing personalization design using a dummy design id" 16 | (let [dummy-id "pd_mock" 17 | response (pd/retrieve-personalization-design stripe-mock-client dummy-id)] 18 | (is (map? response)) 19 | (is (= "issuing.personalization_design" (:object response))) 20 | (is (string? (:id response)))))) 21 | 22 | (deftest update-personalization-design-test 23 | (testing "Update an issuing personalization design with update parameters" 24 | (let [dummy-id "pd_mock" 25 | params {:name "Updated name"} 26 | response (pd/update-personalization-design stripe-mock-client dummy-id params)] 27 | (is (map? response)) 28 | (is (= "issuing.personalization_design" (:object response))) 29 | (is (string? (:id response))) 30 | (is (= "Updated name" (:name response)))))) 31 | 32 | (deftest list-personalization-designs-test 33 | (testing "List all issuing personalization designs" 34 | (let [response (pd/list-personalization-designs stripe-mock-client {})] 35 | (is (map? response)) 36 | (is (= "list" (:object response))) 37 | (is (vector? (:data response))) 38 | (doseq [item (:data response)] 39 | (is (map? item)) 40 | (is (= "issuing.personalization_design" (:object item))) 41 | (is (string? (:id item))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/issuing/physical_bundles_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.issuing.physical-bundles-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.issuing.physical-bundles :as pb])) 5 | 6 | (deftest retrieve-physical-bundle-test 7 | (testing "Retrieve an issuing physical bundle" 8 | (let [response (pb/retrieve-physical-bundle stripe-mock-client "bundle_mock")] 9 | (is (map? response)) 10 | (is (= "issuing.physical_bundle" (:object response))) 11 | (is (string? (:id response)))))) 12 | 13 | (deftest list-physical-bundles-test 14 | (testing "List all issuing physical bundles" 15 | (let [response (pb/list-physical-bundles stripe-mock-client {})] 16 | (is (map? response)) 17 | (is (= "list" (:object response))) 18 | (is (vector? (:data response))) 19 | (is (contains? response :has_more)) 20 | (doseq [bundle (:data response)] 21 | (is (map? bundle)) 22 | (is (= "issuing.physical_bundle" (:object bundle))) 23 | (is (string? (:id bundle))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/issuing/tokens_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.issuing.tokens-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.issuing.tokens :as tokens])) 5 | 6 | (deftest retrieve-token-test 7 | (testing "Retrieve an issuing token" 8 | (let [response (tokens/retrieve-token stripe-mock-client "token_mock")] 9 | (is (map? response)) 10 | (is (= "issuing.token" (:object response))) 11 | (is (string? (:id response))) 12 | (is (contains? response :card))))) 13 | 14 | (deftest update-token-test 15 | (testing "Update an issuing token" 16 | (let [params {:status "active"} 17 | response (tokens/update-token stripe-mock-client "token_mock" params)] 18 | (is (map? response)) 19 | (is (= "issuing.token" (:object response))) 20 | (is (string? (:id response))) 21 | (is (= "active" (get-in response [:status])))))) 22 | 23 | (deftest list-tokens-test 24 | (testing "List issuing tokens" 25 | (let [response (tokens/list-tokens stripe-mock-client {:card "mock_card"})] 26 | (is (map? response)) 27 | (is (= "list" (:object response))) 28 | (is (vector? (:data response))) 29 | (is (contains? response :has_more)) 30 | (doseq [token (:data response)] 31 | (is (map? token)) 32 | (is (= "issuing.token" (:object token))) 33 | (is (string? (:id token))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/issuing/transactions_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.issuing.transactions-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.issuing.transactions :as transactions])) 5 | 6 | (deftest retrieve-transaction-test 7 | (testing "Retrieve an issuing transaction" 8 | (let [response (transactions/retrieve-transaction stripe-mock-client "txn_mock")] 9 | (is (map? response)) 10 | (is (= "issuing.transaction" (:object response))) 11 | (is (string? (:id response))) 12 | (is (contains? response :amount)) 13 | (is (number? (:amount response)))))) 14 | 15 | (deftest update-transaction-test 16 | (testing "Update an issuing transaction" 17 | (let [params {:metadata {:updated "true"}} 18 | response (transactions/update-transaction stripe-mock-client "txn_mock" params)] 19 | (is (map? response)) 20 | (is (= "issuing.transaction" (:object response))) 21 | (is (string? (:id response)))))) 22 | 23 | (deftest list-transactions-test 24 | (testing "List issuing transactions" 25 | (let [response (transactions/list-transactions stripe-mock-client {})] 26 | (is (map? response)) 27 | (is (= "list" (:object response))) 28 | (is (vector? (:data response))) 29 | (doseq [txn (:data response)] 30 | (is (map? txn)) 31 | (is (= "issuing.transaction" (:object txn))) 32 | (is (string? (:id txn))) 33 | (is (contains? txn :amount)) 34 | (is (number? (:amount txn))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/mandates_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.mandates-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.mandates :as mandates])) 5 | 6 | (deftest retrieve-mandate-test 7 | (testing "retrieve-mandate returns a valid mandate" 8 | (let [dummy-mandate-id "mand_mock_123" 9 | mandate (mandates/retrieve-mandate stripe-mock-client dummy-mandate-id)] 10 | (is (string? (:id mandate)) "Mandate should have a string id") 11 | (is (= "mandate" (:object mandate)) "Returned object should be 'mandate'")))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/plans_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.plans-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.plans :as plans])) 5 | 6 | (deftest create-plan-test 7 | (testing "Create a plan with valid parameters" 8 | (let [params {:amount 1000 9 | :currency "usd" 10 | :interval "month" 11 | :product "prod_mock_123" 12 | :nickname "Basic Plan"} 13 | response (plans/create-plan stripe-mock-client params)] 14 | (is (string? (:id response)) "Plan should have an id") 15 | (is (= "plan" (:object response)) "Returned object should be 'plan'")))) 16 | 17 | (deftest retrieve-plan-test 18 | (testing "Retrieve a plan by id" 19 | (let [dummy-id "plan_mock_123" 20 | response (plans/retrieve-plan stripe-mock-client dummy-id)] 21 | (is (= dummy-id (:id response)) "Retrieved plan id should match") 22 | (is (= "plan" (:object response)) "Returned object should be 'plan'")))) 23 | 24 | (deftest update-plan-test 25 | (testing "Update a plan with valid parameters" 26 | (let [dummy-id "plan_mock_123" 27 | update-params {:nickname "Updated Plan"} 28 | response (plans/update-plan stripe-mock-client dummy-id update-params)] 29 | (is (= dummy-id (:id response)) "Plan id should remain unchanged") 30 | (is (= "plan" (:object response)) "Returned object should be 'plan'")))) 31 | 32 | (deftest list-plans-test 33 | (testing "List all plans with query parameters" 34 | (let [params {:limit 1} 35 | response (plans/list-plans stripe-mock-client params)] 36 | (is (map? response) "Response should be a map") 37 | (is (vector? (:data response)) "Response :data should be a vector of plans")))) 38 | 39 | (deftest delete-plan-test 40 | (testing "Delete a plan by id" 41 | (let [dummy-id "plan_mock_123" 42 | response (plans/delete-plan stripe-mock-client dummy-id)] 43 | (is (= dummy-id (:id response)) "Deleted plan id should match") 44 | (is (= "plan" (:object response)) "Returned object should be 'plan'")))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/prices_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.prices-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.prices :as prices])) 5 | 6 | (deftest create-price-test 7 | (testing "Create a price with valid parameters" 8 | (let [params {:unit_amount 1500 9 | :currency "usd" 10 | :product "prod_mock_123" 11 | :recurring {:interval "month"}} 12 | response (prices/create-price stripe-mock-client params)] 13 | (is (string? (:id response)) "Price should have an id") 14 | (is (= "price" (:object response)) 15 | "Returned object should be 'price'")))) 16 | 17 | (deftest retrieve-price-test 18 | (testing "Retrieve a price by id" 19 | (let [dummy-id "price_mock_123" 20 | response (prices/retrieve-price stripe-mock-client dummy-id)] 21 | (is (= dummy-id (:id response)) "Retrieved price id should match") 22 | (is (= "price" (:object response)) 23 | "Returned object should be 'price'")))) 24 | 25 | (deftest update-price-test 26 | (testing "Update a price with valid parameters" 27 | (let [dummy-id "price_mock_123" 28 | update-params {:metadata {:order "order123"}} 29 | response (prices/update-price stripe-mock-client dummy-id update-params)] 30 | (is (= dummy-id (:id response)) "Price id should remain unchanged") 31 | (is (= "price" (:object response)) 32 | "Returned object should be 'price'")))) 33 | 34 | (deftest list-prices-test 35 | (testing "List all prices with query parameters" 36 | (let [params {:limit 1} 37 | response (prices/list-prices stripe-mock-client params)] 38 | (is (map? response) "Response should be a map") 39 | (is (vector? (:data response)) 40 | "Response :data should be a vector of prices")))) 41 | 42 | (deftest search-prices-test 43 | (testing "Search for prices with valid query parameters" 44 | (let [params {:query "currency:'usd'"} 45 | response (prices/search-prices stripe-mock-client params)] 46 | (is (map? response) "Response should be a map") 47 | (is (vector? (:data response)) 48 | "Response :data should be a vector of prices")))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/promotion_codes_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.promotion-codes-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.promotion-codes :as promo])) 5 | 6 | (deftest create-promotion-code-test 7 | (testing "Create promotion code" 8 | (let [params {:coupon "cpn_mock" :code "PROMO50"} 9 | response (promo/create-promotion-code stripe-mock-client params)] 10 | (is (map? response)) 11 | (is (= "promotion_code" (:object response))) 12 | (is (string? (:id response))) 13 | (is (= "PROMO50" (:code response))) 14 | (is (boolean? (:active response)))))) 15 | 16 | (deftest retrieve-promotion-code-test 17 | (testing "Retrieve promotion code" 18 | (let [response (promo/retrieve-promotion-code stripe-mock-client "promo_mock")] 19 | (is (map? response)) 20 | (is (= "promotion_code" (:object response))) 21 | (is (string? (:id response))) 22 | (is (contains? response :code)) 23 | (is (string? (:code response))) 24 | (is (contains? response :active)) 25 | (is (boolean? (:active response)))))) 26 | 27 | (deftest update-promotion-code-test 28 | (testing "Update promotion code" 29 | (let [params {} 30 | response (promo/update-promotion-code stripe-mock-client "promo_mock" params)] 31 | (is (map? response)) 32 | (is (= "promotion_code" (:object response))) 33 | (is (string? (:id response)))))) 34 | 35 | (deftest list-promotion-codes-test 36 | (testing "List promotion codes" 37 | (let [response (promo/list-promotion-codes stripe-mock-client {:limit 2})] 38 | (is (map? response)) 39 | (is (= "list" (:object response))) 40 | (is (vector? (:data response))) 41 | (doseq [promo-code (:data response)] 42 | (is (map? promo-code)) 43 | (is (= "promotion_code" (:object promo-code))) 44 | (is (string? (:id promo-code))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/radar/early_fraud_warnings_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.radar.early-fraud-warnings-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.radar.early-fraud-warnings :as efw])) 5 | 6 | (deftest retrieve-early-fraud-warning-test 7 | (testing "Retrieve early fraud warning" 8 | (let [response (efw/retrieve-early-fraud-warning stripe-mock-client "efw_mock")] 9 | (is (map? response)) 10 | (is (= "radar.early_fraud_warning" (:object response))) 11 | (is (string? (:id response))) 12 | (is (contains? response :charge)) 13 | (is (string? (:charge response))) 14 | (is (contains? response :created)) 15 | (is (number? (:created response)))))) 16 | 17 | (deftest list-early-fraud-warnings-test 18 | (testing "List early fraud warnings" 19 | (let [response (efw/list-early-fraud-warnings stripe-mock-client {})] 20 | (is (map? response)) 21 | (is (= "list" (:object response))) 22 | (is (vector? (:data response))) 23 | (doseq [warning (:data response)] 24 | (is (map? warning)) 25 | (is (= "radar.early_fraud_warning" (:object warning))) 26 | (is (string? (:id warning))) 27 | (is (contains? warning :charge)) 28 | (is (string? (:charge warning))) 29 | (is (contains? warning :created)) 30 | (is (number? (:created warning))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/radar/value_list_items_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.radar.value-list-items-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.radar.value-list-items :as vli])) 5 | 6 | (deftest create-value-list-item-test 7 | (testing "Create a radar value list item" 8 | (let [params {:value "test_value" :value_list "vl_mock"} 9 | response (vli/create-value-list-item stripe-mock-client params)] 10 | (is (map? response)) 11 | (is (= "radar.value_list_item" (:object response))) 12 | (is (string? (:id response))) 13 | (is (= "test_value" (:value response))) 14 | (is (= "vl_mock" (:value_list response)))))) 15 | 16 | (deftest retrieve-value-list-item-test 17 | (testing "Retrieve a radar value list item" 18 | (let [response (vli/retrieve-value-list-item stripe-mock-client "vli_mock")] 19 | (is (map? response)) 20 | (is (= "radar.value_list_item" (:object response))) 21 | (is (string? (:id response))) 22 | (is (contains? response :value)) 23 | (is (string? (:value response)))))) 24 | 25 | (deftest list-value-list-items-test 26 | (testing "List radar value list items" 27 | (let [response (vli/list-value-list-items stripe-mock-client {:limit 3 :value_list "vl_mock"})] 28 | (is (map? response)) 29 | (is (= "list" (:object response))) 30 | (is (vector? (:data response))) 31 | (doseq [item (:data response)] 32 | (is (map? item)) 33 | (is (= "radar.value_list_item" (:object item))) 34 | (is (string? (:id item))) 35 | (is (contains? item :value)) 36 | (is (string? (:value item))))))) 37 | 38 | (deftest delete-value-list-item-test 39 | (testing "Delete a radar value list item" 40 | (let [response (vli/delete-value-list-item stripe-mock-client "vli_mock")] 41 | (is (map? response)) 42 | (is (= "radar.value_list_item" (:object response))) 43 | (is (string? (:id response))) 44 | (is (true? (:deleted response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/refunds_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.refunds-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.refunds :as refunds])) 5 | 6 | (deftest create-refund-test 7 | (testing "Create refund" 8 | (let [params {:charge "ch_mock" :amount 500} 9 | response (refunds/create-refund stripe-mock-client params)] 10 | (is (map? response)) 11 | (is (= "refund" (:object response))) 12 | (is (string? (:id response))) 13 | (is (= "ch_mock" (:charge response))) 14 | (is (= 500 (:amount response)))))) 15 | 16 | (deftest retrieve-refund-test 17 | (testing "Retrieve refund" 18 | (let [response (refunds/retrieve-refund stripe-mock-client "rf_mock")] 19 | (is (map? response)) 20 | (is (= "refund" (:object response))) 21 | (is (string? (:id response))) 22 | (is (contains? response :charge)) 23 | (is (string? (:charge response)))))) 24 | 25 | (deftest update-refund-test 26 | (testing "Update refund" 27 | (let [params {} 28 | response (refunds/update-refund stripe-mock-client "rf_mock" params)] 29 | (is (map? response)) 30 | (is (= "refund" (:object response))) 31 | (is (string? (:id response)))))) 32 | 33 | (deftest list-refunds-test 34 | (testing "List refunds" 35 | (let [response (refunds/list-refunds stripe-mock-client {:limit 2})] 36 | (is (map? response)) 37 | (is (= "list" (:object response))) 38 | (is (vector? (:data response))) 39 | (doseq [r (:data response)] 40 | (is (map? r)) 41 | (is (= "refund" (:object r))) 42 | (is (string? (:id r))) 43 | (is (contains? r :charge)) 44 | (is (string? (:charge r))) 45 | (is (contains? r :amount)) 46 | (is (number? (:amount r))))))) 47 | 48 | (deftest cancel-refund-test 49 | (testing "Cancel refund" 50 | (let [response (refunds/cancel-refund stripe-mock-client "rf_mock")] 51 | (is (map? response)) 52 | (is (= "refund" (:object response))) 53 | (is (string? (:id response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/reporting/report_runs_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.reporting.report-runs-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.reporting.report-runs :as rr])) 5 | 6 | (deftest create-report-run-test 7 | (testing "Create report run" 8 | (let [params {:report_type "balance.summary.1"} 9 | response (rr/create-report-run stripe-mock-client params)] 10 | (is (map? response)) 11 | (is (= "reporting.report_run" (:object response))) 12 | (is (string? (:id response))) 13 | (is (= "balance.summary.1" (:report_type response)))))) 14 | 15 | (deftest retrieve-report-run-test 16 | (testing "Retrieve report run" 17 | (let [response (rr/retrieve-report-run stripe-mock-client "rr_mock")] 18 | (is (map? response)) 19 | (is (= "reporting.report_run" (:object response))) 20 | (is (string? (:id response))) 21 | (is (contains? response :report_type))))) 22 | 23 | (deftest list-report-runs-test 24 | (testing "List report runs" 25 | (let [response (rr/list-report-runs stripe-mock-client {})] 26 | (is (map? response)) 27 | (is (= "list" (:object response))) 28 | (is (vector? (:data response))) 29 | (doseq [item (:data response)] 30 | (is (map? item)) 31 | (is (= "reporting.report_run" (:object item))) 32 | (is (string? (:id item))) 33 | (is (contains? item :report_type)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/reporting/report_types_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.reporting.report-types-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.reporting.report-types :as report-types])) 5 | 6 | (deftest retrieve-report-type-test 7 | (testing "Retrieve a report type" 8 | (let [response (report-types/retrieve-report-type stripe-mock-client "rt_mock")] 9 | (is (map? response)) 10 | (is (= "reporting.report_type" (:object response))) 11 | (is (string? (:id response))) 12 | (is (contains? response :name)) 13 | (is (string? (:name response)))))) 14 | 15 | (deftest list-report-types-test 16 | (testing "List report types" 17 | (let [response (report-types/list-report-types stripe-mock-client {})] 18 | (is (map? response)) 19 | (is (= "list" (:object response))) 20 | (is (vector? (:data response))) 21 | (doseq [rt (:data response)] 22 | (is (map? rt)) 23 | (is (= "reporting.report_type" (:object rt))) 24 | (is (string? (:id rt))) 25 | (is (contains? rt :name)) 26 | (is (string? (:name rt))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/reviews_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.reviews-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.reviews :as reviews])) 5 | 6 | (deftest retrieve-review-test 7 | (testing "Retrieve review" 8 | (let [response (reviews/retrieve-review stripe-mock-client "rvw_mock")] 9 | (is (map? response)) 10 | (is (= "review" (:object response))) 11 | (is (string? (:id response))) 12 | (is (contains? response :open)) 13 | (is (boolean? (:open response))) 14 | (is (contains? response :charge)) 15 | (is (string? (:charge response)))))) 16 | 17 | (deftest list-reviews-test 18 | (testing "List reviews" 19 | (let [response (reviews/list-reviews stripe-mock-client {:limit 2})] 20 | (is (map? response)) 21 | (is (= "list" (:object response))) 22 | (is (vector? (:data response))) 23 | (doseq [r (:data response)] 24 | (is (map? r)) 25 | (is (= "review" (:object r))) 26 | (is (string? (:id r))) 27 | (is (contains? r :open)) 28 | (is (boolean? (:open r))) 29 | (is (contains? r :charge)) 30 | (is (string? (:charge r))))))) 31 | 32 | (deftest approve-review-test 33 | (testing "Approve review" 34 | (let [response (reviews/approve-review stripe-mock-client "rvw_mock")] 35 | (is (map? response)) 36 | (is (= "review" (:object response))) 37 | (is (string? (:id response))) 38 | (is (contains? response :open)) 39 | (is (contains? response :charge)) 40 | (is (string? (:charge response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/setup_attempts_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.setup-attempts-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.setup-attempts :as setup-attempts])) 5 | 6 | (deftest list-setup-attempts-test 7 | (testing "List setup attempts" 8 | (let [response (setup-attempts/list-setup-attempts stripe-mock-client {:limit 2 :setup_intent "seti_mock"})] 9 | (is (map? response)) 10 | (is (= "list" (:object response))) 11 | (is (vector? (:data response))) 12 | (doseq [attempt (:data response)] 13 | (is (map? attempt)) 14 | (is (= "setup_attempt" (:object attempt))) 15 | (is (string? (:id attempt))) 16 | (is (contains? attempt :created)) 17 | (is (number? (:created attempt))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/sigma/scheduled_query_runs_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.sigma.scheduled-query-runs-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.sigma.scheduled-query-runs :as sqr])) 5 | 6 | (deftest retrieve-scheduled-query-run-test 7 | (testing "Retrieve scheduled query run" 8 | (let [response (sqr/retrieve-scheduled-query-run stripe-mock-client "sqrun_mock")] 9 | (is (map? response)) 10 | (is (= "scheduled_query_run" (:object response))) 11 | (is (string? (:id response))) 12 | (is (contains? response :created)) 13 | (is (number? (:created response)))))) 14 | 15 | (deftest list-scheduled-query-runs-test 16 | (testing "List scheduled query runs" 17 | (let [response (sqr/list-scheduled-query-runs stripe-mock-client {})] 18 | (is (map? response)) 19 | (is (= "list" (:object response))) 20 | (is (vector? (:data response))) 21 | (doseq [item (:data response)] 22 | (is (map? item)) 23 | (is (= "scheduled_query_run" (:object item))) 24 | (is (string? (:id item))) 25 | (is (contains? item :created)) 26 | (is (number? (:created item))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/sources_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.sources-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.sources :as sources])) 5 | 6 | (deftest create-source-test 7 | (testing "Create source" 8 | (let [params {:type "card" :currency "usd" :owner {:email "test@example.com"}} 9 | response (sources/create-source stripe-mock-client params)] 10 | (is (map? response)) 11 | (is (= "source" (:object response))) 12 | (is (string? (:id response))) 13 | (is (= "card" (:type response))) 14 | (is (= "usd" (:currency response)))))) 15 | 16 | (deftest retrieve-source-test 17 | (testing "Retrieve source" 18 | (let [response (sources/retrieve-source stripe-mock-client "src_mock")] 19 | (is (map? response)) 20 | (is (= "source" (:object response))) 21 | (is (string? (:id response))) 22 | (is (contains? response :type)) 23 | (is (string? (:type response)))))) 24 | 25 | (deftest update-source-test 26 | (testing "Update source" 27 | (let [params {:owner {:email "updated@example.com"}} 28 | response (sources/update-source stripe-mock-client "src_mock" params)] 29 | (is (map? response)) 30 | (is (= "source" (:object response))) 31 | (is (string? (:id response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/tax/calculations_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.tax.calculations-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.tax.calculations :as calc])) 5 | 6 | (deftest create-calculation-test 7 | (testing "Create tax calculation" 8 | (let [params {:currency "usd" :line_items [{:amount 1000 :reference "abc"}] 9 | :customer "cus_mock"} 10 | response (calc/create-calculation stripe-mock-client params)] 11 | (is (map? response)) 12 | (is (= "tax.calculation" (:object response))) 13 | (is (string? (:id response))) 14 | (is (= "cus_mock" (:customer response)))))) 15 | 16 | (deftest retrieve-calculation-test 17 | (testing "Retrieve tax calculation" 18 | (let [response (calc/retrieve-calculation stripe-mock-client "calc_mock")] 19 | (is (map? response)) 20 | (is (= "tax.calculation" (:object response))) 21 | (is (string? (:id response))) 22 | (is (contains? response :customer))))) 23 | 24 | (deftest list-line-items-test 25 | (testing "List line items for tax calculation" 26 | (let [response (calc/list-line-items stripe-mock-client "calc_mock" {:limit 2})] 27 | (is (map? response)) 28 | (is (= "list" (:object response))) 29 | (is (vector? (:data response))) 30 | (doseq [item (:data response)] 31 | (is (map? item)) 32 | (is (= "tax.calculation_line_item" (:object item))) 33 | (is (string? (:id item))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/tax/registrations_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.tax.registrations-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.tax.registrations :as regs])) 5 | 6 | (deftest create-registration-test 7 | (testing "Create tax registration" 8 | (let [params {:active_from "now" 9 | :country "US" 10 | :country_options {"us" {:state "CA" :type "state_sales_tax"}}} 11 | response (regs/create-registration stripe-mock-client params)] 12 | (is (map? response)) 13 | (is (= "tax.registration" (:object response))) 14 | (is (string? (:id response))) 15 | (is (= "US" (:country response)))))) 16 | 17 | (deftest retrieve-registration-test 18 | (testing "Retrieve tax registration" 19 | (let [response (regs/retrieve-registration stripe-mock-client "reg_mock")] 20 | (is (map? response)) 21 | (is (= "tax.registration" (:object response))) 22 | (is (string? (:id response))) 23 | (is (contains? response :country))))) 24 | 25 | (deftest update-registration-test 26 | (testing "Update tax registration" 27 | (let [response (regs/update-registration stripe-mock-client "reg_mock" {:expires_at "now"})] 28 | (is (map? response)) 29 | (is (= "tax.registration" (:object response))) 30 | (is (string? (:id response)))))) 31 | 32 | (deftest list-registrations-test 33 | (testing "List tax registrations" 34 | (let [response (regs/list-registrations stripe-mock-client {:limit 2})] 35 | (is (map? response)) 36 | (is (= "list" (:object response))) 37 | (is (vector? (:data response))) 38 | (doseq [reg (:data response)] 39 | (is (map? reg)) 40 | (is (= "tax.registration" (:object reg))) 41 | (is (string? (:id reg))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/tax/settings_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.tax.settings-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.tax.settings :as settings])) 5 | 6 | (deftest retrieve-settings-test 7 | (testing "Retrieve tax settings" 8 | (let [response (settings/retrieve-settings stripe-mock-client)] 9 | (is (map? response)) 10 | (is (= "tax.settings" (:object response)))))) 11 | 12 | (deftest update-settings-test 13 | (testing "Update tax settings" 14 | (let [params {:defaults {:tax_code "txcd_mock"}} 15 | response (settings/update-settings stripe-mock-client params)] 16 | (is (map? response)) 17 | (is (= "tax.settings" (:object response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/tax_codes_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.tax-codes-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.tax-codes :as tax-codes])) 5 | 6 | (deftest retrieve-tax-code-test 7 | (testing "Retrieve tax code" 8 | (let [response (tax-codes/retrieve-tax-code stripe-mock-client "txc_mock")] 9 | (is (map? response)) 10 | (is (= "tax_code" (:object response))) 11 | (is (string? (:id response))) 12 | (is (contains? response :description)) 13 | (is (string? (:description response)))))) 14 | 15 | (deftest list-tax-codes-test 16 | (testing "List tax codes" 17 | (let [response (tax-codes/list-tax-codes stripe-mock-client {:limit 2})] 18 | (is (map? response)) 19 | (is (= "list" (:object response))) 20 | (is (vector? (:data response))) 21 | (doseq [tc (:data response)] 22 | (is (map? tc)) 23 | (is (= "tax_code" (:object tc))) 24 | (is (string? (:id tc))) 25 | (is (contains? tc :description)) 26 | (is (string? (:description tc))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/tax_ids_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.tax-ids-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.tax-ids :as tax-ids])) 5 | 6 | (deftest create-tax-id-test 7 | (testing "Create tax id" 8 | (let [params {:type "eu_vat" :value "DE123456789"} 9 | response (tax-ids/create-tax-id stripe-mock-client params)] 10 | (is (map? response)) 11 | (is (= "tax_id" (:object response))) 12 | (is (string? (:id response))) 13 | (is (= "eu_vat" (:type response))) 14 | (is (= "DE123456789" (:value response))) 15 | (is (= "DE" (:country response)))))) 16 | 17 | (deftest retrieve-tax-id-test 18 | (testing "Retrieve tax id" 19 | (let [response (tax-ids/retrieve-tax-id stripe-mock-client "txi_mock")] 20 | (is (map? response)) 21 | (is (= "tax_id" (:object response))) 22 | (is (string? (:id response))) 23 | (is (contains? response :type)) 24 | (is (string? (:type response)))))) 25 | 26 | (deftest list-tax-ids-test 27 | (testing "List tax ids" 28 | (let [response (tax-ids/list-tax-ids stripe-mock-client {:limit 2})] 29 | (is (map? response)) 30 | (is (= "list" (:object response))) 31 | (is (vector? (:data response))) 32 | (doseq [tid (:data response)] 33 | (is (map? tid)) 34 | (is (= "tax_id" (:object tid))) 35 | (is (string? (:id tid))))))) 36 | 37 | (deftest delete-tax-id-test 38 | (testing "Delete tax id" 39 | (let [response (tax-ids/delete-tax-id stripe-mock-client "txi_mock")] 40 | (is (map? response)) 41 | (is (= "tax_id" (:object response))) 42 | (is (string? (:id response))) 43 | (is (true? (:deleted response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/tax_rates_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.tax-rates-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.tax-rates :as tax-rates])) 5 | 6 | (deftest create-tax-rate-test 7 | (testing "Create tax rate" 8 | (let [params {:display_name "VAT" 9 | :percentage 20.0 10 | :inclusive false 11 | :description "German VAT" 12 | :jurisdiction "DE"} 13 | response (tax-rates/create-tax-rate stripe-mock-client params)] 14 | (is (map? response)) 15 | (is (= "tax_rate" (:object response))) 16 | (is (string? (:id response))) 17 | (is (= "VAT" (:display_name response))) 18 | (is (= 20 (:percentage response))) 19 | (is (= false (:inclusive response))) 20 | (is (= "German VAT" (:description response))) 21 | (is (= "DE" (:jurisdiction response)))))) 22 | 23 | (deftest retrieve-tax-rate-test 24 | (testing "Retrieve tax rate" 25 | (let [response (tax-rates/retrieve-tax-rate stripe-mock-client "txr_mock")] 26 | (is (map? response)) 27 | (is (= "tax_rate" (:object response))) 28 | (is (string? (:id response))) 29 | (is (contains? response :display_name)) 30 | (is (string? (:display_name response)))))) 31 | 32 | (deftest update-tax-rate-test 33 | (testing "Update tax rate" 34 | (let [params {:description "Updated description"} 35 | response (tax-rates/update-tax-rate stripe-mock-client "txr_mock" params)] 36 | (is (map? response)) 37 | (is (= "tax_rate" (:object response))) 38 | (is (string? (:id response))) 39 | (is (= "Updated description" (:description response)))))) 40 | 41 | (deftest list-tax-rates-test 42 | (testing "List tax rates" 43 | (let [response (tax-rates/list-tax-rates stripe-mock-client {:limit 2})] 44 | (is (map? response)) 45 | (is (= "list" (:object response))) 46 | (is (vector? (:data response))) 47 | (doseq [tr (:data response)] 48 | (is (map? tr)) 49 | (is (= "tax_rate" (:object tr))) 50 | (is (string? (:id tr))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/terminal/configurations_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.terminal.configurations-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.terminal.configurations :as tc])) 5 | 6 | (deftest create-configuration-test 7 | (testing "Create terminal configuration" 8 | (let [params {:name "Test Config"} 9 | response (tc/create-configuration stripe-mock-client params)] 10 | (is (map? response)) 11 | (is (= "terminal.configuration" (:object response))) 12 | (is (string? (:id response))) 13 | (is (= "Test Config" (:name response)))))) 14 | 15 | (deftest retrieve-configuration-test 16 | (testing "Retrieve terminal configuration" 17 | (let [response (tc/retrieve-configuration stripe-mock-client "tc_mock")] 18 | (is (map? response)) 19 | (is (= "terminal.configuration" (:object response))) 20 | (is (string? (:id response))) 21 | (is (contains? response :name))))) 22 | 23 | (deftest update-configuration-test 24 | (testing "Update terminal configuration" 25 | (let [params {:name "test"} 26 | response (tc/update-configuration stripe-mock-client "tc_mock" params)] 27 | (is (map? response)) 28 | (is (= "terminal.configuration" (:object response))) 29 | (is (string? (:id response)))))) 30 | 31 | (deftest list-configurations-test 32 | (testing "List terminal configurations" 33 | (let [response (tc/list-configurations stripe-mock-client {:limit 2})] 34 | (is (map? response)) 35 | (is (= "list" (:object response))) 36 | (is (vector? (:data response))) 37 | (doseq [config (:data response)] 38 | (is (map? config)) 39 | (is (= "terminal.configuration" (:object config))) 40 | (is (string? (:id config))) 41 | (is (contains? config :name)))))) 42 | 43 | (deftest delete-configuration-test 44 | (testing "Delete terminal configuration" 45 | (let [response (tc/delete-configuration stripe-mock-client "tc_mock")] 46 | (is (map? response)) 47 | (is (= "terminal.configuration" (:object response))) 48 | (is (string? (:id response))) 49 | (is (true? (:deleted response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/terminal/connection_tokens_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.terminal.connection-tokens-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.terminal.connection-tokens :as ct])) 5 | 6 | (deftest create-connection-token-test 7 | (testing "Create terminal connection token" 8 | (let [response (ct/create-connection-token stripe-mock-client {})] 9 | (is (map? response)) 10 | (is (= "terminal.connection_token" (:object response))) 11 | (is (string? (:secret response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/topups_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.topups-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.topups :as topups])) 5 | 6 | (deftest create-topup-test 7 | (testing "Create topup" 8 | (let [params {:amount 1000 :currency "usd" :description "Test topup"} 9 | response (topups/create-topup stripe-mock-client params)] 10 | (is (map? response)) 11 | (is (= "topup" (:object response))) 12 | (is (string? (:id response))) 13 | (is (= 1000 (:amount response))) 14 | (is (= "usd" (:currency response))) 15 | (is (= "Test topup" (:description response)))))) 16 | 17 | (deftest retrieve-topup-test 18 | (testing "Retrieve topup" 19 | (let [response (topups/retrieve-topup stripe-mock-client "tu_mock")] 20 | (is (map? response)) 21 | (is (= "topup" (:object response))) 22 | (is (string? (:id response))) 23 | (is (contains? response :amount))))) 24 | 25 | (deftest update-topup-test 26 | (testing "Update topup" 27 | (let [params {:description "Updated topup"} 28 | response (topups/update-topup stripe-mock-client "tu_mock" params)] 29 | (is (map? response)) 30 | (is (= "topup" (:object response))) 31 | (is (string? (:id response))) 32 | (is (= "Updated topup" (:description response)))))) 33 | 34 | (deftest list-topups-test 35 | (testing "List topups" 36 | (let [response (topups/list-topups stripe-mock-client {:limit 2})] 37 | (is (map? response)) 38 | (is (= "list" (:object response))) 39 | (is (vector? (:data response))) 40 | (doseq [t (:data response)] 41 | (is (map? t)) 42 | (is (= "topup" (:object t))) 43 | (is (string? (:id t))))))) 44 | 45 | (deftest cancel-topup-test 46 | (testing "Cancel topup" 47 | (let [response (topups/cancel-topup stripe-mock-client "tu_mock")] 48 | (is (map? response)) 49 | (is (= "topup" (:object response))) 50 | (is (string? (:id response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/treasury/credit_reversals_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.treasury.credit-reversals-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.treasury.credit-reversals :as cr])) 5 | 6 | (deftest create-credit-reversal-test 7 | (testing "Create treasury credit reversal" 8 | (let [params {:received_credit "rd_mock"} 9 | response (cr/create-credit-reversal stripe-mock-client params)] 10 | (is (map? response)) 11 | (is (= "treasury.credit_reversal" (:object response))) 12 | (is (string? (:id response))) 13 | (is (= 1000 (:amount response))) 14 | (is (= "usd" (:currency response)))))) 15 | 16 | (deftest retrieve-credit-reversal-test 17 | (testing "Retrieve treasury credit reversal" 18 | (let [response (cr/retrieve-credit-reversal stripe-mock-client "cr_mock")] 19 | (is (map? response)) 20 | (is (= "treasury.credit_reversal" (:object response))) 21 | (is (string? (:id response))) 22 | (is (contains? response :amount))))) 23 | 24 | (deftest list-credit-reversals-test 25 | (testing "List treasury credit reversals" 26 | (let [response (cr/list-credit-reversals stripe-mock-client {:limit 2 :financial_account "fa_mock"})] 27 | (is (map? response)) 28 | (is (= "list" (:object response))) 29 | (is (vector? (:data response))) 30 | (doseq [item (:data response)] 31 | (is (map? item)) 32 | (is (= "treasury.credit_reversal" (:object item))) 33 | (is (string? (:id item))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/treasury/debit_reversals_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.treasury.debit-reversals-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.treasury.debit-reversals :as dr])) 5 | 6 | (deftest create-debit-reversal-test 7 | (testing "Create treasury debit reversal" 8 | (let [params {:received_debit "txn_mock"} 9 | response (dr/create-debit-reversal stripe-mock-client params)] 10 | (is (map? response)) 11 | (is (= "treasury.debit_reversal" (:object response))) 12 | (is (string? (:id response))) 13 | (is (string? (:transaction response)))))) 14 | 15 | (deftest retrieve-debit-reversal-test 16 | (testing "Retrieve treasury debit reversal" 17 | (let [response (dr/retrieve-debit-reversal stripe-mock-client "dr_mock")] 18 | (is (map? response)) 19 | (is (= "treasury.debit_reversal" (:object response))) 20 | (is (string? (:id response))) 21 | (is (contains? response :amount))))) 22 | 23 | (deftest list-debit-reversals-test 24 | (testing "List treasury debit reversals" 25 | (let [response (dr/list-debit-reversals stripe-mock-client {:limit 2 :financial_account "fa_mock"})] 26 | (is (map? response)) 27 | (is (= "list" (:object response))) 28 | (is (vector? (:data response))) 29 | (doseq [item (:data response)] 30 | (is (map? item)) 31 | (is (= "treasury.debit_reversal" (:object item))) 32 | (is (string? (:id item))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/treasury/inbound_transfers_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.treasury.inbound-transfers-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.treasury.inbound-transfers :as it])) 5 | 6 | (deftest create-inbound-transfer-test 7 | (testing "Create treasury inbound transfer" 8 | (let [params {:amount 1000 :currency "usd" :financial_account "fa_mock" 9 | :origin_payment_method "pm_mock"} 10 | response (it/create-inbound-transfer stripe-mock-client params)] 11 | (is (map? response)) 12 | (is (= "treasury.inbound_transfer" (:object response))) 13 | (is (string? (:id response))) 14 | (is (= 1000 (:amount response))) 15 | (is (= "usd" (:currency response))) 16 | (is (= "fa_mock" (:financial_account response)))))) 17 | 18 | (deftest retrieve-inbound-transfer-test 19 | (testing "Retrieve treasury inbound transfer" 20 | (let [response (it/retrieve-inbound-transfer stripe-mock-client "it_mock")] 21 | (is (map? response)) 22 | (is (= "treasury.inbound_transfer" (:object response))) 23 | (is (string? (:id response))) 24 | (is (contains? response :amount))))) 25 | 26 | (deftest list-inbound-transfers-test 27 | (testing "List treasury inbound transfers" 28 | (let [response (it/list-inbound-transfers stripe-mock-client {:limit 2 :financial_account "fa_mock"})] 29 | (is (map? response)) 30 | (is (= "list" (:object response))) 31 | (is (vector? (:data response))) 32 | (doseq [transfer (:data response)] 33 | (is (map? transfer)) 34 | (is (= "treasury.inbound_transfer" (:object transfer))) 35 | (is (string? (:id transfer))))))) 36 | 37 | (deftest cancel-inbound-transfer-test 38 | (testing "Cancel treasury inbound transfer" 39 | (let [response (it/cancel-inbound-transfer stripe-mock-client "it_cancel_mock")] 40 | (is (map? response)) 41 | (is (= "treasury.inbound_transfer" (:object response))) 42 | (is (string? (:id response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/treasury/outbound_payments_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.treasury.outbound-payments-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.treasury.outbound-payments :as op])) 5 | 6 | (deftest create-outbound-payment-test 7 | (testing "Create treasury outbound payment" 8 | (let [params {:amount 500 :currency "usd" :financial_account "fa_mock"} 9 | response (op/create-outbound-payment stripe-mock-client params)] 10 | (is (map? response)) 11 | (is (= "treasury.outbound_payment" (:object response))) 12 | (is (string? (:id response))) 13 | (is (= 500 (:amount response))) 14 | (is (= "usd" (:currency response))) 15 | (is (= "fa_mock" (:financial_account response)))))) 16 | 17 | (deftest retrieve-outbound-payment-test 18 | (testing "Retrieve treasury outbound payment" 19 | (let [response (op/retrieve-outbound-payment stripe-mock-client "op_mock")] 20 | (is (map? response)) 21 | (is (= "treasury.outbound_payment" (:object response))) 22 | (is (string? (:id response))) 23 | (is (contains? response :amount))))) 24 | 25 | (deftest list-outbound-payments-test 26 | (testing "List treasury outbound payments" 27 | (let [response (op/list-outbound-payments stripe-mock-client {:limit 2 :financial_account "fa_mock"})] 28 | (is (map? response)) 29 | (is (= "list" (:object response))) 30 | (is (vector? (:data response))) 31 | (doseq [payment (:data response)] 32 | (is (map? payment)) 33 | (is (= "treasury.outbound_payment" (:object payment))) 34 | (is (string? (:id payment))))))) 35 | 36 | (deftest cancel-outbound-payment-test 37 | (testing "Cancel treasury outbound payment" 38 | (let [response (op/cancel-outbound-payment stripe-mock-client "op_cancel_mock")] 39 | (is (map? response)) 40 | (is (= "treasury.outbound_payment" (:object response))) 41 | (is (string? (:id response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/treasury/outbound_transfers_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.treasury.outbound-transfers-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.treasury.outbound-transfers :as ot])) 5 | 6 | (deftest create-outbound-transfer-test 7 | (testing "Create treasury outbound transfer" 8 | (let [params {:amount 700 :currency "usd" :financial_account "fa_mock"} 9 | response (ot/create-outbound-transfer stripe-mock-client params)] 10 | (is (map? response)) 11 | (is (= "treasury.outbound_transfer" (:object response))) 12 | (is (string? (:id response))) 13 | (is (= 700 (:amount response))) 14 | (is (= "usd" (:currency response)))))) 15 | 16 | (deftest retrieve-outbound-transfer-test 17 | (testing "Retrieve treasury outbound transfer" 18 | (let [response (ot/retrieve-outbound-transfer stripe-mock-client "ot_mock")] 19 | (is (map? response)) 20 | (is (= "treasury.outbound_transfer" (:object response))) 21 | (is (string? (:id response))) 22 | (is (contains? response :amount))))) 23 | 24 | (deftest list-outbound-transfers-test 25 | (testing "List treasury outbound transfers" 26 | (let [response (ot/list-outbound-transfers stripe-mock-client {:limit 2 :financial_account "fa_mock"})] 27 | (is (map? response)) 28 | (is (= "list" (:object response))) 29 | (is (vector? (:data response))) 30 | (doseq [transfer (:data response)] 31 | (is (map? transfer)) 32 | (is (= "treasury.outbound_transfer" (:object transfer))) 33 | (is (string? (:id transfer))))))) 34 | 35 | (deftest cancel-outbound-transfer-test 36 | (testing "Cancel treasury outbound transfer" 37 | (let [response (ot/cancel-outbound-transfer stripe-mock-client "ot_cancel_mock")] 38 | (is (map? response)) 39 | (is (= "treasury.outbound_transfer" (:object response))) 40 | (is (string? (:id response)))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/treasury/received_credits_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.treasury.received-credits-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.treasury.received-credits :as rc])) 5 | 6 | (deftest retrieve-received-credit-test 7 | (testing "Retrieve treasury received credit" 8 | (let [response (rc/retrieve-received-credit stripe-mock-client "rc_mock")] 9 | (is (map? response)) 10 | (is (= "treasury.received_credit" (:object response))) 11 | (is (string? (:id response))) 12 | (is (contains? response :amount)) 13 | (is (number? (:amount response)))))) 14 | 15 | (deftest list-received-credits-test 16 | (testing "List treasury received credits" 17 | (let [response (rc/list-received-credits stripe-mock-client {:limit 2 :financial_account "fa_mock"})] 18 | (is (map? response)) 19 | (is (= "list" (:object response))) 20 | (is (vector? (:data response))) 21 | (doseq [credit (:data response)] 22 | (is (map? credit)) 23 | (is (= "treasury.received_credit" (:object credit))) 24 | (is (string? (:id credit))) 25 | (is (contains? credit :amount)) 26 | (is (number? (:amount credit))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/treasury/received_debits_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.treasury.received-debits-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.treasury.received-debits :as rd])) 5 | 6 | (deftest retrieve-received-debit-test 7 | (testing "Retrieve treasury received debit" 8 | (let [response (rd/retrieve-received-debit stripe-mock-client "rd_mock")] 9 | (is (map? response)) 10 | (is (= "treasury.received_debit" (:object response))) 11 | (is (string? (:id response))) 12 | (is (contains? response :amount))))) 13 | 14 | (deftest list-received-debits-test 15 | (testing "List treasury received debits" 16 | (let [response (rd/list-received-debits stripe-mock-client {:limit 2 :financial_account "fa_mock"})] 17 | (is (map? response)) 18 | (is (= "list" (:object response))) 19 | (is (vector? (:data response))) 20 | (doseq [debit (:data response)] 21 | (is (map? debit)) 22 | (is (= "treasury.received_debit" (:object debit))) 23 | (is (string? (:id debit))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/treasury/transaction_entries_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.treasury.transaction-entries-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.treasury.transaction-entries :as te])) 5 | 6 | (deftest retrieve-transaction-entry-test 7 | (testing "Retrieve treasury transaction entry" 8 | (let [response (te/retrieve-transaction-entry stripe-mock-client "te_mock")] 9 | (is (map? response)) 10 | (is (= "treasury.transaction_entry" (:object response))) 11 | (is (string? (:id response))) 12 | (is (contains? response :transaction))))) 13 | 14 | (deftest list-transaction-entries-test 15 | (testing "List treasury transaction entries" 16 | (let [response (te/list-transaction-entries stripe-mock-client {:financial_account "fa_mock" :limit 2})] 17 | (is (map? response)) 18 | (is (= "list" (:object response))) 19 | (is (vector? (:data response))) 20 | (doseq [entry (:data response)] 21 | (is (map? entry)) 22 | (is (= "treasury.transaction_entry" (:object entry))) 23 | (is (string? (:id entry))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/mock/treasury/transactions_test.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.mock.treasury.transactions-test 2 | (:require [stripe-clojure.test-util :refer [stripe-mock-client]] 3 | [clojure.test :refer [deftest is testing]] 4 | [stripe-clojure.treasury.transactions :as tt])) 5 | 6 | (deftest retrieve-transaction-test 7 | (testing "Retrieve treasury transaction" 8 | (let [response (tt/retrieve-transaction stripe-mock-client "txn_mock")] 9 | (is (map? response)) 10 | (is (= "treasury.transaction" (:object response))) 11 | (is (string? (:id response))) 12 | (is (contains? response :amount)) 13 | (is (number? (:amount response))) 14 | (is (contains? response :currency)) 15 | (is (string? (:currency response))) 16 | (is (contains? response :created)) 17 | (is (number? (:created response)))))) 18 | 19 | (deftest list-transactions-test 20 | (testing "List treasury transactions" 21 | (let [response (tt/list-transactions stripe-mock-client {:limit 2 :financial_account "fa_mock"})] 22 | (is (map? response)) 23 | (is (= "list" (:object response))) 24 | (is (vector? (:data response))) 25 | (doseq [tx (:data response)] 26 | (is (map? tx)) 27 | (is (= "treasury.transaction" (:object tx))) 28 | (is (string? (:id tx))) 29 | (is (contains? tx :amount)) 30 | (is (number? (:amount tx))) 31 | (is (contains? tx :currency)) 32 | (is (string? (:currency tx))))))) -------------------------------------------------------------------------------- /test/stripe_clojure/test_util.clj: -------------------------------------------------------------------------------- 1 | (ns stripe-clojure.test-util 2 | (:require [stripe-clojure.core :as stripe] 3 | [stripe-clojure.config :as config])) 4 | 5 | ;; For mock tests, we use the stripe-mock server 6 | (def stripe-mock-client (stripe/init-stripe {:mock true})) 7 | 8 | ;; For integration tests, we need to use a real Stripe API test key 9 | (def stripe-integration-client (stripe/init-stripe {:api-key (or (System/getenv "STRIPE_TEST_API_KEY") "test_key") 10 | :api-version config/base-api-version})) 11 | --------------------------------------------------------------------------------