本文整理汇总了PHP中Invoice::getProducts方法的典型用法代码示例。如果您正苦于以下问题:PHP Invoice::getProducts方法的具体用法?PHP Invoice::getProducts怎么用?PHP Invoice::getProducts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Invoice
的用法示例。
在下文中一共展示了Invoice::getProducts方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _process
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
{
$products = $invoice->getProducts();
$data = $this->getPaymentData($products[0]->data()->get('fortumo_service_xml'));
$a = new Am_Paysystem_Action_HtmlTemplate_Fortumo($this->getDir(), 'fortumo-payment.phtml');
$a->data = $data;
$a->invoice = $invoice;
$result->setAction($a);
}
示例2: _process
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
{
$prSpeeds = array();
foreach ($invoice->getProducts() as $product) {
$prSpeeds[] = ($o = $product->data()->get('bitpay_speed_risk')) ? $o : $this->getConfig('bitpay_speed_risk');
}
$user = $invoice->getUser();
$post = array('price' => $invoice->first_total, 'currency' => $invoice->currency, 'posData' => array(), 'notificationURL' => $this->getPluginUrl('ipn'), 'transactionSpeed' => $this->transactionSpeed[min($prSpeeds)], 'redirectURL' => $this->getConfig('use_http', false) ? str_replace('https://', 'http://', $this->getReturnUrl()) : $this->getReturnUrl(), 'orderID' => $invoice->public_id, 'itemDesc' => $invoice->getLineDescription(), 'buyerName' => $user->getName(), 'buyerAddress1' => $user->street, 'buyerAddress2' => $user->street2, 'buyerState' => Am_Di::getInstance()->stateTable->getTitleByCode($user->country, $user->state), 'buyerZip' => $user->zip, 'buyerCountry' => Am_Di::getInstance()->countryTable->getTitleByCode($user->country), 'buyerEmail' => $user->email, 'buyerPhone' => $user->phone);
$post = array_filter($post);
$req = new Am_Request_Bitpay($this, Am_HttpRequest::METHOD_POST, json_encode($post), 'createInvoice');
$res = $req->getResult();
if (!isset($res['status']) || $res['status'] != 'new') {
Am_Di::getInstance()->errorLogTable->log("BitPay API Error. Invoice status is not NEW: " . @$res['status'] . ".");
throw new Am_Exception_InternalError();
}
$invoice->data()->set(self::BITPAY_INVOICE_ID, $res['id'])->update();
$action = new Am_Paysystem_Action_Redirect($res['url']);
$result->setAction($action);
}
示例3: _process
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
{
$products = $invoice->getProducts();
$a = new Am_Paysystem_Action_Form(self::LIVE_URL);
$web_id = $products[0]->data()->get('web_id');
if (empty($web_id)) {
$this->getConfig('web_id');
}
$a->id = $web_id;
$a->pricepoint = $products[0]->data()->get(self::PRICEPOINT);
$a->paymentoption = $this->getPaymentOption($invoice);
$a->firstname = $invoice->getFirstName();
$a->lastname = $invoice->getLastName();
$a->address = $invoice->getStreet();
$a->city = $invoice->getCity();
$a->state = $invoice->getState();
$a->zip = $invoice->getZip();
$a->country = $invoice->getCountry();
$a->phone = $invoice->getPhone();
$a->email = $invoice->getEmail();
$a->username = $invoice->getLogin();
$a->password = 'notused';
$a->purchaseamt = $invoice->first_total;
$a->currencyid = $invoice->currency;
$a->purchasedesc = $invoice->getLineDescription();
if ($invoice->rebill_times) {
$a->recurflag = 'Y';
$a->recuramt = $invoice->second_total;
$a->recurdatevalue = $this->getDays(new Am_Period($this->invoice->first_period));
} else {
$a->recurflag = 'N';
}
$a->xfield = $invoice->public_id;
$a->postbackurl = $this->getPluginUrl('ipn');
$a->country = $invoice->getCountry();
$result->setAction($a);
}
示例4: isNotificationRuleMatch
protected function isNotificationRuleMatch(EmailTemplate $tmpl, Invoice $invoice)
{
if (!$tmpl->conditions) {
return true;
}
$conds = array();
foreach (explode(',', $tmpl->conditions) as $item) {
preg_match('/([A-Z]*)-(.*)/', $item, $match);
$conds[$match[1]][] = $match[2];
}
//check product conditions
$product_ids = array();
if (isset($conds['CATEGORY'])) {
$catProducts = $this->getDi()->productCategoryTable->getCategoryProducts();
foreach ($conds['CATEGORY'] as $cat_id) {
if (isset($catProducts[$cat_id])) {
$product_ids = array_merge($product_ids, $catProducts[$cat_id]);
}
}
}
if (isset($conds['PRODUCT'])) {
$product_ids = array_merge($product_ids, $conds['PRODUCT']);
}
if (!count($product_ids) && isset($conds['CATEGORY'])) {
//user set up categories without products
return false;
}
if (count($product_ids)) {
$invoice_product_id = array_map(create_function('$a', 'return $a->pk();'), $invoice->getProducts());
if (!array_intersect($product_ids, $invoice_product_id)) {
return false;
}
}
//check paysystem conditions
if (isset($conds['PAYSYSTEM']) && !in_array($invoice->paysys_id, $conds['PAYSYSTEM'])) {
return false;
}
return true;
}
示例5: hasDigitalProducts
function hasDigitalProducts(Invoice $invoice)
{
if ($this->getConfig('tax_digital')) {
return true;
}
foreach ($invoice->getProducts() as $p) {
if ($p->tax_group && $p->tax_digital) {
return true;
}
}
}