/** * Create Xml Message * @param SEPA\GroupHeader $setGroupHeader * @return SEPA\Message */ public static function createXMLMessage(\SEPA\GroupHeader $setGroupHeader = null) { $message = new \SEPA\Message(); //set to Message Group Header if (!empty($setGroupHeader)) { $message->setMessageGroupHeader($setGroupHeader); } return $message; }
/** * Generate Payment Info * @param $paymentInfo */ public function generatePaymentInfo($paymentsInfo) { //set Message Payment Info foreach ($paymentsInfo as $SequenceType => $paymentInfo) { try { /** @var $paymentInfo \SEPA\PaymentInfo */ if (is_object($paymentInfo) && $paymentInfo instanceof \SEPA\PaymentInfo) { $this->paymentInfoObject = $paymentInfo; } else { $paymentInfo = $this->objectToArray($paymentInfo); //set payment info $this->paymentInfoObject = SEPAXmlGeneratorFactory::createXMLPaymentInfo()->setPaymentInformationIdentification($paymentInfo['id'])->setSequenceType($SequenceType)->setCreditorAccountIBAN($paymentInfo['creditor_iban'])->setCreditorAccountBIC($paymentInfo['creditor_bic'])->setCreditorName($paymentInfo['creditor_name'])->setCreditorSchemeIdentification($paymentInfo['scheme_identifier'])->setRequestedCollectionDate($paymentInfo['requested_collection_date']); if (isset($paymentInfo['proprietary_name'])) { $this->paymentInfoObject->setUseProprietaryName($paymentInfo['proprietary_name']); } elseif (isset($paymentInfo['schema_name'])) { $this->paymentInfoObject->setUseSchemaNameCore($paymentInfo['schema_name']); } } if (is_object($paymentInfo) && isset($paymentInfo->transactions)) { $transactions = $paymentInfo->transactions; } elseif (is_object($paymentInfo) && $paymentInfo instanceof \SEPA\PaymentInfo) { $transactions = $paymentInfo->getDirectDebitTransactionObjects(); } else { $transactions = $paymentInfo['transactions']; } //generate Direct Debit Transactions $this->generateDirectDebitTransactions($transactions); //add Message Payment Info $this->messageObject->addMessagePaymentInfo($this->paymentInfoObject); } catch (Exception $e) { //Your log here // $e->getMessage(); } } }