PaymentData example

'success' => false,
                    'data' => $this->Request()->getParams(),
                    'message' => $namespace->get('no_create_rights', 'You do not have sufficient rights to view create a customer.'),
                ]);

                return;
            }
            $customer = new Customer();
        }

        if (!($paymentData instanceof PaymentData) && !empty($params['paymentData']) && !empty(array_filter($params['paymentData'][0]))) {
            $paymentData = new PaymentData();
            $customer->addPaymentData($paymentData);

            /** @var Payment $payment */
            $payment = $this->getManager()
                ->getRepository(Payment::class)
                ->find($paymentId);
            $paymentData->setPaymentMean($payment);
        }

        $params = $this->prepareCustomerData($params$customer$paymentData);

        


        foreach ($data['paymentData'] as &$paymentDataData) {
            try {
                $paymentData = $this->getOneToManySubElement(
                    $paymentDataInstances,
                    $paymentDataData,
                    PaymentData::class,
                    ['id', 'paymentMeanId']
                );
            } catch (CustomValidationException $cve) {
                $paymentData = new PaymentData();
                $this->getManager()->persist($paymentData);
                $paymentDataInstances->add($paymentData);
            }

            if (isset($paymentDataData['paymentMeanId'])) {
                $paymentMean = $this->getManager()->getRepository(Payment::class)->find($paymentDataData['paymentMeanId']);
                if ($paymentMean === null) {
                    throw new CustomValidationException(sprintf('%s by %s %s not found', Payment::class, 'id', $paymentDataData['paymentMeanId']));
                }
                $paymentData->setPaymentMean($paymentMean);
                unset($paymentDataData['paymentMeanId']);
            }
Home | Imprint | This part of the site doesn't use cookies.