+sub extract_tax_amounts {
+ my ($self, $response) = @_;
+
+ my %tax_amounts;
+
+ my $products = $response->{Products};
+ return unless $products;
+
+ foreach my $node (@$products) {
+ my $flags = $node->{flags};
+ if ($flags &&
+ grep($_ eq '{TAX}', @$flags) &&
+ grep($_ eq '{CALCULATED}', @$flags))
+ {
+ $tax_amounts{ $node->{code} } = $node->{subtotal};
+ }
+ }
+
+ return %tax_amounts;
+}
+