当前位置: 首页>>代码示例>>PHP>>正文


PHP WCV_Vendors::get_vendor_paypal方法代码示例

本文整理汇总了PHP中WCV_Vendors::get_vendor_paypal方法的典型用法代码示例。如果您正苦于以下问题:PHP WCV_Vendors::get_vendor_paypal方法的具体用法?PHP WCV_Vendors::get_vendor_paypal怎么用?PHP WCV_Vendors::get_vendor_paypal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WCV_Vendors的用法示例。


在下文中一共展示了WCV_Vendors::get_vendor_paypal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: set_vendor_items

 /**
  *
  *
  * @param unknown $order
  * @param unknown $author_email
  * @param unknown $setPaymentOptionsRequest
  * @param unknown $is_admin (optional)
  *
  * @return unknown
  */
 public function set_vendor_items($order, $setPaymentOptionsRequest)
 {
     $receivers = WCV_Vendors::get_vendor_dues_from_order($order, false);
     $receivers_two = WCV_Vendors::get_vendor_dues_from_order($order);
     foreach ($receivers as $products) {
         $invoice_items = array();
         $shipping_given = $tax_given = 0;
         foreach ($products as $key => $product) {
             $product_id = $product['product_id'];
             $shipping_given += $product['shipping'];
             $tax_given += $product['tax'];
             $product['commission'] = round($product['commission'], 2);
             if (!empty($product['commission'])) {
                 $item = new InvoiceItem();
                 $item->name = get_the_title($product_id);
                 $item->identifier = $product_id;
                 $item->price = $product['commission'];
                 $item->itemPrice = round($product['commission'] / $product['qty'], 2);
                 $item->itemCount = $product['qty'];
                 $invoice_items[] = $item;
             }
         }
         if (empty($invoice_items)) {
             continue;
         }
         $receiverOptions = new ReceiverOptions();
         $setPaymentOptionsRequest->receiverOptions[] = $receiverOptions;
         // Set the current vendor
         $receiverId = new ReceiverIdentifier();
         $receiverId->email = $product['vendor_id'] == 1 ? $this->main_paypal : WCV_Vendors::get_vendor_paypal($product['vendor_id']);
         $receiverOptions->receiver = $receiverId;
         $receiverOptions->invoiceData = new InvoiceData();
         $receiverOptions->invoiceData->item = $invoice_items;
         $receiverOptions->invoiceData->totalTax = number_format($receivers_two[$product['vendor_id']]['tax'], 2);
         $receiverOptions->invoiceData->totalShipping = number_format($receivers_two[$product['vendor_id']]['shipping'], 2);
     }
     return $setPaymentOptionsRequest;
 }
开发者ID:stodorovic,项目名称:wcvendors,代码行数:48,代码来源:paypal_ap.php


注:本文中的WCV_Vendors::get_vendor_paypal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。