本文整理汇总了PHP中FileData::setMimeType方法的典型用法代码示例。如果您正苦于以下问题:PHP FileData::setMimeType方法的具体用法?PHP FileData::setMimeType怎么用?PHP FileData::setMimeType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileData
的用法示例。
在下文中一共展示了FileData::setMimeType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: confirmDeliveryAndSendInvoice
public function confirmDeliveryAndSendInvoice($order)
{
$invoices = array();
$invoiceNumbers = array();
if ($order->hasInvoices()) {
foreach ($order->getInvoiceCollection() as $invoiceItem) {
$invoices[] = $invoiceItem;
$invoiceNumbers[] = $invoiceItem->getIncrementId();
}
}
$pdf = Mage::getModel('sales/order_pdf_invoice')->getPdf($invoices);
$pdfData = $pdf->render();
$documentNumber = join(', ', $invoiceNumbers);
$issueDate = strtotime($order->getCreatedAt());
$dueDateDays = intval(Mage::getStoreConfig('payment/ipcpaygate/invipay_base_duedate'));
$dueDate = $issueDate + $dueDateDays * 60 * 60 * 24;
$client = $this->getApiClient();
$request = new PaymentManagementData();
$request->setPaymentId($order->getInvipayPaymentId());
$request->setDoConfirmDelivery(true);
$conversionData = new OrderToInvoiceData();
$conversionData->setInvoiceDocumentNumber($documentNumber);
$conversionData->setIssueDate(date('Y-m-d', $issueDate));
$conversionData->setDueDate(date('Y-m-d', $dueDate));
$request->setConversionData($conversionData);
$document = new FileData();
$document->setName('Zamowienie_nr_' . $order->getEntityId() . '.pdf');
$document->setMimeType('application/pdf');
$document->setContentFromBin($pdfData);
$request->setDocument($document);
$result = $client->managePayment($request);
$order->setInvipayDeliveryConfirmed(true);
$order->setInvipayCompleted(true);
$order->save();
}
示例2: managePaymentRequestIfApplicable
public function managePaymentRequestIfApplicable($order)
{
$context = Context::getContext();
if ($order->hasInvoice() && count($order->getHistory($context->language->id, Configuration::get('PS_OS_DELIVERED'), true, 0)) > 0) {
$paymentRequest = new InvipayPaymentRequest(InvipayPaymentRequest::getIdByOrderId($order->id));
if (!$paymentRequest->completed) {
$order_invoice_list = $order->getInvoicesCollection();
$pdf = new PDF($order_invoice_list, PDF::TEMPLATE_INVOICE, $context->smarty);
$pdfData = $pdf->render(false);
$invoiceNumbers = array();
$issueDate = $order->date_add;
foreach ($order_invoice_list as $invoice) {
$invoiceNumbers[] = $invoice->getInvoiceNumberFormatted($context->language->id, $context->shop !== null ? $context->shop->id : null);
$issueDate = $invoice->date_add;
}
$documentNumber = join(', ', $invoiceNumbers);
$issueDate = strtotime($issueDate);
$config = $this->loadConfiguration();
$dueDateDays = (int) $config['BASE_DUE_DATE'];
$dueDate = $issueDate + $dueDateDays * 60 * 60 * 24;
$client = $this->getApiClient();
$request = new PaymentManagementData();
$request->setPaymentId($paymentRequest->payment_id);
$request->setDoConfirmDelivery(true);
$conversionData = new OrderToInvoiceData();
$conversionData->setInvoiceDocumentNumber($documentNumber);
$conversionData->setIssueDate(date('Y-m-d', $issueDate));
$conversionData->setDueDate(date('Y-m-d', $dueDate));
$request->setConversionData($conversionData);
$document = new FileData();
$document->setName($order->reference . '.pdf');
$document->setMimeType('application/pdf');
$document->setContentFromBin($pdfData);
$request->setDocument($document);
$client->managePayment($request);
$paymentRequest->delivery_confirmed = true;
$paymentRequest->completed = true;
$paymentRequest->save();
}
}
}