예제 #1
0
 static function formatMoneyForMail($money)
 {
     $decimal_separator = basket_plus::getBasketVar(DECIMAL_SEPARATOR);
     return basket_plus::getCurrency() . " " . number_format($money, 2, $decimal_separator, '');
 }
예제 #2
0
 public function process($session_basket, $return_url, $cancel_url, $notify_url)
 {
     $this->add_field('rm', '2');
     $this->add_field('cmd', '_cart');
     $this->add_field('upload', '1');
     $this->add_field('currency_code', basket_plus::getCurrency());
     $this->add_field('business', basket_plus::getBasketVar(PAYPAL_ACCOUNT));
     // IPN stuff
     $this->add_field('return', $return_url);
     $this->add_field('cancel_return', $cancel_url);
     $this->add_field('notify_url', $notify_url);
     // postage
     $pickup = $session_basket->pickup;
     if (!$pickup) {
         $postage = $session_basket->postage_cost();
         if ($postage > 0) {
             $this->add_field('shipping_1', $postage);
         }
     }
     // basket contents
     $id = 1;
     foreach ($session_basket->contents as $key => $basket_item) {
         $this->add_field("item_name_{$id}", $basket_item->getCode());
         $this->add_field("amount_{$id}", $basket_item->product_cost_per);
         $this->add_field("quantity_{$id}", $basket_item->quantity);
         $id++;
     }
     // shipping address
     $this->add_field("payer_email", $session_basket->email);
     $this->add_field("address_name", $session_basket->fname);
     $this->add_field("address_street", $session_basket->house . " " . $session_basket->street);
     $this->add_field("address_city", $session_basket->town);
     $this->add_field("address_zip", $session_basket->postalcode);
     $this->add_field("contact_phone", $session_basket->phone);
     $string = "<form method=\"post\" name=\"paypal_form\" " . "action=\"" . $this->paypal_url . "\">\n";
     foreach ($this->fields as $name => $value) {
         $string = $string . "<input type=\"hidden\" name=\"{$name}\" value=\"{$value}\"/>\n";
     }
     $string = $string . "</form>\n\t\t<script>\n\t\t\tfunction s_f(){\n\t\t\t\tdocument.forms[\"paypal_form\"].submit();\n\t\t\t\t}; \n\t\t\twindow.setTimeout(s_f,20);\n\t\t</script>";
     return $string;
 }