예제 #1
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;
 }
예제 #2
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;
 }
예제 #3
0
파일: Amount.php 프로젝트: seoduda/Patua
 /**
  * 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;
 }
예제 #4
0
파일: Currency.php 프로젝트: Roc4rdho/app
 /**
  * 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;
 }
 public function testFormat()
 {
     $result = FormatConverter::format("12.0123", "%0.2f");
     $this->assertEquals("12.01", $result);
 }
예제 #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;
 }