Skip to content

Commit

Permalink
add check masterpass user endpoint (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
onurpolattimur authored Oct 22, 2021
1 parent 56bcc4d commit c290f6a
Show file tree
Hide file tree
Showing 4 changed files with 43 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 @@ -127,4 +127,10 @@ public PaymentTransactionApprovalListResponse disapprovePaymentTransactions(Disa
return HttpClient.post(requestOptions.getBaseUrl() + path, createHeaders(disapprovePaymentTransactionsRequest, path, requestOptions),
disapprovePaymentTransactionsRequest, PaymentTransactionApprovalListResponse.class);
}

public CheckMasterpassUserResponse checkMasterpassUser(CheckMasterpassUserRequest checkMasterpassUserRequest) {
String path = "/payment/v1/masterpass-payments/check-user";
return HttpClient.post(requestOptions.getBaseUrl() + path, createHeaders(checkMasterpassUserRequest, path, requestOptions),
checkMasterpassUserRequest, CheckMasterpassUserResponse.class);
}
}
11 changes: 11 additions & 0 deletions src/main/java/io/craftgate/request/CheckMasterpassUserRequest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.craftgate.request;

import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class CheckMasterpassUserRequest {

private String masterpassGsmNumber;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.craftgate.response;

import lombok.Data;

@Data
public class CheckMasterpassUserResponse {

private Boolean isEligibleToUseMasterpass;
private Boolean isAnyCardSavedInCustomerProgram;
private Boolean hasMasterpassAccount;
private Boolean hashAnyCardSavedInMasterpassAccount;
private Boolean isMasterpassAccountLinkedWithMerchant;
private Boolean isMasterpassAccountLocked;
private Boolean isPhoneNumberUpdatedInAnotherMerchant;
private String accountStatus;
}
10 changes: 10 additions & 0 deletions src/test/java/io/craftgate/sample/PaymentSample.java
Original file line number Diff line number Diff line change
Expand Up @@ -896,4 +896,14 @@ void post_auth_payment() {
assertEquals(paymentId, response.getId());
assertEquals(PaymentPhase.POST_AUTH, response.getPaymentPhase());
}

@Test
void check_masterpass_user() {
CheckMasterpassUserRequest request = CheckMasterpassUserRequest.builder()
.masterpassGsmNumber("903000000000")
.build();

CheckMasterpassUserResponse response = craftgate.payment().checkMasterpassUser(request);
assertNotNull(response);
}
}

0 comments on commit c290f6a

Please sign in to comment.