mollie / magento2

Mollie Payments for Magento 2
https://www.mollie.com
Other
98 stars 50 forks source link

Fix for coupon code api requests #596

Closed BobWez98 closed 1 year ago

BobWez98 commented 1 year ago

Thank you for creating this pull request! To make the best use of your and our time we created this checklist to get the best possible pull requests:

This PR touches code in the following areas (Check what is applicable):

Frontend

Backend

Order Processing (Mollie communication)

Please describe the bug/feature/etc this PR contains:

We're using the magento api to apply coupon codes, when using a coupon code valid or invalid, this extension throws the following error: TypeError: Mollie\Payment\Plugin\Sales\Cart\AddPaymentFeeToCart::processCart(): Argument #1 ($cart) must be of type Magento\Quote\Api\Data\CartInterface, null given,

This error is thrown because the cartInterface is null. These changes fixes this.

Scenario to test this code:

Use a coupon code via api endpoints.

Frank-Magmodules commented 1 year ago

Hello @BobWez98,

Thanks for opening this issue. We tried to reproduce this problem but we can’t seem to reproduce this. Do you maybe have the GraphQL or REST request for us where this problem occurs? We’ve tried it with this mutation without luck:

mutation {
  applyCouponToCart(
    input: {
      cart_id: "{{cart_token}}",
      coupon_code: "H20"
    }
  ) {
    cart {
      applied_coupons {
        code
      }
    }
  }
}
Frank-Magmodules commented 1 year ago

Hello there, @BobWez98! I hope you’re doing well. It seems like there hasn’t been any activity or response regarding the issue, so I will assume that everything is clear now and I will proceed to close it. However, please don’t hesitate to contact us directly if you still need further assistance or if something is still unclear. I’ll be more than happy to help you out!