1day2die %!s(int64=3) %!d(string=hai) anos
pai
achega
487040f06a
Modificáronse 2 ficheiros con 28 adicións e 9 borrados
  1. 7 1
      app/Models/Payment.php
  2. 21 8
      app/Models/PaypalProduct.php

+ 7 - 1
app/Models/Payment.php

@@ -53,7 +53,13 @@ class Payment extends Model
     {
         return $this->belongsTo(User::class);
     }
-    public function formatToCurrency($value,$locale = 'de_DE')
+
+    /**
+     * @param  float/int
+     * @param  string
+     * @return string
+     */
+    public function formatToCurrency($value,$locale = 'en_US')
     {
         $formatter = new NumberFormatter($locale, NumberFormatter::CURRENCY);
         return $formatter->formatCurrency($value, $this->currency_code);

+ 21 - 8
app/Models/PaypalProduct.php

@@ -41,28 +41,41 @@ class PaypalProduct extends Model
     }
 
     /**
+     * @param  float/int
      * @param string $locale
      * @return string
      */
-    public function formatToCurrency($value,$locale = 'de_DE')
+    public function formatToCurrency($value,$locale = 'en_US')
     {
         $formatter = new NumberFormatter($locale, NumberFormatter::CURRENCY);
         return $formatter->formatCurrency($value, $this->currency_code);
     }
 
-    public function getTaxPercent(){
+    /**
+     * @desc Returns the tax in % or 0 if less than 0
+     * @return int
+     */
+    public function getTaxPercent()
+    {
         $tax = Configuration::getValueByKey("SALES_TAX");
-        if ( $tax < 0 ) {
-            return 0;
-        }
-        return $tax;
+        return $tax < 0 ? 0 : $tax;
     }
 
-    public function getTaxValue(){
+    /**
+     * @desc Returns the total tax value.
+     * @return float
+     */
+    public function getTaxValue()
+    {
         return $this->price*$this->getTaxPercent()/100;
     }
 
-    public function getTotalPrice(){
+    /**
+     * @desc Returns the total price incl. tax
+     * @return float
+     */
+    public function getTotalPrice() 
+    {
         return $this->price+($this->getTaxValue());
     }
 }