Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add retrieve migrated card method #185

Merged
merged 2 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/main/java/io/craftgate/adapter/PaymentAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ public MultiPaymentResponse retrieveMultiPayment(String token) {
return HttpClient.get(requestOptions.getBaseUrl() + path, createHeaders(path, requestOptions), MultiPaymentResponse.class);
}

public StoredCardResponse retrieveProviderCard(RetrieveProviderCardRequest retrieveProviderCardRequest) {
String query = RequestQueryParamsBuilder.buildQueryParam(retrieveProviderCardRequest);
String path = "/payment/v1/cards/provider-card-mappings" + query;
return HttpClient.get(requestOptions.getBaseUrl() + path, createHeaders(path, requestOptions), StoredCardResponse.class);
}

public boolean is3DSecureCallbackVerified(String threeDSecureCallbackKey, Map<String, String> params) {
String hash = params.get("hash");
String hashString = threeDSecureCallbackKey +
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.craftgate.request;

import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class RetrieveProviderCardRequest {

private String providerCardToken;
private String externalId;
private String providerCardUserId;

}
14 changes: 14 additions & 0 deletions src/test/java/io/craftgate/sample/PaymentSample.java
Original file line number Diff line number Diff line change
Expand Up @@ -1764,6 +1764,20 @@ void retrieve_multi_payment() {
assertNotNull(response);
}

@Test
void retrieve_provider_card() {

RetrieveProviderCardRequest retrieveProviderCardRequest = RetrieveProviderCardRequest.builder()
.providerCardToken("45f12c74-3000-465c-96dc-876850e7dd7a")
.providerCardUserId("0309ac2d-c5a5-4b4f-a91f-5c444ba07b24")
.externalId("1001")
.build();

StoredCardResponse response = craftgate.payment().retrieveProviderCard(retrieveProviderCardRequest);

assertNotNull(response);
}

@Test
void should_validate_3D_secure_callback_verified() {
//given
Expand Down
Loading