Пример #1
0
 /**
  * Total amount charged as part of this payment.
  *
  *
  * @param string|double $total
  *
  * @return $this
  */
 public function setTotal($total)
 {
     NumericValidator::validate($total, "Total");
     $total = FormatConverter::formatToPrice($total, $this->getCurrency());
     $this->total = $total;
     return $this;
 }
Пример #2
0
 /**
  * Cost in percent. Range of 0 to 100.
  *
  * @param string $percent
  * 
  * @return $this
  */
 public function setPercent($percent)
 {
     NumericValidator::validate($percent, "Percent");
     $percent = FormatConverter::formatToNumber($percent);
     $this->percent = $percent;
     return $this;
 }
Пример #3
0
 /**
  * Quantity of the item. Range of 0 to 9999.999.
  *
  * @param string|double $quantity
  * 
  * @return $this
  */
 public function setQuantity($quantity)
 {
     NumericValidator::validate($quantity, "Percent");
     $quantity = FormatConverter::formatToPrice($quantity);
     $this->quantity = $quantity;
     return $this;
 }
Пример #4
0
 /**
  * amount up to N digit after the decimals separator as defined in ISO 4217 for the appropriate currency code.
  *
  * @param string|double $value
  * 
  * @return $this
  */
 public function setValue($value)
 {
     NumericValidator::validate($value, "Value");
     $value = FormatConverter::formatToPrice($value, $this->getCurrency());
     $this->value = $value;
     return $this;
 }
Пример #5
0
 /**
  * Tax of the item. Only supported when the `payment_method` is set to `paypal`.
  *
  * @param string|double $tax
  * 
  * @return $this
  */
 public function setTax($tax)
 {
     NumericValidator::validate($tax, "Tax");
     $tax = FormatConverter::formatToPrice($tax, $this->getCurrency());
     $this->tax = $tax;
     return $this;
 }
Пример #6
0
 /**
  *
  * @dataProvider invalidProvider
  * @expectedException \InvalidArgumentException
  */
 public function testValidateException($input)
 {
     NumericValidator::validate($input, "Test Value");
 }
Пример #7
0
 /**
  * Discount percentage applied to the payment, if any
  *
  * @param string $discount_percentage
  * 
  * @return $this
  */
 public function setDiscountPercentage($discount_percentage)
 {
     NumericValidator::validate($discount_percentage, "Discount Percentage");
     $discount_percentage = FormatConverter::formatToPrice($discount_percentage);
     $this->discount_percentage = $discount_percentage;
     return $this;
 }
Пример #8
0
 /**
  * Fee charged by PayPal. In case of a refund, this is the fee amount refunded to the original receipient of the payment.
  *
  * @param string|double $fee
  * 
  * @return $this
  */
 public function setFee($fee)
 {
     NumericValidator::validate($fee, "Fee");
     $fee = FormatConverter::formatToPrice($fee);
     $this->fee = $fee;
     return $this;
 }
Пример #9
0
 /**
  * Amount being charged as gift wrap fee.
  *
  * @param string|double $gift_wrap
  * 
  * @return $this
  */
 public function setGiftWrap($gift_wrap)
 {
     NumericValidator::validate($gift_wrap, "Gift Wrap");
     $gift_wrap = FormatConverter::formatToPrice($gift_wrap);
     $this->gift_wrap = $gift_wrap;
     return $this;
 }