Example #1
0
 /**
  * @return Payone_Api_Request_Parameter_Capture_Business
  */
 protected function mapBusinessParameters()
 {
     $business = new Payone_Api_Request_Parameter_Capture_Business();
     $business->setBookingDate('');
     $business->setDocumentDate('');
     $business->setDueTime('');
     $paymentMethod = $this->getPaymentMethod();
     // settleaccount possibilities depend on payment method:
     if ($paymentMethod instanceof Payone_Core_Model_Payment_Method_AdvancePayment or $paymentMethod instanceof Payone_Core_Model_Payment_Method_OnlineBankTransfer) {
         $payment = $paymentMethod->getInfoInstance();
         // Advancepayment and OnlineBankTransfer use NO/AUTO
         if ($this->isInvoiceLast() || $this->helperRegistry()->isPaymentCancelRegistered($payment)) {
             // Invoice completes the order
             $business->setSettleaccount(Payone_Api_Enum_Settleaccount::AUTO);
         } else {
             // partial payment
             $business->setSettleaccount(Payone_Api_Enum_Settleaccount::NO);
         }
     } elseif ($paymentMethod instanceof Payone_Core_Model_Payment_Method_SafeInvoice and $paymentMethod->getInfoInstance()->getPayoneSafeInvoiceType() == Payone_Api_Enum_FinancingType::BSV) {
         // BillSAFE always settles account:
         $business->setSettleaccount(Payone_Api_Enum_Settleaccount::YES);
     } else {
         // all other can always use AUTO, regardless of complete or partial capture
         $business->setSettleaccount(Payone_Api_Enum_Settleaccount::AUTO);
     }
     return $business;
 }
 /**
  * returns params to capture orders
  *
  * @param object $order
  * @param array $postionIds
  * @param bool $finalize
  * @param bool $includeShipment
  * @return \Payone_Api_Request_Parameter_Capture_Business 
  */
 public function buildOrderCapture($order, $postionIds, $finalize, $includeShipment = false)
 {
     $paymentName = $order->getPayment()->getName();
     $params = $this->getAuthParameters($order->getPayment()->getId());
     $params['txid'] = $order->getTransactionId();
     $params['sequencenumber'] = $this->getParamSequencenumber($order);
     $params['amount'] = $this->getParamCaptureAmount($order, $postionIds, $includeShipment);
     $params['currency'] = $order->getCurrency();
     //create business object (used for settleaccount param)
     $business = new Payone_Api_Request_Parameter_Capture_Business();
     if ($this->payonePaymentHelper->isPayonePayInAdvance($paymentName) || $this->payonePaymentHelper->isPayoneInstantBankTransfer($paymentName)) {
         $business->setSettleaccount($finalize ? Payone_Api_Enum_Settleaccount::YES : Payone_Api_Enum_Settleaccount::NO);
     } else {
         $business->setSettleaccount($finalize ? Payone_Api_Enum_Settleaccount::YES : Payone_Api_Enum_Settleaccount::AUTO);
     }
     $params['business'] = $business;
     return $params;
 }