com.dynamitegc.billing.business.spreedly.SpreedlyPaymentPlatformServiceTest.java Source code

Java tutorial

Introduction

Here is the source code for com.dynamitegc.billing.business.spreedly.SpreedlyPaymentPlatformServiceTest.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.dynamitegc.billing.business.spreedly;

import com.dynamitegc.billing.PaymentDetails;
import com.dynamitegc.billing.PaymentMethod;
import com.dynamitegc.billing.TransactionReceipt;
import com.dynamitegc.billing.business.TransactionReceiptService;
import com.dynamitegc.membership.business.MemberService;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.datatype.joda.JodaModule;
import com.niyamit.spreedly.GatewayService;
import com.niyamit.spreedly.Gateways;
import com.niyamit.spreedly.PaymentMethodService;
import com.niyamit.spreedly.TransactionService;
import java.io.IOException;
import java.util.List;
import static org.testng.Assert.*;
import org.testng.annotations.Test;

/**
 *
 * @author bsneade
 */
public class SpreedlyPaymentPlatformServiceTest {

    @Test
    public void testSerialzeToSpreedlyPaymentDetails() throws IOException {
        final String details = "{\"paymentMethod\":{\"token\":\"4c9IuXcquWbhICDDHocQv7xTnok\",\"createdAt\":1404140476738,\"updatedAt\":1404140476738,\"email\":\"\",\"storageState\":\"cached\",\"data\":\"\",\"creditCard\":null,\"retained\":null,\"test\":true,\"lastFourDigits\":\"1111\",\"firstSixDigits\":\"411111\",\"cardType\":\"visa\",\"firstName\":\"K\",\"lastName\":\"bell\",\"month\":2,\"year\":2018,\"fullName\":\"K bell\",\"paymentMethodType\":\"credit_card\",\"verificationValue\":\"XXX\",\"number\":\"XXXX-XXXX-XXXX-1111\",\"address1\":\"\",\"address2\":\"\",\"city\":\"\",\"state\":\"\",\"zip\":\"\",\"country\":\"\",\"phone_number\":\"\"}}";
        final ObjectMapper objectMapper = new ObjectMapper();
        objectMapper.registerModule(new JodaModule());
        final SpreedlyPaymentDetails spreedlyPaymentDetails = objectMapper.readValue(details,
                SpreedlyPaymentDetails.class);
        assertNotNull(spreedlyPaymentDetails);
    }

}