Skip to content

Commit 7f1b829

Browse files
Expose taxes property order properties
1 parent 4af8db7 commit 7f1b829

File tree

6 files changed

+31
-4
lines changed

6 files changed

+31
-4
lines changed

libs/fluxc-plugin/src/main/kotlin/org/wordpress/android/fluxc/model/order/FeeLine.kt

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ class FeeLine {
2323

2424
@SerializedName("tax_status")
2525
var taxStatus: FeeLineTaxStatus? = null
26+
27+
@SerializedName("taxes")
28+
var taxes: List<LineTaxEntry>? = null
2629
}
2730

2831
enum class FeeLineTaxStatus(val value: String) {

libs/fluxc-plugin/src/main/kotlin/org/wordpress/android/fluxc/model/order/LineItem.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ data class LineItem(
2828
@SerializedName("bundled_by")
2929
val bundledBy: String? = null,
3030
@SerializedName("composite_parent")
31-
val compositeParent: String? = null
31+
val compositeParent: String? = null,
32+
@SerializedName("taxes")
33+
val taxes: List<LineTaxEntry>? = null,
3234
) {
3335
class Attribute(val key: String?, val value: String?)
3436

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package org.wordpress.android.fluxc.model.order
2+
3+
import com.google.gson.annotations.SerializedName
4+
import java.math.BigDecimal
5+
6+
/**
7+
* Tax information for a line item, it can be part of a line item or a shipping line or a fee line.
8+
*/
9+
data class LineTaxEntry(
10+
@SerializedName("id")
11+
val rateId: Long? = null,
12+
@SerializedName("total")
13+
private val _total: String? = null,
14+
) {
15+
val total: BigDecimal?
16+
get() = _total?.toBigDecimalOrNull()
17+
}

libs/fluxc-plugin/src/main/kotlin/org/wordpress/android/fluxc/model/order/ShippingLine.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@ data class ShippingLine(
1313
@JsonAdapter(NullStringJsonAdapter::class, nullSafe = false)
1414
val methodId: String? = null,
1515
@SerializedName("method_title")
16-
val methodTitle: String? = null
16+
val methodTitle: String? = null,
17+
@SerializedName("taxes")
18+
val taxes: List<LineTaxEntry>? = null,
1719
)

libs/fluxc-plugin/src/main/kotlin/org/wordpress/android/fluxc/model/refunds/RefundMapper.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ class RefundMapper @Inject constructor() {
2929
total = it.total?.toBigDecimalOrNull(),
3030
sku = it.sku,
3131
price = it.price?.toBigDecimalOrNull(),
32-
metaData = it.metaData
32+
metaData = it.metaData,
33+
taxes = it.taxes
3334
)
3435
} ?: emptyList(),
3536
shippingLineItems = response.shippingLineItems ?: emptyList(),

libs/fluxc-plugin/src/main/kotlin/org/wordpress/android/fluxc/model/refunds/WCRefundModel.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package org.wordpress.android.fluxc.model.refunds
22

33
import com.google.gson.annotations.SerializedName
44
import org.wordpress.android.fluxc.model.metadata.WCMetaData
5+
import org.wordpress.android.fluxc.model.order.LineTaxEntry
56
import java.math.BigDecimal
67
import java.util.Date
78

@@ -35,7 +36,8 @@ data class WCRefundModel(
3536
val total: BigDecimal? = null,
3637
val sku: String? = null,
3738
val price: BigDecimal? = null,
38-
val metaData: List<WCMetaData>? = null
39+
val metaData: List<WCMetaData>? = null,
40+
val taxes: List<LineTaxEntry>? = null
3941
)
4042

4143
data class WCRefundShippingLine(

0 commit comments

Comments
 (0)