Skip to content

Commit

Permalink
Add retrieve migrated card method (#185)
Browse files Browse the repository at this point in the history
* Add retrieve migrated card method

* Update
  • Loading branch information
semihshn authored Jun 5, 2024
1 parent 19a534b commit a2fc8cb
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
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

0 comments on commit a2fc8cb

Please sign in to comment.