Skip to content

Commit 6e2357c

Browse files
committed
ECOM-663 Omni Store Credit — 3. Apply in Cart and at Checkout, add store credit data to FetchedOrder.kt
1 parent 1454ceb commit 6e2357c

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ fun FetchedOrder.toUpdated(): UpdatedOrder {
9797
electronicInvoiceSdiCode = electronicInvoiceSdiCode,
9898
commercialRelationshipScheme = commercialRelationshipScheme,
9999
lang = lang,
100+
storeCredit = storeCredit?.toUpdated(),
100101
)
101102
}
102103

@@ -346,3 +347,18 @@ fun FetchedOrder.LoyaltyRedemption.toUpdated(): UpdatedOrder.LoyaltyRedemption {
346347
cancelled = this.cancelled,
347348
)
348349
}
350+
351+
fun FetchedOrder.StoreCredit.toUpdated(): UpdatedOrder.StoreCredit {
352+
return UpdatedOrder.StoreCredit(
353+
redemption = this.redemption?.toUpdated(),
354+
balance = this.balance,
355+
)
356+
}
357+
358+
fun FetchedOrder.StoreCreditRedemption.toUpdated(): UpdatedOrder.StoreCreditRedemption {
359+
return UpdatedOrder.StoreCreditRedemption(
360+
id = this.id,
361+
amount = this.amount,
362+
cancelled = this.cancelled,
363+
)
364+
}

src/main/kotlin/com/ecwid/apiclient/v3/dto/order/request/UpdatedOrder.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ data class UpdatedOrder(
104104
@JsonFieldName("b2b_b2c")
105105
val commercialRelationshipScheme: CommercialRelationshipScheme? = null,
106106
val lang: String? = null,
107+
val storeCredit: StoreCredit? = null,
107108

108109
) : ApiUpdatedDTO {
109110

@@ -380,6 +381,17 @@ data class UpdatedOrder(
380381
val cancelled: Boolean? = null,
381382
)
382383

384+
data class StoreCredit(
385+
val redemption: StoreCreditRedemption? = null,
386+
val balance: Double? = null
387+
)
388+
389+
data class StoreCreditRedemption(
390+
val id: String? = null,
391+
val amount: Double? = null,
392+
val cancelled: Boolean? = null,
393+
)
394+
383395
companion object {
384396
const val FACEBOOK_ORDER_REFERENCE_ID = "FACEBOOK"
385397
}

0 commit comments

Comments
 (0)