Merged PR 1287: Add Stripe UK source

This PR adds three streams from our Stripe UK Account: balance transactions, charges and payment intents.

The scope includes sources, staging models and docs for both.
This commit is contained in:
Pablo Martín 2024-02-19 15:59:40 +00:00
commit 8a1f7eab97
10 changed files with 1088 additions and 1 deletions

View file

@ -10,5 +10,6 @@
}
]
},
"dbt.enableNewLineagePanel": true
"dbt.enableNewLineagePanel": true,
"dbt.enableNewDocsPanel": true
}

35
models/doc_blocks.md Normal file
View file

@ -0,0 +1,35 @@
{% docs generic_id_desc %}
The unique ID for records in this relation.
{% enddocs %}
{% docs field_docs_na_desc %}
No available documentation for this field.
{% enddocs %}
{% docs _airbyte_raw_id_desc %}
A UUID assigned by Airbyte to each processed event during the sync job.
{% enddocs %}
{% docs _airbyte_extracted_at_desc %}
A timestamp for when the event was pulled by Airbyte from the original data source.
{% enddocs %}
{% docs _airbyte_meta_desc %}
You can query the _airbyte_meta column to see which rows failed for content reasons, and why.
{% enddocs %}
{% docs dwh_extracted_at_date_desc %}
A timestamp for when the event was pulled by Airbyte from the original data source.
{% enddocs %}

View file

@ -0,0 +1,402 @@
version: 2
sources:
- name: stripe_uk
schema: sync_stripe_uk
tables:
- name: balance_transactions
identifier: balance_transactions
description: |
Individual transactions happening in our different Stripe currency accounts.
You can read more about this object here: https://docs.stripe.com/api/balance_transactions/object.
columns:
- name: id
data_type: character varying
description: "{{ doc('generic_id_desc') }}"
- name: fee
data_type: bigint
description: "Fees (in cents) paid for this transaction. Represented as a positive integer when assessed."
- name: net
data_type: bigint
description: "Net impact to a Stripe balance (in cents). A positive value represents incrementing a Stripe balance, and a negative value decrementing a Stripe balance. You can calculate the net impact of a transaction on a balance by amount - fee"
- name: type
data_type: character varying
description: "Transaction type: adjustment, advance, advance_funding, anticipation_repayment, application_fee, application_fee_refund, charge, climate_order_purchase, climate_order_refund, connect_collection_transfer, contribution, issuing_authorization_hold, issuing_authorization_release, issuing_dispute, issuing_transaction, obligation_outbound, obligation_reversal_inbound, payment, payment_failure_refund, payment_network_reserve_hold, payment_network_reserve_release, payment_refund, payment_reversal, payment_unreconciled, payout, payout_cancel, payout_failure, refund, refund_failure, reserve_transaction, reserved_funds, stripe_fee, stripe_fx_fee, tax_fee, topup, topup_reversal, transfer, transfer_cancel, transfer_failure, or transfer_refund. Learn more about balance transaction types and what they represent. To classify transactions for accounting purposes, consider reporting_category instead."
- name: amount
data_type: bigint
description: "Gross amount of this transaction (in cents). A positive value represents funds charged to another party, and a negative value represents funds sent to another party."
- name: object
data_type: character varying
description: "Silly column. The value is always `balance_transaction`."
- name: source
data_type: character varying
description: "This transaction relates to the Stripe object indicated here. Can be different object types (charge, refund, payment, etc)."
- name: status
data_type: character varying
description: "The transactions net funds status in the Stripe balance, which are either available or pending."
- name: created
data_type: bigint
description: "{{ doc('stripe_created_desc') }}"
- name: currency
data_type: character varying
description: "{{ doc('stripe_currency_desc') }}"
- name: description
data_type: character varying
description: "An arbitrary string attached to the object. Often useful for displaying to users."
- name: fee_details
data_type: jsonb
description: "Detailed breakdown of fees (in cents) paid for this transaction."
- name: available_on
data_type: bigint
description: "The date that the transactions net funds become available in the Stripe balance."
- name: exchange_rate
data_type: numeric
description: "If applicable, this transaction uses an exchange rate. If money converts from currency A to currency B, then the amount in currency A, multipled by the exchange_rate, equals the amount in currency B. For example, if you charge a customer 10.00 EUR, the PaymentIntents amount is 1000 and currency is eur. If this converts to 12.34 USD in your Stripe account, the BalanceTransactions amount is 1234, its currency is usd, and the exchange_rate is 1.234."
- name: sourced_transfers
data_type: jsonb
description: "{{ doc('field_docs_na_desc') }}"
- name: reporting_category
data_type: character varying
description: "Read more at https://stripe.com/docs/reports/reporting-categories."
- name: _airbyte_raw_id
data_type: character varying
description: "{{ doc('_airbyte_raw_id_desc') }}"
- name: _airbyte_extracted_at
data_type: timestamp with time zone
description: "{{ doc('_airbyte_extracted_at_desc') }}"
- name: _airbyte_meta
data_type: jsonb
description: "{{ doc('_airbyte_meta_desc') }}"
- name: charges
identifier: charges
description: |
The Charge object represents a single attempt to move money into your Stripe account. PaymentIntent confirmation is the most common way to create Charges, but transferring money to a different Stripe account through Connect also creates Charges. Some legacy payment flows create Charges directly, which is not recommended for new integrations.
You can read more about this object here: https://docs.stripe.com/api/charges.
columns:
- name: id
data_type: character varying
description: "{{ doc('generic_id_desc') }}"
- name: card
data_type: jsonb
description: "{{ doc('field_docs_na_desc') }}"
- name: paid
data_type: boolean
description: "true if the charge succeeded, or was successfully authorized for later capture."
- name: order
data_type: character varying
description: "{{ doc('field_docs_na_desc') }}"
- name: amount
data_type: bigint
description: "Amount intended to be collected by this payment. A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or equivalent in charge currency. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99)."
- name: object
data_type: character varying
description: "Silly column. The value is always `charge`."
- name: review
data_type: character varying
description: "ID of the review associated with this charge if one exists."
- name: source
data_type: jsonb
description: "{{ doc('field_docs_na_desc') }}"
- name: status
data_type: character varying
description: "The status of the payment is either succeeded, pending, or failed."
- name: created
data_type: bigint
description: "{{ doc('stripe_created_desc') }}"
- name: dispute
data_type: character varying
description: "{{ doc('field_docs_na_desc')}}"
- name: invoice
data_type: character varying
description: "ID of the invoice this charge is for if one exists."
- name: outcome
data_type: jsonb
description: "Details about whether the payment was accepted, and why. See understanding declines for details."
- name: refunds
data_type: jsonb
description: "A list of refunds that have been applied to the charge."
- name: updated
data_type: bigint
description: "{{ doc('stripe_created_desc')}}"
- name: captured
data_type: boolean
description: "If the charge was created without capturing, this Boolean represents whether it is still uncaptured or has since been captured."
- name: currency
data_type: character varying
description: "{{ doc('stripe_currency_desc') }}"
- name: customer
data_type: character varying
description: "ID of the customer this charge is for if one exists."
- name: disputed
data_type: boolean
description: "Whether the charge has been disputed."
- name: livemode
data_type: boolean
description: "{{ doc('stripe_livemode_desc') }}"
- name: metadata
data_type: jsonb
description: "{{ doc('stripe_metadata_desc') }}"
- name: refunded
data_type: boolean
description: "Whether the charge has been fully refunded. If the charge is only partially refunded, this attribute will still be false."
- name: shipping
data_type: jsonb
description: "Shipping information for the charge."
- name: application
data_type: character varying
description: "{{ doc('field_docs_na_desc') }}"
- name: description
data_type: character varying
description: "An arbitrary string attached to the object. Often useful for displaying to users."
- name: destination
data_type: character varying
description: "{{ doc('field_docs_na_desc') }}"
- name: receipt_url
data_type: character varying
description: "This is the URL to view the receipt for this charge. The receipt is kept up-to-date to the latest state of the charge, including any refunds. If the charge is for an Invoice, the receipt will be stylized as an Invoice receipt."
- name: failure_code
data_type: character varying
description: "Error code explaining reason for charge failure if available (see the errors section for a list of codes)."
- name: on_behalf_of
data_type: character varying
description: "The account (if any) the charge was made on behalf of without triggering an automatic transfer. See the Connect documentation for details."
- name: fraud_details
data_type: jsonb
description: "Information on fraud assessments for the charge."
- name: receipt_email
data_type: character varying
description: "This is the email address that the receipt for this charge was sent to."
- name: transfer_data
data_type: jsonb
description: "An optional dictionary including the account to automatically transfer to as part of a destination charge. See the Connect documentation for details."
- name: amount_updates
data_type: jsonb
description: "{{ doc('field_docs_na_desc') }}"
- name: payment_intent
data_type: character varying
description: "ID of the PaymentIntent associated with this charge, if one exists."
- name: payment_method
data_type: character varying
description: "ID of the payment method used in this charge."
- name: receipt_number
data_type: character varying
description: "This is the transaction number that appears on email receipts sent for this charge. This attribute will be null until a receipt has been sent."
- name: transfer_group
data_type: character varying
description: "A string that identifies this transaction as part of a group. See the Connect documentation for details."
- name: amount_captured
data_type: bigint
description: "Amount in cents captured (can be less than the amount attribute on the charge if a partial capture was made)."
- name: amount_refunded
data_type: bigint
description: "Amount in cents refunded (can be less than the amount attribute on the charge if a partial refund was issued)."
- name: application_fee
data_type: character varying
description: "The application fee (if any) for the charge. See the Connect documentation for details."
- name: billing_details
data_type: jsonb
description: "Billing information associated with the payment method at the time of the transaction."
- name: failure_message
data_type: character varying
description: "Message to user further explaining reason for charge failure if available."
- name: source_transfer
data_type: character varying
description: "The transfer ID which created this charge. Only present if the charge came from another Stripe account. See the Connect documentation for details."
- name: balance_transaction
data_type: character varying
description: "ID of the balance transaction that describes the impact of this charge on your account balance (not including refunds or disputes)."
- name: statement_descriptor
data_type: character varying
description: "For card charges, use statement_descriptor_suffix instead. Otherwise, you can use this value as the complete description of a charge on your customers statements. Must contain at least one letter, maximum 22 characters."
- name: statement_description
data_type: character varying
description: "{{ doc('field_docs_na_desc') }}"
- name: application_fee_amount
data_type: bigint
description: "The amount of the application fee (if any) requested for the charge. See the Connect documentation for details."
- name: payment_method_details
data_type: jsonb
description: "Details about the payment method at the time of the transaction."
- name: failure_balance_transaction
data_type: character varying
description: "ID of the balance transaction that describes the reversal of the balance on your account due to payment failure."
- name: statement_descriptor_suffix
data_type: character varying
description: "Provides information about the charge that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor thats set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor."
- name: calculated_statement_descriptor
data_type: character varying
description: "The full statement descriptor that is passed to card networks, and that is displayed on your customers credit card and bank statements. Allows you to see what the statement descriptor looks like after the static and dynamic portions are combined."
- name: _airbyte_raw_id
data_type: character varying
description: "{{ doc('_airbyte_raw_id_desc') }}"
- name: _airbyte_extracted_at
data_type: timestamp with time zone
description: "{{ doc('_airbyte_extracted_at_desc') }}"
- name: _airbyte_meta
data_type: jsonb
description: "{{ doc('_airbyte_meta_desc') }}"
- name: payment_intents
identifier: payment_intents
description: |
A PaymentIntent guides you through the process of collecting a payment from your customer. We recommend that you create exactly one PaymentIntent for each order or customer session in your system. You can reference the PaymentIntent later to see the history of payment attempts for a particular session.
A PaymentIntent transitions through multiple statuses throughout its lifetime as it interfaces with Stripe.js to perform authentication flows and ultimately creates at most one successful charge.
You can read more about this object here: https://docs.stripe.com/api/payment_intents.
columns:
- name: id
data_type: character varying
description: "{{ doc('generic_id_desc') }}"
- name: amount
data_type: bigint
description: "Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or equivalent in charge currency. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99)."
- name: object
data_type: character varying
description: "Silly column. The value is always `payment_intent`."
- name: review
data_type: character varying
description: "ID of the review associated with this PaymentIntent, if any."
- name: source
data_type: character varying
description: "{{ doc('field_docs_na_desc') }}"
- name: status
data_type: character varying
description: "Status of this PaymentIntent, one of requires_payment_method, requires_confirmation, requires_action, processing, requires_capture, canceled, or succeeded. Read more about each PaymentIntent status."
- name: charges
data_type: jsonb
description: "{{ doc('field_docs_na_desc') }}"
- name: created
data_type: bigint
description: "{{ doc('stripe_created_desc') }}"
- name: invoice
data_type: character varying
description: "ID of the invoice that created this PaymentIntent, if it exists."
- name: updated
data_type: bigint
description: "{{ doc('stripe_created_desc')}}"
- name: currency
data_type: character varying
description: "{{ doc('stripe_currency_desc') }}"
- name: customer
data_type: character varying
description: |
"ID of the Customer this PaymentIntent belongs to, if one exists.
Payment methods attached to other Customers cannot be used with this PaymentIntent.
If present in combination with setup_future_usage, this PaymentIntents payment method will be attached to the Customer after the PaymentIntent has been confirmed and any required actions from the user are complete."
- name: livemode
data_type: boolean
description: "{{ doc('stripe_livemode_desc') }}"
- name: metadata
data_type: jsonb
description: "{{ doc('stripe_metadata_desc') }}"
- name: shipping
data_type: jsonb
description: "Shipping information for the charge."
- name: processing
data_type: jsonb
description: "If present, this property tells you about the processing state of the payment."
- name: application
data_type: character varying
description: "ID of the Connect application that created the PaymentIntent."
- name: canceled_at
data_type: bigint
description: "Populated when status is canceled, this is the time at which the PaymentIntent was canceled. Measured in seconds since the Unix epoch."
- name: description
data_type: character varying
description: "An arbitrary string attached to the object. Often useful for displaying to users."
- name: next_action
data_type: jsonb
description: "If present, this property tells you what actions you need to take in order for your customer to fulfill a payment using the provided source."
- name: on_behalf_of
data_type: character varying
description: "The account (if any) for which the funds of the PaymentIntent are intended. See the PaymentIntents use case for connected accounts for details."
- name: client_secret
data_type: character varying
description: |
"The client secret of this PaymentIntent. Used for client-side retrieval using a publishable key.
The client secret can be used to complete a payment from your frontend. It should not be stored, logged, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.
Refer to our docs to accept a payment and learn about how client_secret should be handled."
- name: latest_charge
data_type: character varying
description: "The latest charge created by this PaymentIntent."
- name: receipt_email
data_type: character varying
description: "Email address that the receipt for the resulting payment will be sent to. If receipt_email is specified for a payment in live mode, a receipt will be sent regardless of your email settings."
- name: transfer_data
data_type: jsonb
description: "The data that automatically creates a Transfer after the payment finalizes. Learn more about the use case for connected accounts."
- name: amount_details
data_type: jsonb
description: "Details about items that the amount includes."
- name: capture_method
data_type: character varying
description: "Controls when the funds will be captured from the customers account. One of: automatic, automatic_async, manual."
- name: payment_method
data_type: character varying
description: "ID of the payment method used in this PaymentIntent."
- name: transfer_group
data_type: character varying
description: "A string that identifies the resulting payment as part of a group. Learn more about the use case for connected accounts."
- name: amount_received
data_type: bigint
description: "Amount that this PaymentIntent collects."
- name: amount_capturable
data_type: bigint
description: "Amount that can be captured from this PaymentIntent."
- name: last_payment_error
data_type: jsonb
description: "The payment error encountered in the previous PaymentIntent confirmation. It will be cleared if the PaymentIntent is later updated for any reason."
- name: setup_future_usage
data_type: character varying
description: |
"Indicates that you intend to make future payments with this PaymentIntents payment method.
Providing this parameter will attach the payment method to the PaymentIntents Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be attached to a Customer after the transaction completes.
When processing card payments, Stripe also uses setup_future_usage to dynamically optimize your payment flow and comply with regional legislation and network rules, such as SCA."
- name: cancellation_reason
data_type: character varying
description: "Reason for cancellation of this PaymentIntent, either user-provided (duplicate, fraudulent, requested_by_customer, or abandoned) or generated by Stripe internally (failed_invoice, void_invoice, or automatic)."
- name: confirmation_method
data_type: character varying
description: "Describes whether we can confirm this PaymentIntent automatically, or if it requires customer action to confirm the payment."
- name: payment_method_types
data_type: jsonb
description: "The list of payment method types (e.g. card) that this PaymentIntent is allowed to use."
- name: statement_descriptor
data_type: character varying
description: "For card charges, use statement_descriptor_suffix. Otherwise, you can use this value as the complete description of a charge on your customers statements. It must contain at least one letter and be 122 characters long."
- name: statement_description
data_type: character varying
description: "{{ doc('field_docs_na_desc') }}"
- name: application_fee_amount
data_type: bigint
description: "The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owners Stripe account. The amount of the application fee collected will be capped at the total payment amount. For more information, see the PaymentIntents use case for connected accounts."
- name: payment_method_options
data_type: jsonb
description: "Payment method-specific configuration for this PaymentIntent."
- name: automatic_payment_methods
data_type: jsonb
description: "When you enable this parameter, this PaymentIntent accepts payment methods that you enable in the Dashboard and that are compatible with this PaymentIntents other parameters."
- name: statement_descriptor_suffix
data_type: character varying
description: "Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor thats set on the account to form the complete statement descriptor. The concatenated descriptor must contain 1-22 characters."
- name: payment_method_configuration_details
data_type: jsonb
description: "{{ doc('field_docs_na_desc') }}"
- name: _airbyte_raw_id
data_type: character varying
description: "{{ doc('_airbyte_raw_id_desc') }}"
- name: _airbyte_extracted_at
data_type: timestamp with time zone
description: "{{ doc('_airbyte_extracted_at_desc') }}"
- name: _airbyte_meta
data_type: jsonb
description: "{{ doc('_airbyte_meta_desc') }}"

View file

@ -0,0 +1,469 @@
version: 2
models:
- name: stg_stripe__balance_transactions
description: |
Individual transactions happening in our different Stripe currency accounts.
You can read more about this object here: https://docs.stripe.com/api/balance_transactions/object.
columns:
- name: id
data_type: character varying
description: "{{ doc('generic_id_desc') }}"
- name: fee
data_type: bigint
description: "Fees (in cents) paid for this transaction. Represented as a positive integer when assessed."
- name: net
data_type: bigint
description: "Net impact to a Stripe balance (in cents). A positive value represents incrementing a Stripe balance, and a negative value decrementing a Stripe balance. You can calculate the net impact of a transaction on a balance by amount - fee"
- name: type
data_type: character varying
description: "Transaction type: adjustment, advance, advance_funding, anticipation_repayment, application_fee, application_fee_refund, charge, climate_order_purchase, climate_order_refund, connect_collection_transfer, contribution, issuing_authorization_hold, issuing_authorization_release, issuing_dispute, issuing_transaction, obligation_outbound, obligation_reversal_inbound, payment, payment_failure_refund, payment_network_reserve_hold, payment_network_reserve_release, payment_refund, payment_reversal, payment_unreconciled, payout, payout_cancel, payout_failure, refund, refund_failure, reserve_transaction, reserved_funds, stripe_fee, stripe_fx_fee, tax_fee, topup, topup_reversal, transfer, transfer_cancel, transfer_failure, or transfer_refund. Learn more about balance transaction types and what they represent. To classify transactions for accounting purposes, consider reporting_category instead."
- name: amount
data_type: bigint
description: "Gross amount of this transaction (in cents). A positive value represents funds charged to another party, and a negative value represents funds sent to another party."
- name: object
data_type: character varying
description: "Silly column. The value is always `balance_transaction`."
- name: source
data_type: character varying
description: "This transaction relates to the Stripe object indicated here. Can be different object types (charge, refund, payment, etc)."
- name: status
data_type: character varying
description: "The transactions net funds status in the Stripe balance, which are either available or pending."
- name: created_at_utc
data_type: bigint
description: "The timestamp at which the object was created."
- name: currency
data_type: character varying
description: "{{ doc('stripe_currency_desc') }}"
- name: description
data_type: character varying
description: "An arbitrary string attached to the object. Often useful for displaying to users."
- name: fee_details
data_type: jsonb
description: "Detailed breakdown of fees (in cents) paid for this transaction."
- name: available_at_utc
data_type: bigint
description: "The timestamp at which the transactions net funds become available in the Stripe balance."
- name: exchange_rate
data_type: numeric
description: "If applicable, this transaction uses an exchange rate. If money converts from currency A to currency B, then the amount in currency A, multipled by the exchange_rate, equals the amount in currency B. For example, if you charge a customer 10.00 EUR, the PaymentIntents amount is 1000 and currency is eur. If this converts to 12.34 USD in your Stripe account, the BalanceTransactions amount is 1234, its currency is usd, and the exchange_rate is 1.234."
- name: sourced_transfers
data_type: jsonb
description: "{{ doc('field_docs_na_desc') }}"
- name: reporting_category
data_type: character varying
description: "Read more at https://stripe.com/docs/reports/reporting-categories."
- name: dwh_extracted_at_date
data_type: timestamp with time zone
description: "{{ doc('dwh_extracted_at_date_desc')}}"
- name: stg_stripe__charges
description: ""
columns:
- name: id
data_type: character varying
description: "{{ doc('generic_id_desc') }}"
- name: card
data_type: jsonb
description: "{{ doc('field_docs_na_desc') }}"
- name: is_paid
data_type: boolean
description: "true if the charge succeeded, or was successfully authorized for later capture."
- name: order
data_type: character varying
description: "{{ doc('field_docs_na_desc') }}"
- name: amount
data_type: bigint
description: "Amount intended to be collected by this payment. A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or equivalent in charge currency. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99)."
- name: object
data_type: character varying
description: "Silly column. The value is always `charge`."
- name: review
data_type: character varying
description: "ID of the review associated with this charge if one exists."
- name: source
data_type: jsonb
description: "{{ doc('field_docs_na_desc') }}"
- name: status
data_type: character varying
description: "The status of the payment is either succeeded, pending, or failed."
- name: created_at_utc
data_type: timestamp with time zone
description: "The timestamp at which the object was created."
- name: dispute
data_type: character varying
description: "{{ doc('field_docs_na_desc')}}"
- name: invoice
data_type: character varying
description: "ID of the invoice this charge is for if one exists."
- name: outcome
data_type: jsonb
description: "Details about whether the payment was accepted, and why. See understanding declines for details."
- name: refunds
data_type: jsonb
description: "A list of refunds that have been applied to the charge."
- name: updated_at_utc
data_type: timestamp with time zone
description: "The timestamp at which the object was last updated."
- name: is_captured
data_type: boolean
description: "If the charge was created without capturing, this Boolean represents whether it is still uncaptured or has since been captured."
- name: currency
data_type: character varying
description: "{{ doc('stripe_currency_desc') }}"
- name: customer
data_type: character varying
description: "ID of the customer this charge is for if one exists."
- name: is_disputed
data_type: boolean
description: "Whether the charge has been disputed."
- name: is_livemode
data_type: boolean
description: "{{ doc('stripe_livemode_desc') }}"
- name: metadata
data_type: jsonb
description: "{{ doc('stripe_metadata_desc') }}"
- name: is_refunded
data_type: boolean
description: "Whether the charge has been fully refunded. If the charge is only partially refunded, this attribute will still be false."
- name: shipping
data_type: jsonb
description: "Shipping information for the charge."
- name: application
data_type: character varying
description: "{{ doc('field_docs_na_desc') }}"
- name: description
data_type: character varying
description: "An arbitrary string attached to the object. Often useful for displaying to users."
- name: destination
data_type: character varying
description: "{{ doc('field_docs_na_desc') }}"
- name: receipt_url
data_type: character varying
description: "This is the URL to view the receipt for this charge. The receipt is kept up-to-date to the latest state of the charge, including any refunds. If the charge is for an Invoice, the receipt will be stylized as an Invoice receipt."
- name: failure_code
data_type: character varying
description: "Error code explaining reason for charge failure if available (see the errors section for a list of codes)."
- name: on_behalf_of
data_type: character varying
description: "The account (if any) the charge was made on behalf of without triggering an automatic transfer. See the Connect documentation for details."
- name: fraud_details
data_type: jsonb
description: "Information on fraud assessments for the charge."
- name: receipt_email
data_type: character varying
description: "This is the email address that the receipt for this charge was sent to."
- name: transfer_data
data_type: jsonb
description: "An optional dictionary including the account to automatically transfer to as part of a destination charge. See the Connect documentation for details."
- name: amount_updates
data_type: jsonb
description: "{{ doc('field_docs_na_desc') }}"
- name: payment_intent
data_type: character varying
description: "ID of the PaymentIntent associated with this charge, if one exists."
- name: payment_method
data_type: character varying
description: "ID of the payment method used in this charge."
- name: receipt_number
data_type: character varying
description: "This is the transaction number that appears on email receipts sent for this charge. This attribute will be null until a receipt has been sent."
- name: transfer_group
data_type: character varying
description: "A string that identifies this transaction as part of a group. See the Connect documentation for details."
- name: amount_captured
data_type: bigint
description: "Amount in cents captured (can be less than the amount attribute on the charge if a partial capture was made)."
- name: amount_refunded
data_type: bigint
description: "Amount in cents refunded (can be less than the amount attribute on the charge if a partial refund was issued)."
- name: application_fee
data_type: character varying
description: "The application fee (if any) for the charge. See the Connect documentation for details."
- name: billing_details
data_type: jsonb
description: "Billing information associated with the payment method at the time of the transaction."
- name: failure_message
data_type: character varying
description: "Message to user further explaining reason for charge failure if available."
- name: source_transfer
data_type: character varying
description: "The transfer ID which created this charge. Only present if the charge came from another Stripe account. See the Connect documentation for details."
- name: balance_transaction
data_type: character varying
description: "ID of the balance transaction that describes the impact of this charge on your account balance (not including refunds or disputes)."
- name: statement_descriptor
data_type: character varying
description: "For card charges, use statement_descriptor_suffix instead. Otherwise, you can use this value as the complete description of a charge on your customers statements. Must contain at least one letter, maximum 22 characters."
- name: statement_description
data_type: character varying
description: "{{ doc('field_docs_na_desc') }}"
- name: application_fee_amount
data_type: bigint
description: "The amount of the application fee (if any) requested for the charge. See the Connect documentation for details."
- name: payment_method_details
data_type: jsonb
description: "Details about the payment method at the time of the transaction."
- name: failure_balance_transaction
data_type: character varying
description: "ID of the balance transaction that describes the reversal of the balance on your account due to payment failure."
- name: statement_descriptor_suffix
data_type: character varying
description: "Provides information about the charge that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor thats set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor."
- name: calculated_statement_descriptor
data_type: character varying
description: "The full statement descriptor that is passed to card networks, and that is displayed on your customers credit card and bank statements. Allows you to see what the statement descriptor looks like after the static and dynamic portions are combined."
- name: dwh_extracted_at_date
data_type: timestamp with time zone
description: "{{ doc('dwh_extracted_at_date_desc') }}"
- name: stg_stripe__payment_intents
description: |
A PaymentIntent guides you through the process of collecting a payment from your customer. We recommend that you create exactly one PaymentIntent for each order or customer session in your system. You can reference the PaymentIntent later to see the history of payment attempts for a particular session.
A PaymentIntent transitions through multiple statuses throughout its lifetime as it interfaces with Stripe.js to perform authentication flows and ultimately creates at most one successful charge.
You can read more about this object here: https://docs.stripe.com/api/payment_intents.
columns:
- name: id
data_type: character varying
description: "{{ doc('generic_id_desc') }}"
- name: amount
data_type: bigint
description: "Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or equivalent in charge currency. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99)."
- name: object
data_type: character varying
description: "Silly column. The value is always `payment_intent`."
- name: review
data_type: character varying
description: "ID of the review associated with this PaymentIntent, if any."
- name: source
data_type: character varying
description: "{{ doc('field_docs_na_desc') }}"
- name: status
data_type: character varying
description: "Status of this PaymentIntent, one of requires_payment_method, requires_confirmation, requires_action, processing, requires_capture, canceled, or succeeded. Read more about each PaymentIntent status."
- name: charges
data_type: jsonb
description: "{{ doc('field_docs_na_desc') }}"
- name: created_at_utc
data_type: timestamp with time zone
description: "The timestamp at which the object was created."
- name: invoice
data_type: character varying
description: "ID of the invoice that created this PaymentIntent, if it exists."
- name: updated_at_utc
data_type: timestamp with time zone
description: "The timestamp at which the object was last updated."
- name: currency
data_type: character varying
description: "{{ doc('stripe_currency_desc') }}"
- name: customer
data_type: character varying
description: |
"ID of the Customer this PaymentIntent belongs to, if one exists.
Payment methods attached to other Customers cannot be used with this PaymentIntent.
If present in combination with setup_future_usage, this PaymentIntents payment method will be attached to the Customer after the PaymentIntent has been confirmed and any required actions from the user are complete."
- name: is_livemode
data_type: boolean
description: "{{ doc('stripe_livemode_desc') }}"
- name: metadata
data_type: jsonb
description: "{{ doc('stripe_metadata_desc') }}"
- name: shipping
data_type: jsonb
description: "Shipping information for the charge."
- name: processing
data_type: jsonb
description: "If present, this property tells you about the processing state of the payment."
- name: application
data_type: character varying
description: "ID of the Connect application that created the PaymentIntent."
- name: canceled_at_utc
data_type: timestamp with time zone
description: "Populated when status is canceled, this is the time at which the PaymentIntent was canceled."
- name: description
data_type: character varying
description: "An arbitrary string attached to the object. Often useful for displaying to users."
- name: next_action
data_type: jsonb
description: "If present, this property tells you what actions you need to take in order for your customer to fulfill a payment using the provided source."
- name: on_behalf_of
data_type: character varying
description: "The account (if any) for which the funds of the PaymentIntent are intended. See the PaymentIntents use case for connected accounts for details."
- name: client_secret
data_type: character varying
description: |
"The client secret of this PaymentIntent. Used for client-side retrieval using a publishable key.
The client secret can be used to complete a payment from your frontend. It should not be stored, logged, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.
Refer to our docs to accept a payment and learn about how client_secret should be handled."
- name: latest_charge
data_type: character varying
description: "The latest charge created by this PaymentIntent."
- name: receipt_email
data_type: character varying
description: "Email address that the receipt for the resulting payment will be sent to. If receipt_email is specified for a payment in live mode, a receipt will be sent regardless of your email settings."
- name: transfer_data
data_type: jsonb
description: "The data that automatically creates a Transfer after the payment finalizes. Learn more about the use case for connected accounts."
- name: amount_details
data_type: jsonb
description: "Details about items that the amount includes."
- name: capture_method
data_type: character varying
description: "Controls when the funds will be captured from the customers account. One of: automatic, automatic_async, manual."
- name: payment_method
data_type: character varying
description: "ID of the payment method used in this PaymentIntent."
- name: transfer_group
data_type: character varying
description: "A string that identifies the resulting payment as part of a group. Learn more about the use case for connected accounts."
- name: amount_received
data_type: bigint
description: "Amount that this PaymentIntent collects."
- name: amount_capturable
data_type: bigint
description: "Amount that can be captured from this PaymentIntent."
- name: last_payment_error
data_type: jsonb
description: "The payment error encountered in the previous PaymentIntent confirmation. It will be cleared if the PaymentIntent is later updated for any reason."
- name: setup_future_usage
data_type: character varying
description: |
"Indicates that you intend to make future payments with this PaymentIntents payment method.
Providing this parameter will attach the payment method to the PaymentIntents Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be attached to a Customer after the transaction completes.
When processing card payments, Stripe also uses setup_future_usage to dynamically optimize your payment flow and comply with regional legislation and network rules, such as SCA."
- name: cancellation_reason
data_type: character varying
description: "Reason for cancellation of this PaymentIntent, either user-provided (duplicate, fraudulent, requested_by_customer, or abandoned) or generated by Stripe internally (failed_invoice, void_invoice, or automatic)."
- name: confirmation_method
data_type: character varying
description: "Describes whether we can confirm this PaymentIntent automatically, or if it requires customer action to confirm the payment."
- name: payment_method_types
data_type: jsonb
description: "The list of payment method types (e.g. card) that this PaymentIntent is allowed to use."
- name: statement_descriptor
data_type: character varying
description: "For card charges, use statement_descriptor_suffix. Otherwise, you can use this value as the complete description of a charge on your customers statements. It must contain at least one letter and be 122 characters long."
- name: statement_description
data_type: character varying
description: "{{ doc('field_docs_na_desc') }}"
- name: application_fee_amount
data_type: bigint
description: "The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owners Stripe account. The amount of the application fee collected will be capped at the total payment amount. For more information, see the PaymentIntents use case for connected accounts."
- name: payment_method_options
data_type: jsonb
description: "Payment method-specific configuration for this PaymentIntent."
- name: automatic_payment_methods
data_type: jsonb
description: "When you enable this parameter, this PaymentIntent accepts payment methods that you enable in the Dashboard and that are compatible with this PaymentIntents other parameters."
- name: statement_descriptor_suffix
data_type: character varying
description: "Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor thats set on the account to form the complete statement descriptor. The concatenated descriptor must contain 1-22 characters."
- name: payment_method_configuration_details
data_type: jsonb
description: "{{ doc('field_docs_na_desc') }}"
- name: dwh_extracted_at_date
data_type: timestamp with time zone
description: "{{ doc('dwh_extracted_at_date_desc') }}"

View file

@ -0,0 +1,28 @@
with
raw_balance_transactions as (
select * from {{ source("stripe_uk", "balance_transactions") }}
),
stg_stripe__balance_transactions as (
select
{{ adapter.quote("id") }},
{{ adapter.quote("fee") }},
{{ adapter.quote("net") }},
{{ adapter.quote("type") }},
{{ adapter.quote("amount") }},
{{ adapter.quote("object") }},
{{ adapter.quote("source") }},
{{ adapter.quote("status") }},
to_timestamp({{ adapter.quote("created") }}) as created_at_utc,
{{ adapter.quote("currency") }},
{{ adapter.quote("description") }},
{{ adapter.quote("fee_details") }},
to_timestamp({{ adapter.quote("available_on") }}) as available_at_utc,
{{ adapter.quote("exchange_rate") }},
{{ adapter.quote("sourced_transfers") }},
{{ adapter.quote("reporting_category") }},
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_date
from raw_balance_transactions
)
select *
from stg_stripe__balance_transactions

View file

@ -0,0 +1,61 @@
with
raw_charges as (select * from {{ source("stripe_uk", "charges") }}),
stg_stripe__charges as (
select
{{ adapter.quote("id") }},
{{ adapter.quote("card") }},
cast({{ adapter.quote("paid") }} as bool) as is_paid,
{{ adapter.quote("order") }},
{{ adapter.quote("amount") }},
{{ adapter.quote("object") }},
{{ adapter.quote("review") }},
{{ adapter.quote("source") }},
{{ adapter.quote("status") }},
to_timestamp({{ adapter.quote("created") }}) as created_at_utc,
{{ adapter.quote("dispute") }},
{{ adapter.quote("invoice") }},
{{ adapter.quote("outcome") }},
{{ adapter.quote("refunds") }},
to_timestamp({{ adapter.quote("updated") }}) as updated_at_utc,
cast({{ adapter.quote("captured") }} as bool) as is_captured,
{{ adapter.quote("currency") }},
{{ adapter.quote("customer") }},
cast({{ adapter.quote("disputed") }} as bool) as is_disputed,
cast({{ adapter.quote("livemode") }} as bool) as is_livemode,
{{ adapter.quote("metadata") }},
cast({{ adapter.quote("refunded") }} as bool) as is_refunded,
{{ adapter.quote("shipping") }},
{{ adapter.quote("application") }},
{{ adapter.quote("description") }},
{{ adapter.quote("destination") }},
{{ adapter.quote("receipt_url") }},
{{ adapter.quote("failure_code") }},
{{ adapter.quote("on_behalf_of") }},
{{ adapter.quote("fraud_details") }},
{{ adapter.quote("receipt_email") }},
{{ adapter.quote("transfer_data") }},
{{ adapter.quote("amount_updates") }},
{{ adapter.quote("payment_intent") }},
{{ adapter.quote("payment_method") }},
{{ adapter.quote("receipt_number") }},
{{ adapter.quote("transfer_group") }},
{{ adapter.quote("amount_captured") }},
{{ adapter.quote("amount_refunded") }},
{{ adapter.quote("application_fee") }},
{{ adapter.quote("billing_details") }},
{{ adapter.quote("failure_message") }},
{{ adapter.quote("source_transfer") }},
{{ adapter.quote("balance_transaction") }},
{{ adapter.quote("statement_descriptor") }},
{{ adapter.quote("statement_description") }},
{{ adapter.quote("application_fee_amount") }},
{{ adapter.quote("payment_method_details") }},
{{ adapter.quote("failure_balance_transaction") }},
{{ adapter.quote("statement_descriptor_suffix") }},
{{ adapter.quote("calculated_statement_descriptor") }},
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_date
from raw_charges
)
select *
from stg_stripe__charges

View file

@ -0,0 +1,53 @@
with
raw_payment_intents as (select * from {{ source("stripe_uk", "payment_intents") }}),
stg_stripe__payment_intents as (
select
{{ adapter.quote("id") }},
{{ adapter.quote("amount") }},
{{ adapter.quote("object") }},
{{ adapter.quote("review") }},
{{ adapter.quote("source") }},
{{ adapter.quote("status") }},
{{ adapter.quote("charges") }},
to_timestamp({{ adapter.quote("created") }}) as created_at_utc,
{{ adapter.quote("invoice") }},
to_timestamp({{ adapter.quote("updated") }}) as updated_at_utc,
{{ adapter.quote("currency") }},
{{ adapter.quote("customer") }},
cast({{ adapter.quote("livemode") }} as bool) as is_livemode,
{{ adapter.quote("metadata") }},
{{ adapter.quote("shipping") }},
{{ adapter.quote("processing") }},
{{ adapter.quote("application") }},
to_timestamp({{ adapter.quote("canceled_at") }}) as canceled_at_utc,
{{ adapter.quote("description") }},
{{ adapter.quote("next_action") }},
{{ adapter.quote("on_behalf_of") }},
{{ adapter.quote("client_secret") }},
{{ adapter.quote("latest_charge") }},
{{ adapter.quote("receipt_email") }},
{{ adapter.quote("transfer_data") }},
{{ adapter.quote("amount_details") }},
{{ adapter.quote("capture_method") }},
{{ adapter.quote("payment_method") }},
{{ adapter.quote("transfer_group") }},
{{ adapter.quote("amount_received") }},
{{ adapter.quote("amount_capturable") }},
{{ adapter.quote("last_payment_error") }},
{{ adapter.quote("setup_future_usage") }},
{{ adapter.quote("cancellation_reason") }},
{{ adapter.quote("confirmation_method") }},
{{ adapter.quote("payment_method_types") }},
{{ adapter.quote("statement_descriptor") }},
{{ adapter.quote("statement_description") }},
{{ adapter.quote("application_fee_amount") }},
{{ adapter.quote("payment_method_options") }},
{{ adapter.quote("automatic_payment_methods") }},
{{ adapter.quote("statement_descriptor_suffix") }},
{{ adapter.quote("payment_method_configuration_details") }},
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_date
from raw_payment_intents
)
select *
from stg_stripe__payment_intents

View file

@ -0,0 +1,29 @@
{% docs stripe_created_desc %}
Time at which the object was created. Measured in seconds since the Unix epoch.
{% enddocs %}
{% docs stripe_updated_desc %}
Time at which the object was last updated. Measured in seconds since the Unix epoch.
{% enddocs %}
{% docs stripe_currency_desc %}
Three-letter ISO currency code, in lowercase. Must be a supported currency.
{% enddocs %}
{% docs stripe_livemode_desc %}
Has the value true if the object exists in live mode or the value false if the object exists in test mode."
{% enddocs %}
{% docs stripe_metadata_desc %}
Additional properties supplied by Superhog.
{% enddocs %}

6
package-lock.yml Normal file
View file

@ -0,0 +1,6 @@
packages:
- package: dbt-labs/codegen
version: 0.12.1
- package: dbt-labs/dbt_utils
version: 1.1.1
sha1_hash: acdde602cd2e228b1dac1cf1a7e5f98f12c16b3b

3
packages.yml Normal file
View file

@ -0,0 +1,3 @@
packages:
- package: dbt-labs/codegen
version: 0.12.1