All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.global.api.builders.FraudBuilder Maven / Gradle / Ivy

There is a newer version: 14.2.3
Show newest version
package com.global.api.builders;

import com.global.api.ServicesContainer;
import com.global.api.entities.Address;
import com.global.api.entities.BrowserData;
import com.global.api.entities.PhoneNumber;
import com.global.api.entities.enums.*;
import com.global.api.entities.exceptions.ApiException;
import com.global.api.paymentMethods.IPaymentMethod;
import lombok.var;
import org.joda.time.DateTime;

import java.math.BigDecimal;

public class FraudBuilder extends SecureBuilder {

    public FraudBuilder(TransactionType type) {
        setTransactionType(type);
//        setAuthenticationSource(AuthenticationSource.Browser);
    }

    @Override
    public TResult execute(String configName) throws ApiException {
        super.execute(configName);

        var client = ServicesContainer.getInstance().getFraudCheckClient(configName);
        return (TResult) client.processFraud(this);
    }

    @Override
    public void setupValidations() {
        validations
                .of(TransactionType.RiskAssess)
                .check("paymentMethod").isNotNull();
    }

    public FraudBuilder WithAmount(BigDecimal value) {
        setAmount(value);
        return this;
    }

    public FraudBuilder WithCurrency(String value) {
        setCurrency(value);
        return this;
    }

    public FraudBuilder WithAuthenticationSource(AuthenticationSource value) {
        setAuthenticationSource(value);
        return this;
    }

    public FraudBuilder WithOrderCreateDate(DateTime value) {
        setOrderCreateDate(value);
        return this;
    }

    public FraudBuilder WithReferenceNumber(String referenceNumber) {
        setReferenceNumber(referenceNumber);
        return this;
    }

    public FraudBuilder WithAddressMatchIndicator(Boolean value) {
        setAddressMatchIndicator(value);
        return this;
    }

    public FraudBuilder WithAddress(Address address) {
        return WithAddress(address, AddressType.Billing);
    }

    public FraudBuilder WithAddress(Address address, AddressType type) {
        if (type.equals(AddressType.Billing)) {
            setBillingAddress(address);
        } else {
            setShippingAddress(address);
        }
        return this;
    }

    public FraudBuilder WithGiftCardAmount(BigDecimal giftCardAmount) {
        setGiftCardAmount(giftCardAmount);
        return this;
    }

    public FraudBuilder WithGiftCardCount(Integer giftCardCount) {
        setGiftCardCount(giftCardCount);
        return this;
    }

    public FraudBuilder WithGiftCardCurrency(String giftCardCurrency) {
        setGiftCardCurrency(giftCardCurrency);
        return this;
    }

    public FraudBuilder WithDeliveryEmail(String deliveryEmail) {
        setDeliveryEmail(deliveryEmail);
        return this;
    }

    public FraudBuilder WithDeliveryTimeFrame(DeliveryTimeFrame deliveryTimeframe) {
        setDeliveryTimeframe(deliveryTimeframe);
        return this;
    }

    public FraudBuilder WithShippingMethod(ShippingMethod shippingMethod) {
        setShippingMethod(shippingMethod);
        return this;
    }

    public FraudBuilder WithShippingNameMatchesCardHolderName(Boolean shippingNameMatchesCardHolderName) {
        setShippingNameMatchesCardHolderName(shippingNameMatchesCardHolderName);
        return this;
    }

    public FraudBuilder WithPreOrderIndicator(PreOrderIndicator preOrderIndicator) {
        setPreOrderIndicator(preOrderIndicator);
        return this;
    }

    public FraudBuilder WithPreOrderAvailabilityDate(DateTime preOrderAvailabilityDate) {
        setPreOrderAvailabilityDate(preOrderAvailabilityDate);
        return this;
    }

    public FraudBuilder WithReorderIndicator(ReorderIndicator reorderIndicator) {
        setReorderIndicator(reorderIndicator);
        return this;
    }

    public FraudBuilder WithOrderTransactionType(OrderTransactionType orderTransactionType) {
        setOrderTransactionType(orderTransactionType);
        return this;
    }

    public FraudBuilder WithCustomerAccountId(String customerAccountId) {
        setCustomerAccountId(customerAccountId);
        return this;
    }

    public FraudBuilder WithAccountAgeIndicator(AgeIndicator ageIndicator) {
        setAccountAgeIndicator(ageIndicator);
        return this;
    }

    public FraudBuilder WithAccountCreateDate(DateTime accountCreateDate) {
        setAccountCreateDate(accountCreateDate);
        return this;
    }

    public FraudBuilder WithAccountChangeDate(DateTime accountChangeDate) {
        setAccountChangeDate(accountChangeDate);
        return this;
    }

    public FraudBuilder WithAccountChangeIndicator(AgeIndicator accountChangeIndicator) {
        setAccountChangeIndicator(accountChangeIndicator);
        return this;
    }

    public FraudBuilder WithPasswordChangeDate(DateTime passwordChangeDate) {
        setPasswordChangeDate(passwordChangeDate);
        return this;
    }

    public FraudBuilder WithPasswordChangeIndicator(AgeIndicator passwordChangeIndicator) {
        setPasswordChangeIndicator(passwordChangeIndicator);
        return this;
    }

    public FraudBuilder WithPhoneNumber(String phoneCountryCode, String number, PhoneNumberType type) {
        var phoneNumber = new PhoneNumber();
        phoneNumber.setCountryCode(phoneCountryCode);
        phoneNumber.setNumber(number);
        //setPhoneList[type](phoneNumber);
        switch (type) {
            case Home:
                setHomeNumber(number);
                setHomeCountryCode(phoneCountryCode);
                break;
            case Work:
                setWorkNumber(number);
                setWorkCountryCode(phoneCountryCode);
                break;
            case Mobile:
                setMobileNumber(number);
                setMobileCountryCode(phoneCountryCode);
                break;
            default:
                break;
        }

        return this;
    }

    public FraudBuilder WithPaymentAccountCreateDate(DateTime paymentAccountCreateDate) {
        setPaymentAccountCreateDate(paymentAccountCreateDate);
        return this;
    }

    public FraudBuilder WithPaymentAccountAgeIndicator(AgeIndicator paymentAgeIndicator) {
        setPaymentAgeIndicator(paymentAgeIndicator);
        return this;
    }

    public FraudBuilder WithPreviousSuspiciousActivity(Boolean previousSuspiciousActivity) {
        setPreviousSuspiciousActivity(previousSuspiciousActivity);
        return this;
    }

    public FraudBuilder WithNumberOfPurchasesInLastSixMonths(Integer numberOfPurchasesInLastSixMonths) {
        setNumberOfPurchasesInLastSixMonths(numberOfPurchasesInLastSixMonths);
        return this;
    }

    public FraudBuilder WithNumberOfTransactionsInLast24Hours(Integer numberOfTransactionsInLast24Hours) {
        setNumberOfTransactionsInLast24Hours(numberOfTransactionsInLast24Hours);
        return this;
    }

    public FraudBuilder WithNumberOfTransactionsInLastYear(Integer numberOfTransactionsInLastYear) {
        setNumberOfTransactionsInLastYear(numberOfTransactionsInLastYear);
        return this;
    }

    public FraudBuilder WithNumberOfAddCardAttemptsInLast24Hours(Integer numberOfAddCardAttemptsInLast24Hours) {
        setNumberOfAddCardAttemptsInLast24Hours(numberOfAddCardAttemptsInLast24Hours);
        return this;
    }

    public FraudBuilder WithShippingAddressCreateDate(DateTime shippingAddressCreateDate) {
        setShippingAddressCreateDate(shippingAddressCreateDate);
        return this;
    }

    public FraudBuilder WithShippingAddressUsageIndicator(AgeIndicator shippingAddressUsageIndicator) {
        setShippingAddressUsageIndicator(shippingAddressUsageIndicator);
        return this;
    }

    public FraudBuilder WithPriorAuthenticationMethod(PriorAuthenticationMethod priorAuthenticationMethod) {
        setPriorAuthenticationMethod(priorAuthenticationMethod);
        return this;
    }

    public FraudBuilder WithPriorAuthenticationTransactionId(String priorAuthencitationTransactionId) {
        setPriorAuthenticationTransactionId(priorAuthencitationTransactionId);
        return this;
    }

    public FraudBuilder WithPriorAuthenticationTimestamp(DateTime priorAuthenticationTimestamp) {
        setPriorAuthenticationTimestamp(priorAuthenticationTimestamp);
        return this;
    }

    public FraudBuilder WithPriorAuthenticationData(String priorAuthenticationData) {
        setPriorAuthenticationData(priorAuthenticationData);
        return this;
    }

    public FraudBuilder WithMaxNumberOfInstallments(Integer maxNumberOfInstallments) {
        setMaxNumberOfInstallments(maxNumberOfInstallments);
        return this;
    }

    public FraudBuilder WithRecurringAuthorizationFrequency(Integer recurringAuthorizationFrequency) {
        setRecurringAuthorizationFrequency(recurringAuthorizationFrequency);
        return this;
    }

    public FraudBuilder WithRecurringAuthorizationExpiryDate(DateTime recurringAuthorizationExpiryDate) {
        setRecurringAuthorizationExpiryDate(recurringAuthorizationExpiryDate);
        return this;
    }

    public FraudBuilder WithCustomerAuthenticationData(String customerAuthenticationData) {
        setCustomerAuthenticationData(customerAuthenticationData);
        return this;
    }

    public FraudBuilder WithCustomerAuthenticationTimestamp(DateTime customerAuthenticationTimestamp) {
        setCustomerAuthenticationTimestamp(customerAuthenticationTimestamp);
        return this;
    }

    public FraudBuilder WithCustomerAuthenticationMethod(CustomerAuthenticationMethod customerAuthenticationMethod) {
        setCustomerAuthenticationMethod(customerAuthenticationMethod);
        return this;
    }

    public FraudBuilder WithIdempotencyKey(String value) {
        setIdempotencyKey(value);
        return this;
    }

    public FraudBuilder WithBrowserData(BrowserData value) {
        setBrowserData(value);
        return this;
    }

    public FraudBuilder WithPaymentMethod(IPaymentMethod value) {
        setPaymentMethod(value);
        return this;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy