This is an effort to make the existing uc_usps code work with D8. I’ve noticed a couple issues while testing that may need further review or separate issues / suggestions.

1. Currently it looks like uc_quote.pages.inc uc_quote_assemble_quotes accepts multiple quotes (rates), but uses the same method label for all of them. A few variables need to be changed. Maybe change $quote to $quote['rate'] and $method->label() to $quote['option_label']. Also it looks like uc_quote_build_quote_form would have to be updated to handle the option_label render array unless it is rendered before that. The existing getQuotes for FlatRate etc. would have to be updated to reflect the changes. I can work on a separate patch for that if needed or include it with this one.

2. It looks like getQuotes is triggered twice in a row when I click “Click to calculate shipping” so far I’ve traced it back to QuotePane::process and this code in QuotePane::view

if ($form_state->getTriggeringElement()) {
  $this->prepare($order, $form, $form_state);
}

Preparing the first patch.

CommentFileSizeAuthor
#3 port_uc_usps_to_d8-3094227-3.patch33.76 KBnathaniel

Comments

Nathaniel created an issue. See original summary.

nathaniel’s picture

Issue summary: View changes
nathaniel’s picture

StatusFileSize
new33.76 KB

This patch is mostly updating variables in USPSRateBase and also updating variables and some cleanup in USPSDomesticRate / USPSInternationalRate.

I’ve tested a single domestic service request and successfully received a response from the USPS API after modifying uc_quote as needed separately.

nathaniel’s picture

Status: Active » Needs review