@codespar/sdk 0.16.4 → 0.16.5

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.
@@ -15642,6 +15642,389 @@ export interface paths {
15642
15642
  patch?: never;
15643
15643
  trace?: never;
15644
15644
  };
15645
+ "/v1/test/charges/{chargeId}/pay": {
15646
+ parameters: {
15647
+ query?: never;
15648
+ header?: never;
15649
+ path?: never;
15650
+ cookie?: never;
15651
+ };
15652
+ get?: never;
15653
+ put?: never;
15654
+ /**
15655
+ * Pay a charge in the sandbox
15656
+ * @description Plays the DEBTOR of a test charge: settles it through the SAME path a Celcoin `charge-in` webhook takes (translate, publish `commerce.charge.paid`, reconcile, ledger `fund()` with the `pending -> settled` claim). It is not a status write, so the event fans out to your triggers exactly as a real payment would, and the ledger and receipt side effects are the ones production produces.
15657
+ *
15658
+ * **Test-mode only, fail-closed.** A live-environment key or project answers 403 `sandbox_pay_not_permitted` before the body is read or any query runs.
15659
+ *
15660
+ * **Nothing claims money moved.** The event payload, the ledger entry and the charge row all carry `simulated: true` and `settled_against: "sandbox_fixture"`; a real `charge-in` never carries either.
15661
+ *
15662
+ * **Idempotent.** The provider event id is the one the real delivery would carry, so a second pay dedupes at the event (no second trigger fire), the ledger dedupes on the charge, and a charge already `settled` answers its recorded state with `idempotent_replay: true` whatever amount the second call names.
15663
+ *
15664
+ * `chargeId` is the id `create` returned, or your own idempotency key, resolved under the caller's org and project: another tenant's charge is `charge_not_found`, never `forbidden`.
15665
+ */
15666
+ post: {
15667
+ parameters: {
15668
+ query?: never;
15669
+ header?: never;
15670
+ path: {
15671
+ chargeId: string;
15672
+ };
15673
+ cookie?: never;
15674
+ };
15675
+ requestBody?: {
15676
+ content: {
15677
+ "application/json": {
15678
+ /** @description Overrides the quoted amount, in minor units, to simulate a partial or divergent payment. The funding bridge credits what arrived and closes the charge, exactly as it does for a real `charge-in` that disagrees with the quote. Omitted: the quoted amount is paid in full. */
15679
+ amount_minor?: number;
15680
+ };
15681
+ };
15682
+ };
15683
+ responses: {
15684
+ /** @description OK */
15685
+ 200: {
15686
+ headers: {
15687
+ [name: string]: unknown;
15688
+ };
15689
+ content: {
15690
+ "application/json": {
15691
+ charge_id: string;
15692
+ /** @enum {string} */
15693
+ status: "paid";
15694
+ /** @description What CodeSpar recorded: `settled`. */
15695
+ local_status: string;
15696
+ currency: string;
15697
+ quoted_minor: number;
15698
+ /** @description What the ledger credited. */
15699
+ paid_minor: number;
15700
+ /** @enum {string} */
15701
+ payment: "full" | "partial" | "over";
15702
+ /** @description The leg the simulated debtor used. Always `Pix` today. */
15703
+ paid_via: string;
15704
+ wallet_id: string;
15705
+ /** @description The `fund` entry keyed `bolepix:<charge_id>`. Null only for a charge the other credit path settled. */
15706
+ ledger_entry_id: string | null;
15707
+ /** @description The one `commerce.charge.paid` this charge has. A second pay never mints another. */
15708
+ event: {
15709
+ id: string;
15710
+ /** @enum {string} */
15711
+ type: "commerce.charge.paid";
15712
+ } | null;
15713
+ /** @description True when a sandbox fixture settled it. Read off the records, never off the request. */
15714
+ simulated: boolean;
15715
+ /** @enum {string|null} */
15716
+ settled_against: "sandbox_fixture" | null;
15717
+ /**
15718
+ * @description Nothing moved anywhere, including at the provider's sandbox.
15719
+ * @enum {boolean}
15720
+ */
15721
+ money_moved: false;
15722
+ /** @description True when the charge was already settled and this call answered from the record. */
15723
+ idempotent_replay: boolean;
15724
+ };
15725
+ };
15726
+ };
15727
+ /** @description The body is outside the schema, or the credential names no project. */
15728
+ 400: {
15729
+ headers: {
15730
+ [name: string]: unknown;
15731
+ };
15732
+ content: {
15733
+ "application/json": {
15734
+ error: {
15735
+ /** @enum {string} */
15736
+ code: "invalid_body" | "project_scope_missing";
15737
+ message: string;
15738
+ details?: {
15739
+ [key: string]: unknown;
15740
+ };
15741
+ };
15742
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
15743
+ request_id: string | null;
15744
+ };
15745
+ };
15746
+ };
15747
+ /** @description Not a test-environment key/project. Terminal for that credential. */
15748
+ 403: {
15749
+ headers: {
15750
+ [name: string]: unknown;
15751
+ };
15752
+ content: {
15753
+ "application/json": {
15754
+ error: {
15755
+ /** @enum {string} */
15756
+ code: "sandbox_pay_not_permitted";
15757
+ message: string;
15758
+ details?: {
15759
+ [key: string]: unknown;
15760
+ };
15761
+ };
15762
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
15763
+ request_id: string | null;
15764
+ };
15765
+ };
15766
+ };
15767
+ /** @description No charge under that id for this tenant. */
15768
+ 404: {
15769
+ headers: {
15770
+ [name: string]: unknown;
15771
+ };
15772
+ content: {
15773
+ "application/json": {
15774
+ error: {
15775
+ /** @enum {string} */
15776
+ code: "charge_not_found";
15777
+ message: string;
15778
+ details?: {
15779
+ [key: string]: unknown;
15780
+ };
15781
+ };
15782
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
15783
+ request_id: string | null;
15784
+ };
15785
+ };
15786
+ };
15787
+ /** @description The charge exists and cannot be paid: `issuance_unconfirmed` is a reservation whose create never got an answer; `charge_not_payable` is a charge already closed (expired or cancelled). */
15788
+ 409: {
15789
+ headers: {
15790
+ [name: string]: unknown;
15791
+ };
15792
+ content: {
15793
+ "application/json": {
15794
+ error: {
15795
+ /** @enum {string} */
15796
+ code: "issuance_unconfirmed" | "charge_not_payable";
15797
+ message: string;
15798
+ details?: {
15799
+ [key: string]: unknown;
15800
+ };
15801
+ };
15802
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
15803
+ request_id: string | null;
15804
+ };
15805
+ };
15806
+ };
15807
+ /** @description The payment event was published but the ledger credit did not land; the charge is still open. Retrying is safe — the event dedupes and the credit is keyed on the charge. */
15808
+ 502: {
15809
+ headers: {
15810
+ [name: string]: unknown;
15811
+ };
15812
+ content: {
15813
+ "application/json": {
15814
+ error: {
15815
+ /** @enum {string} */
15816
+ code: "sandbox_settlement_failed";
15817
+ message: string;
15818
+ details?: {
15819
+ [key: string]: unknown;
15820
+ };
15821
+ };
15822
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
15823
+ request_id: string | null;
15824
+ };
15825
+ };
15826
+ };
15827
+ };
15828
+ };
15829
+ delete?: never;
15830
+ options?: never;
15831
+ head?: never;
15832
+ patch?: never;
15833
+ trace?: never;
15834
+ };
15835
+ "/v1/charges/{chargeId}/sandbox/pay": {
15836
+ parameters: {
15837
+ query?: never;
15838
+ header?: never;
15839
+ path?: never;
15840
+ cookie?: never;
15841
+ };
15842
+ get?: never;
15843
+ put?: never;
15844
+ /**
15845
+ * Pay a charge in the sandbox (alias path)
15846
+ * @deprecated
15847
+ * @description Alias of `POST /v1/test/charges/{chargeId}/pay` (ent#979 contract: one handler, two paths, one scope). Same body, same answers.
15848
+ *
15849
+ * Plays the DEBTOR of a test charge: settles it through the SAME path a Celcoin `charge-in` webhook takes (translate, publish `commerce.charge.paid`, reconcile, ledger `fund()` with the `pending -> settled` claim). It is not a status write, so the event fans out to your triggers exactly as a real payment would, and the ledger and receipt side effects are the ones production produces.
15850
+ *
15851
+ * **Test-mode only, fail-closed.** A live-environment key or project answers 403 `sandbox_pay_not_permitted` before the body is read or any query runs.
15852
+ *
15853
+ * **Nothing claims money moved.** The event payload, the ledger entry and the charge row all carry `simulated: true` and `settled_against: "sandbox_fixture"`; a real `charge-in` never carries either.
15854
+ *
15855
+ * **Idempotent.** The provider event id is the one the real delivery would carry, so a second pay dedupes at the event (no second trigger fire), the ledger dedupes on the charge, and a charge already `settled` answers its recorded state with `idempotent_replay: true` whatever amount the second call names.
15856
+ *
15857
+ * `chargeId` is the id `create` returned, or your own idempotency key, resolved under the caller's org and project: another tenant's charge is `charge_not_found`, never `forbidden`.
15858
+ */
15859
+ post: {
15860
+ parameters: {
15861
+ query?: never;
15862
+ header?: never;
15863
+ path: {
15864
+ chargeId: string;
15865
+ };
15866
+ cookie?: never;
15867
+ };
15868
+ requestBody?: {
15869
+ content: {
15870
+ "application/json": {
15871
+ /** @description Overrides the quoted amount, in minor units, to simulate a partial or divergent payment. The funding bridge credits what arrived and closes the charge, exactly as it does for a real `charge-in` that disagrees with the quote. Omitted: the quoted amount is paid in full. */
15872
+ amount_minor?: number;
15873
+ };
15874
+ };
15875
+ };
15876
+ responses: {
15877
+ /** @description OK */
15878
+ 200: {
15879
+ headers: {
15880
+ [name: string]: unknown;
15881
+ };
15882
+ content: {
15883
+ "application/json": {
15884
+ charge_id: string;
15885
+ /** @enum {string} */
15886
+ status: "paid";
15887
+ /** @description What CodeSpar recorded: `settled`. */
15888
+ local_status: string;
15889
+ currency: string;
15890
+ quoted_minor: number;
15891
+ /** @description What the ledger credited. */
15892
+ paid_minor: number;
15893
+ /** @enum {string} */
15894
+ payment: "full" | "partial" | "over";
15895
+ /** @description The leg the simulated debtor used. Always `Pix` today. */
15896
+ paid_via: string;
15897
+ wallet_id: string;
15898
+ /** @description The `fund` entry keyed `bolepix:<charge_id>`. Null only for a charge the other credit path settled. */
15899
+ ledger_entry_id: string | null;
15900
+ /** @description The one `commerce.charge.paid` this charge has. A second pay never mints another. */
15901
+ event: {
15902
+ id: string;
15903
+ /** @enum {string} */
15904
+ type: "commerce.charge.paid";
15905
+ } | null;
15906
+ /** @description True when a sandbox fixture settled it. Read off the records, never off the request. */
15907
+ simulated: boolean;
15908
+ /** @enum {string|null} */
15909
+ settled_against: "sandbox_fixture" | null;
15910
+ /**
15911
+ * @description Nothing moved anywhere, including at the provider's sandbox.
15912
+ * @enum {boolean}
15913
+ */
15914
+ money_moved: false;
15915
+ /** @description True when the charge was already settled and this call answered from the record. */
15916
+ idempotent_replay: boolean;
15917
+ };
15918
+ };
15919
+ };
15920
+ /** @description The body is outside the schema, or the credential names no project. */
15921
+ 400: {
15922
+ headers: {
15923
+ [name: string]: unknown;
15924
+ };
15925
+ content: {
15926
+ "application/json": {
15927
+ error: {
15928
+ /** @enum {string} */
15929
+ code: "invalid_body" | "project_scope_missing";
15930
+ message: string;
15931
+ details?: {
15932
+ [key: string]: unknown;
15933
+ };
15934
+ };
15935
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
15936
+ request_id: string | null;
15937
+ };
15938
+ };
15939
+ };
15940
+ /** @description Not a test-environment key/project. Terminal for that credential. */
15941
+ 403: {
15942
+ headers: {
15943
+ [name: string]: unknown;
15944
+ };
15945
+ content: {
15946
+ "application/json": {
15947
+ error: {
15948
+ /** @enum {string} */
15949
+ code: "sandbox_pay_not_permitted";
15950
+ message: string;
15951
+ details?: {
15952
+ [key: string]: unknown;
15953
+ };
15954
+ };
15955
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
15956
+ request_id: string | null;
15957
+ };
15958
+ };
15959
+ };
15960
+ /** @description No charge under that id for this tenant. */
15961
+ 404: {
15962
+ headers: {
15963
+ [name: string]: unknown;
15964
+ };
15965
+ content: {
15966
+ "application/json": {
15967
+ error: {
15968
+ /** @enum {string} */
15969
+ code: "charge_not_found";
15970
+ message: string;
15971
+ details?: {
15972
+ [key: string]: unknown;
15973
+ };
15974
+ };
15975
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
15976
+ request_id: string | null;
15977
+ };
15978
+ };
15979
+ };
15980
+ /** @description The charge exists and cannot be paid: `issuance_unconfirmed` is a reservation whose create never got an answer; `charge_not_payable` is a charge already closed (expired or cancelled). */
15981
+ 409: {
15982
+ headers: {
15983
+ [name: string]: unknown;
15984
+ };
15985
+ content: {
15986
+ "application/json": {
15987
+ error: {
15988
+ /** @enum {string} */
15989
+ code: "issuance_unconfirmed" | "charge_not_payable";
15990
+ message: string;
15991
+ details?: {
15992
+ [key: string]: unknown;
15993
+ };
15994
+ };
15995
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
15996
+ request_id: string | null;
15997
+ };
15998
+ };
15999
+ };
16000
+ /** @description The payment event was published but the ledger credit did not land; the charge is still open. Retrying is safe — the event dedupes and the credit is keyed on the charge. */
16001
+ 502: {
16002
+ headers: {
16003
+ [name: string]: unknown;
16004
+ };
16005
+ content: {
16006
+ "application/json": {
16007
+ error: {
16008
+ /** @enum {string} */
16009
+ code: "sandbox_settlement_failed";
16010
+ message: string;
16011
+ details?: {
16012
+ [key: string]: unknown;
16013
+ };
16014
+ };
16015
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
16016
+ request_id: string | null;
16017
+ };
16018
+ };
16019
+ };
16020
+ };
16021
+ };
16022
+ delete?: never;
16023
+ options?: never;
16024
+ head?: never;
16025
+ patch?: never;
16026
+ trace?: never;
16027
+ };
15645
16028
  "/v1/consumers/consents": {
15646
16029
  parameters: {
15647
16030
  query?: never;