Closed boldsidney closed 3 years ago
Thank you for your issue. We will start researching this in our next sprint (5oct - 16 oct).
@boldsidney We made a chance in our plugin. Are you able to test is? Since we do not have licence to this plugin and still awaiting response from Amasty. https://github.com/buckaroo-it/Magento2/commit/1d84a7c8c482620fa3f2351424b875d0d07639a4
@boldsidney Did you do any tests allready?
Hi @Buckaroo-Rens ,
I've tested it on magento 2.3.5-p2 with buckaroo version 1.26.0. Unfortunately it's still not working.
Looking at the code changes, it would seem that the fix was done by making use of the discount amount data. However, the amasty giftcard doesn't work like that. Rather than working with the core magento discount fields, it just records the discount separately in its own table and directly removes the giftcard value from the grand total.
With you not having access to the extension, perhaps it's easier if you were to provide guidance on what changes should be done to the soap packet to process the refund and that we find a way to implement it ourselves?
sample order placement
<ns1:Currency>EUR</ns1:Currency>
<ns1:AmountDebit>79.97</ns1:AmountDebit>
<ns1:AmountCredit>0</ns1:AmountCredit>
<ns1:Services>
<ns1:Service Name="afterpaydigiaccept" Action="Pay" Version="1">
... address data ...
<ns1:RequestParameter Name="CustomerIPAddress">127.0.0.1</ns1:RequestParameter>
<ns1:RequestParameter Name="Accept">true</ns1:RequestParameter>
<ns1:RequestParameter Name="B2B">false</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleDescription" GroupID="1">1 x Product 1</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleId" GroupID="1">27909</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleQuantity" GroupID="1">1</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleUnitPrice" GroupID="1">49.99</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleVatCategory" GroupID="1">1</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleDescription" GroupID="2">1 x Product 2</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleId" GroupID="2">5540</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleQuantity" GroupID="2">1</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleUnitPrice" GroupID="2">34.99</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleVatCategory" GroupID="2">1</ns1:RequestParameter>
<ns1:RequestParameter Name="ShippingCosts">4.99</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleDescription" GroupID="3">Betaald bedrag</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleId" GroupID="3">BETAALD</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleQuantity" GroupID="3">1</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleUnitPrice" GroupID="3">-10</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleVatCategory" GroupID="3">4</ns1:RequestParameter>
</ns1:Service>
</ns1:Services>
following creditmemo request
<ns1:Currency>EUR</ns1:Currency>
<ns1:AmountDebit>0</ns1:AmountDebit>
<ns1:AmountCredit>79.97</ns1:AmountCredit>
<ns1:Services>
<ns1:Service Name="afterpaydigiaccept" Action="Refund" Version="1">
<ns1:RequestParameter Name="ArticleDescription" GroupID="1">1 x Product 1</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleId" GroupID="1">27909</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleQuantity" GroupID="1">1</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleUnitPrice" GroupID="1">49.99</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleVatCategory" GroupID="1">1</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleDescription" GroupID="2">1 x Product 2</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleId" GroupID="2">5540</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleQuantity" GroupID="2">1</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleUnitPrice" GroupID="2">34.99</ns1:RequestParameter>
<ns1:RequestParameter Name="ArticleVatCategory" GroupID="2">1</ns1:RequestParameter>
<ns1:RequestParameter Name="ShippingCosts">4.99</ns1:RequestParameter>
</ns1:Service>
</ns1:Services>
error message
<Status>
<Code Code="690">Rejected</Code>
<SubCode Code="S996">An error occurred while processing the transaction: Refund rejected. The following validation errors occurred:
TotalGrossAmount (79.97) is not equal to the sum of the articles (89.97).</SubCode>
<DateTime>2020-10-19T13:38:09</DateTime>
</Status>
Seeing as the payment request adds an additional discount article with a minus value, would our issue be solved if we were to do the same when doing the refund? And when doing partial refunds, I would assume that we have to split the giftcard amount over the articles like the way magento does with the discount amount. Furthermore, does it matter for Afterpay what we specify as description for the giftcard discount, or can it be anything?
We made some final changes in version 1.30 which is already released.
Buckaroo version v1.15.0 added support for amasty gift cards. This works great when placing orders, however when creating a credit memo we get the error
This is due to the grand total excluding gift card value being send as reference value, which is then compared to the grand total on the order in magento which is including gift card value
I had a look at what is send to the gateway, and it's something like this
There is no mention of the giftcard leading to the issue that amountCredit !== (ArticleUnitPrice + ShippingCosts)
In the payment method you see in the getRequestArticlesData method that third party giftcards are added to the order https://github.com/buckaroo-it/Magento2/blob/v1.25.4-RC1/Model/Method/Afterpay.php#L740
However when looking at the getCreditmemoArticleData method, we see no such mention. It seems to me that this method should include the used giftcard for use in refund as well.
Putting the remaining value from the gift card as adjustment refund doesnt work either because then you get a Magento error stating that the total refund value exceeds the grand total.
steps to reproduce
expected result
actual result
Ideally the balance on the used giftcard would also be restored after a successful creditmemo. But perhaps that is more specific to the amasty extension and out of scope for the buckaroo integration.
We're currently running v1.24.0 on production, but I've also had a look at the more recent gifcard related changes between 1.24 and master, but those seemed to be for buckaroo giftcards like fashion cheque and had no effect for third party amasty giftcards when i tried applying those changes as patches on our test environment.