Skip to content

Commit 1232ed8

Browse files
committed
fix(shopinbit): WIP/not fully tested: add state/province where required
1 parent 7a56c67 commit 1232ed8

13 files changed

Lines changed: 441 additions & 189 deletions

lib/models/shopinbit/shopinbit_request_draft.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,20 @@ class ShopinbitRequestDraft {
55
final String requestDescription;
66
final String deliveryCountryName;
77
final String deliveryCountryCode;
8+
final String? deliveryState;
89
final String? voucherCode;
910

11+
bool get requiresState => switch (deliveryCountryCode) {
12+
"US" || "CA" => category != .travel,
13+
_ => false,
14+
};
15+
1016
ShopinbitRequestDraft({
1117
required this.category,
1218
required this.requestDescription,
1319
required this.deliveryCountryName,
1420
required this.deliveryCountryCode,
21+
required this.deliveryState,
1522
required this.voucherCode,
1623
});
1724

@@ -20,6 +27,7 @@ class ShopinbitRequestDraft {
2027
"requestDescription": requestDescription,
2128
"deliveryCountryName": deliveryCountryName,
2229
"deliveryCountryCode": deliveryCountryCode,
30+
"deliveryState": deliveryState,
2331
"voucherCode": voucherCode,
2432
};
2533

lib/pages/shopinbit/shopinbit_car_fee_view.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ class _ShopInBitCarFeeViewState extends ConsumerState<ShopInBitCarFeeView> {
134134
zip: _billingPostalCodeController.text.trim(),
135135
city: _billingCityController.text.trim(),
136136
country: widget.draft.deliveryCountryCode,
137+
state: widget.draft.requiresState ? widget.draft.deliveryState! : null,
137138
);
138139

139140
// Cache the car request alongside billing so the backend failsafe can
@@ -361,12 +362,15 @@ class _ShopInBitCarFeeViewState extends ConsumerState<ShopInBitCarFeeView> {
361362

362363
spacing,
363364
DetailItem(
364-
title: "Billing country",
365+
title: "Country",
365366
detail:
366367
"${widget.draft.deliveryCountryName} "
367368
"(${widget.draft.deliveryCountryCode})",
368369
disableSelectableText: true,
369370
),
371+
if (widget.draft.requiresState) spacing,
372+
if (widget.draft.requiresState)
373+
DetailItem(title: "State", detail: widget.draft.deliveryState!),
370374
if (!isDesktop) const Spacer(),
371375
if (isDesktop) const SizedBox(height: 24),
372376
PrimaryButton(

lib/pages/shopinbit/shopinbit_offer_view.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,7 @@ class _ShopInBitOfferViewState extends ConsumerState<ShopInBitOfferView> {
196196
if (context.mounted) {
197197
await Navigator.of(context).pushNamed(
198198
ShopInBitShippingView.routeName,
199-
arguments: (
200-
apiTicketId: widget.apiTicketId,
201-
deliveryCountry: deliveryCountry,
202-
countries: response!.value!,
203-
),
199+
arguments: (ticket: ticket!, countries: response!.value!),
204200
);
205201
}
206202
},

0 commit comments

Comments
 (0)