boilpayment 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- boilpayment/__init__.py +337 -0
- boilpayment/core.py +310 -0
- boilpayment/credits.py +70 -0
- boilpayment/cs.py +183 -0
- boilpayment/lifecycle.py +116 -0
- boilpayment/notify.py +43 -0
- boilpayment/polar.py +29 -0
- boilpayment/portone.py +30 -0
- boilpayment/postgres.py +56 -0
- boilpayment/refund.py +49 -0
- boilpayment/stripe.py +32 -0
- boilpayment/toss.py +35 -0
- boilpayment/usage.py +54 -0
- boilpayment/webhook.py +50 -0
- boilpayment-0.2.0.dist-info/METADATA +104 -0
- boilpayment-0.2.0.dist-info/RECORD +147 -0
- boilpayment-0.2.0.dist-info/WHEEL +4 -0
- boilpayment-0.2.0.dist-info/licenses/LICENSE +21 -0
- boilpayment_core/__init__.py +72 -0
- boilpayment_core/attempt_review.py +67 -0
- boilpayment_core/clock.py +44 -0
- boilpayment_core/idempotent.py +224 -0
- boilpayment_core/keys.py +64 -0
- boilpayment_core/logger.py +134 -0
- boilpayment_core/memory.py +416 -0
- boilpayment_core/money.py +102 -0
- boilpayment_core/payment_refs.py +37 -0
- boilpayment_core/period.py +180 -0
- boilpayment_core/policy.py +148 -0
- boilpayment_core/store.py +104 -0
- boilpayment_core/types.py +981 -0
- boilpayment_credits/__init__.py +26 -0
- boilpayment_credits/clawback.py +111 -0
- boilpayment_credits/consume.py +69 -0
- boilpayment_credits/expire.py +63 -0
- boilpayment_credits/grant.py +489 -0
- boilpayment_credits/notify_expiring.py +131 -0
- boilpayment_credits/rollover.py +131 -0
- boilpayment_cs/__init__.py +187 -0
- boilpayment_cs/apply_purchased_grant.py +70 -0
- boilpayment_cs/cases.py +195 -0
- boilpayment_cs/checkout_support.py +189 -0
- boilpayment_cs/churn.py +71 -0
- boilpayment_cs/complete_checkout.py +154 -0
- boilpayment_cs/dispute.py +435 -0
- boilpayment_cs/evidence.py +558 -0
- boilpayment_cs/export_customer.py +101 -0
- boilpayment_cs/finish_refund_cases.py +71 -0
- boilpayment_cs/metrics.py +263 -0
- boilpayment_cs/purchase_snapshot.py +178 -0
- boilpayment_cs/reconcile.py +128 -0
- boilpayment_cs/recover_missing_grant.py +269 -0
- boilpayment_cs/refund_assist.py +341 -0
- boilpayment_cs/regrant.py +190 -0
- boilpayment_cs/request_refund.py +128 -0
- boilpayment_cs/settlement_report.py +107 -0
- boilpayment_cs/store_purchase.py +319 -0
- boilpayment_cs/support.py +192 -0
- boilpayment_cs/timeline.py +700 -0
- boilpayment_cs/widget.py +87 -0
- boilpayment_lifecycle/__init__.py +54 -0
- boilpayment_lifecycle/backfill.py +351 -0
- boilpayment_lifecycle/cancel.py +218 -0
- boilpayment_lifecycle/charge_attempt.py +465 -0
- boilpayment_lifecycle/downgrade.py +185 -0
- boilpayment_lifecycle/dunning.py +560 -0
- boilpayment_lifecycle/held.py +216 -0
- boilpayment_lifecycle/internal.py +125 -0
- boilpayment_lifecycle/legacy_attempts.py +207 -0
- boilpayment_lifecycle/missed_periods.py +96 -0
- boilpayment_lifecycle/period.py +10 -0
- boilpayment_lifecycle/reactivate.py +296 -0
- boilpayment_lifecycle/renewal.py +195 -0
- boilpayment_lifecycle/retry.py +37 -0
- boilpayment_lifecycle/scheduler.py +319 -0
- boilpayment_lifecycle/start.py +176 -0
- boilpayment_lifecycle/trial.py +177 -0
- boilpayment_lifecycle/upgrade.py +410 -0
- boilpayment_lifecycle/upgrade_charge.py +115 -0
- boilpayment_notify/__init__.py +33 -0
- boilpayment_notify/composite.py +24 -0
- boilpayment_notify/outbox.py +86 -0
- boilpayment_notify/resend.py +68 -0
- boilpayment_notify/slack.py +34 -0
- boilpayment_notify/smtp.py +81 -0
- boilpayment_notify/templates.py +160 -0
- boilpayment_polar/__init__.py +642 -0
- boilpayment_portone/__init__.py +856 -0
- boilpayment_refund/__init__.py +36 -0
- boilpayment_refund/evaluate.py +313 -0
- boilpayment_refund/execute.py +119 -0
- boilpayment_refund/execute_request.py +106 -0
- boilpayment_refund/execute_settle.py +178 -0
- boilpayment_refund/external.py +362 -0
- boilpayment_refund/reason.py +38 -0
- boilpayment_refund/util.py +82 -0
- boilpayment_schema_postgres/__init__.py +38 -0
- boilpayment_schema_postgres/audit_log.py +59 -0
- boilpayment_schema_postgres/consistency.py +57 -0
- boilpayment_schema_postgres/ledger_store.py +437 -0
- boilpayment_schema_postgres/mapping.py +115 -0
- boilpayment_schema_postgres/migrate.py +205 -0
- boilpayment_schema_postgres/repo.py +731 -0
- boilpayment_schema_postgres/retention.py +106 -0
- boilpayment_schema_postgres/sql/0001_core.sql +144 -0
- boilpayment_schema_postgres/sql/0002_credits.sql +159 -0
- boilpayment_schema_postgres/sql/0003_usage.sql +48 -0
- boilpayment_schema_postgres/sql/0004_webhook.sql +49 -0
- boilpayment_schema_postgres/sql/0005_refund.sql +33 -0
- boilpayment_schema_postgres/sql/0006_cs.sql +64 -0
- boilpayment_schema_postgres/sql/0007_subscription_provider_ref_nullable.sql +3 -0
- boilpayment_schema_postgres/sql/0008_iap.sql +15 -0
- boilpayment_schema_postgres/sql/0009_ledger_idempotency_per_customer.sql +7 -0
- boilpayment_schema_postgres/sql/0010_usage_idempotency_per_customer.sql +5 -0
- boilpayment_schema_postgres/sql/0011_subscription_status_paused_incomplete.sql +6 -0
- boilpayment_schema_postgres/sql/0012_subscription_currency.sql +4 -0
- boilpayment_schema_postgres/sql/0013_ledger_consume_key.sql +10 -0
- boilpayment_schema_postgres/sql/0014_subscription_billing_customer_ref.sql +6 -0
- boilpayment_schema_postgres/tx.py +136 -0
- boilpayment_stripe/__init__.py +1000 -0
- boilpayment_toss/__init__.py +869 -0
- boilpayment_usage/__init__.py +47 -0
- boilpayment_usage/billing_currency.py +27 -0
- boilpayment_usage/check.py +167 -0
- boilpayment_usage/close_period.py +68 -0
- boilpayment_usage/flush_outbox.py +93 -0
- boilpayment_usage/period.py +15 -0
- boilpayment_usage/prepare_settlement.py +199 -0
- boilpayment_usage/record.py +121 -0
- boilpayment_usage/report_period.py +63 -0
- boilpayment_usage/reservation.py +343 -0
- boilpayment_usage/resettle_period.py +99 -0
- boilpayment_usage/settle_due_periods.py +98 -0
- boilpayment_usage/settle_period.py +150 -0
- boilpayment_usage/settlement_period.py +46 -0
- boilpayment_usage/settlement_types.py +62 -0
- boilpayment_webhook/__init__.py +32 -0
- boilpayment_webhook/attempt_row.py +37 -0
- boilpayment_webhook/correlation.py +62 -0
- boilpayment_webhook/grants.py +33 -0
- boilpayment_webhook/handlers.py +493 -0
- boilpayment_webhook/http.py +47 -0
- boilpayment_webhook/identity.py +69 -0
- boilpayment_webhook/payment_ref.py +103 -0
- boilpayment_webhook/process.py +189 -0
- boilpayment_webhook/receive.py +98 -0
- boilpayment_webhook/refund.py +113 -0
boilpayment/__init__.py
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
"""boilpayment -- root export.
|
|
2
|
+
|
|
3
|
+
Deliberately narrow (see ../README.md "Root export & name collisions" for the full rationale and
|
|
4
|
+
the two real name collisions this avoids). What's here:
|
|
5
|
+
1. The full surface of boilpayment_core (types, Policy, Clock/IdGen, period/money
|
|
6
|
+
helpers, idempotency helpers, in-memory reference implementations, logging) -- this is what
|
|
7
|
+
every other module's function signatures are built from, so it's safe and expected to be
|
|
8
|
+
fully available at the root.
|
|
9
|
+
2. A curated set of the most-used entry points from the five core operation modules
|
|
10
|
+
(lifecycle, credits, refund, usage, webhook), so
|
|
11
|
+
`from boilpayment import upgrade, consume, evaluate, record, receive` covers the
|
|
12
|
+
common path without picking a submodule.
|
|
13
|
+
|
|
14
|
+
NOT re-exported here -- use the dedicated submodule instead:
|
|
15
|
+
- `.stripe`, `.toss`, `.portone`, `.polar` -- the four provider adapters export several
|
|
16
|
+
same-named functions/types with DIFFERENT shapes (`normalize_failure`,
|
|
17
|
+
`normalize_subscription`, `normalize_refund`, `map_event_type`, `to_normalized_event` collide
|
|
18
|
+
between stripe/polar; `CashReceiptType`, `CashReceiptStatus`, `CashReceipt` collide between
|
|
19
|
+
toss/portone). Bundling any two of them at the root would silently shadow one implementation
|
|
20
|
+
with the other.
|
|
21
|
+
- `.notify`, `.cs`, `.postgres` -- add-on/infra modules, not every project uses them.
|
|
22
|
+
- `.refund`'s own `proration_ratio` (and `days_between`/`apply_rounding`/
|
|
23
|
+
`weighted_avg_unit_price`) -- `proration_ratio` is a REAL collision with core's own
|
|
24
|
+
`proration_ratio` (re-exported via #1 above); refund's copy is available at `.refund` only, so
|
|
25
|
+
`from boilpayment import ...` always gets core's version unambiguously.
|
|
26
|
+
- the rest of `.lifecycle` (`downgrade`/`convert_trial`/`retry_on_version_conflict`/the
|
|
27
|
+
`dunning`, `scheduler`, `period` submodules), `.credits` (`grant_for_period`/
|
|
28
|
+
`rollover_on_renewal`/`clawback`/`expire_due`/`notify_expiring`), `.usage`
|
|
29
|
+
(`close_period`/`flush_outbox`), `.webhook` (`process_pending`/`default_handlers`/http
|
|
30
|
+
helpers/correlation ids) -- deeper wiring, no collisions, just kept off the root to keep it a
|
|
31
|
+
short list. Pull them from their submodule.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
from __future__ import annotations
|
|
35
|
+
|
|
36
|
+
from boilpayment_core import (
|
|
37
|
+
DEFAULT_POLICY,
|
|
38
|
+
ZERO_DECIMAL_CURRENCIES,
|
|
39
|
+
AnnualRefundMethod,
|
|
40
|
+
AppendResult,
|
|
41
|
+
Balance,
|
|
42
|
+
BankReset,
|
|
43
|
+
BaseLogger,
|
|
44
|
+
CancelCredits,
|
|
45
|
+
CancelMode,
|
|
46
|
+
CashReceiptMode,
|
|
47
|
+
CashReceiptRef,
|
|
48
|
+
CashReceiptType,
|
|
49
|
+
Checkout,
|
|
50
|
+
ClawbackShortfall,
|
|
51
|
+
Clock,
|
|
52
|
+
CollectingLogger,
|
|
53
|
+
CollectingNotifier,
|
|
54
|
+
ConsoleLogger,
|
|
55
|
+
ConsumeInput,
|
|
56
|
+
ConsumeOrder,
|
|
57
|
+
ConsumeResult,
|
|
58
|
+
CreateCheckoutInput,
|
|
59
|
+
CsCase,
|
|
60
|
+
CsCaseKind,
|
|
61
|
+
CsCaseStatus,
|
|
62
|
+
Customer,
|
|
63
|
+
CustomerStatus,
|
|
64
|
+
Deps,
|
|
65
|
+
DisputeOnLost,
|
|
66
|
+
DisputeOnOpen,
|
|
67
|
+
DowngradeMode,
|
|
68
|
+
ExpiringBucket,
|
|
69
|
+
FeeBearer,
|
|
70
|
+
FixedClock,
|
|
71
|
+
GrantDuringGrace,
|
|
72
|
+
GrantLagBehavior,
|
|
73
|
+
IdGen,
|
|
74
|
+
InMemoryLedger,
|
|
75
|
+
InMemoryRepo,
|
|
76
|
+
InsufficientBalanceError,
|
|
77
|
+
Interval,
|
|
78
|
+
IntervalChangeMode,
|
|
79
|
+
LedgerEntry,
|
|
80
|
+
LedgerKind,
|
|
81
|
+
LedgerReference,
|
|
82
|
+
LedgerSource,
|
|
83
|
+
LedgerStore,
|
|
84
|
+
Logger,
|
|
85
|
+
LogLevel,
|
|
86
|
+
MemTable,
|
|
87
|
+
Money,
|
|
88
|
+
MonthEndAnchor,
|
|
89
|
+
MultipleSubscriptions,
|
|
90
|
+
NegativeBalance,
|
|
91
|
+
NegativeOffset,
|
|
92
|
+
NewLedgerEntry,
|
|
93
|
+
NoopLogger,
|
|
94
|
+
NoopNotifier,
|
|
95
|
+
NormalizedEvent,
|
|
96
|
+
NormalizedEventType,
|
|
97
|
+
Notification,
|
|
98
|
+
Notifier,
|
|
99
|
+
NotifyType,
|
|
100
|
+
OnFinalFailure,
|
|
101
|
+
OnRecovery,
|
|
102
|
+
Operation,
|
|
103
|
+
OperationStatus,
|
|
104
|
+
OutboxItem,
|
|
105
|
+
Overage,
|
|
106
|
+
OveruseBehavior,
|
|
107
|
+
PauseMode,
|
|
108
|
+
Payment,
|
|
109
|
+
PaymentFailure,
|
|
110
|
+
PaymentKind,
|
|
111
|
+
PaymentKitError,
|
|
112
|
+
PaymentProvider,
|
|
113
|
+
PaymentStatus,
|
|
114
|
+
Period,
|
|
115
|
+
Plan,
|
|
116
|
+
PlanPrice,
|
|
117
|
+
Policy,
|
|
118
|
+
PolicyValidationError,
|
|
119
|
+
Pool,
|
|
120
|
+
PoolMode,
|
|
121
|
+
ProrationDenominator,
|
|
122
|
+
ProviderCapabilities,
|
|
123
|
+
ProviderError,
|
|
124
|
+
ProviderName,
|
|
125
|
+
ProviderRef,
|
|
126
|
+
Refund,
|
|
127
|
+
RefundDecision,
|
|
128
|
+
RefundMethod,
|
|
129
|
+
RefundRounding,
|
|
130
|
+
RefundStatus,
|
|
131
|
+
RegrantMode,
|
|
132
|
+
Repo,
|
|
133
|
+
RevokeShortfall,
|
|
134
|
+
Rollover,
|
|
135
|
+
RunIdempotentResult,
|
|
136
|
+
SequentialIdGen,
|
|
137
|
+
Subscription,
|
|
138
|
+
SubscriptionStatus,
|
|
139
|
+
SystemClock,
|
|
140
|
+
Table,
|
|
141
|
+
TrialAbuseGuard,
|
|
142
|
+
TrialCreditsOnCancel,
|
|
143
|
+
TrialCreditsOnConvert,
|
|
144
|
+
UpgradeCreditDelta,
|
|
145
|
+
UpgradeMode,
|
|
146
|
+
UsageDuringGrace,
|
|
147
|
+
UsageEvent,
|
|
148
|
+
UuidIdGen,
|
|
149
|
+
WebhookEventRecord,
|
|
150
|
+
WebhookEventStatus,
|
|
151
|
+
WebhookSignatureError,
|
|
152
|
+
add_money,
|
|
153
|
+
assert_same_currency,
|
|
154
|
+
civil_day_of,
|
|
155
|
+
days_in_month,
|
|
156
|
+
days_in_period,
|
|
157
|
+
deserialize_cs_case,
|
|
158
|
+
deserialize_ledger_entry,
|
|
159
|
+
deserialize_refund,
|
|
160
|
+
deserialize_subscription,
|
|
161
|
+
elapsed_ratio,
|
|
162
|
+
hash_payload,
|
|
163
|
+
money,
|
|
164
|
+
mul_money_ratio,
|
|
165
|
+
next_period,
|
|
166
|
+
period_containing,
|
|
167
|
+
proration_ratio,
|
|
168
|
+
redact,
|
|
169
|
+
resolve_policy,
|
|
170
|
+
serialize_cs_case,
|
|
171
|
+
serialize_ledger_entry,
|
|
172
|
+
serialize_refund,
|
|
173
|
+
serialize_subscription,
|
|
174
|
+
stable_stringify,
|
|
175
|
+
validate_policy,
|
|
176
|
+
)
|
|
177
|
+
from boilpayment_credits import consume, topup
|
|
178
|
+
from boilpayment_lifecycle import cancel, downgrade, reactivate, upgrade
|
|
179
|
+
from boilpayment_refund import evaluate, execute, on_external_refund
|
|
180
|
+
from boilpayment_usage import check, record
|
|
181
|
+
from boilpayment_webhook import default_handlers, process, receive
|
|
182
|
+
|
|
183
|
+
__all__ = [
|
|
184
|
+
"DEFAULT_POLICY",
|
|
185
|
+
"ZERO_DECIMAL_CURRENCIES",
|
|
186
|
+
"AnnualRefundMethod",
|
|
187
|
+
"AppendResult",
|
|
188
|
+
"Balance",
|
|
189
|
+
"BankReset",
|
|
190
|
+
"BaseLogger",
|
|
191
|
+
"CancelCredits",
|
|
192
|
+
"CancelMode",
|
|
193
|
+
"CashReceiptMode",
|
|
194
|
+
"CashReceiptRef",
|
|
195
|
+
"CashReceiptType",
|
|
196
|
+
"Checkout",
|
|
197
|
+
"ClawbackShortfall",
|
|
198
|
+
"Clock",
|
|
199
|
+
"CollectingLogger",
|
|
200
|
+
"CollectingNotifier",
|
|
201
|
+
"ConsoleLogger",
|
|
202
|
+
"ConsumeInput",
|
|
203
|
+
"ConsumeOrder",
|
|
204
|
+
"ConsumeResult",
|
|
205
|
+
"CreateCheckoutInput",
|
|
206
|
+
"CsCase",
|
|
207
|
+
"CsCaseKind",
|
|
208
|
+
"CsCaseStatus",
|
|
209
|
+
"Customer",
|
|
210
|
+
"CustomerStatus",
|
|
211
|
+
"Deps",
|
|
212
|
+
"DisputeOnLost",
|
|
213
|
+
"DisputeOnOpen",
|
|
214
|
+
"DowngradeMode",
|
|
215
|
+
"ExpiringBucket",
|
|
216
|
+
"FeeBearer",
|
|
217
|
+
"FixedClock",
|
|
218
|
+
"GrantDuringGrace",
|
|
219
|
+
"GrantLagBehavior",
|
|
220
|
+
"IdGen",
|
|
221
|
+
"InMemoryLedger",
|
|
222
|
+
"InMemoryRepo",
|
|
223
|
+
"InsufficientBalanceError",
|
|
224
|
+
"Interval",
|
|
225
|
+
"IntervalChangeMode",
|
|
226
|
+
"LedgerEntry",
|
|
227
|
+
"LedgerKind",
|
|
228
|
+
"LedgerReference",
|
|
229
|
+
"LedgerSource",
|
|
230
|
+
"LedgerStore",
|
|
231
|
+
"LogLevel",
|
|
232
|
+
"Logger",
|
|
233
|
+
"MemTable",
|
|
234
|
+
"Money",
|
|
235
|
+
"MonthEndAnchor",
|
|
236
|
+
"MultipleSubscriptions",
|
|
237
|
+
"NegativeBalance",
|
|
238
|
+
"NegativeOffset",
|
|
239
|
+
"NewLedgerEntry",
|
|
240
|
+
"NoopLogger",
|
|
241
|
+
"NoopNotifier",
|
|
242
|
+
"NormalizedEvent",
|
|
243
|
+
"NormalizedEventType",
|
|
244
|
+
"Notification",
|
|
245
|
+
"Notifier",
|
|
246
|
+
"NotifyType",
|
|
247
|
+
"OnFinalFailure",
|
|
248
|
+
"OnRecovery",
|
|
249
|
+
"Operation",
|
|
250
|
+
"OperationStatus",
|
|
251
|
+
"OutboxItem",
|
|
252
|
+
"Overage",
|
|
253
|
+
"OveruseBehavior",
|
|
254
|
+
"PauseMode",
|
|
255
|
+
"Payment",
|
|
256
|
+
"PaymentFailure",
|
|
257
|
+
"PaymentKind",
|
|
258
|
+
"PaymentKitError",
|
|
259
|
+
"PaymentProvider",
|
|
260
|
+
"PaymentStatus",
|
|
261
|
+
"Period",
|
|
262
|
+
"Plan",
|
|
263
|
+
"PlanPrice",
|
|
264
|
+
"Policy",
|
|
265
|
+
"PolicyValidationError",
|
|
266
|
+
"Pool",
|
|
267
|
+
"PoolMode",
|
|
268
|
+
"ProrationDenominator",
|
|
269
|
+
"ProviderCapabilities",
|
|
270
|
+
"ProviderError",
|
|
271
|
+
"ProviderName",
|
|
272
|
+
"ProviderRef",
|
|
273
|
+
"Refund",
|
|
274
|
+
"RefundDecision",
|
|
275
|
+
"RefundMethod",
|
|
276
|
+
"RefundRounding",
|
|
277
|
+
"RefundStatus",
|
|
278
|
+
"RegrantMode",
|
|
279
|
+
"Repo",
|
|
280
|
+
"RevokeShortfall",
|
|
281
|
+
"Rollover",
|
|
282
|
+
"RunIdempotentResult",
|
|
283
|
+
"SequentialIdGen",
|
|
284
|
+
"Subscription",
|
|
285
|
+
"SubscriptionStatus",
|
|
286
|
+
"SystemClock",
|
|
287
|
+
"Table",
|
|
288
|
+
"TrialAbuseGuard",
|
|
289
|
+
"TrialCreditsOnCancel",
|
|
290
|
+
"TrialCreditsOnConvert",
|
|
291
|
+
"UpgradeCreditDelta",
|
|
292
|
+
"UpgradeMode",
|
|
293
|
+
"UsageDuringGrace",
|
|
294
|
+
"UsageEvent",
|
|
295
|
+
"UuidIdGen",
|
|
296
|
+
"WebhookEventRecord",
|
|
297
|
+
"WebhookEventStatus",
|
|
298
|
+
"WebhookSignatureError",
|
|
299
|
+
"add_money",
|
|
300
|
+
"assert_same_currency",
|
|
301
|
+
"cancel",
|
|
302
|
+
"check",
|
|
303
|
+
"civil_day_of",
|
|
304
|
+
"consume",
|
|
305
|
+
"days_in_month",
|
|
306
|
+
"days_in_period",
|
|
307
|
+
"default_handlers",
|
|
308
|
+
"deserialize_cs_case",
|
|
309
|
+
"deserialize_ledger_entry",
|
|
310
|
+
"deserialize_refund",
|
|
311
|
+
"deserialize_subscription",
|
|
312
|
+
"downgrade",
|
|
313
|
+
"elapsed_ratio",
|
|
314
|
+
"evaluate",
|
|
315
|
+
"execute",
|
|
316
|
+
"hash_payload",
|
|
317
|
+
"money",
|
|
318
|
+
"mul_money_ratio",
|
|
319
|
+
"next_period",
|
|
320
|
+
"on_external_refund",
|
|
321
|
+
"period_containing",
|
|
322
|
+
"process",
|
|
323
|
+
"proration_ratio",
|
|
324
|
+
"reactivate",
|
|
325
|
+
"receive",
|
|
326
|
+
"record",
|
|
327
|
+
"redact",
|
|
328
|
+
"resolve_policy",
|
|
329
|
+
"serialize_cs_case",
|
|
330
|
+
"serialize_ledger_entry",
|
|
331
|
+
"serialize_refund",
|
|
332
|
+
"serialize_subscription",
|
|
333
|
+
"stable_stringify",
|
|
334
|
+
"topup",
|
|
335
|
+
"upgrade",
|
|
336
|
+
"validate_policy",
|
|
337
|
+
]
|
boilpayment/core.py
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
"""Thin re-export -- see ../README.md. Full surface of boilpayment_core (types, Policy, Clock/IdGen, period/money
|
|
2
|
+
helpers, idempotency helpers, in-memory reference implementations, logging). This is also
|
|
3
|
+
re-exported in full from the package root (boilpayment).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from boilpayment_core import (
|
|
9
|
+
DEFAULT_POLICY,
|
|
10
|
+
AppendResult,
|
|
11
|
+
Balance,
|
|
12
|
+
BaseLogger,
|
|
13
|
+
CancelPolicy,
|
|
14
|
+
CashReceiptPolicy,
|
|
15
|
+
CashReceiptRef,
|
|
16
|
+
Checkout,
|
|
17
|
+
Clock,
|
|
18
|
+
CollectingLogger,
|
|
19
|
+
CollectingNotifier,
|
|
20
|
+
ConsoleLogger,
|
|
21
|
+
ConsumeInput,
|
|
22
|
+
ConsumeResult,
|
|
23
|
+
CreateCheckoutInput,
|
|
24
|
+
CreditConversion,
|
|
25
|
+
CreditExpiryDays,
|
|
26
|
+
CreditsPolicy,
|
|
27
|
+
CsAutoApprovePolicy,
|
|
28
|
+
CsCase,
|
|
29
|
+
CsFraudPolicy,
|
|
30
|
+
CsPolicy,
|
|
31
|
+
CsRegrantPolicy,
|
|
32
|
+
Customer,
|
|
33
|
+
Deps,
|
|
34
|
+
DisputePolicy,
|
|
35
|
+
DowngradePolicy,
|
|
36
|
+
DunningPolicy,
|
|
37
|
+
ExpiringBucket,
|
|
38
|
+
FixedClock,
|
|
39
|
+
IapSettings,
|
|
40
|
+
IdGen,
|
|
41
|
+
InMemoryLedger,
|
|
42
|
+
InMemoryRepo,
|
|
43
|
+
InsufficientBalanceError,
|
|
44
|
+
IntervalChangePolicy,
|
|
45
|
+
LedgerEntry,
|
|
46
|
+
LedgerReference,
|
|
47
|
+
LedgerStore,
|
|
48
|
+
Logger,
|
|
49
|
+
MemTable,
|
|
50
|
+
Money,
|
|
51
|
+
NewLedgerEntry,
|
|
52
|
+
NoopLogger,
|
|
53
|
+
NoopNotifier,
|
|
54
|
+
NormalizedEvent,
|
|
55
|
+
Notification,
|
|
56
|
+
Notifier,
|
|
57
|
+
Operation,
|
|
58
|
+
OperationTable,
|
|
59
|
+
OutboxItem,
|
|
60
|
+
PausePolicy,
|
|
61
|
+
Payment,
|
|
62
|
+
PaymentFailure,
|
|
63
|
+
PaymentKitError,
|
|
64
|
+
PaymentProvider,
|
|
65
|
+
Period,
|
|
66
|
+
PeriodPolicy,
|
|
67
|
+
Plan,
|
|
68
|
+
PlanPrice,
|
|
69
|
+
Policy,
|
|
70
|
+
PolicyValidationError,
|
|
71
|
+
ProrationPolicy,
|
|
72
|
+
ProviderCapabilities,
|
|
73
|
+
ProviderError,
|
|
74
|
+
ProviderRef,
|
|
75
|
+
Refund,
|
|
76
|
+
RefundDecision,
|
|
77
|
+
RefundLookupProvider,
|
|
78
|
+
RefundPolicy,
|
|
79
|
+
RefundReasons,
|
|
80
|
+
Repo,
|
|
81
|
+
RetentionPolicy,
|
|
82
|
+
RunIdempotentResult,
|
|
83
|
+
SequentialIdGen,
|
|
84
|
+
StoreProof,
|
|
85
|
+
StorePurchaseProvider,
|
|
86
|
+
Subscription,
|
|
87
|
+
SubscriptionPolicy,
|
|
88
|
+
SystemClock,
|
|
89
|
+
T,
|
|
90
|
+
Table,
|
|
91
|
+
TrialPolicy,
|
|
92
|
+
UpgradePolicy,
|
|
93
|
+
UsageEvent,
|
|
94
|
+
UsagePolicy,
|
|
95
|
+
UuidIdGen,
|
|
96
|
+
VerifiedStorePurchase,
|
|
97
|
+
WebhookEventRecord,
|
|
98
|
+
WebhookSignatureError,
|
|
99
|
+
add_money,
|
|
100
|
+
assert_same_currency,
|
|
101
|
+
attempt_review,
|
|
102
|
+
civil_day_of,
|
|
103
|
+
clock,
|
|
104
|
+
currency_exponent,
|
|
105
|
+
days_in_month,
|
|
106
|
+
days_in_period,
|
|
107
|
+
deserialize_cs_case,
|
|
108
|
+
deserialize_ledger_entry,
|
|
109
|
+
deserialize_refund,
|
|
110
|
+
deserialize_subscription,
|
|
111
|
+
elapsed_ratio,
|
|
112
|
+
expected_attempt_amount,
|
|
113
|
+
find_local_payment,
|
|
114
|
+
hash_payload,
|
|
115
|
+
hold_attempt_for_review,
|
|
116
|
+
iap_settings_from_dict,
|
|
117
|
+
idempotent,
|
|
118
|
+
is_closed_by_person,
|
|
119
|
+
is_legacy_attempt_row,
|
|
120
|
+
is_store_purchase_provider,
|
|
121
|
+
is_under_review,
|
|
122
|
+
iso_z,
|
|
123
|
+
key_matches_instant,
|
|
124
|
+
keys,
|
|
125
|
+
ledger_instant_key,
|
|
126
|
+
logger,
|
|
127
|
+
lookup_mismatch,
|
|
128
|
+
memory,
|
|
129
|
+
minor_units_from_decimal,
|
|
130
|
+
minor_units_from_milliunits,
|
|
131
|
+
money,
|
|
132
|
+
mul_money_ratio,
|
|
133
|
+
next_period,
|
|
134
|
+
operation_instant_key,
|
|
135
|
+
payment_refs,
|
|
136
|
+
period,
|
|
137
|
+
period_containing,
|
|
138
|
+
policy,
|
|
139
|
+
policy_from_dict,
|
|
140
|
+
policy_to_dict,
|
|
141
|
+
proration_fraction,
|
|
142
|
+
proration_ratio,
|
|
143
|
+
record_payment_ref_aliases,
|
|
144
|
+
redact,
|
|
145
|
+
resolve_policy,
|
|
146
|
+
round_half_away_from_zero,
|
|
147
|
+
run_idempotent,
|
|
148
|
+
scale_minor,
|
|
149
|
+
serialize_cs_case,
|
|
150
|
+
serialize_ledger_entry,
|
|
151
|
+
serialize_refund,
|
|
152
|
+
serialize_subscription,
|
|
153
|
+
stable_stringify,
|
|
154
|
+
store,
|
|
155
|
+
store_account_token,
|
|
156
|
+
types,
|
|
157
|
+
validate_policy,
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
__all__ = [
|
|
161
|
+
"DEFAULT_POLICY",
|
|
162
|
+
"AppendResult",
|
|
163
|
+
"Balance",
|
|
164
|
+
"BaseLogger",
|
|
165
|
+
"CancelPolicy",
|
|
166
|
+
"CashReceiptPolicy",
|
|
167
|
+
"CashReceiptRef",
|
|
168
|
+
"Checkout",
|
|
169
|
+
"Clock",
|
|
170
|
+
"CollectingLogger",
|
|
171
|
+
"CollectingNotifier",
|
|
172
|
+
"ConsoleLogger",
|
|
173
|
+
"ConsumeInput",
|
|
174
|
+
"ConsumeResult",
|
|
175
|
+
"CreateCheckoutInput",
|
|
176
|
+
"CreditConversion",
|
|
177
|
+
"CreditExpiryDays",
|
|
178
|
+
"CreditsPolicy",
|
|
179
|
+
"CsAutoApprovePolicy",
|
|
180
|
+
"CsCase",
|
|
181
|
+
"CsFraudPolicy",
|
|
182
|
+
"CsPolicy",
|
|
183
|
+
"CsRegrantPolicy",
|
|
184
|
+
"Customer",
|
|
185
|
+
"Deps",
|
|
186
|
+
"DisputePolicy",
|
|
187
|
+
"DowngradePolicy",
|
|
188
|
+
"DunningPolicy",
|
|
189
|
+
"ExpiringBucket",
|
|
190
|
+
"FixedClock",
|
|
191
|
+
"IapSettings",
|
|
192
|
+
"IdGen",
|
|
193
|
+
"InMemoryLedger",
|
|
194
|
+
"InMemoryRepo",
|
|
195
|
+
"InsufficientBalanceError",
|
|
196
|
+
"IntervalChangePolicy",
|
|
197
|
+
"LedgerEntry",
|
|
198
|
+
"LedgerReference",
|
|
199
|
+
"LedgerStore",
|
|
200
|
+
"Logger",
|
|
201
|
+
"MemTable",
|
|
202
|
+
"Money",
|
|
203
|
+
"NewLedgerEntry",
|
|
204
|
+
"NoopLogger",
|
|
205
|
+
"NoopNotifier",
|
|
206
|
+
"NormalizedEvent",
|
|
207
|
+
"Notification",
|
|
208
|
+
"Notifier",
|
|
209
|
+
"Operation",
|
|
210
|
+
"OperationTable",
|
|
211
|
+
"OutboxItem",
|
|
212
|
+
"PausePolicy",
|
|
213
|
+
"Payment",
|
|
214
|
+
"PaymentFailure",
|
|
215
|
+
"PaymentKitError",
|
|
216
|
+
"PaymentProvider",
|
|
217
|
+
"Period",
|
|
218
|
+
"PeriodPolicy",
|
|
219
|
+
"Plan",
|
|
220
|
+
"PlanPrice",
|
|
221
|
+
"Policy",
|
|
222
|
+
"PolicyValidationError",
|
|
223
|
+
"ProrationPolicy",
|
|
224
|
+
"ProviderCapabilities",
|
|
225
|
+
"ProviderError",
|
|
226
|
+
"ProviderRef",
|
|
227
|
+
"Refund",
|
|
228
|
+
"RefundDecision",
|
|
229
|
+
"RefundLookupProvider",
|
|
230
|
+
"RefundPolicy",
|
|
231
|
+
"RefundReasons",
|
|
232
|
+
"Repo",
|
|
233
|
+
"RetentionPolicy",
|
|
234
|
+
"RunIdempotentResult",
|
|
235
|
+
"SequentialIdGen",
|
|
236
|
+
"StoreProof",
|
|
237
|
+
"StorePurchaseProvider",
|
|
238
|
+
"Subscription",
|
|
239
|
+
"SubscriptionPolicy",
|
|
240
|
+
"SystemClock",
|
|
241
|
+
"T",
|
|
242
|
+
"Table",
|
|
243
|
+
"TrialPolicy",
|
|
244
|
+
"UpgradePolicy",
|
|
245
|
+
"UsageEvent",
|
|
246
|
+
"UsagePolicy",
|
|
247
|
+
"UuidIdGen",
|
|
248
|
+
"VerifiedStorePurchase",
|
|
249
|
+
"WebhookEventRecord",
|
|
250
|
+
"WebhookSignatureError",
|
|
251
|
+
"add_money",
|
|
252
|
+
"assert_same_currency",
|
|
253
|
+
"attempt_review",
|
|
254
|
+
"civil_day_of",
|
|
255
|
+
"clock",
|
|
256
|
+
"currency_exponent",
|
|
257
|
+
"days_in_month",
|
|
258
|
+
"days_in_period",
|
|
259
|
+
"deserialize_cs_case",
|
|
260
|
+
"deserialize_ledger_entry",
|
|
261
|
+
"deserialize_refund",
|
|
262
|
+
"deserialize_subscription",
|
|
263
|
+
"elapsed_ratio",
|
|
264
|
+
"expected_attempt_amount",
|
|
265
|
+
"find_local_payment",
|
|
266
|
+
"hash_payload",
|
|
267
|
+
"hold_attempt_for_review",
|
|
268
|
+
"iap_settings_from_dict",
|
|
269
|
+
"idempotent",
|
|
270
|
+
"is_closed_by_person",
|
|
271
|
+
"is_legacy_attempt_row",
|
|
272
|
+
"is_store_purchase_provider",
|
|
273
|
+
"is_under_review",
|
|
274
|
+
"iso_z",
|
|
275
|
+
"key_matches_instant",
|
|
276
|
+
"keys",
|
|
277
|
+
"ledger_instant_key",
|
|
278
|
+
"logger",
|
|
279
|
+
"lookup_mismatch",
|
|
280
|
+
"memory",
|
|
281
|
+
"minor_units_from_decimal",
|
|
282
|
+
"minor_units_from_milliunits",
|
|
283
|
+
"money",
|
|
284
|
+
"mul_money_ratio",
|
|
285
|
+
"next_period",
|
|
286
|
+
"operation_instant_key",
|
|
287
|
+
"payment_refs",
|
|
288
|
+
"period",
|
|
289
|
+
"period_containing",
|
|
290
|
+
"policy",
|
|
291
|
+
"policy_from_dict",
|
|
292
|
+
"policy_to_dict",
|
|
293
|
+
"proration_fraction",
|
|
294
|
+
"proration_ratio",
|
|
295
|
+
"record_payment_ref_aliases",
|
|
296
|
+
"redact",
|
|
297
|
+
"resolve_policy",
|
|
298
|
+
"round_half_away_from_zero",
|
|
299
|
+
"run_idempotent",
|
|
300
|
+
"scale_minor",
|
|
301
|
+
"serialize_cs_case",
|
|
302
|
+
"serialize_ledger_entry",
|
|
303
|
+
"serialize_refund",
|
|
304
|
+
"serialize_subscription",
|
|
305
|
+
"stable_stringify",
|
|
306
|
+
"store",
|
|
307
|
+
"store_account_token",
|
|
308
|
+
"types",
|
|
309
|
+
"validate_policy",
|
|
310
|
+
]
|
boilpayment/credits.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""Thin re-export -- see ../README.md. Full surface of boilpayment_credits (grant, consume, rollover, clawback,
|
|
2
|
+
expire, notify_expiring).
|
|
3
|
+
"""
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
from boilpayment_credits import (
|
|
7
|
+
ClawbackInput,
|
|
8
|
+
ClawbackResult,
|
|
9
|
+
ConsumeCreditsInput,
|
|
10
|
+
ExpireDueInput,
|
|
11
|
+
ExpireDueResult,
|
|
12
|
+
ExpiringNotice,
|
|
13
|
+
GrantForPeriodInput,
|
|
14
|
+
GrantPoolInput,
|
|
15
|
+
GrantResult,
|
|
16
|
+
ManualAdjustInput,
|
|
17
|
+
NotifyExpiringInput,
|
|
18
|
+
NotifyExpiringResult,
|
|
19
|
+
RolloverInput,
|
|
20
|
+
RolloverResult,
|
|
21
|
+
TopupInput,
|
|
22
|
+
clawback,
|
|
23
|
+
consume,
|
|
24
|
+
default_expiry,
|
|
25
|
+
expire,
|
|
26
|
+
expire_due,
|
|
27
|
+
grant,
|
|
28
|
+
grant_for_period,
|
|
29
|
+
grant_promo,
|
|
30
|
+
grant_trial,
|
|
31
|
+
manual_grant,
|
|
32
|
+
manual_revoke,
|
|
33
|
+
notify_expiring,
|
|
34
|
+
rollover,
|
|
35
|
+
rollover_on_renewal,
|
|
36
|
+
topup,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
__all__ = [
|
|
40
|
+
"ClawbackInput",
|
|
41
|
+
"ClawbackResult",
|
|
42
|
+
"ConsumeCreditsInput",
|
|
43
|
+
"ExpireDueInput",
|
|
44
|
+
"ExpireDueResult",
|
|
45
|
+
"ExpiringNotice",
|
|
46
|
+
"GrantForPeriodInput",
|
|
47
|
+
"GrantPoolInput",
|
|
48
|
+
"GrantResult",
|
|
49
|
+
"ManualAdjustInput",
|
|
50
|
+
"NotifyExpiringInput",
|
|
51
|
+
"NotifyExpiringResult",
|
|
52
|
+
"RolloverInput",
|
|
53
|
+
"RolloverResult",
|
|
54
|
+
"TopupInput",
|
|
55
|
+
"clawback",
|
|
56
|
+
"consume",
|
|
57
|
+
"default_expiry",
|
|
58
|
+
"expire",
|
|
59
|
+
"expire_due",
|
|
60
|
+
"grant",
|
|
61
|
+
"grant_for_period",
|
|
62
|
+
"grant_promo",
|
|
63
|
+
"grant_trial",
|
|
64
|
+
"manual_grant",
|
|
65
|
+
"manual_revoke",
|
|
66
|
+
"notify_expiring",
|
|
67
|
+
"rollover",
|
|
68
|
+
"rollover_on_renewal",
|
|
69
|
+
"topup",
|
|
70
|
+
]
|