From 067751e2379dc0d41add66d3e8662d44d9546aae Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Tue, 14 Jul 2026 13:47:17 +0000 Subject: [PATCH 1/2] ## Java SDK Changes: * `gr4vy.transactions.refundSettlements.get()`: **Added** * `gr4vy.transactions.refundSettlements.list()`: **Added** --- .speakeasy/gen.lock | 202 +++- .speakeasy/gen.yaml | 2 +- .speakeasy/workflow.lock | 12 +- README.md | 9 +- RELEASES.md | 12 +- build.gradle | 2 +- docs/models/components/RefundSettlement.md | 27 + docs/models/components/RefundSettlements.md | 10 + .../GetTransactionRefundSettlementRequest.md | 10 + .../GetTransactionRefundSettlementResponse.md | 11 + ...ListTransactionRefundSettlementsRequest.md | 9 + ...istTransactionRefundSettlementsResponse.md | 11 + docs/sdks/refundsettlements/README.md | 138 +++ gradle.properties | 2 +- .../com/gr4vy/sdk/AsyncRefundSettlements.java | 150 +++ .../java/com/gr4vy/sdk/AsyncTransactions.java | 6 + .../java/com/gr4vy/sdk/RefundSettlements.java | 144 +++ .../java/com/gr4vy/sdk/SDKConfiguration.java | 4 +- src/main/java/com/gr4vy/sdk/Transactions.java | 6 + .../models/components/RefundSettlement.java | 887 ++++++++++++++++++ .../models/components/RefundSettlements.java | 106 +++ ...GetTransactionRefundSettlementRequest.java | 206 ++++ ...sactionRefundSettlementRequestBuilder.java | 88 ++ ...etTransactionRefundSettlementResponse.java | 253 +++++ ...stTransactionRefundSettlementsRequest.java | 165 ++++ ...actionRefundSettlementsRequestBuilder.java | 80 ++ ...tTransactionRefundSettlementsResponse.java | 253 +++++ ...sactionRefundSettlementRequestBuilder.java | 93 ++ ...etTransactionRefundSettlementResponse.java | 253 +++++ ...actionRefundSettlementsRequestBuilder.java | 85 ++ ...tTransactionRefundSettlementsResponse.java | 253 +++++ .../GetTransactionRefundSettlement.java | 493 ++++++++++ .../ListTransactionRefundSettlements.java | 493 ++++++++++ 33 files changed, 4440 insertions(+), 35 deletions(-) create mode 100644 docs/models/components/RefundSettlement.md create mode 100644 docs/models/components/RefundSettlements.md create mode 100644 docs/models/operations/GetTransactionRefundSettlementRequest.md create mode 100644 docs/models/operations/GetTransactionRefundSettlementResponse.md create mode 100644 docs/models/operations/ListTransactionRefundSettlementsRequest.md create mode 100644 docs/models/operations/ListTransactionRefundSettlementsResponse.md create mode 100644 docs/sdks/refundsettlements/README.md create mode 100644 src/main/java/com/gr4vy/sdk/AsyncRefundSettlements.java create mode 100644 src/main/java/com/gr4vy/sdk/RefundSettlements.java create mode 100644 src/main/java/com/gr4vy/sdk/models/components/RefundSettlement.java create mode 100644 src/main/java/com/gr4vy/sdk/models/components/RefundSettlements.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/GetTransactionRefundSettlementRequest.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/GetTransactionRefundSettlementRequestBuilder.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/GetTransactionRefundSettlementResponse.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/ListTransactionRefundSettlementsRequest.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/ListTransactionRefundSettlementsRequestBuilder.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/ListTransactionRefundSettlementsResponse.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/async/GetTransactionRefundSettlementRequestBuilder.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/async/GetTransactionRefundSettlementResponse.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/async/ListTransactionRefundSettlementsRequestBuilder.java create mode 100644 src/main/java/com/gr4vy/sdk/models/operations/async/ListTransactionRefundSettlementsResponse.java create mode 100644 src/main/java/com/gr4vy/sdk/operations/GetTransactionRefundSettlement.java create mode 100644 src/main/java/com/gr4vy/sdk/operations/ListTransactionRefundSettlements.java diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 4b5f1b6c..7f92a653 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,24 +1,24 @@ lockVersion: 2.0.0 id: 5bbaa3a9-baa0-471b-ba6a-13fd88e8c119 management: - docChecksum: 8b981b21a3057e996c4adeb0b908f15d + docChecksum: 9c343f80a790408d258e2821c036621f docVersion: 1.0.0 - speakeasyVersion: 1.790.0 - generationVersion: 2.917.0 - releaseVersion: 2.16.108 - configChecksum: c7033b0103414d0b5325d5bd364f509d + speakeasyVersion: 1.790.1 + generationVersion: 2.918.1 + releaseVersion: 2.16.109 + configChecksum: 312ae760c2120d2e193eee58e234874e repoURL: https://github.com/gr4vy/gr4vy-java.git installationURL: https://github.com/gr4vy/gr4vy-java published: true persistentEdits: - generation_id: 94217059-4913-4381-a7ee-ae54e7b496cb - pristine_commit_hash: 131c72da372719a11a0004b4b61d173924b71c9d - pristine_tree_hash: c29adaf2a24bb797d49996afeac0efb254aa0641 + generation_id: 1484f777-bb1e-4888-8c01-9055ad5efb56 + pristine_commit_hash: 7e8a079f58c7f0f1ef526dc04632cc8768578de8 + pristine_tree_hash: 7731583fe047dd714d7070528050d16f7a04c50f features: java: additionalDependencies: 0.1.0 constsAndDefaults: 0.1.3 - core: 3.55.30 + core: 3.55.31 flattening: 2.81.1 globalSecurity: 2.83.4 globalSecurityCallbacks: 0.1.0 @@ -28,7 +28,7 @@ features: groups: 2.81.3 ignores: 2.81.1 nameOverrides: 2.81.5 - nullables: 0.1.0 + nullables: 0.1.1 openEnums: 0.2.0 pagination: 1.0.4 retries: 0.1.3 @@ -46,8 +46,8 @@ trackedFiles: pristine_git_object: 2dd1492d7b4e43639a052483c2652afa851289eb build.gradle: id: f07866736216 - last_write_checksum: sha1:d7661627f53384cdcacc0fb18deac0eca85d4821 - pristine_git_object: b738c3b5758edbb7747a26bb5ff70a52a37d9c4f + last_write_checksum: sha1:b03603a0fa3a89f3ed97bf52de9b14b300b27ed6 + pristine_git_object: 7352f66499ad3189cea422bd903ccafb2ce79993 docs/models/components/ACHBankPaymentMethodCreate.md: id: e852a32f84bc last_write_checksum: sha1:474c254440ecb3b629970e28fa28b8ff8ab1ba8b @@ -1176,6 +1176,14 @@ trackedFiles: id: a2190313768a last_write_checksum: sha1:21f9368f68fb81aec4af2cdf0fa40370a7be635a pristine_git_object: 8f771a61af505597440c4fdaf7d97b9c6ba8314b + docs/models/components/RefundSettlement.md: + id: f83507cee507 + last_write_checksum: sha1:fbfc938b24ccfa27d971a2ef9d8b1ed472cf3ac7 + pristine_git_object: 1097e2cebe493ce808c8c328e4d4874c2f41384d + docs/models/components/RefundSettlements.md: + id: 8dae10d19dd2 + last_write_checksum: sha1:1091df0eda8f824fb734392fcfbe7e476b978949 + pristine_git_object: de37ae5b99e7093021e55e2f7c501af2c4023137 docs/models/components/RefundStatus.md: id: 77cdfb79bfbb last_write_checksum: sha1:28de1b3565f3be33fad8e64b3e70c817beb3a803 @@ -2164,6 +2172,14 @@ trackedFiles: id: b197d6bb0ad4 last_write_checksum: sha1:532cd37040ded74f71c908272c121f96dd2ef099 pristine_git_object: 70b83e8ad0d2f8c8e7602be9d83be224b5a0bc62 + docs/models/operations/GetTransactionRefundSettlementRequest.md: + id: c94499566d97 + last_write_checksum: sha1:f37477ee048b6300fa2af49a4b7c21a0425fb703 + pristine_git_object: e94b275654ea62307d9e6cf7ea87c25f95552de4 + docs/models/operations/GetTransactionRefundSettlementResponse.md: + id: 4259ad6d7ceb + last_write_checksum: sha1:195026927fa7138e71b52d6f12e623b1163ea172 + pristine_git_object: 7d3bd6a8ae14b5fe9c045765dc1c41bc89aeca14 docs/models/operations/GetTransactionRequest.md: id: 7e83fd7f0b7c last_write_checksum: sha1:ea790a6c06846489b3e0bd09799953e9a82606b2 @@ -2404,6 +2420,14 @@ trackedFiles: id: ddb0749e4642 last_write_checksum: sha1:d1510016043c58f22249c436b53a0b78bb7bf298 pristine_git_object: 87654aa673221c7038f7f99ee9c72b37209e7034 + docs/models/operations/ListTransactionRefundSettlementsRequest.md: + id: 3a37f9b5065e + last_write_checksum: sha1:ec4c2d86b5330149719cb4c657ea4838b8ea9e0c + pristine_git_object: 57895f828296b0bfa48753c9220ac35abe125a1e + docs/models/operations/ListTransactionRefundSettlementsResponse.md: + id: a450d3a89b46 + last_write_checksum: sha1:62bb03084b8e2cb62f96c1c2b79142f2e40e6db1 + pristine_git_object: fe079376163b83f0d2f2d4581856eaa3ccfc7b43 docs/models/operations/ListTransactionRefundsRequest.md: id: 1af62b9bd56d last_write_checksum: sha1:3b1f16cd6dd1761f824d77626156d44eea332b26 @@ -2704,6 +2728,10 @@ trackedFiles: id: 451a9838a921 last_write_checksum: sha1:eb04e9c323edf2ab9cd4c1e248fff25d3ca44a3f pristine_git_object: 9b880d4e61a83f51d8a090f1dfbe5457da7ca486 + docs/sdks/refundsettlements/README.md: + id: 30eb44550460 + last_write_checksum: sha1:3deac00ff2831525063b6ac26cd3b1b3699cec03 + pristine_git_object: b77e13ad92d27a5d870bbadf56121b3786825f28 docs/sdks/reportexecutions/README.md: id: 018b5056e0f9 last_write_checksum: sha1:a4d85a002c7a5177973f5ec89a3315b5707c1389 @@ -2746,8 +2774,8 @@ trackedFiles: pristine_git_object: 15c4e4642f204ccb312d8814155b69e153b4e19b gradle.properties: id: 2afbb999f001 - last_write_checksum: sha1:386d0b734af38baec1adca17654c1b7217db1d02 - pristine_git_object: bcc5f564b1d213711ed033832292d4227b46c73a + last_write_checksum: sha1:c13e310bba675be102050d6024e5a56a43387b37 + pristine_git_object: 3801cccc3d3b1916ad8cdb107eb478f7daa362b1 gradle/wrapper/gradle-wrapper.jar: id: ec27dae6e852 last_write_checksum: sha1:f725fb1467084142d74fd7cd8eab691ab3442611 @@ -2904,6 +2932,10 @@ trackedFiles: id: 9b84e4b1d9a6 last_write_checksum: sha1:fd75312fbd240dd7746d0da91a228ca6889272db pristine_git_object: af1b4ed683be8d1699ac10dd44db7d1d02b90fc7 + src/main/java/com/gr4vy/sdk/AsyncRefundSettlements.java: + id: ad83f52aed64 + last_write_checksum: sha1:e19bad08141fb52f719aa69b80b33a23c4db4fd6 + pristine_git_object: e2d3bb347954e5ba4e6b9cf134e447ed1706fdc8 src/main/java/com/gr4vy/sdk/AsyncRefunds.java: id: a3f797240c0b last_write_checksum: sha1:b63f824668f6727b2da240f04611cc2837a87e10 @@ -2938,8 +2970,8 @@ trackedFiles: pristine_git_object: a6bbf0fbc29524b348fd7cc9e00047ec46275401 src/main/java/com/gr4vy/sdk/AsyncTransactions.java: id: bf9640b12cf9 - last_write_checksum: sha1:e49d128eed5277f4819fc307c15d895795fb4e8b - pristine_git_object: dfc40490e0471aa59cbbf8d06bf4adb645405007 + last_write_checksum: sha1:4f4b0bc624f2d3589391b318846193d7385609d1 + pristine_git_object: 431d73315bcd6315ec3fa24bb2ccb319d368993c src/main/java/com/gr4vy/sdk/AsyncTransactionsRefunds.java: id: 25e32812684e last_write_checksum: sha1:dc1b6a43809efd702627e0fb1b8bb768bce94a87 @@ -3044,6 +3076,10 @@ trackedFiles: id: 5fe07a63563d last_write_checksum: sha1:c2aba9e00fbf965d882cc6fb3d4a5ef1ac12af37 pristine_git_object: db7a6f5ff8f060588bf95d622a972aef5a1fce4e + src/main/java/com/gr4vy/sdk/RefundSettlements.java: + id: 53650df9c18e + last_write_checksum: sha1:248c21a19118b0dbc86b5ed12b7c7b03bad0728a + pristine_git_object: d229b3b90924f02bef9cd99921b669a054422d2e src/main/java/com/gr4vy/sdk/Refunds.java: id: 06d73de40717 last_write_checksum: sha1:e9cb2f4548b10a59ef2b2185313e6d76bea7d4ea @@ -3058,8 +3094,8 @@ trackedFiles: pristine_git_object: 502a7312d3dc82c102dbaf7ed5e952d0c793e26f src/main/java/com/gr4vy/sdk/SDKConfiguration.java: id: 73a7edeaca45 - last_write_checksum: sha1:81628e0802d8864265e355cf4e3b9a9bf366921f - pristine_git_object: 40411439d332f31963b68b17b5ec4555388028e1 + last_write_checksum: sha1:6c3ad6eb4ebcedcac40cb71b5e7116b15e4718c3 + pristine_git_object: f91edbcd393a10e07834787247891dd4b0169ab0 src/main/java/com/gr4vy/sdk/SecuritySource.java: id: 1b6add6b9b50 last_write_checksum: sha1:2f365cc823c6243188e83f4df618c9737fcee8bd @@ -3086,8 +3122,8 @@ trackedFiles: pristine_git_object: c2607f8627fe389c7931efa78da82d0d695d18ac src/main/java/com/gr4vy/sdk/Transactions.java: id: 3cf11cff6a7f - last_write_checksum: sha1:15761b87e1a44f0901a9ac9b75b36b58d688c887 - pristine_git_object: 777ef1d4f63172f7752698dc5396f50c6d5e1d8c + last_write_checksum: sha1:55cef1e5392e131296219a904dbb2479a8045075 + pristine_git_object: fa86c63af6bda0025e42f092763efc1b45d6b000 src/main/java/com/gr4vy/sdk/TransactionsRefunds.java: id: cf62b811d59f last_write_checksum: sha1:50c365428eec86db114bd293148371e32d558554 @@ -4220,6 +4256,14 @@ trackedFiles: id: 4b22e399807b last_write_checksum: sha1:53b9d2207917491dcd78d3a2bed75d1f8a433dfa pristine_git_object: 311639b264c92860ebf774adb5156b5f7f1ba79c + src/main/java/com/gr4vy/sdk/models/components/RefundSettlement.java: + id: 4238324c5ad2 + last_write_checksum: sha1:3d18915d64b47186af456da815ebe0f42cefbe0c + pristine_git_object: c252dddd7fd841782d3008dd83ab7deefb580a86 + src/main/java/com/gr4vy/sdk/models/components/RefundSettlements.java: + id: b010c3091231 + last_write_checksum: sha1:0cb0974a04a00714e6318f5f37059be7ea96ddfa + pristine_git_object: b46e61778952c381ff079ae22da8d6cdf8e113f2 src/main/java/com/gr4vy/sdk/models/components/RefundStatus.java: id: 84b5d6af33dc last_write_checksum: sha1:e837e1884e204f5ed757d6203afc9ca62e31cf63 @@ -4984,6 +5028,10 @@ trackedFiles: id: d81a38561108 last_write_checksum: sha1:7959720c1019c36f229767514a41e2e9a798935d pristine_git_object: 542a31ff3f355b14b2277af599fb3d5e3500fbfa + src/main/java/com/gr4vy/sdk/models/operations//async/GetTransactionRefundSettlementRequestBuilder.java: + id: 30cce69c1472 + last_write_checksum: sha1:f2e16e4827c9cacd9b74f231971817dee1414a96 + pristine_git_object: a9d760b4ea38f75129e71da5fc18fe22b0fd8926 src/main/java/com/gr4vy/sdk/models/operations//async/GetTransactionRequestBuilder.java: id: c50fa1fcd18f last_write_checksum: sha1:85699eabc913db8fca62797f06175b0ea5e67460 @@ -5096,6 +5144,10 @@ trackedFiles: id: 5da67dc24205 last_write_checksum: sha1:28da59efc24f2ad4ef9277f8d40950176cdc35b1 pristine_git_object: 948880a521392346f7ee6e6e6f9548c3acb050c2 + src/main/java/com/gr4vy/sdk/models/operations//async/ListTransactionRefundSettlementsRequestBuilder.java: + id: e745d3aaa07e + last_write_checksum: sha1:767a52cfcc1d227b5e26f7c37830b7824b40c0bb + pristine_git_object: eba03373260fea297cf328659c6c00c36ae26cb1 src/main/java/com/gr4vy/sdk/models/operations//async/ListTransactionRefundsRequestBuilder.java: id: 5b16a97efd52 last_write_checksum: sha1:a3f6fffdd50d8880e215c0b9e4a18484bec52f23 @@ -5944,6 +5996,18 @@ trackedFiles: id: b903a5f2c2ef last_write_checksum: sha1:9011f1826b033b5e68bb53535b6d6980a5af4923 pristine_git_object: 7d4a9bf3657fae384ffb3d836ef0b9707369f2af + src/main/java/com/gr4vy/sdk/models/operations/GetTransactionRefundSettlementRequest.java: + id: 11a124544ae9 + last_write_checksum: sha1:249d5f150ff3d2582795054069a59741cf217f26 + pristine_git_object: b1f53bee94ea4bbfc27b98e285e72882a311ccc5 + src/main/java/com/gr4vy/sdk/models/operations/GetTransactionRefundSettlementRequestBuilder.java: + id: 03aaef65c67e + last_write_checksum: sha1:efd34405506098438925f700c10bf7615628f9c8 + pristine_git_object: d66ef561095ad5fd3b92cec7480528068dc0ceb3 + src/main/java/com/gr4vy/sdk/models/operations/GetTransactionRefundSettlementResponse.java: + id: cb5e98a97767 + last_write_checksum: sha1:4bee91a8ab646982d0af42ab01053d4eb1ea9dc1 + pristine_git_object: 060f067bf9a1b721a1a69d24e0de9a6ec20cd7e9 src/main/java/com/gr4vy/sdk/models/operations/GetTransactionRequest.java: id: 3f451780d12e last_write_checksum: sha1:01f9baa5ec2a916e5c53a8392d4a4dafb949ed8c @@ -6296,6 +6360,18 @@ trackedFiles: id: efca39aac837 last_write_checksum: sha1:d4e6a013d62cbf33e79f7a5716724dab05198ff6 pristine_git_object: 5e5acbd1161b5c02df51cb6aa326e77526d27604 + src/main/java/com/gr4vy/sdk/models/operations/ListTransactionRefundSettlementsRequest.java: + id: 8a65af3784f9 + last_write_checksum: sha1:349be587ae22ea0b202b7198ec2fd89de949447a + pristine_git_object: 6017bb785ca01e609689f590761325779d43ccd7 + src/main/java/com/gr4vy/sdk/models/operations/ListTransactionRefundSettlementsRequestBuilder.java: + id: db418a9d7c21 + last_write_checksum: sha1:ca211d9dfc7817e8fea588aa932859d533d546a6 + pristine_git_object: ac6b521238040d81545171b585c48e086536556c + src/main/java/com/gr4vy/sdk/models/operations/ListTransactionRefundSettlementsResponse.java: + id: e45cf0750ff4 + last_write_checksum: sha1:3e1033c3314fdfc897073a5ec517a00851b80002 + pristine_git_object: 1733f84e9d7cc1b7890e553fd6989e2af1ea71fd src/main/java/com/gr4vy/sdk/models/operations/ListTransactionRefundsRequest.java: id: d225fa3e8834 last_write_checksum: sha1:3a85e47f7bcb9d98a7ad250d98de747d4ade3018 @@ -6828,6 +6904,10 @@ trackedFiles: id: 4d89980f7060 last_write_checksum: sha1:bba1f77bcfd2b6d8cc4ac500e398b5fc3b36b405 pristine_git_object: bd5cdb3eacd1fc2cbb1b7b3811faf68c4a69b393 + src/main/java/com/gr4vy/sdk/models/operations/async/GetTransactionRefundSettlementResponse.java: + id: fe009d060998 + last_write_checksum: sha1:7300ddee8b3ef2535cc098a20f9cc1c91725249c + pristine_git_object: 81235026404980f10b0a17ff08358525a7a4d877 src/main/java/com/gr4vy/sdk/models/operations/async/GetTransactionResponse.java: id: b425836eb518 last_write_checksum: sha1:45173ac3597bcd9b9f4ed1a11bf07cee78ce957f @@ -6940,6 +7020,10 @@ trackedFiles: id: bed5acb1dfe5 last_write_checksum: sha1:78c781665644caa81837ddcffba4e50cfb538ce4 pristine_git_object: 828233c21e3e040bcf92d75289b863db17ed623d + src/main/java/com/gr4vy/sdk/models/operations/async/ListTransactionRefundSettlementsResponse.java: + id: 8243bcdeb6a7 + last_write_checksum: sha1:0dd79fd8890856a542337ad710b227aeb31fc840 + pristine_git_object: 1e3fe207dd5fc70dbcb1d82dfdf3f062b3a202bb src/main/java/com/gr4vy/sdk/models/operations/async/ListTransactionRefundsResponse.java: id: f9f84d70caef last_write_checksum: sha1:7e595d45e7733cf7b7fac8e583a7e26c31cf2ee7 @@ -7288,6 +7372,10 @@ trackedFiles: id: 4090552350f6 last_write_checksum: sha1:1b226954ef025e1d04ce04481139888b0b24f39a pristine_git_object: 50378c2b71495f771a4289afe39c8d3fae8b3968 + src/main/java/com/gr4vy/sdk/operations/GetTransactionRefundSettlement.java: + id: 7f9921810108 + last_write_checksum: sha1:23776dacc2a12bc0be21de23a8fc10f49f6757db + pristine_git_object: f22332b21504756738437a6bbad3031c5c3899c7 src/main/java/com/gr4vy/sdk/operations/GetTransactionSettlement.java: id: b34eab46d29a last_write_checksum: sha1:d21dc9eed30cb6f140ca0755805c803eb0f72fc6 @@ -7396,6 +7484,10 @@ trackedFiles: id: 2c060ebeaaec last_write_checksum: sha1:4779a3e99678a95da59e67943f18f649739773a2 pristine_git_object: 6aef3754496b3664d04de9768ae8b29c7a81fdfe + src/main/java/com/gr4vy/sdk/operations/ListTransactionRefundSettlements.java: + id: 81ee5fceb10b + last_write_checksum: sha1:af00274eb1c94d3224c1369e8acf2b20a15a1f69 + pristine_git_object: 6f9eeda796dc9b1cd280647dc1a02f5fdb315715 src/main/java/com/gr4vy/sdk/operations/ListTransactionRefunds.java: id: e75218352b75 last_write_checksum: sha1:d3706610b4703fb66aae23be5190625ca6ade778 @@ -11902,9 +11994,77 @@ examples: application/json: {"type": "error", "code": "bad_gateway", "status": 502, "message": "Request could not be processed"} "504": application/json: {"type": "error", "code": "gateway_timeout", "status": 504, "message": "Request could not be processed"} + get_transaction_refund_settlement: + speakeasy-default-get-transaction-refund-settlement: + parameters: + path: + transaction_id: "7099948d-7286-47e4-aad8-b68f7eb44591" + settlement_id: "b1e2c3d4-5678-1234-9abc-1234567890ab" + responses: + "200": + application/json: {"id": "b1e2c3d4-5678-1234-9abc-1234567890ab", "merchant_account_id": "default", "created_at": "2024-06-01T12:00:00.000Z", "updated_at": "2024-06-01T12:00:00.000Z", "posted_at": "2024-06-01T12:00:00.000Z", "ingested_at": "2024-06-01T12:00:00.000Z", "currency": "EUR", "amount": 1100, "commission": 100, "payment_service_report_id": "a1b2c3d4-5678-1234-9abc-1234567890ab", "payment_service_report_file_ids": ["f1e2d3c4-5678-1234-9abc-1234567890ab"], "transaction_id": "7099948d-7286-47e4-aad8-b68f7eb44591", "type": "refund-settlement", "refund_id": "b1e2c3d4-5678-1234-9abc-1234567890ab"} + "400": + application/json: {"type": "error", "code": "bad_request", "status": 400, "message": "Request failed validation"} + "401": + application/json: {"type": "error", "code": "unauthorized", "status": 401, "message": "No valid API authentication found"} + "403": + application/json: {"type": "error", "code": "forbidden", "status": 403, "message": "Request failed validation"} + "404": + application/json: {"type": "error", "code": "not_found", "status": 404, "message": "The resource could not be found"} + "405": + application/json: {"type": "error", "code": "method_not_allowed", "status": 405, "message": "Method Not Allowed"} + "409": + application/json: {"type": "error", "code": "duplicate_record", "status": 409, "message": "Request failed validation"} + "422": + application/json: {} + "425": + application/json: {"type": "error", "code": "too_early", "status": 425, "message": "Request failed validation"} + "429": + application/json: {"type": "error", "code": "too_many_requests", "status": 429, "message": "Request failed validation"} + "500": + application/json: {"type": "error", "code": "server_error", "status": 500, "message": "Request could not be processed"} + "502": + application/json: {"type": "error", "code": "bad_gateway", "status": 502, "message": "Request could not be processed"} + "504": + application/json: {"type": "error", "code": "gateway_timeout", "status": 504, "message": "Request could not be processed"} + list_transaction_refund_settlements: + speakeasy-default-list-transaction-refund-settlements: + parameters: + path: + transaction_id: "7099948d-7286-47e4-aad8-b68f7eb44591" + responses: + "200": + application/json: {"items": [{"id": "b1e2c3d4-5678-1234-9abc-1234567890ab", "merchant_account_id": "default", "created_at": "2024-06-01T12:00:00.000Z", "updated_at": "2024-06-01T12:00:00.000Z", "posted_at": "2024-06-01T12:00:00.000Z", "ingested_at": "2024-06-01T12:00:00.000Z", "currency": "EUR", "amount": 1100, "commission": 100, "payment_service_report_id": "a1b2c3d4-5678-1234-9abc-1234567890ab", "payment_service_report_file_ids": ["f1e2d3c4-5678-1234-9abc-1234567890ab"], "transaction_id": "7099948d-7286-47e4-aad8-b68f7eb44591", "type": "refund-settlement", "refund_id": "b1e2c3d4-5678-1234-9abc-1234567890ab"}]} + "400": + application/json: {"type": "error", "code": "bad_request", "status": 400, "message": "Request failed validation"} + "401": + application/json: {"type": "error", "code": "unauthorized", "status": 401, "message": "No valid API authentication found"} + "403": + application/json: {"type": "error", "code": "forbidden", "status": 403, "message": "Request failed validation"} + "404": + application/json: {"type": "error", "code": "not_found", "status": 404, "message": "The resource could not be found"} + "405": + application/json: {"type": "error", "code": "method_not_allowed", "status": 405, "message": "Method Not Allowed"} + "409": + application/json: {"type": "error", "code": "duplicate_record", "status": 409, "message": "Request failed validation"} + "422": + application/json: {} + "425": + application/json: {"type": "error", "code": "too_early", "status": 425, "message": "Request failed validation"} + "429": + application/json: {"type": "error", "code": "too_many_requests", "status": 429, "message": "Request failed validation"} + "500": + application/json: {"type": "error", "code": "server_error", "status": 500, "message": "Request could not be processed"} + "502": + application/json: {"type": "error", "code": "bad_gateway", "status": 502, "message": "Request could not be processed"} + "504": + application/json: {"type": "error", "code": "gateway_timeout", "status": 504, "message": "Request could not be processed"} examplesVersion: 1.0.2 generatedTests: {} -releaseNotes: "## Java SDK Changes:\n* `gr4vy.transactions.capture()`: \n * `request.transactionCaptureCreate.reauthorizeIfAuthorizationExpired` **Changed** (Breaking ⚠️)\n * `response.union(Transaction).giftCardRedemptions[].errorCode` **Changed**\n* `gr4vy.buyers.giftCards.list()`: `response.items[].balanceErrorCode` **Changed**\n* `gr4vy.giftCards.balances.list()`: `response.items[].balanceErrorCode` **Changed**\n* `gr4vy.transactions.list()`: `response.items[].giftCardRedemptions[].errorCode` **Changed**\n* `gr4vy.transactions.create()`: `response.giftCardRedemptions[].errorCode` **Changed**\n* `gr4vy.transactions.get()`: `response.giftCardRedemptions[].errorCode` **Changed**\n* `gr4vy.transactions.update()`: `response.giftCardRedemptions[].errorCode` **Changed**\n* `gr4vy.transactions.void()`: `response.union(Transaction).giftCardRedemptions[].errorCode` **Changed**\n* `gr4vy.transactions.cancel()`: `response.transaction.giftCardRedemptions[].errorCode` **Changed**\n* `gr4vy.transactions.sync()`: `response.giftCardRedemptions[].errorCode` **Changed**\n" +releaseNotes: | + ## Java SDK Changes: + * `gr4vy.transactions.refundSettlements.get()`: **Added** + * `gr4vy.transactions.refundSettlements.list()`: **Added** generatedFiles: - .gitattributes - USAGE.md diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index d191be74..0635a95f 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -30,7 +30,7 @@ generation: generateNewTests: false skipResponseBodyAssertions: false java: - version: 2.16.108 + version: 2.16.109 additionalDependencies: - testImplementation:org.junit.jupiter:junit-jupiter:5.10.0 - implementation:com.auth0:java-jwt:4.5.0 diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 54de893c..8b074687 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,4 +1,4 @@ -speakeasyVersion: 1.790.0 +speakeasyVersion: 1.790.1 sources: Gr4vy: sourceNamespace: openapi @@ -9,8 +9,8 @@ sources: - 1.0.0 openapi: sourceNamespace: openapi - sourceRevisionDigest: sha256:f48fb83bd084d15a1e9ed005ca34bc0214edef0644987829221854140a7d9d5c - sourceBlobDigest: sha256:e8da1b10f989ac81d4108692091aa05045258eda8882c22f1f53025e43d9a0e5 + sourceRevisionDigest: sha256:329f2b0c3a2cda8052762d4e9f4ade27766ae9c9150743efaf78c928939999ef + sourceBlobDigest: sha256:8a63b384b4ed46f9cf924d0a41ad2da905dee0bd965b7a1a571b8566001f24b6 tags: - latest - 1.0.0 @@ -25,10 +25,10 @@ targets: java: source: openapi sourceNamespace: openapi - sourceRevisionDigest: sha256:f48fb83bd084d15a1e9ed005ca34bc0214edef0644987829221854140a7d9d5c - sourceBlobDigest: sha256:e8da1b10f989ac81d4108692091aa05045258eda8882c22f1f53025e43d9a0e5 + sourceRevisionDigest: sha256:329f2b0c3a2cda8052762d4e9f4ade27766ae9c9150743efaf78c928939999ef + sourceBlobDigest: sha256:8a63b384b4ed46f9cf924d0a41ad2da905dee0bd965b7a1a571b8566001f24b6 codeSamplesNamespace: openapi-java-code-samples - codeSamplesRevisionDigest: sha256:68e4b23f7936273abf7d9c368655ad2652b386d785648cd9ff01e6c9e0e84f1b + codeSamplesRevisionDigest: sha256:18f087c9393277a418b21f587c69f1ef74380ca8d9282078e97160eb5e3065c7 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index bf9e7a96..d2571af8 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ The samples below show how a published SDK artifact is used: Gradle: ```groovy -implementation 'com.gr4vy:sdk:2.16.108' +implementation 'com.gr4vy:sdk:2.16.109' ``` Maven: @@ -67,7 +67,7 @@ Maven: com.gr4vy sdk - 2.16.108 + 2.16.109 ``` @@ -540,6 +540,11 @@ Async support is available for: * [list](docs/sdks/events/README.md#list) - List transaction events +#### [Transactions.RefundSettlements](docs/sdks/refundsettlements/README.md) + +* [get](docs/sdks/refundsettlements/README.md#get) - Get transaction refund settlement +* [list](docs/sdks/refundsettlements/README.md#list) - List transaction refund settlements + #### [Transactions.Refunds](docs/sdks/transactionsrefunds/README.md) * [list](docs/sdks/transactionsrefunds/README.md#list) - List transaction refunds diff --git a/RELEASES.md b/RELEASES.md index 1b8af7e8..d2084057 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1918,4 +1918,14 @@ Based on: ### Generated - [java v2.16.108] . ### Releases -- [Maven Central v2.16.108] https://central.sonatype.com/artifact/com.gr4vy/sdk/2.16.108 - . \ No newline at end of file +- [Maven Central v2.16.108] https://central.sonatype.com/artifact/com.gr4vy/sdk/2.16.108 - . + +## 2026-07-14 13:45:15 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.790.1 (2.918.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [java v2.16.109] . +### Releases +- [Maven Central v2.16.109] https://central.sonatype.com/artifact/com.gr4vy/sdk/2.16.109 - . \ No newline at end of file diff --git a/build.gradle b/build.gradle index b738c3b5..7352f664 100644 --- a/build.gradle +++ b/build.gradle @@ -80,7 +80,7 @@ dependencies { implementation 'org.bouncycastle:bcpkix-jdk18on:1.80' implementation 'org.slf4j:slf4j-simple:2.0.7' api 'com.fasterxml.jackson.core:jackson-annotations:2.22' - implementation 'com.fasterxml.jackson.core:jackson-databind:2.22.0' + implementation 'com.fasterxml.jackson.core:jackson-databind:2.22.1' implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.22.0' implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.22.0' api('org.openapitools:jackson-databind-nullable:0.2.6') {exclude group: 'com.fasterxml.jackson.core', module: 'jackson-databind'} diff --git a/docs/models/components/RefundSettlement.md b/docs/models/components/RefundSettlement.md new file mode 100644 index 00000000..1097e2ce --- /dev/null +++ b/docs/models/components/RefundSettlement.md @@ -0,0 +1,27 @@ +# RefundSettlement + +A settlement record for a refund on a transaction. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `id` | *String* | :heavy_check_mark: | The unique identifier for the record. | b1e2c3d4-5678-1234-9abc-1234567890ab | +| `merchantAccountId` | *String* | :heavy_check_mark: | The merchant account this record belongs to. | default | +| `createdAt` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_check_mark: | The date and time the record was created, in ISO 8601 format. | 2024-06-01T12:00:00.000Z | +| `updatedAt` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_check_mark: | The date and time the record was last updated, in ISO 8601 format. | 2024-06-01T12:00:00.000Z | +| `postedAt` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_check_mark: | The date and time the record was posted, in ISO 8601 format. | 2024-06-01T12:00:00.000Z | +| `ingestedAt` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_check_mark: | The date and time the record was ingested, in ISO 8601 format. | 2024-06-01T12:00:00.000Z | +| `currency` | *String* | :heavy_check_mark: | ISO 4217 currency code. | **Example 1:** EUR
**Example 2:** GBP
**Example 3:** USD | +| `amount` | *long* | :heavy_check_mark: | The total amount in the smallest currency unit (e.g. cents). | 1100 | +| `exchangeRate` | *JsonNullable\* | :heavy_minus_sign: | The exchange rate, if applicable. | 1 | +| `commission` | *long* | :heavy_check_mark: | The commission amount deducted in the smallest currency unit. | 100 | +| `interchange` | *JsonNullable\* | :heavy_minus_sign: | The interchange fee, if applicable, in the smallest currency unit. | 50 | +| `markup` | *JsonNullable\* | :heavy_minus_sign: | The markup fee, if applicable, in the smallest currency unit. | 10 | +| `schemeFee` | *JsonNullable\* | :heavy_minus_sign: | The scheme fee, if applicable, in the smallest currency unit. | 5 | +| `paymentServiceReportId` | *String* | :heavy_check_mark: | The report ID from the payment service. | a1b2c3d4-5678-1234-9abc-1234567890ab | +| `paymentServiceReportFileIds` | List\<*String*> | :heavy_check_mark: | List of file IDs for the payment service report. | [
"f1e2d3c4-5678-1234-9abc-1234567890ab"
] | +| `transactionId` | *String* | :heavy_check_mark: | The transaction this record is associated with. | 7099948d-7286-47e4-aad8-b68f7eb44591 | +| `type` | *Optional\* | :heavy_minus_sign: | Always `refund-settlement`. | refund-settlement | +| `refundId` | *String* | :heavy_check_mark: | The refund this settlement is associated with. | b1e2c3d4-5678-1234-9abc-1234567890ab | \ No newline at end of file diff --git a/docs/models/components/RefundSettlements.md b/docs/models/components/RefundSettlements.md new file mode 100644 index 00000000..de37ae5b --- /dev/null +++ b/docs/models/components/RefundSettlements.md @@ -0,0 +1,10 @@ +# RefundSettlements + +A list of settlement records for the refunds on a transaction. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `items` | List\<[RefundSettlement](../../models/components/RefundSettlement.md)> | :heavy_check_mark: | The list of refund settlement objects. | \ No newline at end of file diff --git a/docs/models/operations/GetTransactionRefundSettlementRequest.md b/docs/models/operations/GetTransactionRefundSettlementRequest.md new file mode 100644 index 00000000..e94b2756 --- /dev/null +++ b/docs/models/operations/GetTransactionRefundSettlementRequest.md @@ -0,0 +1,10 @@ +# GetTransactionRefundSettlementRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `transactionId` | *String* | :heavy_check_mark: | The unique identifier of the transaction. | 7099948d-7286-47e4-aad8-b68f7eb44591 | +| `settlementId` | *String* | :heavy_check_mark: | The unique identifier of the refund settlement. | b1e2c3d4-5678-1234-9abc-1234567890ab | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | \ No newline at end of file diff --git a/docs/models/operations/GetTransactionRefundSettlementResponse.md b/docs/models/operations/GetTransactionRefundSettlementResponse.md new file mode 100644 index 00000000..7d3bd6a8 --- /dev/null +++ b/docs/models/operations/GetTransactionRefundSettlementResponse.md @@ -0,0 +1,11 @@ +# GetTransactionRefundSettlementResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `refundSettlement` | [Optional\](../../models/components/RefundSettlement.md) | :heavy_minus_sign: | Successful Response | \ No newline at end of file diff --git a/docs/models/operations/ListTransactionRefundSettlementsRequest.md b/docs/models/operations/ListTransactionRefundSettlementsRequest.md new file mode 100644 index 00000000..57895f82 --- /dev/null +++ b/docs/models/operations/ListTransactionRefundSettlementsRequest.md @@ -0,0 +1,9 @@ +# ListTransactionRefundSettlementsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `transactionId` | *String* | :heavy_check_mark: | The unique identifier of the transaction. | 7099948d-7286-47e4-aad8-b68f7eb44591 | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | \ No newline at end of file diff --git a/docs/models/operations/ListTransactionRefundSettlementsResponse.md b/docs/models/operations/ListTransactionRefundSettlementsResponse.md new file mode 100644 index 00000000..fe079376 --- /dev/null +++ b/docs/models/operations/ListTransactionRefundSettlementsResponse.md @@ -0,0 +1,11 @@ +# ListTransactionRefundSettlementsResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `refundSettlements` | [Optional\](../../models/components/RefundSettlements.md) | :heavy_minus_sign: | Successful Response | \ No newline at end of file diff --git a/docs/sdks/refundsettlements/README.md b/docs/sdks/refundsettlements/README.md new file mode 100644 index 00000000..b77e13ad --- /dev/null +++ b/docs/sdks/refundsettlements/README.md @@ -0,0 +1,138 @@ +# Transactions.RefundSettlements + +## Overview + +### Available Operations + +* [get](#get) - Get transaction refund settlement +* [list](#list) - List transaction refund settlements + +## get + +Retrieve a specific refund settlement for a transaction by its unique identifier. + +### Example Usage + + +```java +package hello.world; + +import com.gr4vy.sdk.Gr4vy; +import com.gr4vy.sdk.models.errors.*; +import com.gr4vy.sdk.models.operations.GetTransactionRefundSettlementResponse; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws Exception { + + Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("") + .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", "")) + .build(); + + GetTransactionRefundSettlementResponse res = sdk.transactions().refundSettlements().get() + .transactionId("7099948d-7286-47e4-aad8-b68f7eb44591") + .settlementId("b1e2c3d4-5678-1234-9abc-1234567890ab") + .call(); + + if (res.refundSettlement().isPresent()) { + System.out.println(res.refundSettlement().get()); + } + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `transactionId` | *String* | :heavy_check_mark: | The unique identifier of the transaction. | 7099948d-7286-47e4-aad8-b68f7eb44591 | +| `settlementId` | *String* | :heavy_check_mark: | The unique identifier of the refund settlement. | b1e2c3d4-5678-1234-9abc-1234567890ab | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | + +### Response + +**[GetTransactionRefundSettlementResponse](../../models/operations/GetTransactionRefundSettlementResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| models/errors/Error400 | 400 | application/json | +| models/errors/Error401 | 401 | application/json | +| models/errors/Error403 | 403 | application/json | +| models/errors/Error404 | 404 | application/json | +| models/errors/Error405 | 405 | application/json | +| models/errors/Error409 | 409 | application/json | +| models/errors/HTTPValidationError | 422 | application/json | +| models/errors/Error425 | 425 | application/json | +| models/errors/Error429 | 429 | application/json | +| models/errors/Error500 | 500 | application/json | +| models/errors/Error502 | 502 | application/json | +| models/errors/Error504 | 504 | application/json | +| models/errors/APIException | 4XX, 5XX | \*/\* | + +## list + +List all refund settlements for a specific transaction. + +### Example Usage + + +```java +package hello.world; + +import com.gr4vy.sdk.Gr4vy; +import com.gr4vy.sdk.models.errors.*; +import com.gr4vy.sdk.models.operations.ListTransactionRefundSettlementsResponse; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws Exception { + + Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("") + .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", "")) + .build(); + + ListTransactionRefundSettlementsResponse res = sdk.transactions().refundSettlements().list() + .transactionId("7099948d-7286-47e4-aad8-b68f7eb44591") + .call(); + + if (res.refundSettlements().isPresent()) { + System.out.println(res.refundSettlements().get()); + } + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `transactionId` | *String* | :heavy_check_mark: | The unique identifier of the transaction. | 7099948d-7286-47e4-aad8-b68f7eb44591 | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | + +### Response + +**[ListTransactionRefundSettlementsResponse](../../models/operations/ListTransactionRefundSettlementsResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| models/errors/Error400 | 400 | application/json | +| models/errors/Error401 | 401 | application/json | +| models/errors/Error403 | 403 | application/json | +| models/errors/Error404 | 404 | application/json | +| models/errors/Error405 | 405 | application/json | +| models/errors/Error409 | 409 | application/json | +| models/errors/HTTPValidationError | 422 | application/json | +| models/errors/Error425 | 425 | application/json | +| models/errors/Error429 | 429 | application/json | +| models/errors/Error500 | 500 | application/json | +| models/errors/Error502 | 502 | application/json | +| models/errors/Error504 | 504 | application/json | +| models/errors/APIException | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index bcc5f564..3801cccc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ groupId=com.gr4vy artifactId=sdk -version=2.16.108 +version=2.16.109 org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g diff --git a/src/main/java/com/gr4vy/sdk/AsyncRefundSettlements.java b/src/main/java/com/gr4vy/sdk/AsyncRefundSettlements.java new file mode 100644 index 00000000..e2d3bb34 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/AsyncRefundSettlements.java @@ -0,0 +1,150 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk; + +import static com.gr4vy.sdk.operations.Operations.AsyncRequestOperation; + +import com.gr4vy.sdk.models.operations.GetTransactionRefundSettlementRequest; +import com.gr4vy.sdk.models.operations.ListTransactionRefundSettlementsRequest; +import com.gr4vy.sdk.models.operations.async.GetTransactionRefundSettlementRequestBuilder; +import com.gr4vy.sdk.models.operations.async.GetTransactionRefundSettlementResponse; +import com.gr4vy.sdk.models.operations.async.ListTransactionRefundSettlementsRequestBuilder; +import com.gr4vy.sdk.models.operations.async.ListTransactionRefundSettlementsResponse; +import com.gr4vy.sdk.operations.GetTransactionRefundSettlement; +import com.gr4vy.sdk.operations.ListTransactionRefundSettlements; +import com.gr4vy.sdk.utils.Headers; +import com.gr4vy.sdk.utils.Options; +import java.lang.String; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import org.openapitools.jackson.nullable.JsonNullable; + + +public class AsyncRefundSettlements { + private static final Headers _headers = Headers.EMPTY; + private final SDKConfiguration sdkConfiguration; + private final RefundSettlements syncSDK; + + AsyncRefundSettlements(RefundSettlements syncSDK, SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + this.syncSDK = syncSDK; + } + + /** + * Switches to the sync SDK. + * + * @return The sync SDK + */ + public RefundSettlements sync() { + return syncSDK; + } + + + /** + * Get transaction refund settlement + * + *

Retrieve a specific refund settlement for a transaction by its unique identifier. + * + * @return The async call builder + */ + public GetTransactionRefundSettlementRequestBuilder get() { + return new GetTransactionRefundSettlementRequestBuilder(sdkConfiguration); + } + + /** + * Get transaction refund settlement + * + *

Retrieve a specific refund settlement for a transaction by its unique identifier. + * + * @param transactionId The unique identifier of the transaction. + * @param settlementId The unique identifier of the refund settlement. + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture get(String transactionId, String settlementId) { + return get( + transactionId, settlementId, JsonNullable.undefined(), + Optional.empty()); + } + + /** + * Get transaction refund settlement + * + *

Retrieve a specific refund settlement for a transaction by its unique identifier. + * + * @param transactionId The unique identifier of the transaction. + * @param settlementId The unique identifier of the refund settlement. + * @param merchantAccountId + * @param options additional options + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture get( + String transactionId, String settlementId, + JsonNullable merchantAccountId, Optional options) { + GetTransactionRefundSettlementRequest request = + GetTransactionRefundSettlementRequest + .builder() + .transactionId(transactionId) + .settlementId(settlementId) + .merchantAccountId(merchantAccountId) + .build(); + AsyncRequestOperation operation + = new GetTransactionRefundSettlement.Async( + sdkConfiguration, options, sdkConfiguration.retryScheduler(), + _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * List transaction refund settlements + * + *

List all refund settlements for a specific transaction. + * + * @return The async call builder + */ + public ListTransactionRefundSettlementsRequestBuilder list() { + return new ListTransactionRefundSettlementsRequestBuilder(sdkConfiguration); + } + + /** + * List transaction refund settlements + * + *

List all refund settlements for a specific transaction. + * + * @param transactionId The unique identifier of the transaction. + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture list(String transactionId) { + return list(transactionId, JsonNullable.undefined(), Optional.empty()); + } + + /** + * List transaction refund settlements + * + *

List all refund settlements for a specific transaction. + * + * @param transactionId The unique identifier of the transaction. + * @param merchantAccountId + * @param options additional options + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture list( + String transactionId, JsonNullable merchantAccountId, + Optional options) { + ListTransactionRefundSettlementsRequest request = + ListTransactionRefundSettlementsRequest + .builder() + .transactionId(transactionId) + .merchantAccountId(merchantAccountId) + .build(); + AsyncRequestOperation operation + = new ListTransactionRefundSettlements.Async( + sdkConfiguration, options, sdkConfiguration.retryScheduler(), + _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + +} diff --git a/src/main/java/com/gr4vy/sdk/AsyncTransactions.java b/src/main/java/com/gr4vy/sdk/AsyncTransactions.java index dfc40490..431d7331 100644 --- a/src/main/java/com/gr4vy/sdk/AsyncTransactions.java +++ b/src/main/java/com/gr4vy/sdk/AsyncTransactions.java @@ -55,6 +55,7 @@ public class AsyncTransactions { private final AsyncActions actions; private final AsyncEvents events; private final AsyncSettlements settlements; + private final AsyncRefundSettlements refundSettlements; private final AsyncCaptures captures; private final Transactions syncSDK; @@ -64,6 +65,7 @@ public class AsyncTransactions { this.actions = new AsyncActions(syncSDK.actions(), this.sdkConfiguration); this.events = new AsyncEvents(syncSDK.events(), this.sdkConfiguration); this.settlements = new AsyncSettlements(syncSDK.settlements(), this.sdkConfiguration); + this.refundSettlements = new AsyncRefundSettlements(syncSDK.refundSettlements(), this.sdkConfiguration); this.captures = new AsyncCaptures(syncSDK.captures(), this.sdkConfiguration); this.syncSDK = syncSDK; } @@ -84,6 +86,10 @@ public final AsyncSettlements settlements() { return settlements; } + public final AsyncRefundSettlements refundSettlements() { + return refundSettlements; + } + public final AsyncCaptures captures() { return captures; } diff --git a/src/main/java/com/gr4vy/sdk/RefundSettlements.java b/src/main/java/com/gr4vy/sdk/RefundSettlements.java new file mode 100644 index 00000000..d229b3b9 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/RefundSettlements.java @@ -0,0 +1,144 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk; + +import static com.gr4vy.sdk.operations.Operations.RequestOperation; + +import com.gr4vy.sdk.models.operations.GetTransactionRefundSettlementRequest; +import com.gr4vy.sdk.models.operations.GetTransactionRefundSettlementRequestBuilder; +import com.gr4vy.sdk.models.operations.GetTransactionRefundSettlementResponse; +import com.gr4vy.sdk.models.operations.ListTransactionRefundSettlementsRequest; +import com.gr4vy.sdk.models.operations.ListTransactionRefundSettlementsRequestBuilder; +import com.gr4vy.sdk.models.operations.ListTransactionRefundSettlementsResponse; +import com.gr4vy.sdk.operations.GetTransactionRefundSettlement; +import com.gr4vy.sdk.operations.ListTransactionRefundSettlements; +import com.gr4vy.sdk.utils.Headers; +import com.gr4vy.sdk.utils.Options; +import java.lang.String; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + + +public class RefundSettlements { + private static final Headers _headers = Headers.EMPTY; + private final SDKConfiguration sdkConfiguration; + private final AsyncRefundSettlements asyncSDK; + + RefundSettlements(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + this.asyncSDK = new AsyncRefundSettlements(this, sdkConfiguration); + } + + /** + * Switches to the async SDK. + * + * @return The async SDK + */ + public AsyncRefundSettlements async() { + return asyncSDK; + } + + /** + * Get transaction refund settlement + * + *

Retrieve a specific refund settlement for a transaction by its unique identifier. + * + * @return The call builder + */ + public GetTransactionRefundSettlementRequestBuilder get() { + return new GetTransactionRefundSettlementRequestBuilder(sdkConfiguration); + } + + /** + * Get transaction refund settlement + * + *

Retrieve a specific refund settlement for a transaction by its unique identifier. + * + * @param transactionId The unique identifier of the transaction. + * @param settlementId The unique identifier of the refund settlement. + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public GetTransactionRefundSettlementResponse get(String transactionId, String settlementId) { + return get(transactionId, settlementId, JsonNullable.undefined(), + Optional.empty()); + } + + /** + * Get transaction refund settlement + * + *

Retrieve a specific refund settlement for a transaction by its unique identifier. + * + * @param transactionId The unique identifier of the transaction. + * @param settlementId The unique identifier of the refund settlement. + * @param merchantAccountId + * @param options additional options + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public GetTransactionRefundSettlementResponse get( + String transactionId, String settlementId, + JsonNullable merchantAccountId, Optional options) { + GetTransactionRefundSettlementRequest request = + GetTransactionRefundSettlementRequest + .builder() + .transactionId(transactionId) + .settlementId(settlementId) + .merchantAccountId(merchantAccountId) + .build(); + RequestOperation operation + = new GetTransactionRefundSettlement.Sync(sdkConfiguration, options, _headers); + return operation.handleResponse(operation.doRequest(request)); + } + + /** + * List transaction refund settlements + * + *

List all refund settlements for a specific transaction. + * + * @return The call builder + */ + public ListTransactionRefundSettlementsRequestBuilder list() { + return new ListTransactionRefundSettlementsRequestBuilder(sdkConfiguration); + } + + /** + * List transaction refund settlements + * + *

List all refund settlements for a specific transaction. + * + * @param transactionId The unique identifier of the transaction. + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public ListTransactionRefundSettlementsResponse list(String transactionId) { + return list(transactionId, JsonNullable.undefined(), Optional.empty()); + } + + /** + * List transaction refund settlements + * + *

List all refund settlements for a specific transaction. + * + * @param transactionId The unique identifier of the transaction. + * @param merchantAccountId + * @param options additional options + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public ListTransactionRefundSettlementsResponse list( + String transactionId, JsonNullable merchantAccountId, + Optional options) { + ListTransactionRefundSettlementsRequest request = + ListTransactionRefundSettlementsRequest + .builder() + .transactionId(transactionId) + .merchantAccountId(merchantAccountId) + .build(); + RequestOperation operation + = new ListTransactionRefundSettlements.Sync(sdkConfiguration, options, _headers); + return operation.handleResponse(operation.doRequest(request)); + } + +} diff --git a/src/main/java/com/gr4vy/sdk/SDKConfiguration.java b/src/main/java/com/gr4vy/sdk/SDKConfiguration.java index 40411439..f91edbcd 100644 --- a/src/main/java/com/gr4vy/sdk/SDKConfiguration.java +++ b/src/main/java/com/gr4vy/sdk/SDKConfiguration.java @@ -22,8 +22,8 @@ public class SDKConfiguration { private static final String LANGUAGE = "java"; public static final String OPENAPI_DOC_VERSION = "1.0.0"; - public static final String SDK_VERSION = "2.16.108"; - public static final String GEN_VERSION = "2.917.0"; + public static final String SDK_VERSION = "2.16.109"; + public static final String GEN_VERSION = "2.918.1"; private static final String BASE_PACKAGE = "com.gr4vy.sdk"; public static final String USER_AGENT = String.format("speakeasy-sdk/%s %s %s %s %s", diff --git a/src/main/java/com/gr4vy/sdk/Transactions.java b/src/main/java/com/gr4vy/sdk/Transactions.java index 777ef1d4..fa86c63a 100644 --- a/src/main/java/com/gr4vy/sdk/Transactions.java +++ b/src/main/java/com/gr4vy/sdk/Transactions.java @@ -55,6 +55,7 @@ public class Transactions { private final Actions actions; private final Events events; private final Settlements settlements; + private final RefundSettlements refundSettlements; private final Captures captures; Transactions(SDKConfiguration sdkConfiguration) { @@ -63,6 +64,7 @@ public class Transactions { this.actions = new Actions(this.sdkConfiguration); this.events = new Events(this.sdkConfiguration); this.settlements = new Settlements(this.sdkConfiguration); + this.refundSettlements = new RefundSettlements(this.sdkConfiguration); this.captures = new Captures(this.sdkConfiguration); this.asyncSDK = new AsyncTransactions(this, sdkConfiguration); } @@ -83,6 +85,10 @@ public final Settlements settlements() { return settlements; } + public final RefundSettlements refundSettlements() { + return refundSettlements; + } + public final Captures captures() { return captures; } diff --git a/src/main/java/com/gr4vy/sdk/models/components/RefundSettlement.java b/src/main/java/com/gr4vy/sdk/models/components/RefundSettlement.java new file mode 100644 index 00000000..c252dddd --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/RefundSettlement.java @@ -0,0 +1,887 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.utils.LazySingletonValue; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Double; +import java.lang.Long; +import java.lang.Override; +import java.lang.String; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * RefundSettlement + * + *

A settlement record for a refund on a transaction. + */ +public class RefundSettlement { + /** + * The unique identifier for the record. + */ + @JsonProperty("id") + private String id; + + /** + * The merchant account this record belongs to. + */ + @JsonProperty("merchant_account_id") + private String merchantAccountId; + + /** + * The date and time the record was created, in ISO 8601 format. + */ + @JsonProperty("created_at") + private OffsetDateTime createdAt; + + /** + * The date and time the record was last updated, in ISO 8601 format. + */ + @JsonProperty("updated_at") + private OffsetDateTime updatedAt; + + /** + * The date and time the record was posted, in ISO 8601 format. + */ + @JsonProperty("posted_at") + private OffsetDateTime postedAt; + + /** + * The date and time the record was ingested, in ISO 8601 format. + */ + @JsonProperty("ingested_at") + private OffsetDateTime ingestedAt; + + /** + * ISO 4217 currency code. + */ + @JsonProperty("currency") + private String currency; + + /** + * The total amount in the smallest currency unit (e.g. cents). + */ + @JsonProperty("amount") + private long amount; + + /** + * The exchange rate, if applicable. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("exchange_rate") + private JsonNullable exchangeRate; + + /** + * The commission amount deducted in the smallest currency unit. + */ + @JsonProperty("commission") + private long commission; + + /** + * The interchange fee, if applicable, in the smallest currency unit. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("interchange") + private JsonNullable interchange; + + /** + * The markup fee, if applicable, in the smallest currency unit. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("markup") + private JsonNullable markup; + + /** + * The scheme fee, if applicable, in the smallest currency unit. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("scheme_fee") + private JsonNullable schemeFee; + + /** + * The report ID from the payment service. + */ + @JsonProperty("payment_service_report_id") + private String paymentServiceReportId; + + /** + * List of file IDs for the payment service report. + */ + @JsonProperty("payment_service_report_file_ids") + private List paymentServiceReportFileIds; + + /** + * The transaction this record is associated with. + */ + @JsonProperty("transaction_id") + private String transactionId; + + /** + * Always `refund-settlement`. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("type") + private Optional type; + + /** + * The refund this settlement is associated with. + */ + @JsonProperty("refund_id") + private String refundId; + + @JsonCreator + public RefundSettlement( + @JsonProperty("id") String id, + @JsonProperty("merchant_account_id") String merchantAccountId, + @JsonProperty("created_at") OffsetDateTime createdAt, + @JsonProperty("updated_at") OffsetDateTime updatedAt, + @JsonProperty("posted_at") OffsetDateTime postedAt, + @JsonProperty("ingested_at") OffsetDateTime ingestedAt, + @JsonProperty("currency") String currency, + @JsonProperty("amount") long amount, + @JsonProperty("exchange_rate") JsonNullable exchangeRate, + @JsonProperty("commission") long commission, + @JsonProperty("interchange") JsonNullable interchange, + @JsonProperty("markup") JsonNullable markup, + @JsonProperty("scheme_fee") JsonNullable schemeFee, + @JsonProperty("payment_service_report_id") String paymentServiceReportId, + @JsonProperty("payment_service_report_file_ids") List paymentServiceReportFileIds, + @JsonProperty("transaction_id") String transactionId, + @JsonProperty("refund_id") String refundId) { + Utils.checkNotNull(id, "id"); + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + Utils.checkNotNull(createdAt, "createdAt"); + Utils.checkNotNull(updatedAt, "updatedAt"); + Utils.checkNotNull(postedAt, "postedAt"); + Utils.checkNotNull(ingestedAt, "ingestedAt"); + Utils.checkNotNull(currency, "currency"); + Utils.checkNotNull(amount, "amount"); + Utils.checkNotNull(exchangeRate, "exchangeRate"); + Utils.checkNotNull(commission, "commission"); + Utils.checkNotNull(interchange, "interchange"); + Utils.checkNotNull(markup, "markup"); + Utils.checkNotNull(schemeFee, "schemeFee"); + Utils.checkNotNull(paymentServiceReportId, "paymentServiceReportId"); + Utils.checkNotNull(paymentServiceReportFileIds, "paymentServiceReportFileIds"); + Utils.checkNotNull(transactionId, "transactionId"); + Utils.checkNotNull(refundId, "refundId"); + this.id = id; + this.merchantAccountId = merchantAccountId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.postedAt = postedAt; + this.ingestedAt = ingestedAt; + this.currency = currency; + this.amount = amount; + this.exchangeRate = exchangeRate; + this.commission = commission; + this.interchange = interchange; + this.markup = markup; + this.schemeFee = schemeFee; + this.paymentServiceReportId = paymentServiceReportId; + this.paymentServiceReportFileIds = paymentServiceReportFileIds; + this.transactionId = transactionId; + this.type = Builder._SINGLETON_VALUE_Type.value(); + this.refundId = refundId; + } + + public RefundSettlement( + String id, + String merchantAccountId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + OffsetDateTime postedAt, + OffsetDateTime ingestedAt, + String currency, + long amount, + long commission, + String paymentServiceReportId, + List paymentServiceReportFileIds, + String transactionId, + String refundId) { + this(id, merchantAccountId, createdAt, + updatedAt, postedAt, ingestedAt, + currency, amount, JsonNullable.undefined(), + commission, JsonNullable.undefined(), JsonNullable.undefined(), + JsonNullable.undefined(), paymentServiceReportId, paymentServiceReportFileIds, + transactionId, refundId); + } + + /** + * The unique identifier for the record. + */ + @JsonIgnore + public String id() { + return id; + } + + /** + * The merchant account this record belongs to. + */ + @JsonIgnore + public String merchantAccountId() { + return merchantAccountId; + } + + /** + * The date and time the record was created, in ISO 8601 format. + */ + @JsonIgnore + public OffsetDateTime createdAt() { + return createdAt; + } + + /** + * The date and time the record was last updated, in ISO 8601 format. + */ + @JsonIgnore + public OffsetDateTime updatedAt() { + return updatedAt; + } + + /** + * The date and time the record was posted, in ISO 8601 format. + */ + @JsonIgnore + public OffsetDateTime postedAt() { + return postedAt; + } + + /** + * The date and time the record was ingested, in ISO 8601 format. + */ + @JsonIgnore + public OffsetDateTime ingestedAt() { + return ingestedAt; + } + + /** + * ISO 4217 currency code. + */ + @JsonIgnore + public String currency() { + return currency; + } + + /** + * The total amount in the smallest currency unit (e.g. cents). + */ + @JsonIgnore + public long amount() { + return amount; + } + + /** + * The exchange rate, if applicable. + */ + @JsonIgnore + public JsonNullable exchangeRate() { + return exchangeRate; + } + + /** + * The commission amount deducted in the smallest currency unit. + */ + @JsonIgnore + public long commission() { + return commission; + } + + /** + * The interchange fee, if applicable, in the smallest currency unit. + */ + @JsonIgnore + public JsonNullable interchange() { + return interchange; + } + + /** + * The markup fee, if applicable, in the smallest currency unit. + */ + @JsonIgnore + public JsonNullable markup() { + return markup; + } + + /** + * The scheme fee, if applicable, in the smallest currency unit. + */ + @JsonIgnore + public JsonNullable schemeFee() { + return schemeFee; + } + + /** + * The report ID from the payment service. + */ + @JsonIgnore + public String paymentServiceReportId() { + return paymentServiceReportId; + } + + /** + * List of file IDs for the payment service report. + */ + @JsonIgnore + public List paymentServiceReportFileIds() { + return paymentServiceReportFileIds; + } + + /** + * The transaction this record is associated with. + */ + @JsonIgnore + public String transactionId() { + return transactionId; + } + + /** + * Always `refund-settlement`. + */ + @JsonIgnore + public Optional type() { + return type; + } + + /** + * The refund this settlement is associated with. + */ + @JsonIgnore + public String refundId() { + return refundId; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * The unique identifier for the record. + */ + public RefundSettlement withId(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + /** + * The merchant account this record belongs to. + */ + public RefundSettlement withMerchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + /** + * The date and time the record was created, in ISO 8601 format. + */ + public RefundSettlement withCreatedAt(OffsetDateTime createdAt) { + Utils.checkNotNull(createdAt, "createdAt"); + this.createdAt = createdAt; + return this; + } + + /** + * The date and time the record was last updated, in ISO 8601 format. + */ + public RefundSettlement withUpdatedAt(OffsetDateTime updatedAt) { + Utils.checkNotNull(updatedAt, "updatedAt"); + this.updatedAt = updatedAt; + return this; + } + + /** + * The date and time the record was posted, in ISO 8601 format. + */ + public RefundSettlement withPostedAt(OffsetDateTime postedAt) { + Utils.checkNotNull(postedAt, "postedAt"); + this.postedAt = postedAt; + return this; + } + + /** + * The date and time the record was ingested, in ISO 8601 format. + */ + public RefundSettlement withIngestedAt(OffsetDateTime ingestedAt) { + Utils.checkNotNull(ingestedAt, "ingestedAt"); + this.ingestedAt = ingestedAt; + return this; + } + + /** + * ISO 4217 currency code. + */ + public RefundSettlement withCurrency(String currency) { + Utils.checkNotNull(currency, "currency"); + this.currency = currency; + return this; + } + + /** + * The total amount in the smallest currency unit (e.g. cents). + */ + public RefundSettlement withAmount(long amount) { + Utils.checkNotNull(amount, "amount"); + this.amount = amount; + return this; + } + + /** + * The exchange rate, if applicable. + */ + public RefundSettlement withExchangeRate(double exchangeRate) { + Utils.checkNotNull(exchangeRate, "exchangeRate"); + this.exchangeRate = JsonNullable.of(exchangeRate); + return this; + } + + /** + * The exchange rate, if applicable. + */ + public RefundSettlement withExchangeRate(JsonNullable exchangeRate) { + Utils.checkNotNull(exchangeRate, "exchangeRate"); + this.exchangeRate = exchangeRate; + return this; + } + + /** + * The commission amount deducted in the smallest currency unit. + */ + public RefundSettlement withCommission(long commission) { + Utils.checkNotNull(commission, "commission"); + this.commission = commission; + return this; + } + + /** + * The interchange fee, if applicable, in the smallest currency unit. + */ + public RefundSettlement withInterchange(long interchange) { + Utils.checkNotNull(interchange, "interchange"); + this.interchange = JsonNullable.of(interchange); + return this; + } + + /** + * The interchange fee, if applicable, in the smallest currency unit. + */ + public RefundSettlement withInterchange(JsonNullable interchange) { + Utils.checkNotNull(interchange, "interchange"); + this.interchange = interchange; + return this; + } + + /** + * The markup fee, if applicable, in the smallest currency unit. + */ + public RefundSettlement withMarkup(long markup) { + Utils.checkNotNull(markup, "markup"); + this.markup = JsonNullable.of(markup); + return this; + } + + /** + * The markup fee, if applicable, in the smallest currency unit. + */ + public RefundSettlement withMarkup(JsonNullable markup) { + Utils.checkNotNull(markup, "markup"); + this.markup = markup; + return this; + } + + /** + * The scheme fee, if applicable, in the smallest currency unit. + */ + public RefundSettlement withSchemeFee(long schemeFee) { + Utils.checkNotNull(schemeFee, "schemeFee"); + this.schemeFee = JsonNullable.of(schemeFee); + return this; + } + + /** + * The scheme fee, if applicable, in the smallest currency unit. + */ + public RefundSettlement withSchemeFee(JsonNullable schemeFee) { + Utils.checkNotNull(schemeFee, "schemeFee"); + this.schemeFee = schemeFee; + return this; + } + + /** + * The report ID from the payment service. + */ + public RefundSettlement withPaymentServiceReportId(String paymentServiceReportId) { + Utils.checkNotNull(paymentServiceReportId, "paymentServiceReportId"); + this.paymentServiceReportId = paymentServiceReportId; + return this; + } + + /** + * List of file IDs for the payment service report. + */ + public RefundSettlement withPaymentServiceReportFileIds(List paymentServiceReportFileIds) { + Utils.checkNotNull(paymentServiceReportFileIds, "paymentServiceReportFileIds"); + this.paymentServiceReportFileIds = paymentServiceReportFileIds; + return this; + } + + /** + * The transaction this record is associated with. + */ + public RefundSettlement withTransactionId(String transactionId) { + Utils.checkNotNull(transactionId, "transactionId"); + this.transactionId = transactionId; + return this; + } + + /** + * The refund this settlement is associated with. + */ + public RefundSettlement withRefundId(String refundId) { + Utils.checkNotNull(refundId, "refundId"); + this.refundId = refundId; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundSettlement other = (RefundSettlement) o; + return + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.merchantAccountId, other.merchantAccountId) && + Utils.enhancedDeepEquals(this.createdAt, other.createdAt) && + Utils.enhancedDeepEquals(this.updatedAt, other.updatedAt) && + Utils.enhancedDeepEquals(this.postedAt, other.postedAt) && + Utils.enhancedDeepEquals(this.ingestedAt, other.ingestedAt) && + Utils.enhancedDeepEquals(this.currency, other.currency) && + Utils.enhancedDeepEquals(this.amount, other.amount) && + Utils.enhancedDeepEquals(this.exchangeRate, other.exchangeRate) && + Utils.enhancedDeepEquals(this.commission, other.commission) && + Utils.enhancedDeepEquals(this.interchange, other.interchange) && + Utils.enhancedDeepEquals(this.markup, other.markup) && + Utils.enhancedDeepEquals(this.schemeFee, other.schemeFee) && + Utils.enhancedDeepEquals(this.paymentServiceReportId, other.paymentServiceReportId) && + Utils.enhancedDeepEquals(this.paymentServiceReportFileIds, other.paymentServiceReportFileIds) && + Utils.enhancedDeepEquals(this.transactionId, other.transactionId) && + Utils.enhancedDeepEquals(this.type, other.type) && + Utils.enhancedDeepEquals(this.refundId, other.refundId); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + id, merchantAccountId, createdAt, + updatedAt, postedAt, ingestedAt, + currency, amount, exchangeRate, + commission, interchange, markup, + schemeFee, paymentServiceReportId, paymentServiceReportFileIds, + transactionId, type, refundId); + } + + @Override + public String toString() { + return Utils.toString(RefundSettlement.class, + "id", id, + "merchantAccountId", merchantAccountId, + "createdAt", createdAt, + "updatedAt", updatedAt, + "postedAt", postedAt, + "ingestedAt", ingestedAt, + "currency", currency, + "amount", amount, + "exchangeRate", exchangeRate, + "commission", commission, + "interchange", interchange, + "markup", markup, + "schemeFee", schemeFee, + "paymentServiceReportId", paymentServiceReportId, + "paymentServiceReportFileIds", paymentServiceReportFileIds, + "transactionId", transactionId, + "type", type, + "refundId", refundId); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String id; + + private String merchantAccountId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private OffsetDateTime postedAt; + + private OffsetDateTime ingestedAt; + + private String currency; + + private Long amount; + + private JsonNullable exchangeRate = JsonNullable.undefined(); + + private Long commission; + + private JsonNullable interchange = JsonNullable.undefined(); + + private JsonNullable markup = JsonNullable.undefined(); + + private JsonNullable schemeFee = JsonNullable.undefined(); + + private String paymentServiceReportId; + + private List paymentServiceReportFileIds; + + private String transactionId; + + private String refundId; + + private Builder() { + // force use of static builder() method + } + + + /** + * The unique identifier for the record. + */ + public Builder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + + /** + * The merchant account this record belongs to. + */ + public Builder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + + /** + * The date and time the record was created, in ISO 8601 format. + */ + public Builder createdAt(OffsetDateTime createdAt) { + Utils.checkNotNull(createdAt, "createdAt"); + this.createdAt = createdAt; + return this; + } + + + /** + * The date and time the record was last updated, in ISO 8601 format. + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + Utils.checkNotNull(updatedAt, "updatedAt"); + this.updatedAt = updatedAt; + return this; + } + + + /** + * The date and time the record was posted, in ISO 8601 format. + */ + public Builder postedAt(OffsetDateTime postedAt) { + Utils.checkNotNull(postedAt, "postedAt"); + this.postedAt = postedAt; + return this; + } + + + /** + * The date and time the record was ingested, in ISO 8601 format. + */ + public Builder ingestedAt(OffsetDateTime ingestedAt) { + Utils.checkNotNull(ingestedAt, "ingestedAt"); + this.ingestedAt = ingestedAt; + return this; + } + + + /** + * ISO 4217 currency code. + */ + public Builder currency(String currency) { + Utils.checkNotNull(currency, "currency"); + this.currency = currency; + return this; + } + + + /** + * The total amount in the smallest currency unit (e.g. cents). + */ + public Builder amount(long amount) { + Utils.checkNotNull(amount, "amount"); + this.amount = amount; + return this; + } + + + /** + * The exchange rate, if applicable. + */ + public Builder exchangeRate(double exchangeRate) { + Utils.checkNotNull(exchangeRate, "exchangeRate"); + this.exchangeRate = JsonNullable.of(exchangeRate); + return this; + } + + /** + * The exchange rate, if applicable. + */ + public Builder exchangeRate(JsonNullable exchangeRate) { + Utils.checkNotNull(exchangeRate, "exchangeRate"); + this.exchangeRate = exchangeRate; + return this; + } + + + /** + * The commission amount deducted in the smallest currency unit. + */ + public Builder commission(long commission) { + Utils.checkNotNull(commission, "commission"); + this.commission = commission; + return this; + } + + + /** + * The interchange fee, if applicable, in the smallest currency unit. + */ + public Builder interchange(long interchange) { + Utils.checkNotNull(interchange, "interchange"); + this.interchange = JsonNullable.of(interchange); + return this; + } + + /** + * The interchange fee, if applicable, in the smallest currency unit. + */ + public Builder interchange(JsonNullable interchange) { + Utils.checkNotNull(interchange, "interchange"); + this.interchange = interchange; + return this; + } + + + /** + * The markup fee, if applicable, in the smallest currency unit. + */ + public Builder markup(long markup) { + Utils.checkNotNull(markup, "markup"); + this.markup = JsonNullable.of(markup); + return this; + } + + /** + * The markup fee, if applicable, in the smallest currency unit. + */ + public Builder markup(JsonNullable markup) { + Utils.checkNotNull(markup, "markup"); + this.markup = markup; + return this; + } + + + /** + * The scheme fee, if applicable, in the smallest currency unit. + */ + public Builder schemeFee(long schemeFee) { + Utils.checkNotNull(schemeFee, "schemeFee"); + this.schemeFee = JsonNullable.of(schemeFee); + return this; + } + + /** + * The scheme fee, if applicable, in the smallest currency unit. + */ + public Builder schemeFee(JsonNullable schemeFee) { + Utils.checkNotNull(schemeFee, "schemeFee"); + this.schemeFee = schemeFee; + return this; + } + + + /** + * The report ID from the payment service. + */ + public Builder paymentServiceReportId(String paymentServiceReportId) { + Utils.checkNotNull(paymentServiceReportId, "paymentServiceReportId"); + this.paymentServiceReportId = paymentServiceReportId; + return this; + } + + + /** + * List of file IDs for the payment service report. + */ + public Builder paymentServiceReportFileIds(List paymentServiceReportFileIds) { + Utils.checkNotNull(paymentServiceReportFileIds, "paymentServiceReportFileIds"); + this.paymentServiceReportFileIds = paymentServiceReportFileIds; + return this; + } + + + /** + * The transaction this record is associated with. + */ + public Builder transactionId(String transactionId) { + Utils.checkNotNull(transactionId, "transactionId"); + this.transactionId = transactionId; + return this; + } + + + /** + * The refund this settlement is associated with. + */ + public Builder refundId(String refundId) { + Utils.checkNotNull(refundId, "refundId"); + this.refundId = refundId; + return this; + } + + public RefundSettlement build() { + + return new RefundSettlement( + id, merchantAccountId, createdAt, + updatedAt, postedAt, ingestedAt, + currency, amount, exchangeRate, + commission, interchange, markup, + schemeFee, paymentServiceReportId, paymentServiceReportFileIds, + transactionId, refundId); + } + + + private static final LazySingletonValue> _SINGLETON_VALUE_Type = + new LazySingletonValue<>( + "type", + "\"refund-settlement\"", + new TypeReference>() {}); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/components/RefundSettlements.java b/src/main/java/com/gr4vy/sdk/models/components/RefundSettlements.java new file mode 100644 index 00000000..b46e6177 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/RefundSettlements.java @@ -0,0 +1,106 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.util.List; + +/** + * RefundSettlements + * + *

A list of settlement records for the refunds on a transaction. + */ +public class RefundSettlements { + /** + * The list of refund settlement objects. + */ + @JsonProperty("items") + private List items; + + @JsonCreator + public RefundSettlements( + @JsonProperty("items") List items) { + Utils.checkNotNull(items, "items"); + this.items = items; + } + + /** + * The list of refund settlement objects. + */ + @JsonIgnore + public List items() { + return items; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * The list of refund settlement objects. + */ + public RefundSettlements withItems(List items) { + Utils.checkNotNull(items, "items"); + this.items = items; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundSettlements other = (RefundSettlements) o; + return + Utils.enhancedDeepEquals(this.items, other.items); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + items); + } + + @Override + public String toString() { + return Utils.toString(RefundSettlements.class, + "items", items); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private List items; + + private Builder() { + // force use of static builder() method + } + + + /** + * The list of refund settlement objects. + */ + public Builder items(List items) { + Utils.checkNotNull(items, "items"); + this.items = items; + return this; + } + + public RefundSettlements build() { + + return new RefundSettlements( + items); + } + + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/GetTransactionRefundSettlementRequest.java b/src/main/java/com/gr4vy/sdk/models/operations/GetTransactionRefundSettlementRequest.java new file mode 100644 index 00000000..b1f53bee --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/GetTransactionRefundSettlementRequest.java @@ -0,0 +1,206 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.utils.SpeakeasyMetadata; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Override; +import java.lang.String; +import org.openapitools.jackson.nullable.JsonNullable; + + +public class GetTransactionRefundSettlementRequest { + /** + * The unique identifier of the transaction. + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=transaction_id") + private String transactionId; + + /** + * The unique identifier of the refund settlement. + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=settlement_id") + private String settlementId; + + /** + * The ID of the merchant account to use for this request. + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=x-gr4vy-merchant-account-id") + private JsonNullable merchantAccountId; + + @JsonCreator + public GetTransactionRefundSettlementRequest( + String transactionId, + String settlementId, + JsonNullable merchantAccountId) { + Utils.checkNotNull(transactionId, "transactionId"); + Utils.checkNotNull(settlementId, "settlementId"); + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.transactionId = transactionId; + this.settlementId = settlementId; + this.merchantAccountId = merchantAccountId; + } + + public GetTransactionRefundSettlementRequest( + String transactionId, + String settlementId) { + this(transactionId, settlementId, JsonNullable.undefined()); + } + + /** + * The unique identifier of the transaction. + */ + @JsonIgnore + public String transactionId() { + return transactionId; + } + + /** + * The unique identifier of the refund settlement. + */ + @JsonIgnore + public String settlementId() { + return settlementId; + } + + /** + * The ID of the merchant account to use for this request. + */ + @JsonIgnore + public JsonNullable merchantAccountId() { + return merchantAccountId; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * The unique identifier of the transaction. + */ + public GetTransactionRefundSettlementRequest withTransactionId(String transactionId) { + Utils.checkNotNull(transactionId, "transactionId"); + this.transactionId = transactionId; + return this; + } + + /** + * The unique identifier of the refund settlement. + */ + public GetTransactionRefundSettlementRequest withSettlementId(String settlementId) { + Utils.checkNotNull(settlementId, "settlementId"); + this.settlementId = settlementId; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public GetTransactionRefundSettlementRequest withMerchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public GetTransactionRefundSettlementRequest withMerchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetTransactionRefundSettlementRequest other = (GetTransactionRefundSettlementRequest) o; + return + Utils.enhancedDeepEquals(this.transactionId, other.transactionId) && + Utils.enhancedDeepEquals(this.settlementId, other.settlementId) && + Utils.enhancedDeepEquals(this.merchantAccountId, other.merchantAccountId); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + transactionId, settlementId, merchantAccountId); + } + + @Override + public String toString() { + return Utils.toString(GetTransactionRefundSettlementRequest.class, + "transactionId", transactionId, + "settlementId", settlementId, + "merchantAccountId", merchantAccountId); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String transactionId; + + private String settlementId; + + private JsonNullable merchantAccountId = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + + /** + * The unique identifier of the transaction. + */ + public Builder transactionId(String transactionId) { + Utils.checkNotNull(transactionId, "transactionId"); + this.transactionId = transactionId; + return this; + } + + + /** + * The unique identifier of the refund settlement. + */ + public Builder settlementId(String settlementId) { + Utils.checkNotNull(settlementId, "settlementId"); + this.settlementId = settlementId; + return this; + } + + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public GetTransactionRefundSettlementRequest build() { + + return new GetTransactionRefundSettlementRequest( + transactionId, settlementId, merchantAccountId); + } + + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/GetTransactionRefundSettlementRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/GetTransactionRefundSettlementRequestBuilder.java new file mode 100644 index 00000000..d66ef561 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/GetTransactionRefundSettlementRequestBuilder.java @@ -0,0 +1,88 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import static com.gr4vy.sdk.operations.Operations.RequestOperation; + +import com.gr4vy.sdk.SDKConfiguration; +import com.gr4vy.sdk.operations.GetTransactionRefundSettlement; +import com.gr4vy.sdk.utils.Headers; +import com.gr4vy.sdk.utils.Options; +import com.gr4vy.sdk.utils.RetryConfig; +import com.gr4vy.sdk.utils.Utils; +import java.lang.String; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +public class GetTransactionRefundSettlementRequestBuilder { + + private String transactionId; + private String settlementId; + private JsonNullable merchantAccountId = JsonNullable.undefined(); + private Optional retryConfig = Optional.empty(); + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetTransactionRefundSettlementRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetTransactionRefundSettlementRequestBuilder transactionId(String transactionId) { + Utils.checkNotNull(transactionId, "transactionId"); + this.transactionId = transactionId; + return this; + } + + public GetTransactionRefundSettlementRequestBuilder settlementId(String settlementId) { + Utils.checkNotNull(settlementId, "settlementId"); + this.settlementId = settlementId; + return this; + } + + public GetTransactionRefundSettlementRequestBuilder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + public GetTransactionRefundSettlementRequestBuilder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public GetTransactionRefundSettlementRequestBuilder retryConfig(RetryConfig retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = Optional.of(retryConfig); + return this; + } + + public GetTransactionRefundSettlementRequestBuilder retryConfig(Optional retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = retryConfig; + return this; + } + + + private GetTransactionRefundSettlementRequest buildRequest() { + + GetTransactionRefundSettlementRequest request = new GetTransactionRefundSettlementRequest(transactionId, + settlementId, + merchantAccountId); + + return request; + } + + public GetTransactionRefundSettlementResponse call() { + Optional options = Optional.of(Options.builder() + .retryConfig(retryConfig) + .build()); + + RequestOperation operation + = new GetTransactionRefundSettlement.Sync(sdkConfiguration, options, _headers); + GetTransactionRefundSettlementRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/GetTransactionRefundSettlementResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/GetTransactionRefundSettlementResponse.java new file mode 100644 index 00000000..060f067b --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/GetTransactionRefundSettlementResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.models.components.RefundSettlement; +import com.gr4vy.sdk.utils.Response; +import com.gr4vy.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; + + +public class GetTransactionRefundSettlementResponse implements Response { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Successful Response + */ + private Optional refundSettlement; + + @JsonCreator + public GetTransactionRefundSettlementResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional refundSettlement) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(refundSettlement, "refundSettlement"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.refundSettlement = refundSettlement; + } + + public GetTransactionRefundSettlementResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Successful Response + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional refundSettlement() { + return (Optional) refundSettlement; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetTransactionRefundSettlementResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetTransactionRefundSettlementResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetTransactionRefundSettlementResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public GetTransactionRefundSettlementResponse withRefundSettlement(RefundSettlement refundSettlement) { + Utils.checkNotNull(refundSettlement, "refundSettlement"); + this.refundSettlement = Optional.ofNullable(refundSettlement); + return this; + } + + + /** + * Successful Response + */ + public GetTransactionRefundSettlementResponse withRefundSettlement(Optional refundSettlement) { + Utils.checkNotNull(refundSettlement, "refundSettlement"); + this.refundSettlement = refundSettlement; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetTransactionRefundSettlementResponse other = (GetTransactionRefundSettlementResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.refundSettlement, other.refundSettlement); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + refundSettlement); + } + + @Override + public String toString() { + return Utils.toString(GetTransactionRefundSettlementResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "refundSettlement", refundSettlement); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional refundSettlement = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Successful Response + */ + public Builder refundSettlement(RefundSettlement refundSettlement) { + Utils.checkNotNull(refundSettlement, "refundSettlement"); + this.refundSettlement = Optional.ofNullable(refundSettlement); + return this; + } + + /** + * Successful Response + */ + public Builder refundSettlement(Optional refundSettlement) { + Utils.checkNotNull(refundSettlement, "refundSettlement"); + this.refundSettlement = refundSettlement; + return this; + } + + public GetTransactionRefundSettlementResponse build() { + + return new GetTransactionRefundSettlementResponse( + contentType, statusCode, rawResponse, + refundSettlement); + } + + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ListTransactionRefundSettlementsRequest.java b/src/main/java/com/gr4vy/sdk/models/operations/ListTransactionRefundSettlementsRequest.java new file mode 100644 index 00000000..6017bb78 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/ListTransactionRefundSettlementsRequest.java @@ -0,0 +1,165 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.utils.SpeakeasyMetadata; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Override; +import java.lang.String; +import org.openapitools.jackson.nullable.JsonNullable; + + +public class ListTransactionRefundSettlementsRequest { + /** + * The unique identifier of the transaction. + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=transaction_id") + private String transactionId; + + /** + * The ID of the merchant account to use for this request. + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=x-gr4vy-merchant-account-id") + private JsonNullable merchantAccountId; + + @JsonCreator + public ListTransactionRefundSettlementsRequest( + String transactionId, + JsonNullable merchantAccountId) { + Utils.checkNotNull(transactionId, "transactionId"); + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.transactionId = transactionId; + this.merchantAccountId = merchantAccountId; + } + + public ListTransactionRefundSettlementsRequest( + String transactionId) { + this(transactionId, JsonNullable.undefined()); + } + + /** + * The unique identifier of the transaction. + */ + @JsonIgnore + public String transactionId() { + return transactionId; + } + + /** + * The ID of the merchant account to use for this request. + */ + @JsonIgnore + public JsonNullable merchantAccountId() { + return merchantAccountId; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * The unique identifier of the transaction. + */ + public ListTransactionRefundSettlementsRequest withTransactionId(String transactionId) { + Utils.checkNotNull(transactionId, "transactionId"); + this.transactionId = transactionId; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public ListTransactionRefundSettlementsRequest withMerchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public ListTransactionRefundSettlementsRequest withMerchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListTransactionRefundSettlementsRequest other = (ListTransactionRefundSettlementsRequest) o; + return + Utils.enhancedDeepEquals(this.transactionId, other.transactionId) && + Utils.enhancedDeepEquals(this.merchantAccountId, other.merchantAccountId); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + transactionId, merchantAccountId); + } + + @Override + public String toString() { + return Utils.toString(ListTransactionRefundSettlementsRequest.class, + "transactionId", transactionId, + "merchantAccountId", merchantAccountId); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String transactionId; + + private JsonNullable merchantAccountId = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + + /** + * The unique identifier of the transaction. + */ + public Builder transactionId(String transactionId) { + Utils.checkNotNull(transactionId, "transactionId"); + this.transactionId = transactionId; + return this; + } + + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public ListTransactionRefundSettlementsRequest build() { + + return new ListTransactionRefundSettlementsRequest( + transactionId, merchantAccountId); + } + + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ListTransactionRefundSettlementsRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/ListTransactionRefundSettlementsRequestBuilder.java new file mode 100644 index 00000000..ac6b5212 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/ListTransactionRefundSettlementsRequestBuilder.java @@ -0,0 +1,80 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import static com.gr4vy.sdk.operations.Operations.RequestOperation; + +import com.gr4vy.sdk.SDKConfiguration; +import com.gr4vy.sdk.operations.ListTransactionRefundSettlements; +import com.gr4vy.sdk.utils.Headers; +import com.gr4vy.sdk.utils.Options; +import com.gr4vy.sdk.utils.RetryConfig; +import com.gr4vy.sdk.utils.Utils; +import java.lang.String; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +public class ListTransactionRefundSettlementsRequestBuilder { + + private String transactionId; + private JsonNullable merchantAccountId = JsonNullable.undefined(); + private Optional retryConfig = Optional.empty(); + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public ListTransactionRefundSettlementsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public ListTransactionRefundSettlementsRequestBuilder transactionId(String transactionId) { + Utils.checkNotNull(transactionId, "transactionId"); + this.transactionId = transactionId; + return this; + } + + public ListTransactionRefundSettlementsRequestBuilder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + public ListTransactionRefundSettlementsRequestBuilder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public ListTransactionRefundSettlementsRequestBuilder retryConfig(RetryConfig retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = Optional.of(retryConfig); + return this; + } + + public ListTransactionRefundSettlementsRequestBuilder retryConfig(Optional retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = retryConfig; + return this; + } + + + private ListTransactionRefundSettlementsRequest buildRequest() { + + ListTransactionRefundSettlementsRequest request = new ListTransactionRefundSettlementsRequest(transactionId, + merchantAccountId); + + return request; + } + + public ListTransactionRefundSettlementsResponse call() { + Optional options = Optional.of(Options.builder() + .retryConfig(retryConfig) + .build()); + + RequestOperation operation + = new ListTransactionRefundSettlements.Sync(sdkConfiguration, options, _headers); + ListTransactionRefundSettlementsRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ListTransactionRefundSettlementsResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/ListTransactionRefundSettlementsResponse.java new file mode 100644 index 00000000..1733f84e --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/ListTransactionRefundSettlementsResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.models.components.RefundSettlements; +import com.gr4vy.sdk.utils.Response; +import com.gr4vy.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; + + +public class ListTransactionRefundSettlementsResponse implements Response { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Successful Response + */ + private Optional refundSettlements; + + @JsonCreator + public ListTransactionRefundSettlementsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional refundSettlements) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(refundSettlements, "refundSettlements"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.refundSettlements = refundSettlements; + } + + public ListTransactionRefundSettlementsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Successful Response + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional refundSettlements() { + return (Optional) refundSettlements; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public ListTransactionRefundSettlementsResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public ListTransactionRefundSettlementsResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public ListTransactionRefundSettlementsResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public ListTransactionRefundSettlementsResponse withRefundSettlements(RefundSettlements refundSettlements) { + Utils.checkNotNull(refundSettlements, "refundSettlements"); + this.refundSettlements = Optional.ofNullable(refundSettlements); + return this; + } + + + /** + * Successful Response + */ + public ListTransactionRefundSettlementsResponse withRefundSettlements(Optional refundSettlements) { + Utils.checkNotNull(refundSettlements, "refundSettlements"); + this.refundSettlements = refundSettlements; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListTransactionRefundSettlementsResponse other = (ListTransactionRefundSettlementsResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.refundSettlements, other.refundSettlements); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + refundSettlements); + } + + @Override + public String toString() { + return Utils.toString(ListTransactionRefundSettlementsResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "refundSettlements", refundSettlements); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional refundSettlements = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Successful Response + */ + public Builder refundSettlements(RefundSettlements refundSettlements) { + Utils.checkNotNull(refundSettlements, "refundSettlements"); + this.refundSettlements = Optional.ofNullable(refundSettlements); + return this; + } + + /** + * Successful Response + */ + public Builder refundSettlements(Optional refundSettlements) { + Utils.checkNotNull(refundSettlements, "refundSettlements"); + this.refundSettlements = refundSettlements; + return this; + } + + public ListTransactionRefundSettlementsResponse build() { + + return new ListTransactionRefundSettlementsResponse( + contentType, statusCode, rawResponse, + refundSettlements); + } + + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/async/GetTransactionRefundSettlementRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/async/GetTransactionRefundSettlementRequestBuilder.java new file mode 100644 index 00000000..a9d760b4 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/async/GetTransactionRefundSettlementRequestBuilder.java @@ -0,0 +1,93 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations.async; + +import static com.gr4vy.sdk.operations.Operations.AsyncRequestOperation; + +import com.gr4vy.sdk.SDKConfiguration; +import com.gr4vy.sdk.models.operations.GetTransactionRefundSettlementRequest; +import com.gr4vy.sdk.operations.GetTransactionRefundSettlement; +import com.gr4vy.sdk.utils.Headers; +import com.gr4vy.sdk.utils.Options; +import com.gr4vy.sdk.utils.RetryConfig; +import com.gr4vy.sdk.utils.Utils; +import java.lang.String; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import org.openapitools.jackson.nullable.JsonNullable; + +public class GetTransactionRefundSettlementRequestBuilder { + + private String transactionId; + private String settlementId; + private JsonNullable merchantAccountId = JsonNullable.undefined(); + private Optional retryConfig = Optional.empty(); + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetTransactionRefundSettlementRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetTransactionRefundSettlementRequestBuilder transactionId(String transactionId) { + Utils.checkNotNull(transactionId, "transactionId"); + this.transactionId = transactionId; + return this; + } + + public GetTransactionRefundSettlementRequestBuilder settlementId(String settlementId) { + Utils.checkNotNull(settlementId, "settlementId"); + this.settlementId = settlementId; + return this; + } + + public GetTransactionRefundSettlementRequestBuilder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + public GetTransactionRefundSettlementRequestBuilder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public GetTransactionRefundSettlementRequestBuilder retryConfig(RetryConfig retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = Optional.of(retryConfig); + return this; + } + + public GetTransactionRefundSettlementRequestBuilder retryConfig(Optional retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = retryConfig; + return this; + } + + + private GetTransactionRefundSettlementRequest buildRequest() { + + GetTransactionRefundSettlementRequest request = new GetTransactionRefundSettlementRequest(transactionId, + settlementId, + merchantAccountId); + + return request; + } + + public CompletableFuture call() { + Optional options = Optional.of(Options.builder() + .retryConfig(retryConfig) + .build()); + + AsyncRequestOperation operation + = new GetTransactionRefundSettlement.Async( + sdkConfiguration, options, sdkConfiguration.retryScheduler(), + _headers); + GetTransactionRefundSettlementRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/async/GetTransactionRefundSettlementResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/async/GetTransactionRefundSettlementResponse.java new file mode 100644 index 00000000..81235026 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/async/GetTransactionRefundSettlementResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.models.components.RefundSettlement; +import com.gr4vy.sdk.utils.AsyncResponse; +import com.gr4vy.sdk.utils.Blob; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; + + +public class GetTransactionRefundSettlementResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Successful Response + */ + private Optional refundSettlement; + + @JsonCreator + public GetTransactionRefundSettlementResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional refundSettlement) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(refundSettlement, "refundSettlement"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.refundSettlement = refundSettlement; + } + + public GetTransactionRefundSettlementResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Successful Response + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional refundSettlement() { + return (Optional) refundSettlement; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetTransactionRefundSettlementResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetTransactionRefundSettlementResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetTransactionRefundSettlementResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public GetTransactionRefundSettlementResponse withRefundSettlement(RefundSettlement refundSettlement) { + Utils.checkNotNull(refundSettlement, "refundSettlement"); + this.refundSettlement = Optional.ofNullable(refundSettlement); + return this; + } + + + /** + * Successful Response + */ + public GetTransactionRefundSettlementResponse withRefundSettlement(Optional refundSettlement) { + Utils.checkNotNull(refundSettlement, "refundSettlement"); + this.refundSettlement = refundSettlement; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetTransactionRefundSettlementResponse other = (GetTransactionRefundSettlementResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.refundSettlement, other.refundSettlement); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + refundSettlement); + } + + @Override + public String toString() { + return Utils.toString(GetTransactionRefundSettlementResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "refundSettlement", refundSettlement); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional refundSettlement = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Successful Response + */ + public Builder refundSettlement(RefundSettlement refundSettlement) { + Utils.checkNotNull(refundSettlement, "refundSettlement"); + this.refundSettlement = Optional.ofNullable(refundSettlement); + return this; + } + + /** + * Successful Response + */ + public Builder refundSettlement(Optional refundSettlement) { + Utils.checkNotNull(refundSettlement, "refundSettlement"); + this.refundSettlement = refundSettlement; + return this; + } + + public GetTransactionRefundSettlementResponse build() { + + return new GetTransactionRefundSettlementResponse( + contentType, statusCode, rawResponse, + refundSettlement); + } + + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/async/ListTransactionRefundSettlementsRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/async/ListTransactionRefundSettlementsRequestBuilder.java new file mode 100644 index 00000000..eba03373 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/async/ListTransactionRefundSettlementsRequestBuilder.java @@ -0,0 +1,85 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations.async; + +import static com.gr4vy.sdk.operations.Operations.AsyncRequestOperation; + +import com.gr4vy.sdk.SDKConfiguration; +import com.gr4vy.sdk.models.operations.ListTransactionRefundSettlementsRequest; +import com.gr4vy.sdk.operations.ListTransactionRefundSettlements; +import com.gr4vy.sdk.utils.Headers; +import com.gr4vy.sdk.utils.Options; +import com.gr4vy.sdk.utils.RetryConfig; +import com.gr4vy.sdk.utils.Utils; +import java.lang.String; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import org.openapitools.jackson.nullable.JsonNullable; + +public class ListTransactionRefundSettlementsRequestBuilder { + + private String transactionId; + private JsonNullable merchantAccountId = JsonNullable.undefined(); + private Optional retryConfig = Optional.empty(); + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public ListTransactionRefundSettlementsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public ListTransactionRefundSettlementsRequestBuilder transactionId(String transactionId) { + Utils.checkNotNull(transactionId, "transactionId"); + this.transactionId = transactionId; + return this; + } + + public ListTransactionRefundSettlementsRequestBuilder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + public ListTransactionRefundSettlementsRequestBuilder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public ListTransactionRefundSettlementsRequestBuilder retryConfig(RetryConfig retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = Optional.of(retryConfig); + return this; + } + + public ListTransactionRefundSettlementsRequestBuilder retryConfig(Optional retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = retryConfig; + return this; + } + + + private ListTransactionRefundSettlementsRequest buildRequest() { + + ListTransactionRefundSettlementsRequest request = new ListTransactionRefundSettlementsRequest(transactionId, + merchantAccountId); + + return request; + } + + public CompletableFuture call() { + Optional options = Optional.of(Options.builder() + .retryConfig(retryConfig) + .build()); + + AsyncRequestOperation operation + = new ListTransactionRefundSettlements.Async( + sdkConfiguration, options, sdkConfiguration.retryScheduler(), + _headers); + ListTransactionRefundSettlementsRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/async/ListTransactionRefundSettlementsResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/async/ListTransactionRefundSettlementsResponse.java new file mode 100644 index 00000000..1e3fe207 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/async/ListTransactionRefundSettlementsResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.models.components.RefundSettlements; +import com.gr4vy.sdk.utils.AsyncResponse; +import com.gr4vy.sdk.utils.Blob; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; + + +public class ListTransactionRefundSettlementsResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Successful Response + */ + private Optional refundSettlements; + + @JsonCreator + public ListTransactionRefundSettlementsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional refundSettlements) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(refundSettlements, "refundSettlements"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.refundSettlements = refundSettlements; + } + + public ListTransactionRefundSettlementsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Successful Response + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional refundSettlements() { + return (Optional) refundSettlements; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public ListTransactionRefundSettlementsResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public ListTransactionRefundSettlementsResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public ListTransactionRefundSettlementsResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public ListTransactionRefundSettlementsResponse withRefundSettlements(RefundSettlements refundSettlements) { + Utils.checkNotNull(refundSettlements, "refundSettlements"); + this.refundSettlements = Optional.ofNullable(refundSettlements); + return this; + } + + + /** + * Successful Response + */ + public ListTransactionRefundSettlementsResponse withRefundSettlements(Optional refundSettlements) { + Utils.checkNotNull(refundSettlements, "refundSettlements"); + this.refundSettlements = refundSettlements; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListTransactionRefundSettlementsResponse other = (ListTransactionRefundSettlementsResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.refundSettlements, other.refundSettlements); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + refundSettlements); + } + + @Override + public String toString() { + return Utils.toString(ListTransactionRefundSettlementsResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "refundSettlements", refundSettlements); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional refundSettlements = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Successful Response + */ + public Builder refundSettlements(RefundSettlements refundSettlements) { + Utils.checkNotNull(refundSettlements, "refundSettlements"); + this.refundSettlements = Optional.ofNullable(refundSettlements); + return this; + } + + /** + * Successful Response + */ + public Builder refundSettlements(Optional refundSettlements) { + Utils.checkNotNull(refundSettlements, "refundSettlements"); + this.refundSettlements = refundSettlements; + return this; + } + + public ListTransactionRefundSettlementsResponse build() { + + return new ListTransactionRefundSettlementsResponse( + contentType, statusCode, rawResponse, + refundSettlements); + } + + } +} diff --git a/src/main/java/com/gr4vy/sdk/operations/GetTransactionRefundSettlement.java b/src/main/java/com/gr4vy/sdk/operations/GetTransactionRefundSettlement.java new file mode 100644 index 00000000..f22332b2 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/operations/GetTransactionRefundSettlement.java @@ -0,0 +1,493 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.operations; + +import static com.gr4vy.sdk.operations.Operations.RequestOperation; +import static com.gr4vy.sdk.utils.Exceptions.unchecked; +import static com.gr4vy.sdk.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.SDKConfiguration; +import com.gr4vy.sdk.SecuritySource; +import com.gr4vy.sdk.models.components.RefundSettlement; +import com.gr4vy.sdk.models.errors.APIException; +import com.gr4vy.sdk.models.errors.Error400; +import com.gr4vy.sdk.models.errors.Error401; +import com.gr4vy.sdk.models.errors.Error403; +import com.gr4vy.sdk.models.errors.Error404; +import com.gr4vy.sdk.models.errors.Error405; +import com.gr4vy.sdk.models.errors.Error409; +import com.gr4vy.sdk.models.errors.Error425; +import com.gr4vy.sdk.models.errors.Error429; +import com.gr4vy.sdk.models.errors.Error500; +import com.gr4vy.sdk.models.errors.Error502; +import com.gr4vy.sdk.models.errors.Error504; +import com.gr4vy.sdk.models.errors.HTTPValidationError; +import com.gr4vy.sdk.models.operations.GetTransactionRefundSettlementRequest; +import com.gr4vy.sdk.models.operations.GetTransactionRefundSettlementResponse; +import com.gr4vy.sdk.utils.AsyncRetries; +import com.gr4vy.sdk.utils.BackoffStrategy; +import com.gr4vy.sdk.utils.Blob; +import com.gr4vy.sdk.utils.Globals; +import com.gr4vy.sdk.utils.HTTPClient; +import com.gr4vy.sdk.utils.HTTPRequest; +import com.gr4vy.sdk.utils.Headers; +import com.gr4vy.sdk.utils.Hook.AfterErrorContextImpl; +import com.gr4vy.sdk.utils.Hook.AfterSuccessContextImpl; +import com.gr4vy.sdk.utils.Hook.BeforeRequestContextImpl; +import com.gr4vy.sdk.utils.NonRetryableException; +import com.gr4vy.sdk.utils.Options; +import com.gr4vy.sdk.utils.Retries; +import com.gr4vy.sdk.utils.RetryConfig; +import com.gr4vy.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.function.Function; + + +public class GetTransactionRefundSettlement { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final List retryStatusCodes; + final RetryConfig retryConfig; + final HTTPClient client; + final Headers _headers; + final Globals operationGlobals; + + public Base( + SDKConfiguration sdkConfiguration, Optional options, + Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = Utils.templateUrl( + this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); + this.securitySource = this.sdkConfiguration.securitySource(); + options + .ifPresent(o -> o.validate(List.of(Options.Option.RETRY_CONFIG))); + this.retryStatusCodes = List.of("5XX"); + this.retryConfig = options + .flatMap(Options::retryConfig) + .or(sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder().backoff(BackoffStrategy.builder() + .initialInterval(200, TimeUnit.MILLISECONDS) + .maxInterval(200, TimeUnit.MILLISECONDS) + .baseFactor((double) (1)) + .maxElapsedTime(1000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) + .build()); + this.client = this.sdkConfiguration.client(); + this.operationGlobals = new Globals(); + this.sdkConfiguration.globals.getParam("header", "x-gr4vy-merchant-account-id") + .ifPresent(param -> operationGlobals.putParam("header", "x-gr4vy-merchant-account-id", param)); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "get_transaction_refund_settlement", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "get_transaction_refund_settlement", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "get_transaction_refund_settlement", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/transactions/{transaction_id}/refund-settlements/{settlement_id}", + request, this.operationGlobals); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + req.addHeaders(Utils.getHeadersFromMetadata(request, this.operationGlobals)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync( + SDKConfiguration sdkConfiguration, Optional options, + Headers _headers) { + super( + sdkConfiguration, options, + _headers); + } + + private HttpRequest onBuildRequest(GetTransactionRefundSettlementRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetTransactionRefundSettlementRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetTransactionRefundSettlementRequest request) { + Retries retries = Retries.builder() + .action(() -> { + HttpRequest r; + try { + r = onBuildRequest(request); + } catch (Exception e) { + throw new NonRetryableException(e); + } + try { + HttpResponse httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + return onError(httpRes, null); + } + return httpRes; + } catch (Exception e) { + return onError(null, e); + } + }) + .retryConfig(retryConfig) + .statusCodes(retryStatusCodes) + .build(); + return unchecked(() -> onSuccess(retries.run())).get(); + } + + + @Override + public GetTransactionRefundSettlementResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetTransactionRefundSettlementResponse.Builder resBuilder = + GetTransactionRefundSettlementResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetTransactionRefundSettlementResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withRefundSettlement(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "400")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error400.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "401")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error401.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "403")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error403.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "404")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error404.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "405")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error405.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "409")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error409.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "422")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw HTTPValidationError.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "425")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error425.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "429")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error429.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "500")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error500.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "502")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error502.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "504")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error504.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw APIException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw APIException.from("API error occurred", response); + } + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + private final ScheduledExecutorService retryScheduler; + + public Async( + SDKConfiguration sdkConfiguration, Optional options, + ScheduledExecutorService retryScheduler, Headers _headers) { + super( + sdkConfiguration, options, + _headers); + this.retryScheduler = retryScheduler; + } + + private CompletableFuture onBuildRequest(GetTransactionRefundSettlementRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetTransactionRefundSettlementRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetTransactionRefundSettlementRequest request) { + AsyncRetries retries = AsyncRetries.builder() + .retryConfig(retryConfig) + .statusCodes(retryStatusCodes) + .scheduler(retryScheduler) + .build(); + return retries.retry(() -> unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + com.gr4vy.sdk.models.operations.async.GetTransactionRefundSettlementResponse.Builder resBuilder = + com.gr4vy.sdk.models.operations.async.GetTransactionRefundSettlementResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + com.gr4vy.sdk.models.operations.async.GetTransactionRefundSettlementResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withRefundSettlement); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "400")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error400.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "401")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error401.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "403")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error403.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "404")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error404.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "405")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error405.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "409")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error409.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "422")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return HTTPValidationError.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "425")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error425.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "429")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error429.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "500")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error500.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "502")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error502.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "504")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error504.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/operations/ListTransactionRefundSettlements.java b/src/main/java/com/gr4vy/sdk/operations/ListTransactionRefundSettlements.java new file mode 100644 index 00000000..6f9eeda7 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/operations/ListTransactionRefundSettlements.java @@ -0,0 +1,493 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.operations; + +import static com.gr4vy.sdk.operations.Operations.RequestOperation; +import static com.gr4vy.sdk.utils.Exceptions.unchecked; +import static com.gr4vy.sdk.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.SDKConfiguration; +import com.gr4vy.sdk.SecuritySource; +import com.gr4vy.sdk.models.components.RefundSettlements; +import com.gr4vy.sdk.models.errors.APIException; +import com.gr4vy.sdk.models.errors.Error400; +import com.gr4vy.sdk.models.errors.Error401; +import com.gr4vy.sdk.models.errors.Error403; +import com.gr4vy.sdk.models.errors.Error404; +import com.gr4vy.sdk.models.errors.Error405; +import com.gr4vy.sdk.models.errors.Error409; +import com.gr4vy.sdk.models.errors.Error425; +import com.gr4vy.sdk.models.errors.Error429; +import com.gr4vy.sdk.models.errors.Error500; +import com.gr4vy.sdk.models.errors.Error502; +import com.gr4vy.sdk.models.errors.Error504; +import com.gr4vy.sdk.models.errors.HTTPValidationError; +import com.gr4vy.sdk.models.operations.ListTransactionRefundSettlementsRequest; +import com.gr4vy.sdk.models.operations.ListTransactionRefundSettlementsResponse; +import com.gr4vy.sdk.utils.AsyncRetries; +import com.gr4vy.sdk.utils.BackoffStrategy; +import com.gr4vy.sdk.utils.Blob; +import com.gr4vy.sdk.utils.Globals; +import com.gr4vy.sdk.utils.HTTPClient; +import com.gr4vy.sdk.utils.HTTPRequest; +import com.gr4vy.sdk.utils.Headers; +import com.gr4vy.sdk.utils.Hook.AfterErrorContextImpl; +import com.gr4vy.sdk.utils.Hook.AfterSuccessContextImpl; +import com.gr4vy.sdk.utils.Hook.BeforeRequestContextImpl; +import com.gr4vy.sdk.utils.NonRetryableException; +import com.gr4vy.sdk.utils.Options; +import com.gr4vy.sdk.utils.Retries; +import com.gr4vy.sdk.utils.RetryConfig; +import com.gr4vy.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.function.Function; + + +public class ListTransactionRefundSettlements { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final List retryStatusCodes; + final RetryConfig retryConfig; + final HTTPClient client; + final Headers _headers; + final Globals operationGlobals; + + public Base( + SDKConfiguration sdkConfiguration, Optional options, + Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = Utils.templateUrl( + this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); + this.securitySource = this.sdkConfiguration.securitySource(); + options + .ifPresent(o -> o.validate(List.of(Options.Option.RETRY_CONFIG))); + this.retryStatusCodes = List.of("5XX"); + this.retryConfig = options + .flatMap(Options::retryConfig) + .or(sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder().backoff(BackoffStrategy.builder() + .initialInterval(200, TimeUnit.MILLISECONDS) + .maxInterval(200, TimeUnit.MILLISECONDS) + .baseFactor((double) (1)) + .maxElapsedTime(1000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) + .build()); + this.client = this.sdkConfiguration.client(); + this.operationGlobals = new Globals(); + this.sdkConfiguration.globals.getParam("header", "x-gr4vy-merchant-account-id") + .ifPresent(param -> operationGlobals.putParam("header", "x-gr4vy-merchant-account-id", param)); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "list_transaction_refund_settlements", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "list_transaction_refund_settlements", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "list_transaction_refund_settlements", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/transactions/{transaction_id}/refund-settlements", + request, this.operationGlobals); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + req.addHeaders(Utils.getHeadersFromMetadata(request, this.operationGlobals)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync( + SDKConfiguration sdkConfiguration, Optional options, + Headers _headers) { + super( + sdkConfiguration, options, + _headers); + } + + private HttpRequest onBuildRequest(ListTransactionRefundSettlementsRequest request) throws Exception { + HttpRequest req = buildRequest(request, ListTransactionRefundSettlementsRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(ListTransactionRefundSettlementsRequest request) { + Retries retries = Retries.builder() + .action(() -> { + HttpRequest r; + try { + r = onBuildRequest(request); + } catch (Exception e) { + throw new NonRetryableException(e); + } + try { + HttpResponse httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + return onError(httpRes, null); + } + return httpRes; + } catch (Exception e) { + return onError(null, e); + } + }) + .retryConfig(retryConfig) + .statusCodes(retryStatusCodes) + .build(); + return unchecked(() -> onSuccess(retries.run())).get(); + } + + + @Override + public ListTransactionRefundSettlementsResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + ListTransactionRefundSettlementsResponse.Builder resBuilder = + ListTransactionRefundSettlementsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + ListTransactionRefundSettlementsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withRefundSettlements(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "400")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error400.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "401")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error401.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "403")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error403.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "404")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error404.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "405")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error405.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "409")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error409.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "422")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw HTTPValidationError.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "425")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error425.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "429")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error429.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "500")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error500.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "502")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error502.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "504")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error504.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw APIException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw APIException.from("API error occurred", response); + } + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + private final ScheduledExecutorService retryScheduler; + + public Async( + SDKConfiguration sdkConfiguration, Optional options, + ScheduledExecutorService retryScheduler, Headers _headers) { + super( + sdkConfiguration, options, + _headers); + this.retryScheduler = retryScheduler; + } + + private CompletableFuture onBuildRequest(ListTransactionRefundSettlementsRequest request) throws Exception { + HttpRequest req = buildRequest(request, ListTransactionRefundSettlementsRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(ListTransactionRefundSettlementsRequest request) { + AsyncRetries retries = AsyncRetries.builder() + .retryConfig(retryConfig) + .statusCodes(retryStatusCodes) + .scheduler(retryScheduler) + .build(); + return retries.retry(() -> unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + com.gr4vy.sdk.models.operations.async.ListTransactionRefundSettlementsResponse.Builder resBuilder = + com.gr4vy.sdk.models.operations.async.ListTransactionRefundSettlementsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + com.gr4vy.sdk.models.operations.async.ListTransactionRefundSettlementsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withRefundSettlements); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "400")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error400.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "401")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error401.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "403")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error403.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "404")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error404.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "405")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error405.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "409")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error409.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "422")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return HTTPValidationError.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "425")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error425.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "429")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error429.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "500")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error500.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "502")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error502.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "504")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error504.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} From 97e07ca5dd489a42654ec1199bac21c978111a62 Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 13:47:37 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow