Skip to content

Commit

Permalink
Merge pull request #30 from BoulangerV/M1-24-B2B_Kontoinhaber_bei_Las…
Browse files Browse the repository at this point in the history
…tschrift_und_Rate_per_Lastschrift

M1-24 : Adapt account holder fetching for B2B checkout
  • Loading branch information
BoulangerV authored Sep 29, 2020
2 parents a44db0c + 5d318e1 commit ae01fae
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
6 changes: 6 additions & 0 deletions app/code/community/RatePAY/Ratepaypayment/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,12 @@ private function _setBankDataSession($data, $code)
Mage::getSingleton('ratepaypayment/session')->setAccountNumber($data[$code . '_account_number']);
Mage::getSingleton('ratepaypayment/session')->setBankCodeNumber($data[$code . '_bank_code_number']);
}

if (isset($data[$code . '_account_holder'])) {
Mage::getSingleton('ratepaypayment/session')->setUseCompanyName($data[$code . '_account_holder']);
} else {
Mage::getSingleton('ratepaypayment/session')->setUseCompanyName(0);
}
}

/**
Expand Down
4 changes: 4 additions & 0 deletions app/code/community/RatePAY/Ratepaypayment/Helper/Mapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,10 @@ public function getRequestCustomer($quoteOrOrder)
$customer['BankAccount']['BankAccountNumber'] = Mage::getSingleton('ratepaypayment/session')->getAccountNumber();
$customer['BankAccount']['BankCode'] = Mage::getSingleton('ratepaypayment/session')->getBankCodeNumber();
}

if (Mage::getSingleton('ratepaypayment/session')->getUseCompanyName() == 1) {
$customer['BankAccount']['Owner'] = $quoteOrOrder->getBillingAddress()->getCompany();
}
}

return $customer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,22 @@ $bankData = $this->getBankData();
<li>
<label for="ratepay_directdebit_account_holder"><?php echo $this->__('Account holder'); ?></label>
<div class="input-box" style="font-weight: bold">
<?php echo $this->getAccountOwner(); ?>
<?php
// M1-24 : adapt account holder name when B2B (offer to use company)
$company = $this->getCompany();
$customerName = $this->getAccountOwner();

if (!$this->isB2b()) {
echo $customerName;
echo '<input type="hidden" name="payment[' . $_code . '_account_holder]" id="' . $_code . '_account_holder" value="0" />';
} else {
$company = $this->getCompany();
echo '<select name="payment[' . $_code . '_account_holder]" id="' . $_code . '_account_holder" class="input-select required-entry">';
echo '<option value="1" selected="selected">' . $company . '</option>';
echo '<option value="0">' . $customerName . '</option>';
echo '</select>';
}
?>
</div>
</li>
<li id="ratepay_directdebit_element_iban">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,22 @@ $_paymentHelper = Mage::helper('ratepaypayment');
<li class="<?php echo $_code ?>_sepa_element">
<label for="ratepay_rate_account_holder"><?php echo $this->__('Account holder'); ?></label>
<div class="input-box" style="font-weight: bold">
<?php echo $this->getAccountOwner(); ?>
<?php
// M1-24 : adapt account holder name when B2B (offer to use company)
$company = $this->getCompany();
$customerName = $this->getAccountOwner();

if (!$this->isB2b()) {
echo $customerName;
echo '<input type="hidden" name="payment[' . $_code . '_account_holder]" id="' . $_code . '_account_holder" value="0" />';
} else {
$company = $this->getCompany();
echo '<select name="payment[' . $_code . '_account_holder]" id="' . $_code . '_account_holder" class="input-select required-entry">';
echo '<option value="1" selected="selected">' . $company . '</option>';
echo '<option value="0">' . $customerName . '</option>';
echo '</select>';
}
?>
</div>
</li>
<li id="ratepay_rate_element_iban_<?php echo $_code ?>" class="<?php echo $_code ?>_sepa_element">
Expand Down

0 comments on commit ae01fae

Please sign in to comment.