Skip to content

Commit becb314

Browse files
update buckaroofee
1 parent 4292048 commit becb314

File tree

4 files changed

+7
-27
lines changed

4 files changed

+7
-27
lines changed

Model/Method/AbstractMethod.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2773,8 +2773,8 @@ public function checkTotalGrossAmount($requestData, $payment)
27732773
}
27742774

27752775
return $requestData;
2776-
27772776
}
2777+
27782778
public function canUseForCountry($country)
27792779
{
27802780
if ($this->getConfigData('allowspecific') != 1) {

Model/Method/Afterpay.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -778,11 +778,8 @@ protected function getTaxCategory($order)
778778
if (!$taxClassId) {
779779
return $taxCategory;
780780
}
781-
/**
782-
* @var \Buckaroo\Magento2\Model\ConfigProvider\Method\Afterpay $afterPayConfig
783-
*/
784-
$afterPayConfig = $this->configProviderMethodFactory
785-
->get($this->_code);
781+
782+
$afterPayConfig = $this->configProviderMethodFactory->get($this->_code);
786783

787784
$highClasses = explode(',', (string)$afterPayConfig->getHighTaxClasses($storeId));
788785
$middleClasses = explode(',', (string)$afterPayConfig->getMiddleTaxClasses($storeId));
@@ -798,7 +795,6 @@ protected function getTaxCategory($order)
798795
} elseif (in_array($taxClassId, $zeroClasses)) {
799796
$taxCategory = 3;
800797
} else {
801-
// No classes == 4
802798
$taxCategory = 4;
803799
}
804800

Model/Total/Quote/Tax/BuckarooFee.php

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ public function collect(
159159
Total $total
160160
) {
161161
if (!$shippingAssignment->getItems()) {
162+
parent::collect($quote, $shippingAssignment, $total);
162163
return $this;
163164
}
164-
165165
$orderId = $quote->getReservedOrderId();
166166

167167
// Check if already paid amount is affecting the calculation
@@ -170,30 +170,13 @@ public function collect(
170170
}
171171

172172
$result = $this->calculate->calculatePaymentFee($quote, $total);
173+
173174
if ($result === null){
174175
return $this;
175176
}
176-
$amount = $this->priceCurrency->convert($result->getRoundedAmount());
177177

178178
$this->addAssociatedTaxable($shippingAssignment, $result, $quote);
179179

180-
$feeDataObject = $this->quoteDetailsItemDataObjectFactory->create()
181-
->setType('buckaroo_fee')
182-
->setCode('buckaroo_fee')
183-
->setQuantity(1);
184-
185-
$feeDataObject->setUnitPrice($result->getRoundedAmount());
186-
$feeDataObject->setTaxClassKey(
187-
$this->taxClassKeyDataObjectFactory->create()
188-
->setType(TaxClassKeyInterface::TYPE_ID)
189-
->setValue(4)
190-
);
191-
$feeDataObject->setIsTaxIncluded(true);
192-
193-
$quoteDetails = $this->prepareQuoteDetails($shippingAssignment, [$feeDataObject]);
194-
195-
$this->taxCalculationService->calculateTax($quoteDetails, $quote->getStoreId());
196-
197180
parent::collect($quote, $shippingAssignment, $total);
198181

199182
return $this;
@@ -225,7 +208,6 @@ private function addAssociatedTaxable(ShippingAssignmentInterface $shippingAssig
225208

226209
// Retrieve the Buckaroo fee tax class ID from BuckarooFeeConfigProvider using the store
227210
$taxClassId = $this->configProviderBuckarooFee->getBuckarooFeeTaxClass($store);
228-
229211
$associatedTaxables[] = [
230212
CommonTaxCollector::KEY_ASSOCIATED_TAXABLE_TYPE => self::QUOTE_TYPE,
231213
CommonTaxCollector::KEY_ASSOCIATED_TAXABLE_CODE => self::CODE_QUOTE_GW,

Model/Total/Quote/Tax/BuckarooFeeAfterTax.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,13 @@ public function collect(
7474
if (empty($extraTaxableDetails[BuckarooFee::QUOTE_TYPE])) {
7575
return $this;
7676
}
77+
7778
$itemTaxDetails = $extraTaxableDetails[BuckarooFee::QUOTE_TYPE];
7879

7980
if (empty($itemTaxDetails[CommonTaxCollector::ASSOCIATION_ITEM_CODE_FOR_QUOTE][0])) {
8081
return $this;
8182
}
83+
8284
$buckarooFeeTaxDetails = $itemTaxDetails[CommonTaxCollector::ASSOCIATION_ITEM_CODE_FOR_QUOTE][0];
8385

8486
$buckarooFeeBaseTaxAmount = $buckarooFeeTaxDetails['base_row_tax'];

0 commit comments

Comments
 (0)