make amounts in charges numeric

This commit is contained in:
Pablo Martin 2024-02-23 17:12:19 +01:00
parent dbecade13c
commit f2d01290fc
2 changed files with 15 additions and 8 deletions

View file

@ -91,7 +91,7 @@ models:
description: "{{ doc('field_docs_na_desc') }}"
- name: amount
data_type: bigint
data_type: numeric
description: "Amount intended to be collected by this payment. A positive integer representing how much to charge in the regular unit for the currency (1 for $1)."
- name: object
@ -231,11 +231,11 @@ models:
description: "A string that identifies this transaction as part of a group. See the Connect documentation for details."
- name: amount_captured
data_type: bigint
data_type: numeric
description: "Amount captured (can be less than the amount attribute on the charge if a partial capture was made)."
- name: amount_refunded
data_type: bigint
data_type: numeric
description: "Amount refunded (can be less than the amount attribute on the charge if a partial refund was issued)."
- name: application_fee

View file

@ -7,7 +7,10 @@ with
{{ adapter.quote("card") }},
cast({{ adapter.quote("paid") }} as bool) as is_paid,
{{ adapter.quote("order") }},
{{ adapter.quote("amount") }} / (10 ^ cur.decimal_positions) as amount,
cast(
{{ adapter.quote("amount") }}
/ (10 ^ cur.decimal_positions) as numeric(19, 4)
) as amount,
{{ adapter.quote("object") }},
{{ adapter.quote("review") }},
{{ adapter.quote("source") }},
@ -46,10 +49,14 @@ with
{{ adapter.quote("payment_method") }},
{{ adapter.quote("receipt_number") }},
{{ adapter.quote("transfer_group") }},
{{ adapter.quote("amount_captured") }}
/ (10 ^ cur.decimal_positions) as amount_captured,
{{ adapter.quote("amount_refunded") }}
/ (10 ^ cur.decimal_positions) as amount_refunded,
cast(
{{ adapter.quote("amount_captured") }}
/ (10 ^ cur.decimal_positions) as numeric(19, 4)
) as amount_captured,
cast(
{{ adapter.quote("amount_refunded") }}
/ (10 ^ cur.decimal_positions) as numeric(19, 4)
) as amount_refunded,
{{ adapter.quote("application_fee") }},
{{ adapter.quote("billing_details") }},
{{ adapter.quote("failure_message") }},