Skip to content

Commit

Permalink
Update client session to include PrimerOrxer
Browse files Browse the repository at this point in the history
  • Loading branch information
gt-prime committed Oct 2, 2024
1 parent 3e7b399 commit a66bc8e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ data class PrimerCustomerRN(
@Serializable
data class PrimerOrderRN(
val countryCode: CountryCode?,
val shipping: PrimerShippingRN?
)

@Serializable
data class PrimerShippingRN(
val amount: Int?,
val methodId: String?,
val methodName: String?,
val methodDescription: String?
)

@Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package com.primerioreactnative.extensions

import com.primerioreactnative.datamodels.PrimerOrderRN
import com.primerioreactnative.datamodels.PrimerShippingRN
import io.primer.android.domain.action.models.PrimerOrder
import io.primer.android.domain.action.models.PrimerShipping

internal fun PrimerOrder.toPrimerOrderRN() = PrimerOrderRN(countryCode)
internal fun PrimerOrder.toPrimerOrderRN() = PrimerOrderRN(countryCode, shipping?.toPrimerShippingRN())

internal fun PrimerShipping.toPrimerShippingRN() = PrimerShippingRN(amount, methodId, methodName, methodDescription)
10 changes: 9 additions & 1 deletion packages/sdk/src/models/PrimerClientSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ export type PrimerOrder = IPrimerOrder;

interface IPrimerOrder {
countryCode?: string;
shipping?: IPrimerShipping;
}

interface IPrimerShipping {
amount?: number;
methodId?: string;
methodName?: string;
methodDescription?: string;
}

export type PrimerCustomer = IPrimerCustomer;
Expand All @@ -50,4 +58,4 @@ interface IPrimerAddress {
city?: string;
state?: string;
countryCode?: string;
}
}

0 comments on commit a66bc8e

Please sign in to comment.