Skip to content

Commit

Permalink
Add ApplePay integration (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
onurpolattimur authored Oct 10, 2023
1 parent a291905 commit 44558a3
Show file tree
Hide file tree
Showing 5 changed files with 40 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 @@ -196,6 +196,12 @@ public PaymentTransactionResponse updatePaymentTransaction(UpdatePaymentTransact
updatePaymentTransactionRequest, PaymentTransactionResponse.class);
}

public Object createApplePayMerchantSession(ApplePayMerchantSessionCreateRequest applePayMerchantSessionCreateRequest) {
String path = "/payment/v1/apple-pay/merchant-sessions";
return HttpClient.post(requestOptions.getBaseUrl() + path, createHeaders(applePayMerchantSessionCreateRequest, path, requestOptions),
applePayMerchantSessionCreateRequest, Object.class);
}

public boolean is3DSecureCallbackVerified(String threeDSecureCallbackKey, Map<String, String> params) {
String hash = params.get("hash");
String hashString = new StringBuilder(threeDSecureCallbackKey)
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/io/craftgate/model/TokenizedCardType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package io.craftgate.model;

public enum TokenizedCardType {
APPLE_PAY,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.craftgate.request;

import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class ApplePayMerchantSessionCreateRequest {

private String merchantIdentifier;
private String displayName;
private String initiative;
private String initiativeContext;
private String validationUrl;
}
1 change: 1 addition & 0 deletions src/main/java/io/craftgate/request/dto/Card.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class Card {
private String lastFourDigits;
private String cardHolderIdentityNumber;
private Loyalty loyalty;
private TokenizedCard tokenizedCard;

@Builder.Default
private Boolean storeCardAfterSuccessPayment = false;
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/io/craftgate/request/dto/TokenizedCard.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.craftgate.request.dto;

import io.craftgate.model.TokenizedCardType;
import lombok.Builder;
import lombok.Data;

import java.util.Map;
@Data
@Builder
public class TokenizedCard {
private TokenizedCardType type;
private Map<String, Object> data;
}

0 comments on commit 44558a3

Please sign in to comment.