Skip to content

Commit

Permalink
--draft-- fix paypal saving issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniil Tkachev committed Oct 16, 2024
1 parent 818ba86 commit 72129de
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/Controller/AccountSavedPaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ protected function setPaymentListsToView(): void
$paymentTypes[$paymentType->getBrand()][$transactionOxId] = $paymentType->expose();
}
if (strpos($paymentTypeId, 'ppl')) {
$paymentTypes['paypal'][$transactionOxId] = $paymentType->expose();
if (!empty($paymentType->getEmail())) {
$paymentTypes['paypal'][$transactionOxId] = $paymentType->expose();
}
}
if (strpos($paymentTypeId, 'sdd')) {
$paymentTypes['sepa'][$transactionOxId] = $paymentType->expose();
Expand Down
2 changes: 1 addition & 1 deletion src/PaymentExtensions/UnzerPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function execute(
} catch (UnzerApiException $apiException) {
$customer = $this->unzerSDK->createCustomer($customer);
}
//first_transaction
//first_transaction
$transaction = $this->doTransactions($basketModel, $customer, $userModel, $paymentType);
$this->unzerService->setSessionVars($transaction);

Expand Down
10 changes: 8 additions & 2 deletions src/Service/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ public function getSavedPaymentsForUser(?User $user, array $ids, bool $cache): a
foreach ($ids as $typeData) {
$paymentTypes = null;
$paymentTypeId = $typeData['paymenttypeid'] ?: '';
if ($paymentTypeId) {
if (!empty($paymentTypeId)) {
$paymentTypes = $this->setPaymentTypes(
$user,
$typeData['paymenttypeid'] ?: '',
Expand Down Expand Up @@ -690,7 +690,13 @@ private function setPaymentTypes(

foreach ($this->transPaymentTypeIds as $unzerId => $oxVar) {
if (strpos($paymentTypeId, $unzerId)) {
$result[$oxVar][$paymentTypeId] = $paymentType->expose();
if ($unzerId === 'ppl') {
if (!empty($paymentType->getEmail())) {
$result[$oxVar][$paymentTypeId] = $paymentType->expose();
}
} else {
$result[$oxVar][$paymentTypeId] = $paymentType->expose();
}
}
}
return $result;
Expand Down

0 comments on commit 72129de

Please sign in to comment.