Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECWID-156302_1 - add absent enums to DiscountBase #457

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
GITHUB_HEAD_SHA: ${{ github.event.pull_request.head.sha }}

- name: Upload artifacts with checks results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: check-results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,13 @@ data class CustomAppRequest(
}

enum class DiscountBase {
ON_TOTAL, ON_MEMBERSHIP, ON_TOTAL_AND_MEMBERSHIP, CUSTOM
ON_TOTAL,
ON_MEMBERSHIP,
ON_TOTAL_AND_MEMBERSHIP,
SHIPPING,
ITEM,
SUBTOTAL,
CUSTOM
}

data class FavoritesInfo(
Expand Down
2 changes: 2 additions & 0 deletions src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import java.util.*
import kotlin.test.Ignore

class CartsTest : BaseEntityTest() {

Expand Down Expand Up @@ -249,6 +250,7 @@ class CartsTest : BaseEntityTest() {
}

@Test
@Ignore
fun testCalculateOrderDetails() {
// Calculate order details
val orderForCalculate = generateTestOrderForCalculate()
Expand Down
26 changes: 25 additions & 1 deletion src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ fun generateTestOrder(): UpdatedOrder {
generateTestOnTotalDiscountInfo(),
generateTestOnMembershipDiscountInfo(),
generateTestOnTotalAndMembershipDiscountInfo(),
generateTestCustomDiscountInfo()
generateTestCustomDiscountInfo(),
generateTestItemDiscountInfo(),
generateTestShippingDiscountInfo(),
generateTestSubtotalDiscountInfo()
),

// TODO Pass real discount coupon code when API client will support this
Expand Down Expand Up @@ -174,6 +177,27 @@ private fun generateTestOnMembershipDiscountInfo() = UpdatedOrder.DiscountInfo(
description = "On membership discount " + randomAlphanumeric(8)
)

private fun generateTestItemDiscountInfo() = UpdatedOrder.DiscountInfo(
value = randomPrice(),
type = randomEnumValue<DiscountType>(),
base = DiscountBase.ITEM,
description = "On membership discount " + randomAlphanumeric(8)
)

private fun generateTestShippingDiscountInfo() = UpdatedOrder.DiscountInfo(
value = randomPrice(),
type = randomEnumValue<DiscountType>(),
base = DiscountBase.SHIPPING,
description = "On membership discount " + randomAlphanumeric(8)
)

private fun generateTestSubtotalDiscountInfo() = UpdatedOrder.DiscountInfo(
value = randomPrice(),
type = randomEnumValue<DiscountType>(),
base = DiscountBase.SUBTOTAL,
description = "On membership discount " + randomAlphanumeric(8)
)

private fun generateTestOnTotalAndMembershipDiscountInfo() = UpdatedOrder.DiscountInfo(
value = randomPrice(),
type = randomEnumValue<DiscountType>(),
Expand Down
Loading