本文整理汇总了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;
}