-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #457 from Adyen/feature/AD-315
AD-315 I can't pay with any method if the first payment attempt is ca…
- Loading branch information
Showing
9 changed files
with
87 additions
and
17 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
adyenocc/src/com/adyen/commerce/controllers/PaymentCanceledController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.adyen.commerce.controllers; | ||
|
||
import com.adyen.commerce.constants.AdyenoccConstants; | ||
import com.adyen.v6.facades.AdyenCheckoutFacade; | ||
import de.hybris.platform.commerceservices.request.mapping.annotation.ApiVersion; | ||
import de.hybris.platform.order.InvalidCartException; | ||
import de.hybris.platform.order.exceptions.CalculationException; | ||
import de.hybris.platform.webservicescommons.swagger.ApiBaseSiteIdUserIdAndCartIdParam; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.access.annotation.Secured; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping(value = AdyenoccConstants.ADYEN_USER_PREFIX) | ||
@ApiVersion("v2") | ||
@Tag(name = "Adyen") | ||
public class PaymentCanceledController { | ||
|
||
@Autowired | ||
private AdyenCheckoutFacade adyenCheckoutFacade; | ||
|
||
@Secured({"ROLE_CUSTOMERGROUP", "ROLE_CLIENT", "ROLE_CUSTOMERMANAGERGROUP", "ROLE_TRUSTED_CLIENT"}) | ||
@PostMapping(value = "/payment-canceled/{orderCode}") | ||
@Operation(operationId = "paymentCanceled", summary = "Handle payment canceled request", description = | ||
"Restores cart from order code and data in session") | ||
@ApiBaseSiteIdUserIdAndCartIdParam | ||
public ResponseEntity<Void> onCancel(@PathVariable String orderCode) throws InvalidCartException, CalculationException { | ||
adyenCheckoutFacade.restoreCartFromOrderOCC(orderCode); | ||
return ResponseEntity.ok().build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
package com.adyen.v6.facades; | ||
|
||
import de.hybris.platform.core.model.order.OrderModel; | ||
|
||
public interface AdyenOrderFacade { | ||
String getPaymentStatus(final String orderCode, final String sessionGuid); | ||
String getPaymentStatusOCC(final String code); | ||
String getOrderCodeForGUID(final String orderGUID, final String sessionGuid); | ||
OrderModel getOrderModelForCodeOCC(String code); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters