MollieProductResponse.build constructor

MollieProductResponse.build(
  1. dynamic data
)

Implementation

MollieProductResponse.build(dynamic data) {
  id = data["id"];
  orderId = data["orderId"];
  type = data["type"];
  sku = data["sku"];
  name = data["name"];
  productUrl = data["_links"]["productUrl"]["href"];
  imageUrl = data["_links"]["imageUrl"]["href"];
  quantity = data["quantity"];
  vatRate = data["vatRate"];

  unitPrice = MollieAmount(value: data["unitPrice"]?["value"], currency: data["unitPrice"]?["currency"]);

  totalAmount = MollieAmount(value: data["totalAmount"]?["value"], currency: data["totalAmount"]?["currency"]);

  discountAmount =
      MollieAmount(value: data["discountAmount"]?["value"], currency: data["discountAmount"]?["currency"]);

  vatAmount = MollieAmount(value: data["vatAmount"]?["value"], currency: data["vatAmount"]?["currency"]);
}