Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,18 @@ jobs:
run: ./scripts/build

- name: Get GitHub OIDC Token
if: github.repository == 'stainless-sdks/increase-java'
if: |-
github.repository == 'stainless-sdks/increase-java' &&
!startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
uses: actions/github-script@v8
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Build and upload Maven artifacts
if: github.repository == 'stainless-sdks/increase-java'
if: |-
github.repository == 'stainless-sdks/increase-java' &&
!startsWith(github.ref, 'refs/heads/stl/')
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.455.0"
".": "0.456.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 234
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-dd0c83cac837fbe98857fa997663b0d0469344a7564bd4fe506e6c71d1d6af73.yml
openapi_spec_hash: 2352f37602105b164533038199b21804
config_hash: 890ca5fa6b8209d4eaac90550c7dc62c
config_hash: b7ec7f54fa76c1f8bde7a548710a1d38
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 0.456.0 (2026-03-08)

Full Changelog: [v0.455.0...v0.456.0](https://github.com/Increase/increase-java/compare/v0.455.0...v0.456.0)

### Features

* **api:** api update ([a55e64e](https://github.com/Increase/increase-java/commit/a55e64e1ff9e685464535564dc2407d843a8dbca))


### Chores

* **internal:** codegen related update ([5a91cf1](https://github.com/Increase/increase-java/commit/5a91cf189c88da3ae6c9319e5cf309a123ff616e))

## 0.455.0 (2026-03-06)

Full Changelog: [v0.454.0...v0.455.0](https://github.com/Increase/increase-java/compare/v0.454.0...v0.455.0)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<!-- x-release-please-start-version -->

[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.455.0)
[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.455.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.455.0)
[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.456.0)
[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.456.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.456.0)

<!-- x-release-please-end -->

Expand All @@ -13,7 +13,7 @@ The Increase Java SDK is similar to the Increase Kotlin SDK but with minor diffe

<!-- x-release-please-start-version -->

The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.455.0).
The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.456.0).

<!-- x-release-please-end -->

Expand All @@ -24,7 +24,7 @@ The REST API documentation can be found on [increase.com](https://increase.com/d
### Gradle

```kotlin
implementation("com.increase.api:increase-java:0.455.0")
implementation("com.increase.api:increase-java:0.456.0")
```

### Maven
Expand All @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.455.0")
<dependency>
<groupId>com.increase.api</groupId>
<artifactId>increase-java</artifactId>
<version>0.455.0</version>
<version>0.456.0</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repositories {

allprojects {
group = "com.increase.api"
version = "0.455.0" // x-release-please-version
version = "0.456.0" // x-release-please-version
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import com.increase.api.models.events.EventRetrieveParams
import com.increase.api.models.events.UnwrapWebhookEvent
import com.standardwebhooks.Webhook
import com.standardwebhooks.exceptions.WebhookVerificationException
import java.util.Base64
import java.util.function.Consumer
import kotlin.jvm.optionals.getOrNull

Expand Down Expand Up @@ -71,7 +72,10 @@ class EventServiceImpl internal constructor(private val clientOptions: ClientOpt
val headersMap =
headers.names().associateWith { name -> headers.values(name) }.toMap()

val webhook = Webhook(webhookSecret)
val webhook =
Webhook(
"whsec_" + Base64.getEncoder().encodeToString(webhookSecret.toByteArray())
)
webhook.verify(unwrapParams.body(), headersMap)
} catch (e: WebhookVerificationException) {
throw IncreaseWebhookException("Could not verify webhook event signature", e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal class FileCreateParamsTest {
@Test
fun create() {
FileCreateParams.builder()
.file("some content".byteInputStream())
.file("Example data".byteInputStream())
.purpose(FileCreateParams.Purpose.CHECK_IMAGE_FRONT)
.description("x")
.build()
Expand All @@ -22,7 +22,7 @@ internal class FileCreateParamsTest {
fun body() {
val params =
FileCreateParams.builder()
.file("some content".byteInputStream())
.file("Example data".byteInputStream())
.purpose(FileCreateParams.Purpose.CHECK_IMAGE_FRONT)
.description("x")
.build()
Expand All @@ -39,7 +39,7 @@ internal class FileCreateParamsTest {
)
.isEqualTo(
mapOf(
"file" to MultipartField.of("some content".byteInputStream()),
"file" to MultipartField.of("Example data".byteInputStream()),
"purpose" to MultipartField.of(FileCreateParams.Purpose.CHECK_IMAGE_FRONT),
"description" to MultipartField.of("x"),
)
Expand All @@ -53,7 +53,7 @@ internal class FileCreateParamsTest {
fun bodyWithoutOptionalFields() {
val params =
FileCreateParams.builder()
.file("some content".byteInputStream())
.file("Example data".byteInputStream())
.purpose(FileCreateParams.Purpose.CHECK_IMAGE_FRONT)
.build()

Expand All @@ -69,7 +69,7 @@ internal class FileCreateParamsTest {
)
.isEqualTo(
mapOf(
"file" to MultipartField.of("some content".byteInputStream()),
"file" to MultipartField.of("Example data".byteInputStream()),
"purpose" to MultipartField.of(FileCreateParams.Purpose.CHECK_IMAGE_FRONT),
)
.mapValues { (_, field) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ internal class EventServiceAsyncTest {
val payload =
"{\"id\":\"event_001dzz0r20rzr4zrhrr1364hy80\",\"associated_object_id\":\"account_in71c4amph0vgo2qllky\",\"associated_object_type\":\"account\",\"category\":\"account.created\",\"created_at\":\"2020-01-31T23:59:59Z\",\"type\":\"event\"}"
val webhookSecret = "whsec_c2VjcmV0Cg=="
val rawWebhookSecret = "secret\n"
val messageId = "1"
val timestampSeconds = Instant.now().epochSecond
val webhook = Webhook(webhookSecret)
Expand All @@ -74,11 +75,11 @@ internal class EventServiceAsyncTest {
UnwrapWebhookParams.builder()
.body(payload)
.headers(headers)
.secret(webhookSecret)
.secret(rawWebhookSecret)
.build()
)
eventServiceAsync
.withOptions { it.webhookSecret(webhookSecret) }
.withOptions { it.webhookSecret(rawWebhookSecret) }
.unwrap(UnwrapWebhookParams.builder().body(payload).headers(headers).build())

// Secret in method takes precedence to secret on client
Expand All @@ -89,7 +90,7 @@ internal class EventServiceAsyncTest {
UnwrapWebhookParams.builder()
.body(payload)
.headers(headers)
.secret(webhookSecret)
.secret(rawWebhookSecret)
.build()
)

Expand Down Expand Up @@ -137,7 +138,7 @@ internal class EventServiceAsyncTest {
UnwrapWebhookParams.builder()
.body(payload)
.headers(badHeaders)
.secret(webhookSecret)
.secret(rawWebhookSecret)
.build()
)
}
Expand All @@ -146,7 +147,7 @@ internal class EventServiceAsyncTest {
val badHeaders =
headers.toBuilder().replace("webhook-signature", listOf(badSig)).build()
eventServiceAsync
.withOptions { it.webhookSecret(webhookSecret) }
.withOptions { it.webhookSecret(rawWebhookSecret) }
.unwrap(UnwrapWebhookParams.builder().body(payload).headers(badHeaders).build())
}

Expand All @@ -157,14 +158,14 @@ internal class EventServiceAsyncTest {
UnwrapWebhookParams.builder()
.body(payload)
.headers(oldHeaders)
.secret(webhookSecret)
.secret(rawWebhookSecret)
.build()
)
}
assertThrows<IncreaseWebhookException> {
val oldHeaders = headers.toBuilder().replace("webhook-timestamp", listOf("5")).build()
eventServiceAsync
.withOptions { it.webhookSecret(webhookSecret) }
.withOptions { it.webhookSecret(rawWebhookSecret) }
.unwrap(UnwrapWebhookParams.builder().body(payload).headers(oldHeaders).build())
}

Expand All @@ -175,14 +176,14 @@ internal class EventServiceAsyncTest {
UnwrapWebhookParams.builder()
.body(payload)
.headers(wrongIdHeaders)
.secret(webhookSecret)
.secret(rawWebhookSecret)
.build()
)
}
assertThrows<IncreaseWebhookException> {
val wrongIdHeaders = headers.toBuilder().replace("webhook-id", listOf("wrong")).build()
eventServiceAsync
.withOptions { it.webhookSecret(webhookSecret) }
.withOptions { it.webhookSecret(rawWebhookSecret) }
.unwrap(UnwrapWebhookParams.builder().body(payload).headers(wrongIdHeaders).build())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ internal class FileServiceAsyncTest {
val fileFuture =
fileServiceAsync.create(
FileCreateParams.builder()
.file("some content".byteInputStream())
.file("Example data".byteInputStream())
.purpose(FileCreateParams.Purpose.CHECK_IMAGE_FRONT)
.description("x")
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ internal class EventServiceTest {
val payload =
"{\"id\":\"event_001dzz0r20rzr4zrhrr1364hy80\",\"associated_object_id\":\"account_in71c4amph0vgo2qllky\",\"associated_object_type\":\"account\",\"category\":\"account.created\",\"created_at\":\"2020-01-31T23:59:59Z\",\"type\":\"event\"}"
val webhookSecret = "whsec_c2VjcmV0Cg=="
val rawWebhookSecret = "secret\n"
val messageId = "1"
val timestampSeconds = Instant.now().epochSecond
val webhook = Webhook(webhookSecret)
Expand All @@ -72,11 +73,11 @@ internal class EventServiceTest {
UnwrapWebhookParams.builder()
.body(payload)
.headers(headers)
.secret(webhookSecret)
.secret(rawWebhookSecret)
.build()
)
eventService
.withOptions { it.webhookSecret(webhookSecret) }
.withOptions { it.webhookSecret(rawWebhookSecret) }
.unwrap(UnwrapWebhookParams.builder().body(payload).headers(headers).build())

// Secret in method takes precedence to secret on client
Expand All @@ -87,7 +88,7 @@ internal class EventServiceTest {
UnwrapWebhookParams.builder()
.body(payload)
.headers(headers)
.secret(webhookSecret)
.secret(rawWebhookSecret)
.build()
)

Expand Down Expand Up @@ -135,7 +136,7 @@ internal class EventServiceTest {
UnwrapWebhookParams.builder()
.body(payload)
.headers(badHeaders)
.secret(webhookSecret)
.secret(rawWebhookSecret)
.build()
)
}
Expand All @@ -144,7 +145,7 @@ internal class EventServiceTest {
val badHeaders =
headers.toBuilder().replace("webhook-signature", listOf(badSig)).build()
eventService
.withOptions { it.webhookSecret(webhookSecret) }
.withOptions { it.webhookSecret(rawWebhookSecret) }
.unwrap(UnwrapWebhookParams.builder().body(payload).headers(badHeaders).build())
}

Expand All @@ -155,14 +156,14 @@ internal class EventServiceTest {
UnwrapWebhookParams.builder()
.body(payload)
.headers(oldHeaders)
.secret(webhookSecret)
.secret(rawWebhookSecret)
.build()
)
}
assertThrows<IncreaseWebhookException> {
val oldHeaders = headers.toBuilder().replace("webhook-timestamp", listOf("5")).build()
eventService
.withOptions { it.webhookSecret(webhookSecret) }
.withOptions { it.webhookSecret(rawWebhookSecret) }
.unwrap(UnwrapWebhookParams.builder().body(payload).headers(oldHeaders).build())
}

Expand All @@ -173,14 +174,14 @@ internal class EventServiceTest {
UnwrapWebhookParams.builder()
.body(payload)
.headers(wrongIdHeaders)
.secret(webhookSecret)
.secret(rawWebhookSecret)
.build()
)
}
assertThrows<IncreaseWebhookException> {
val wrongIdHeaders = headers.toBuilder().replace("webhook-id", listOf("wrong")).build()
eventService
.withOptions { it.webhookSecret(webhookSecret) }
.withOptions { it.webhookSecret(rawWebhookSecret) }
.unwrap(UnwrapWebhookParams.builder().body(payload).headers(wrongIdHeaders).build())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ internal class FileServiceTest {
val file =
fileService.create(
FileCreateParams.builder()
.file("some content".byteInputStream())
.file("Example data".byteInputStream())
.purpose(FileCreateParams.Purpose.CHECK_IMAGE_FRONT)
.description("x")
.build()
Expand Down
Loading