/** * Set the total value of all items (sum of all items: $item->count * $item->price). * * @param $currency string ISO3 currency code * @param $total string total value of all goods in $currency * @return $this */ public function addTotal($currency, $total) { Preconditions::checkIso3Currency($currency, 'currency'); Preconditions::checkFloat($total, 'total'); $this->total[$currency] = $total; return $this; }
/** * @param string $externalId User provided customer id (not used by purchased.at). * @return Customer */ public function setExternalId($externalId) { if (!is_null($externalId)) { Preconditions::checkStringNonEmpty($externalId, 'externalId'); } $this->externalId = $externalId; return $this; }
/** * @param string $itemSku Preselect the specified item in purchase dialog by SKU. * @return Select */ public function setItemSku($itemSku) { if (!is_null($itemSku)) { Preconditions::checkStringNonEmpty($itemSku, 'itemSku'); } $this->itemSku = $itemSku; return $this; }
/** * @param bool $email Send email to vendor provided address after successful payment. * @return Response */ public function setEmail($email) { if (!is_null($email)) { Preconditions::checkBool($email, 'email'); } $this->email = $email; return $this; }
/** * @param string $sdk * @return $this */ public function setSdk($sdk) { Preconditions::checkStringNonEmpty($sdk, 'sdk'); $this->sdk = $sdk; return $this; }
/** * @param array $languages ISO639 2 letter language codes (en,de,..) * @return Test */ public function setLanguages($languages) { Preconditions::checkArray($languages, 'languages', ['\\PurchasedAt\\Validation\\Preconditions', 'checkIso2Language']); $this->languages = $languages; return $this; }
/** * @param $currency string ISO3 currency code * @param $price string price ofe item in specified currency * @return $this */ public function addPrice($currency, $price) { Preconditions::checkIso3Currency($currency, 'currency'); Preconditions::checkFloat($price, 'price'); $this->price[$currency] = $price; return $this; }