Skip to content

Commit

Permalink
Fix webhook name (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonatasPedroso authored Jul 1, 2024
1 parent e70d90c commit eab1834
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/Charge.kt
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public data class ChargeDiscountFixedDate(

@Serializable
public data class ChargeDiscountSettings(
public val discountModality: ChargeDiscountModality,
public val modality: ChargeDiscountModality,
public val discountFixedDate: List<ChargeDiscountFixedDate>,
)

Expand Down
14 changes: 2 additions & 12 deletions src/main/kotlin/Webhook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import kotlinx.serialization.Serializable

@Serializable
public data class WebhookPayload(
public val name: Int?,
public val name: String?,
public val url: String?,
public val authorization: String?,
public val isActive: Boolean?,
Expand Down Expand Up @@ -109,7 +109,6 @@ public enum class WebhookEvent {

public class WebhookBuilder internal constructor() {
public var name: String? by Properties.nullable()
public var number: Int? by Properties.nullable()
public var url: String? by Properties.nullable()
public var authorization: String? by Properties.nullable()
public var isActive: Boolean? by Properties.nullable()
Expand All @@ -124,15 +123,6 @@ public class WebhookBuilder internal constructor() {
this.name = name
}

/**
* The number of the webhook.
*
* @param number The number of the webhook.
*/
public fun number(number: Int): WebhookBuilder = apply {
this.number = number
}

/**
* The url of the webhook.
*
Expand Down Expand Up @@ -254,7 +244,7 @@ public class WebhookBuilder internal constructor() {
internal fun build(): WebhookRequest {
return WebhookRequest(
webhook = WebhookPayload(
name = number,
name = name,
url = url,
authorization = authorization,
isActive = isActive,
Expand Down
2 changes: 1 addition & 1 deletion src/test/kotlin/ChargeTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class ChargeTests {
type = ChargeType.DYNAMIC
expiresDate = "2021-04-01"
discountSettings = ChargeDiscountSettings(
discountModality = ChargeDiscountModality.FIXED_VALUE_UNTIL_SPECIFIED_DATE,
modality = ChargeDiscountModality.FIXED_VALUE_UNTIL_SPECIFIED_DATE,
discountFixedDate = listOf(ChargeDiscountFixedDate(10, 1000))
)
}
Expand Down

0 comments on commit eab1834

Please sign in to comment.