repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
Lengchuan/SpringBoot-Study
SpringBoot-SpringDataJPA/src/test/java/com/lengchuan/springBoot/jpa/service/impl/CityServiceImplTest.java
// Path: SpringBoot-Redis/src/test/java/com/BaseTest.java // @RunWith(SpringJUnit4ClassRunner.class) // @SpringBootTest(classes = App.class) // public class BaseTest { // // private final static Logger logger = LoggerFactory.getLogger(BaseTest.class); // // @Autowired // private UserService userService; // // @Test // public void add() { // // User u = new User(); // u.setId(1); // u.setName("lengchuan"); // u.setEmail("lishuijun1992@gmail.com"); // // userService.createUser(u); // // } // // @Test // public void get() { // // logger.info("获取到用户信息:{}", userService.getUser(1)); // // } // } // // Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/entity/City.java // @Entity // @Table(name = "city") // public class City implements Serializable { // // private static final long serialVersionUID = 1L; // // @Id // @GeneratedValue // private Long id; // // @Column(nullable = false, unique = true, length = 64) // private String name; // // @Column(nullable = false) // private String state; // // @Column(nullable = false) // private String country; // // @Column(nullable = false) // private String map; // // public City() { // } // // public City(String name, String country) { // super(); // this.name = name; // this.country = country; // } // // public String getName() { // return this.name; // } // // public String getState() { // return this.state; // } // // public String getCountry() { // return this.country; // } // // public String getMap() { // return this.map; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public void setName(String name) { // this.name = name; // } // // public void setState(String state) { // this.state = state; // } // // public void setCountry(String country) { // this.country = country; // } // // public void setMap(String map) { // this.map = map; // } // // @Override // public String toString() { // return getName() + "," + getState() + "," + getCountry(); // } // } // // Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/service/CityService.java // public interface CityService { // // /** // * 通过id查询 // * @param id // * @return // */ // City findById(Long id); // // /** // * 通过country字段查询 // * @param country // * @return // */ // City findByCountryEquals(String country); // // /** // * 分页查询 // * @param pageable // * @return // */ // Page<City> findAll(Pageable pageable); // // /** // * 分页查询 name和country // * @param name // * @param country // * @param pageable // * @return // */ // Page<City> findByNameContainingAndCountryContainingAllIgnoringCase(String name, // String country, Pageable pageable); // // /** // * 分页查询 name和country,忽略大小写 // * @param name // * @param country // * @return // */ // City findByNameAndCountryAllIgnoringCase(String name, String country); // // /** // * 创建 // * @param city // * @return // */ // City createCity(City city); // }
import com.BaseTest; import com.lengchuan.springBoot.jpa.entity.City; import com.lengchuan.springBoot.jpa.service.CityService; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired;
package com.lengchuan.springBoot.jpa.service.impl; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-4-16 */ public class CityServiceImplTest extends BaseTest{ @Autowired
// Path: SpringBoot-Redis/src/test/java/com/BaseTest.java // @RunWith(SpringJUnit4ClassRunner.class) // @SpringBootTest(classes = App.class) // public class BaseTest { // // private final static Logger logger = LoggerFactory.getLogger(BaseTest.class); // // @Autowired // private UserService userService; // // @Test // public void add() { // // User u = new User(); // u.setId(1); // u.setName("lengchuan"); // u.setEmail("lishuijun1992@gmail.com"); // // userService.createUser(u); // // } // // @Test // public void get() { // // logger.info("获取到用户信息:{}", userService.getUser(1)); // // } // } // // Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/entity/City.java // @Entity // @Table(name = "city") // public class City implements Serializable { // // private static final long serialVersionUID = 1L; // // @Id // @GeneratedValue // private Long id; // // @Column(nullable = false, unique = true, length = 64) // private String name; // // @Column(nullable = false) // private String state; // // @Column(nullable = false) // private String country; // // @Column(nullable = false) // private String map; // // public City() { // } // // public City(String name, String country) { // super(); // this.name = name; // this.country = country; // } // // public String getName() { // return this.name; // } // // public String getState() { // return this.state; // } // // public String getCountry() { // return this.country; // } // // public String getMap() { // return this.map; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public void setName(String name) { // this.name = name; // } // // public void setState(String state) { // this.state = state; // } // // public void setCountry(String country) { // this.country = country; // } // // public void setMap(String map) { // this.map = map; // } // // @Override // public String toString() { // return getName() + "," + getState() + "," + getCountry(); // } // } // // Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/service/CityService.java // public interface CityService { // // /** // * 通过id查询 // * @param id // * @return // */ // City findById(Long id); // // /** // * 通过country字段查询 // * @param country // * @return // */ // City findByCountryEquals(String country); // // /** // * 分页查询 // * @param pageable // * @return // */ // Page<City> findAll(Pageable pageable); // // /** // * 分页查询 name和country // * @param name // * @param country // * @param pageable // * @return // */ // Page<City> findByNameContainingAndCountryContainingAllIgnoringCase(String name, // String country, Pageable pageable); // // /** // * 分页查询 name和country,忽略大小写 // * @param name // * @param country // * @return // */ // City findByNameAndCountryAllIgnoringCase(String name, String country); // // /** // * 创建 // * @param city // * @return // */ // City createCity(City city); // } // Path: SpringBoot-SpringDataJPA/src/test/java/com/lengchuan/springBoot/jpa/service/impl/CityServiceImplTest.java import com.BaseTest; import com.lengchuan.springBoot.jpa.entity.City; import com.lengchuan.springBoot.jpa.service.CityService; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; package com.lengchuan.springBoot.jpa.service.impl; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-4-16 */ public class CityServiceImplTest extends BaseTest{ @Autowired
private CityService cityService;
Lengchuan/SpringBoot-Study
SpringBoot-SpringDataJPA/src/test/java/com/lengchuan/springBoot/jpa/service/impl/CityServiceImplTest.java
// Path: SpringBoot-Redis/src/test/java/com/BaseTest.java // @RunWith(SpringJUnit4ClassRunner.class) // @SpringBootTest(classes = App.class) // public class BaseTest { // // private final static Logger logger = LoggerFactory.getLogger(BaseTest.class); // // @Autowired // private UserService userService; // // @Test // public void add() { // // User u = new User(); // u.setId(1); // u.setName("lengchuan"); // u.setEmail("lishuijun1992@gmail.com"); // // userService.createUser(u); // // } // // @Test // public void get() { // // logger.info("获取到用户信息:{}", userService.getUser(1)); // // } // } // // Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/entity/City.java // @Entity // @Table(name = "city") // public class City implements Serializable { // // private static final long serialVersionUID = 1L; // // @Id // @GeneratedValue // private Long id; // // @Column(nullable = false, unique = true, length = 64) // private String name; // // @Column(nullable = false) // private String state; // // @Column(nullable = false) // private String country; // // @Column(nullable = false) // private String map; // // public City() { // } // // public City(String name, String country) { // super(); // this.name = name; // this.country = country; // } // // public String getName() { // return this.name; // } // // public String getState() { // return this.state; // } // // public String getCountry() { // return this.country; // } // // public String getMap() { // return this.map; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public void setName(String name) { // this.name = name; // } // // public void setState(String state) { // this.state = state; // } // // public void setCountry(String country) { // this.country = country; // } // // public void setMap(String map) { // this.map = map; // } // // @Override // public String toString() { // return getName() + "," + getState() + "," + getCountry(); // } // } // // Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/service/CityService.java // public interface CityService { // // /** // * 通过id查询 // * @param id // * @return // */ // City findById(Long id); // // /** // * 通过country字段查询 // * @param country // * @return // */ // City findByCountryEquals(String country); // // /** // * 分页查询 // * @param pageable // * @return // */ // Page<City> findAll(Pageable pageable); // // /** // * 分页查询 name和country // * @param name // * @param country // * @param pageable // * @return // */ // Page<City> findByNameContainingAndCountryContainingAllIgnoringCase(String name, // String country, Pageable pageable); // // /** // * 分页查询 name和country,忽略大小写 // * @param name // * @param country // * @return // */ // City findByNameAndCountryAllIgnoringCase(String name, String country); // // /** // * 创建 // * @param city // * @return // */ // City createCity(City city); // }
import com.BaseTest; import com.lengchuan.springBoot.jpa.entity.City; import com.lengchuan.springBoot.jpa.service.CityService; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired;
package com.lengchuan.springBoot.jpa.service.impl; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-4-16 */ public class CityServiceImplTest extends BaseTest{ @Autowired private CityService cityService; @Test public void findById() throws Exception { } @Test public void findByCountryEquals() throws Exception { } @Test public void findAll() throws Exception { } @Test public void findByNameContainingAndCountryContainingAllIgnoringCase() throws Exception { } @Test public void findByNameAndCountryAllIgnoringCase() throws Exception { } @Test public void createCity() throws Exception {
// Path: SpringBoot-Redis/src/test/java/com/BaseTest.java // @RunWith(SpringJUnit4ClassRunner.class) // @SpringBootTest(classes = App.class) // public class BaseTest { // // private final static Logger logger = LoggerFactory.getLogger(BaseTest.class); // // @Autowired // private UserService userService; // // @Test // public void add() { // // User u = new User(); // u.setId(1); // u.setName("lengchuan"); // u.setEmail("lishuijun1992@gmail.com"); // // userService.createUser(u); // // } // // @Test // public void get() { // // logger.info("获取到用户信息:{}", userService.getUser(1)); // // } // } // // Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/entity/City.java // @Entity // @Table(name = "city") // public class City implements Serializable { // // private static final long serialVersionUID = 1L; // // @Id // @GeneratedValue // private Long id; // // @Column(nullable = false, unique = true, length = 64) // private String name; // // @Column(nullable = false) // private String state; // // @Column(nullable = false) // private String country; // // @Column(nullable = false) // private String map; // // public City() { // } // // public City(String name, String country) { // super(); // this.name = name; // this.country = country; // } // // public String getName() { // return this.name; // } // // public String getState() { // return this.state; // } // // public String getCountry() { // return this.country; // } // // public String getMap() { // return this.map; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public void setName(String name) { // this.name = name; // } // // public void setState(String state) { // this.state = state; // } // // public void setCountry(String country) { // this.country = country; // } // // public void setMap(String map) { // this.map = map; // } // // @Override // public String toString() { // return getName() + "," + getState() + "," + getCountry(); // } // } // // Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/service/CityService.java // public interface CityService { // // /** // * 通过id查询 // * @param id // * @return // */ // City findById(Long id); // // /** // * 通过country字段查询 // * @param country // * @return // */ // City findByCountryEquals(String country); // // /** // * 分页查询 // * @param pageable // * @return // */ // Page<City> findAll(Pageable pageable); // // /** // * 分页查询 name和country // * @param name // * @param country // * @param pageable // * @return // */ // Page<City> findByNameContainingAndCountryContainingAllIgnoringCase(String name, // String country, Pageable pageable); // // /** // * 分页查询 name和country,忽略大小写 // * @param name // * @param country // * @return // */ // City findByNameAndCountryAllIgnoringCase(String name, String country); // // /** // * 创建 // * @param city // * @return // */ // City createCity(City city); // } // Path: SpringBoot-SpringDataJPA/src/test/java/com/lengchuan/springBoot/jpa/service/impl/CityServiceImplTest.java import com.BaseTest; import com.lengchuan.springBoot.jpa.entity.City; import com.lengchuan.springBoot.jpa.service.CityService; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; package com.lengchuan.springBoot.jpa.service.impl; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-4-16 */ public class CityServiceImplTest extends BaseTest{ @Autowired private CityService cityService; @Test public void findById() throws Exception { } @Test public void findByCountryEquals() throws Exception { } @Test public void findAll() throws Exception { } @Test public void findByNameContainingAndCountryContainingAllIgnoringCase() throws Exception { } @Test public void findByNameAndCountryAllIgnoringCase() throws Exception { } @Test public void createCity() throws Exception {
City city = new City();
Lengchuan/SpringBoot-Study
SpringBoot-Druid/src/test/java/com/lengchuan/springBoot/druid/service/TeacherServiceTest.java
// Path: SpringBoot-Redis/src/test/java/com/BaseTest.java // @RunWith(SpringJUnit4ClassRunner.class) // @SpringBootTest(classes = App.class) // public class BaseTest { // // private final static Logger logger = LoggerFactory.getLogger(BaseTest.class); // // @Autowired // private UserService userService; // // @Test // public void add() { // // User u = new User(); // u.setId(1); // u.setName("lengchuan"); // u.setEmail("lishuijun1992@gmail.com"); // // userService.createUser(u); // // } // // @Test // public void get() { // // logger.info("获取到用户信息:{}", userService.getUser(1)); // // } // } // // Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/model/Teacher.java // public class Teacher implements Serializable { // // private Integer id; // // private String name; // // public Integer getId() { // return id; // } // // public void setId(Integer id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // }
import com.BaseTest; import com.lengchuan.springBoot.druid.model.Teacher; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired;
package com.lengchuan.springBoot.druid.service; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-4-5 */ public class TeacherServiceTest extends BaseTest{ @Autowired private TeacherService teacherService; @Test public void createTeacher() throws Exception {
// Path: SpringBoot-Redis/src/test/java/com/BaseTest.java // @RunWith(SpringJUnit4ClassRunner.class) // @SpringBootTest(classes = App.class) // public class BaseTest { // // private final static Logger logger = LoggerFactory.getLogger(BaseTest.class); // // @Autowired // private UserService userService; // // @Test // public void add() { // // User u = new User(); // u.setId(1); // u.setName("lengchuan"); // u.setEmail("lishuijun1992@gmail.com"); // // userService.createUser(u); // // } // // @Test // public void get() { // // logger.info("获取到用户信息:{}", userService.getUser(1)); // // } // } // // Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/model/Teacher.java // public class Teacher implements Serializable { // // private Integer id; // // private String name; // // public Integer getId() { // return id; // } // // public void setId(Integer id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // } // Path: SpringBoot-Druid/src/test/java/com/lengchuan/springBoot/druid/service/TeacherServiceTest.java import com.BaseTest; import com.lengchuan.springBoot.druid.model.Teacher; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; package com.lengchuan.springBoot.druid.service; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-4-5 */ public class TeacherServiceTest extends BaseTest{ @Autowired private TeacherService teacherService; @Test public void createTeacher() throws Exception {
Teacher teacher = new Teacher();
Lengchuan/SpringBoot-Study
SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/service/impl/CityServiceImpl.java
// Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/entity/City.java // @Entity // @Table(name = "city") // public class City implements Serializable { // // private static final long serialVersionUID = 1L; // // @Id // @GeneratedValue // private Long id; // // @Column(nullable = false, unique = true, length = 64) // private String name; // // @Column(nullable = false) // private String state; // // @Column(nullable = false) // private String country; // // @Column(nullable = false) // private String map; // // public City() { // } // // public City(String name, String country) { // super(); // this.name = name; // this.country = country; // } // // public String getName() { // return this.name; // } // // public String getState() { // return this.state; // } // // public String getCountry() { // return this.country; // } // // public String getMap() { // return this.map; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public void setName(String name) { // this.name = name; // } // // public void setState(String state) { // this.state = state; // } // // public void setCountry(String country) { // this.country = country; // } // // public void setMap(String map) { // this.map = map; // } // // @Override // public String toString() { // return getName() + "," + getState() + "," + getCountry(); // } // } // // Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/repository/CityRepository.java // @Repository // public interface CityRepository extends JpaRepository<City, Long> { // // /** // * 通过id查询 // * @param id // * @return // */ // City findById(Long id); // // /** // * 通过country字段查询 // * @param country // * @return // */ // City findByCountryEquals(String country); // // /** // * 分页查询 // * @param pageable // * @return // */ // Page<City> findAll(Pageable pageable); // // /** // * 分页查询 name和country // * @param name // * @param country // * @param pageable // * @return // */ // Page<City> findByNameContainingAndCountryContainingAllIgnoringCase(String name, // String country, Pageable pageable); // // /** // * 分页查询 name和country,忽略大小写 // * @param name // * @param country // * @return // */ // City findByNameAndCountryAllIgnoringCase(String name, String country); // } // // Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/service/CityService.java // public interface CityService { // // /** // * 通过id查询 // * @param id // * @return // */ // City findById(Long id); // // /** // * 通过country字段查询 // * @param country // * @return // */ // City findByCountryEquals(String country); // // /** // * 分页查询 // * @param pageable // * @return // */ // Page<City> findAll(Pageable pageable); // // /** // * 分页查询 name和country // * @param name // * @param country // * @param pageable // * @return // */ // Page<City> findByNameContainingAndCountryContainingAllIgnoringCase(String name, // String country, Pageable pageable); // // /** // * 分页查询 name和country,忽略大小写 // * @param name // * @param country // * @return // */ // City findByNameAndCountryAllIgnoringCase(String name, String country); // // /** // * 创建 // * @param city // * @return // */ // City createCity(City city); // }
import com.lengchuan.springBoot.jpa.config.ReadAndWrite.annotation.TargetDataSource; import com.lengchuan.springBoot.jpa.entity.City; import com.lengchuan.springBoot.jpa.repository.CityRepository; import com.lengchuan.springBoot.jpa.service.CityService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional;
package com.lengchuan.springBoot.jpa.service.impl; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-4-16 */ @Service public class CityServiceImpl implements CityService { @Autowired
// Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/entity/City.java // @Entity // @Table(name = "city") // public class City implements Serializable { // // private static final long serialVersionUID = 1L; // // @Id // @GeneratedValue // private Long id; // // @Column(nullable = false, unique = true, length = 64) // private String name; // // @Column(nullable = false) // private String state; // // @Column(nullable = false) // private String country; // // @Column(nullable = false) // private String map; // // public City() { // } // // public City(String name, String country) { // super(); // this.name = name; // this.country = country; // } // // public String getName() { // return this.name; // } // // public String getState() { // return this.state; // } // // public String getCountry() { // return this.country; // } // // public String getMap() { // return this.map; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public void setName(String name) { // this.name = name; // } // // public void setState(String state) { // this.state = state; // } // // public void setCountry(String country) { // this.country = country; // } // // public void setMap(String map) { // this.map = map; // } // // @Override // public String toString() { // return getName() + "," + getState() + "," + getCountry(); // } // } // // Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/repository/CityRepository.java // @Repository // public interface CityRepository extends JpaRepository<City, Long> { // // /** // * 通过id查询 // * @param id // * @return // */ // City findById(Long id); // // /** // * 通过country字段查询 // * @param country // * @return // */ // City findByCountryEquals(String country); // // /** // * 分页查询 // * @param pageable // * @return // */ // Page<City> findAll(Pageable pageable); // // /** // * 分页查询 name和country // * @param name // * @param country // * @param pageable // * @return // */ // Page<City> findByNameContainingAndCountryContainingAllIgnoringCase(String name, // String country, Pageable pageable); // // /** // * 分页查询 name和country,忽略大小写 // * @param name // * @param country // * @return // */ // City findByNameAndCountryAllIgnoringCase(String name, String country); // } // // Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/service/CityService.java // public interface CityService { // // /** // * 通过id查询 // * @param id // * @return // */ // City findById(Long id); // // /** // * 通过country字段查询 // * @param country // * @return // */ // City findByCountryEquals(String country); // // /** // * 分页查询 // * @param pageable // * @return // */ // Page<City> findAll(Pageable pageable); // // /** // * 分页查询 name和country // * @param name // * @param country // * @param pageable // * @return // */ // Page<City> findByNameContainingAndCountryContainingAllIgnoringCase(String name, // String country, Pageable pageable); // // /** // * 分页查询 name和country,忽略大小写 // * @param name // * @param country // * @return // */ // City findByNameAndCountryAllIgnoringCase(String name, String country); // // /** // * 创建 // * @param city // * @return // */ // City createCity(City city); // } // Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/service/impl/CityServiceImpl.java import com.lengchuan.springBoot.jpa.config.ReadAndWrite.annotation.TargetDataSource; import com.lengchuan.springBoot.jpa.entity.City; import com.lengchuan.springBoot.jpa.repository.CityRepository; import com.lengchuan.springBoot.jpa.service.CityService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; package com.lengchuan.springBoot.jpa.service.impl; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-4-16 */ @Service public class CityServiceImpl implements CityService { @Autowired
private CityRepository cityRepository;
Lengchuan/SpringBoot-Study
SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/service/impl/CityServiceImpl.java
// Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/entity/City.java // @Entity // @Table(name = "city") // public class City implements Serializable { // // private static final long serialVersionUID = 1L; // // @Id // @GeneratedValue // private Long id; // // @Column(nullable = false, unique = true, length = 64) // private String name; // // @Column(nullable = false) // private String state; // // @Column(nullable = false) // private String country; // // @Column(nullable = false) // private String map; // // public City() { // } // // public City(String name, String country) { // super(); // this.name = name; // this.country = country; // } // // public String getName() { // return this.name; // } // // public String getState() { // return this.state; // } // // public String getCountry() { // return this.country; // } // // public String getMap() { // return this.map; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public void setName(String name) { // this.name = name; // } // // public void setState(String state) { // this.state = state; // } // // public void setCountry(String country) { // this.country = country; // } // // public void setMap(String map) { // this.map = map; // } // // @Override // public String toString() { // return getName() + "," + getState() + "," + getCountry(); // } // } // // Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/repository/CityRepository.java // @Repository // public interface CityRepository extends JpaRepository<City, Long> { // // /** // * 通过id查询 // * @param id // * @return // */ // City findById(Long id); // // /** // * 通过country字段查询 // * @param country // * @return // */ // City findByCountryEquals(String country); // // /** // * 分页查询 // * @param pageable // * @return // */ // Page<City> findAll(Pageable pageable); // // /** // * 分页查询 name和country // * @param name // * @param country // * @param pageable // * @return // */ // Page<City> findByNameContainingAndCountryContainingAllIgnoringCase(String name, // String country, Pageable pageable); // // /** // * 分页查询 name和country,忽略大小写 // * @param name // * @param country // * @return // */ // City findByNameAndCountryAllIgnoringCase(String name, String country); // } // // Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/service/CityService.java // public interface CityService { // // /** // * 通过id查询 // * @param id // * @return // */ // City findById(Long id); // // /** // * 通过country字段查询 // * @param country // * @return // */ // City findByCountryEquals(String country); // // /** // * 分页查询 // * @param pageable // * @return // */ // Page<City> findAll(Pageable pageable); // // /** // * 分页查询 name和country // * @param name // * @param country // * @param pageable // * @return // */ // Page<City> findByNameContainingAndCountryContainingAllIgnoringCase(String name, // String country, Pageable pageable); // // /** // * 分页查询 name和country,忽略大小写 // * @param name // * @param country // * @return // */ // City findByNameAndCountryAllIgnoringCase(String name, String country); // // /** // * 创建 // * @param city // * @return // */ // City createCity(City city); // }
import com.lengchuan.springBoot.jpa.config.ReadAndWrite.annotation.TargetDataSource; import com.lengchuan.springBoot.jpa.entity.City; import com.lengchuan.springBoot.jpa.repository.CityRepository; import com.lengchuan.springBoot.jpa.service.CityService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional;
package com.lengchuan.springBoot.jpa.service.impl; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-4-16 */ @Service public class CityServiceImpl implements CityService { @Autowired private CityRepository cityRepository; /** * 通过id查询 * @param id * @return */
// Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/entity/City.java // @Entity // @Table(name = "city") // public class City implements Serializable { // // private static final long serialVersionUID = 1L; // // @Id // @GeneratedValue // private Long id; // // @Column(nullable = false, unique = true, length = 64) // private String name; // // @Column(nullable = false) // private String state; // // @Column(nullable = false) // private String country; // // @Column(nullable = false) // private String map; // // public City() { // } // // public City(String name, String country) { // super(); // this.name = name; // this.country = country; // } // // public String getName() { // return this.name; // } // // public String getState() { // return this.state; // } // // public String getCountry() { // return this.country; // } // // public String getMap() { // return this.map; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public void setName(String name) { // this.name = name; // } // // public void setState(String state) { // this.state = state; // } // // public void setCountry(String country) { // this.country = country; // } // // public void setMap(String map) { // this.map = map; // } // // @Override // public String toString() { // return getName() + "," + getState() + "," + getCountry(); // } // } // // Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/repository/CityRepository.java // @Repository // public interface CityRepository extends JpaRepository<City, Long> { // // /** // * 通过id查询 // * @param id // * @return // */ // City findById(Long id); // // /** // * 通过country字段查询 // * @param country // * @return // */ // City findByCountryEquals(String country); // // /** // * 分页查询 // * @param pageable // * @return // */ // Page<City> findAll(Pageable pageable); // // /** // * 分页查询 name和country // * @param name // * @param country // * @param pageable // * @return // */ // Page<City> findByNameContainingAndCountryContainingAllIgnoringCase(String name, // String country, Pageable pageable); // // /** // * 分页查询 name和country,忽略大小写 // * @param name // * @param country // * @return // */ // City findByNameAndCountryAllIgnoringCase(String name, String country); // } // // Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/service/CityService.java // public interface CityService { // // /** // * 通过id查询 // * @param id // * @return // */ // City findById(Long id); // // /** // * 通过country字段查询 // * @param country // * @return // */ // City findByCountryEquals(String country); // // /** // * 分页查询 // * @param pageable // * @return // */ // Page<City> findAll(Pageable pageable); // // /** // * 分页查询 name和country // * @param name // * @param country // * @param pageable // * @return // */ // Page<City> findByNameContainingAndCountryContainingAllIgnoringCase(String name, // String country, Pageable pageable); // // /** // * 分页查询 name和country,忽略大小写 // * @param name // * @param country // * @return // */ // City findByNameAndCountryAllIgnoringCase(String name, String country); // // /** // * 创建 // * @param city // * @return // */ // City createCity(City city); // } // Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/service/impl/CityServiceImpl.java import com.lengchuan.springBoot.jpa.config.ReadAndWrite.annotation.TargetDataSource; import com.lengchuan.springBoot.jpa.entity.City; import com.lengchuan.springBoot.jpa.repository.CityRepository; import com.lengchuan.springBoot.jpa.service.CityService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; package com.lengchuan.springBoot.jpa.service.impl; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-4-16 */ @Service public class CityServiceImpl implements CityService { @Autowired private CityRepository cityRepository; /** * 通过id查询 * @param id * @return */
public City findById(Long id) {
Lengchuan/SpringBoot-Study
SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/service/ClassService.java
// Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/mapper/cluster/ClassMapper.java // public interface ClassMapper { // // int insert(Class c); // } // // Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/model/Class.java // public class Class implements Serializable { // // private int id; // // private String className; // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getClassName() { // return className; // } // // public void setClassName(String className) { // this.className = className; // } // }
import com.lengchuan.springBoot.druid.mapper.cluster.ClassMapper; import com.lengchuan.springBoot.druid.model.Class; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional;
package com.lengchuan.springBoot.druid.service; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-4-4 */ @Service public class ClassService { @Autowired
// Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/mapper/cluster/ClassMapper.java // public interface ClassMapper { // // int insert(Class c); // } // // Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/model/Class.java // public class Class implements Serializable { // // private int id; // // private String className; // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getClassName() { // return className; // } // // public void setClassName(String className) { // this.className = className; // } // } // Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/service/ClassService.java import com.lengchuan.springBoot.druid.mapper.cluster.ClassMapper; import com.lengchuan.springBoot.druid.model.Class; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; package com.lengchuan.springBoot.druid.service; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-4-4 */ @Service public class ClassService { @Autowired
private ClassMapper classMapper;
Lengchuan/SpringBoot-Study
SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/service/ClassService.java
// Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/mapper/cluster/ClassMapper.java // public interface ClassMapper { // // int insert(Class c); // } // // Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/model/Class.java // public class Class implements Serializable { // // private int id; // // private String className; // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getClassName() { // return className; // } // // public void setClassName(String className) { // this.className = className; // } // }
import com.lengchuan.springBoot.druid.mapper.cluster.ClassMapper; import com.lengchuan.springBoot.druid.model.Class; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional;
package com.lengchuan.springBoot.druid.service; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-4-4 */ @Service public class ClassService { @Autowired private ClassMapper classMapper; @Transactional
// Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/mapper/cluster/ClassMapper.java // public interface ClassMapper { // // int insert(Class c); // } // // Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/model/Class.java // public class Class implements Serializable { // // private int id; // // private String className; // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getClassName() { // return className; // } // // public void setClassName(String className) { // this.className = className; // } // } // Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/service/ClassService.java import com.lengchuan.springBoot.druid.mapper.cluster.ClassMapper; import com.lengchuan.springBoot.druid.model.Class; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; package com.lengchuan.springBoot.druid.service; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-4-4 */ @Service public class ClassService { @Autowired private ClassMapper classMapper; @Transactional
public boolean createClass(Class c) {
Lengchuan/SpringBoot-Study
SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/config/ReadAndWrite/aspect/DynamicDataSourceAspect.java
// Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/config/ReadAndWrite/config/DynamicDataSourceHolder.java // public class DynamicDataSourceHolder { // //使用ThreadLocal把数据源与当前线程绑定 // private static final ThreadLocal<String> dataSources = new ThreadLocal<String>(); // // public static void setDataSource(String dataSourceName) { // dataSources.set(dataSourceName); // } // // public static String getDataSource() { // return dataSources.get(); // } // // public static void clearDataSource() { // dataSources.remove(); // } // }
import com.lengchuan.springBoot.jpa.config.ReadAndWrite.annotation.TargetDataSource; import com.lengchuan.springBoot.jpa.config.ReadAndWrite.config.DynamicDataSourceHolder; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.reflect.MethodSignature; import org.springframework.stereotype.Component; import java.lang.reflect.Method;
package com.lengchuan.springBoot.jpa.config.ReadAndWrite.aspect; /** * aop 配置动态切换数据源 * * @author lengchuan <lishuijun1992@gmail.com> * @date 17-4-5 */ @Aspect @Component public class DynamicDataSourceAspect { @Around("execution(public * com.lengchuan.springBoot.jpa.service..*.*(..))") public Object around(ProceedingJoinPoint pjp) throws Throwable { MethodSignature methodSignature = (MethodSignature) pjp.getSignature(); Method targetMethod = methodSignature.getMethod(); if (targetMethod.isAnnotationPresent(TargetDataSource.class)) { String targetDataSource = targetMethod.getAnnotation(TargetDataSource.class).dataSource(); System.out.println("----------数据源是:" + targetDataSource + "------");
// Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/config/ReadAndWrite/config/DynamicDataSourceHolder.java // public class DynamicDataSourceHolder { // //使用ThreadLocal把数据源与当前线程绑定 // private static final ThreadLocal<String> dataSources = new ThreadLocal<String>(); // // public static void setDataSource(String dataSourceName) { // dataSources.set(dataSourceName); // } // // public static String getDataSource() { // return dataSources.get(); // } // // public static void clearDataSource() { // dataSources.remove(); // } // } // Path: SpringBoot-SpringDataJPA/src/main/java/com/lengchuan/springBoot/jpa/config/ReadAndWrite/aspect/DynamicDataSourceAspect.java import com.lengchuan.springBoot.jpa.config.ReadAndWrite.annotation.TargetDataSource; import com.lengchuan.springBoot.jpa.config.ReadAndWrite.config.DynamicDataSourceHolder; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.reflect.MethodSignature; import org.springframework.stereotype.Component; import java.lang.reflect.Method; package com.lengchuan.springBoot.jpa.config.ReadAndWrite.aspect; /** * aop 配置动态切换数据源 * * @author lengchuan <lishuijun1992@gmail.com> * @date 17-4-5 */ @Aspect @Component public class DynamicDataSourceAspect { @Around("execution(public * com.lengchuan.springBoot.jpa.service..*.*(..))") public Object around(ProceedingJoinPoint pjp) throws Throwable { MethodSignature methodSignature = (MethodSignature) pjp.getSignature(); Method targetMethod = methodSignature.getMethod(); if (targetMethod.isAnnotationPresent(TargetDataSource.class)) { String targetDataSource = targetMethod.getAnnotation(TargetDataSource.class).dataSource(); System.out.println("----------数据源是:" + targetDataSource + "------");
DynamicDataSourceHolder.setDataSource(targetDataSource);
Lengchuan/SpringBoot-Study
SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/service/impl/UserServiceImpl.java
// Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/dao/UserDao.java // @Repository // public class UserDao { // // private final static String USER_PREFIX = "User:"; // // @Autowired // private RedisTemplate redisTemplate; // // public void insertUser(User user) { // ValueOperations valueOperations = redisTemplate.opsForValue(); // valueOperations.set(USER_PREFIX + user.getId(), user); // } // // // public User getUser(Integer id) { // ValueOperations valueOperations = redisTemplate.opsForValue(); // // User user = (User) valueOperations.get(USER_PREFIX + id); // return user; // } // } // // Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/model/User.java // public class User extends Entity { // // private Integer id; // private String name; // private String email; // // public Integer getId() { // return id; // } // // public void setId(Integer id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // @Override // public String toString() { // return "User{" + // "id=" + id + // ", name='" + name + '\'' + // ", email='" + email + '\'' + // '}'; // } // } // // Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/service/UserService.java // public interface UserService { // // void createUser(User user); // // User getUser(Integer id); // }
import com.lengchuan.springBoot.redis.dao.UserDao; import com.lengchuan.springBoot.redis.model.User; import com.lengchuan.springBoot.redis.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service;
package com.lengchuan.springBoot.redis.service.impl; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-5-8 */ @Service public class UserServiceImpl implements UserService { @Autowired
// Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/dao/UserDao.java // @Repository // public class UserDao { // // private final static String USER_PREFIX = "User:"; // // @Autowired // private RedisTemplate redisTemplate; // // public void insertUser(User user) { // ValueOperations valueOperations = redisTemplate.opsForValue(); // valueOperations.set(USER_PREFIX + user.getId(), user); // } // // // public User getUser(Integer id) { // ValueOperations valueOperations = redisTemplate.opsForValue(); // // User user = (User) valueOperations.get(USER_PREFIX + id); // return user; // } // } // // Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/model/User.java // public class User extends Entity { // // private Integer id; // private String name; // private String email; // // public Integer getId() { // return id; // } // // public void setId(Integer id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // @Override // public String toString() { // return "User{" + // "id=" + id + // ", name='" + name + '\'' + // ", email='" + email + '\'' + // '}'; // } // } // // Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/service/UserService.java // public interface UserService { // // void createUser(User user); // // User getUser(Integer id); // } // Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/service/impl/UserServiceImpl.java import com.lengchuan.springBoot.redis.dao.UserDao; import com.lengchuan.springBoot.redis.model.User; import com.lengchuan.springBoot.redis.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; package com.lengchuan.springBoot.redis.service.impl; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-5-8 */ @Service public class UserServiceImpl implements UserService { @Autowired
private UserDao userDao;
Lengchuan/SpringBoot-Study
SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/service/impl/UserServiceImpl.java
// Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/dao/UserDao.java // @Repository // public class UserDao { // // private final static String USER_PREFIX = "User:"; // // @Autowired // private RedisTemplate redisTemplate; // // public void insertUser(User user) { // ValueOperations valueOperations = redisTemplate.opsForValue(); // valueOperations.set(USER_PREFIX + user.getId(), user); // } // // // public User getUser(Integer id) { // ValueOperations valueOperations = redisTemplate.opsForValue(); // // User user = (User) valueOperations.get(USER_PREFIX + id); // return user; // } // } // // Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/model/User.java // public class User extends Entity { // // private Integer id; // private String name; // private String email; // // public Integer getId() { // return id; // } // // public void setId(Integer id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // @Override // public String toString() { // return "User{" + // "id=" + id + // ", name='" + name + '\'' + // ", email='" + email + '\'' + // '}'; // } // } // // Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/service/UserService.java // public interface UserService { // // void createUser(User user); // // User getUser(Integer id); // }
import com.lengchuan.springBoot.redis.dao.UserDao; import com.lengchuan.springBoot.redis.model.User; import com.lengchuan.springBoot.redis.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service;
package com.lengchuan.springBoot.redis.service.impl; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-5-8 */ @Service public class UserServiceImpl implements UserService { @Autowired private UserDao userDao; @Override
// Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/dao/UserDao.java // @Repository // public class UserDao { // // private final static String USER_PREFIX = "User:"; // // @Autowired // private RedisTemplate redisTemplate; // // public void insertUser(User user) { // ValueOperations valueOperations = redisTemplate.opsForValue(); // valueOperations.set(USER_PREFIX + user.getId(), user); // } // // // public User getUser(Integer id) { // ValueOperations valueOperations = redisTemplate.opsForValue(); // // User user = (User) valueOperations.get(USER_PREFIX + id); // return user; // } // } // // Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/model/User.java // public class User extends Entity { // // private Integer id; // private String name; // private String email; // // public Integer getId() { // return id; // } // // public void setId(Integer id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // @Override // public String toString() { // return "User{" + // "id=" + id + // ", name='" + name + '\'' + // ", email='" + email + '\'' + // '}'; // } // } // // Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/service/UserService.java // public interface UserService { // // void createUser(User user); // // User getUser(Integer id); // } // Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/service/impl/UserServiceImpl.java import com.lengchuan.springBoot.redis.dao.UserDao; import com.lengchuan.springBoot.redis.model.User; import com.lengchuan.springBoot.redis.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; package com.lengchuan.springBoot.redis.service.impl; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-5-8 */ @Service public class UserServiceImpl implements UserService { @Autowired private UserDao userDao; @Override
public void createUser(User user) {
Lengchuan/SpringBoot-Study
SpringBoot-FastJson/src/main/java/com/App.java
// Path: SpringBoot-FastJson/src/main/java/com/lengchuan/springBoot/converter/EncrypConverter.java // public class EncrypConverter extends FastJsonHttpMessageConverter4 { // // /** // * 重写read()方法 // * // * @param type // * @param contextClass // * @param inputMessage // * @return // * @throws IOException // * @throws HttpMessageNotReadableException // */ // @Override // public Object read(Type type, Class<?> contextClass, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { // InputStream in = inputMessage.getBody(); // byte[] data = Base64.decode(IOUtils.toString(in, "UTF-8")); // return JSON.parseObject(data, 0, data.length, getFastJsonConfig().getCharset(), type, getFastJsonConfig().getFeatures()); // } // // /** // * 重写readInternal // * // * @param clazz // * @param inputMessage // * @return // * @throws IOException // * @throws HttpMessageNotReadableException // */ // @Override // protected Object readInternal(Class<?> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { // // InputStream in = inputMessage.getBody(); // byte[] data = Base64.decode(IOUtils.toString(in, "UTF-8")); // return JSON.parseObject(data, 0, data.length, getFastJsonConfig().getCharset(), clazz, getFastJsonConfig().getFeatures()); // } // // // /** // * 重写writeInternal()方法 // * // * @param obj // * @param type // * @param outputMessage // * @throws IOException // * @throws HttpMessageNotWritableException // */ // @Override // protected void writeInternal(Object obj, Type type, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException { // String s = Base64.encode(JSON.toJSONBytes(obj)); // HttpBody httpBody = new HttpBody(); // httpBody.setStatus(1); // httpBody.setBody(s); // super.writeInternal(httpBody, type, outputMessage); // } // }
import com.lengchuan.springBoot.converter.EncrypConverter; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.web.HttpMessageConverters; import org.springframework.context.annotation.Bean;
package com; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-3-28 */ @SpringBootApplication public class App { // @Bean // HttpMessageConverters setFastJsonConverter() { // return new HttpMessageConverters(new FastJsonConverter()); // } @Bean HttpMessageConverters fastJsonHttpMessageConverters() {
// Path: SpringBoot-FastJson/src/main/java/com/lengchuan/springBoot/converter/EncrypConverter.java // public class EncrypConverter extends FastJsonHttpMessageConverter4 { // // /** // * 重写read()方法 // * // * @param type // * @param contextClass // * @param inputMessage // * @return // * @throws IOException // * @throws HttpMessageNotReadableException // */ // @Override // public Object read(Type type, Class<?> contextClass, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { // InputStream in = inputMessage.getBody(); // byte[] data = Base64.decode(IOUtils.toString(in, "UTF-8")); // return JSON.parseObject(data, 0, data.length, getFastJsonConfig().getCharset(), type, getFastJsonConfig().getFeatures()); // } // // /** // * 重写readInternal // * // * @param clazz // * @param inputMessage // * @return // * @throws IOException // * @throws HttpMessageNotReadableException // */ // @Override // protected Object readInternal(Class<?> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { // // InputStream in = inputMessage.getBody(); // byte[] data = Base64.decode(IOUtils.toString(in, "UTF-8")); // return JSON.parseObject(data, 0, data.length, getFastJsonConfig().getCharset(), clazz, getFastJsonConfig().getFeatures()); // } // // // /** // * 重写writeInternal()方法 // * // * @param obj // * @param type // * @param outputMessage // * @throws IOException // * @throws HttpMessageNotWritableException // */ // @Override // protected void writeInternal(Object obj, Type type, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException { // String s = Base64.encode(JSON.toJSONBytes(obj)); // HttpBody httpBody = new HttpBody(); // httpBody.setStatus(1); // httpBody.setBody(s); // super.writeInternal(httpBody, type, outputMessage); // } // } // Path: SpringBoot-FastJson/src/main/java/com/App.java import com.lengchuan.springBoot.converter.EncrypConverter; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.web.HttpMessageConverters; import org.springframework.context.annotation.Bean; package com; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-3-28 */ @SpringBootApplication public class App { // @Bean // HttpMessageConverters setFastJsonConverter() { // return new HttpMessageConverters(new FastJsonConverter()); // } @Bean HttpMessageConverters fastJsonHttpMessageConverters() {
return new HttpMessageConverters(new EncrypConverter());
Lengchuan/SpringBoot-Study
SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/controller/StudentController.java
// Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/model/Student.java // public class Student implements Serializable { // private Integer id; // // private String name; // // private String email; // // private Integer age; // // private Date birthday; // // public Integer getId() { // return id; // } // // public void setId(Integer id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // public Integer getAge() { // return age; // } // // public void setAge(Integer age) { // this.age = age; // } // // public Date getBirthday() { // return birthday; // } // // public void setBirthday(Date birthday) { // this.birthday = birthday; // } // } // // Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/service/StudentService.java // @Service // public class StudentService { // // @Autowired // private StudentMapper studentMapper; // // @Transactional // @TargetDataSource(dataSource = "writeDataSource") // public boolean createUser(Student student) { // studentMapper.insert(student); // // //事务测试 // // int i = 1 / 0; // return true; // } // // @TargetDataSource(dataSource = "read1DataSource") // public List<Student> getByPage(int page, int rows) { // Page<Student> studentPage = PageHelper.startPage(page, rows, true); // List<Student> students = studentMapper.getBypage(); // System.out.println("-------------------" + studentPage.toString() + "-----------"); // return students; // } // }
import com.lengchuan.springBoot.druid.model.Student; import com.lengchuan.springBoot.druid.service.StudentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List;
package com.lengchuan.springBoot.druid.controller; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-4-8 */ @RestController public class StudentController { @Autowired
// Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/model/Student.java // public class Student implements Serializable { // private Integer id; // // private String name; // // private String email; // // private Integer age; // // private Date birthday; // // public Integer getId() { // return id; // } // // public void setId(Integer id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // public Integer getAge() { // return age; // } // // public void setAge(Integer age) { // this.age = age; // } // // public Date getBirthday() { // return birthday; // } // // public void setBirthday(Date birthday) { // this.birthday = birthday; // } // } // // Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/service/StudentService.java // @Service // public class StudentService { // // @Autowired // private StudentMapper studentMapper; // // @Transactional // @TargetDataSource(dataSource = "writeDataSource") // public boolean createUser(Student student) { // studentMapper.insert(student); // // //事务测试 // // int i = 1 / 0; // return true; // } // // @TargetDataSource(dataSource = "read1DataSource") // public List<Student> getByPage(int page, int rows) { // Page<Student> studentPage = PageHelper.startPage(page, rows, true); // List<Student> students = studentMapper.getBypage(); // System.out.println("-------------------" + studentPage.toString() + "-----------"); // return students; // } // } // Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/controller/StudentController.java import com.lengchuan.springBoot.druid.model.Student; import com.lengchuan.springBoot.druid.service.StudentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; package com.lengchuan.springBoot.druid.controller; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-4-8 */ @RestController public class StudentController { @Autowired
private StudentService studentService;
Lengchuan/SpringBoot-Study
SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/controller/StudentController.java
// Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/model/Student.java // public class Student implements Serializable { // private Integer id; // // private String name; // // private String email; // // private Integer age; // // private Date birthday; // // public Integer getId() { // return id; // } // // public void setId(Integer id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // public Integer getAge() { // return age; // } // // public void setAge(Integer age) { // this.age = age; // } // // public Date getBirthday() { // return birthday; // } // // public void setBirthday(Date birthday) { // this.birthday = birthday; // } // } // // Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/service/StudentService.java // @Service // public class StudentService { // // @Autowired // private StudentMapper studentMapper; // // @Transactional // @TargetDataSource(dataSource = "writeDataSource") // public boolean createUser(Student student) { // studentMapper.insert(student); // // //事务测试 // // int i = 1 / 0; // return true; // } // // @TargetDataSource(dataSource = "read1DataSource") // public List<Student> getByPage(int page, int rows) { // Page<Student> studentPage = PageHelper.startPage(page, rows, true); // List<Student> students = studentMapper.getBypage(); // System.out.println("-------------------" + studentPage.toString() + "-----------"); // return students; // } // }
import com.lengchuan.springBoot.druid.model.Student; import com.lengchuan.springBoot.druid.service.StudentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List;
package com.lengchuan.springBoot.druid.controller; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-4-8 */ @RestController public class StudentController { @Autowired private StudentService studentService; @RequestMapping("/getStudents")
// Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/model/Student.java // public class Student implements Serializable { // private Integer id; // // private String name; // // private String email; // // private Integer age; // // private Date birthday; // // public Integer getId() { // return id; // } // // public void setId(Integer id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // public Integer getAge() { // return age; // } // // public void setAge(Integer age) { // this.age = age; // } // // public Date getBirthday() { // return birthday; // } // // public void setBirthday(Date birthday) { // this.birthday = birthday; // } // } // // Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/service/StudentService.java // @Service // public class StudentService { // // @Autowired // private StudentMapper studentMapper; // // @Transactional // @TargetDataSource(dataSource = "writeDataSource") // public boolean createUser(Student student) { // studentMapper.insert(student); // // //事务测试 // // int i = 1 / 0; // return true; // } // // @TargetDataSource(dataSource = "read1DataSource") // public List<Student> getByPage(int page, int rows) { // Page<Student> studentPage = PageHelper.startPage(page, rows, true); // List<Student> students = studentMapper.getBypage(); // System.out.println("-------------------" + studentPage.toString() + "-----------"); // return students; // } // } // Path: SpringBoot-Druid/src/main/java/com/lengchuan/springBoot/druid/controller/StudentController.java import com.lengchuan.springBoot.druid.model.Student; import com.lengchuan.springBoot.druid.service.StudentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; package com.lengchuan.springBoot.druid.controller; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-4-8 */ @RestController public class StudentController { @Autowired private StudentService studentService; @RequestMapping("/getStudents")
public List<Student> getStudents(Integer page, Integer rows) {
Lengchuan/SpringBoot-Study
SpringBoot-GlobalExceptionHandler/src/main/java/com/lengchuan/springBoot/exceptionHandler/ExceptionHandler1.java
// Path: SpringBoot-GlobalExceptionHandler/src/main/java/com/lengchuan/springBoot/Exception/MyException1.java // public class MyException1 extends Exception { // public MyException1() { // super(); // } // // public MyException1(String msg) { // super(msg); // } // }
import com.lengchuan.springBoot.Exception.MyException1; import org.springframework.web.bind.annotation.ControllerAdvice; import javax.servlet.http.HttpServletResponse; import java.io.IOException;
package com.lengchuan.springBoot.exceptionHandler; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-3-27 */ @ControllerAdvice("com.lengchuan.springBoot.controller") public class ExceptionHandler1 { /** * 全局异常处理 * * @param response * @param e */ @org.springframework.web.bind.annotation.ExceptionHandler(value = Exception.class) public void ExceptionHandler(HttpServletResponse response, Exception e) { System.out.println("-------全局默认异常处理1-----"); try { response.getOutputStream().write("全局默认异常处理1".getBytes()); } catch (IOException e1) { e1.printStackTrace(); } } /** * 自定义异常处理 * * @param response * @param e */
// Path: SpringBoot-GlobalExceptionHandler/src/main/java/com/lengchuan/springBoot/Exception/MyException1.java // public class MyException1 extends Exception { // public MyException1() { // super(); // } // // public MyException1(String msg) { // super(msg); // } // } // Path: SpringBoot-GlobalExceptionHandler/src/main/java/com/lengchuan/springBoot/exceptionHandler/ExceptionHandler1.java import com.lengchuan.springBoot.Exception.MyException1; import org.springframework.web.bind.annotation.ControllerAdvice; import javax.servlet.http.HttpServletResponse; import java.io.IOException; package com.lengchuan.springBoot.exceptionHandler; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-3-27 */ @ControllerAdvice("com.lengchuan.springBoot.controller") public class ExceptionHandler1 { /** * 全局异常处理 * * @param response * @param e */ @org.springframework.web.bind.annotation.ExceptionHandler(value = Exception.class) public void ExceptionHandler(HttpServletResponse response, Exception e) { System.out.println("-------全局默认异常处理1-----"); try { response.getOutputStream().write("全局默认异常处理1".getBytes()); } catch (IOException e1) { e1.printStackTrace(); } } /** * 自定义异常处理 * * @param response * @param e */
@org.springframework.web.bind.annotation.ExceptionHandler(value = MyException1.class)
Lengchuan/SpringBoot-Study
SpringBoot-FastJson/src/main/java/com/lengchuan/springBoot/controller/UserController.java
// Path: SpringBoot-FastJson/src/main/java/com/lengchuan/springBoot/druid/model/User.java // public class User implements Serializable{ // // @JSONField(serialize = false) // private String name; // private int age; // private String email; // private List<User> friends; // // public User(String name, int age, String email) { // this.name = name; // this.age = age; // this.email = email; // } // // public User() { // friends = new ArrayList<User>(); // friends.add(new User("lengchuan1", 25, "123@123.test")); // friends.add(new User("lengchuan2", 25, "1234@123.test")); // friends.add(new User("lengchuan3", 25, "12345@123.test")); // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public int getAge() { // return age; // } // // public void setAge(int age) { // this.age = age; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // public List<User> getFriends() { // return friends; // } // // public void setFriends(List<User> friends) { // this.friends = friends; // } // }
import com.alibaba.fastjson.JSON; import com.lengchuan.springBoot.druid.model.User; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController;
package com.lengchuan.springBoot.controller; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-3-28 */ @RestController @RequestMapping("user") public class UserController { @RequestMapping("/getUser")
// Path: SpringBoot-FastJson/src/main/java/com/lengchuan/springBoot/druid/model/User.java // public class User implements Serializable{ // // @JSONField(serialize = false) // private String name; // private int age; // private String email; // private List<User> friends; // // public User(String name, int age, String email) { // this.name = name; // this.age = age; // this.email = email; // } // // public User() { // friends = new ArrayList<User>(); // friends.add(new User("lengchuan1", 25, "123@123.test")); // friends.add(new User("lengchuan2", 25, "1234@123.test")); // friends.add(new User("lengchuan3", 25, "12345@123.test")); // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public int getAge() { // return age; // } // // public void setAge(int age) { // this.age = age; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // public List<User> getFriends() { // return friends; // } // // public void setFriends(List<User> friends) { // this.friends = friends; // } // } // Path: SpringBoot-FastJson/src/main/java/com/lengchuan/springBoot/controller/UserController.java import com.alibaba.fastjson.JSON; import com.lengchuan.springBoot.druid.model.User; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; package com.lengchuan.springBoot.controller; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-3-28 */ @RestController @RequestMapping("user") public class UserController { @RequestMapping("/getUser")
public User getUser() {
Lengchuan/SpringBoot-Study
SpringBoot-Redis/src/test/java/com/lengchuan/springBoot/redis/service/impl/UserServiceImplTest.java
// Path: SpringBoot-Redis/src/test/java/com/BaseTest.java // @RunWith(SpringJUnit4ClassRunner.class) // @SpringBootTest(classes = App.class) // public class BaseTest { // // private final static Logger logger = LoggerFactory.getLogger(BaseTest.class); // // @Autowired // private UserService userService; // // @Test // public void add() { // // User u = new User(); // u.setId(1); // u.setName("lengchuan"); // u.setEmail("lishuijun1992@gmail.com"); // // userService.createUser(u); // // } // // @Test // public void get() { // // logger.info("获取到用户信息:{}", userService.getUser(1)); // // } // } // // Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/model/User.java // public class User extends Entity { // // private Integer id; // private String name; // private String email; // // public Integer getId() { // return id; // } // // public void setId(Integer id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // @Override // public String toString() { // return "User{" + // "id=" + id + // ", name='" + name + '\'' + // ", email='" + email + '\'' + // '}'; // } // } // // Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/service/UserService.java // public interface UserService { // // void createUser(User user); // // User getUser(Integer id); // }
import com.BaseTest; import com.lengchuan.springBoot.redis.model.User; import com.lengchuan.springBoot.redis.service.UserService; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired;
package com.lengchuan.springBoot.redis.service.impl; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-5-8 */ public class UserServiceImplTest extends BaseTest { @Test public void getUser() throws Exception { System.out.println(userService.getUser(1)); } @Autowired
// Path: SpringBoot-Redis/src/test/java/com/BaseTest.java // @RunWith(SpringJUnit4ClassRunner.class) // @SpringBootTest(classes = App.class) // public class BaseTest { // // private final static Logger logger = LoggerFactory.getLogger(BaseTest.class); // // @Autowired // private UserService userService; // // @Test // public void add() { // // User u = new User(); // u.setId(1); // u.setName("lengchuan"); // u.setEmail("lishuijun1992@gmail.com"); // // userService.createUser(u); // // } // // @Test // public void get() { // // logger.info("获取到用户信息:{}", userService.getUser(1)); // // } // } // // Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/model/User.java // public class User extends Entity { // // private Integer id; // private String name; // private String email; // // public Integer getId() { // return id; // } // // public void setId(Integer id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // @Override // public String toString() { // return "User{" + // "id=" + id + // ", name='" + name + '\'' + // ", email='" + email + '\'' + // '}'; // } // } // // Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/service/UserService.java // public interface UserService { // // void createUser(User user); // // User getUser(Integer id); // } // Path: SpringBoot-Redis/src/test/java/com/lengchuan/springBoot/redis/service/impl/UserServiceImplTest.java import com.BaseTest; import com.lengchuan.springBoot.redis.model.User; import com.lengchuan.springBoot.redis.service.UserService; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; package com.lengchuan.springBoot.redis.service.impl; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-5-8 */ public class UserServiceImplTest extends BaseTest { @Test public void getUser() throws Exception { System.out.println(userService.getUser(1)); } @Autowired
private UserService userService;
Lengchuan/SpringBoot-Study
SpringBoot-Redis/src/test/java/com/lengchuan/springBoot/redis/service/impl/UserServiceImplTest.java
// Path: SpringBoot-Redis/src/test/java/com/BaseTest.java // @RunWith(SpringJUnit4ClassRunner.class) // @SpringBootTest(classes = App.class) // public class BaseTest { // // private final static Logger logger = LoggerFactory.getLogger(BaseTest.class); // // @Autowired // private UserService userService; // // @Test // public void add() { // // User u = new User(); // u.setId(1); // u.setName("lengchuan"); // u.setEmail("lishuijun1992@gmail.com"); // // userService.createUser(u); // // } // // @Test // public void get() { // // logger.info("获取到用户信息:{}", userService.getUser(1)); // // } // } // // Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/model/User.java // public class User extends Entity { // // private Integer id; // private String name; // private String email; // // public Integer getId() { // return id; // } // // public void setId(Integer id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // @Override // public String toString() { // return "User{" + // "id=" + id + // ", name='" + name + '\'' + // ", email='" + email + '\'' + // '}'; // } // } // // Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/service/UserService.java // public interface UserService { // // void createUser(User user); // // User getUser(Integer id); // }
import com.BaseTest; import com.lengchuan.springBoot.redis.model.User; import com.lengchuan.springBoot.redis.service.UserService; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired;
package com.lengchuan.springBoot.redis.service.impl; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-5-8 */ public class UserServiceImplTest extends BaseTest { @Test public void getUser() throws Exception { System.out.println(userService.getUser(1)); } @Autowired private UserService userService; @Test public void createUser() throws Exception {
// Path: SpringBoot-Redis/src/test/java/com/BaseTest.java // @RunWith(SpringJUnit4ClassRunner.class) // @SpringBootTest(classes = App.class) // public class BaseTest { // // private final static Logger logger = LoggerFactory.getLogger(BaseTest.class); // // @Autowired // private UserService userService; // // @Test // public void add() { // // User u = new User(); // u.setId(1); // u.setName("lengchuan"); // u.setEmail("lishuijun1992@gmail.com"); // // userService.createUser(u); // // } // // @Test // public void get() { // // logger.info("获取到用户信息:{}", userService.getUser(1)); // // } // } // // Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/model/User.java // public class User extends Entity { // // private Integer id; // private String name; // private String email; // // public Integer getId() { // return id; // } // // public void setId(Integer id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // @Override // public String toString() { // return "User{" + // "id=" + id + // ", name='" + name + '\'' + // ", email='" + email + '\'' + // '}'; // } // } // // Path: SpringBoot-Redis/src/main/java/com/lengchuan/springBoot/redis/service/UserService.java // public interface UserService { // // void createUser(User user); // // User getUser(Integer id); // } // Path: SpringBoot-Redis/src/test/java/com/lengchuan/springBoot/redis/service/impl/UserServiceImplTest.java import com.BaseTest; import com.lengchuan.springBoot.redis.model.User; import com.lengchuan.springBoot.redis.service.UserService; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; package com.lengchuan.springBoot.redis.service.impl; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-5-8 */ public class UserServiceImplTest extends BaseTest { @Test public void getUser() throws Exception { System.out.println(userService.getUser(1)); } @Autowired private UserService userService; @Test public void createUser() throws Exception {
User user = new User();
Lengchuan/SpringBoot-Study
SpringBoot-GlobalExceptionHandler/src/main/java/com/lengchuan/springBoot/controller2/DemoController2.java
// Path: SpringBoot-GlobalExceptionHandler/src/main/java/com/lengchuan/springBoot/Exception/MyException1.java // public class MyException1 extends Exception { // public MyException1() { // super(); // } // // public MyException1(String msg) { // super(msg); // } // }
import com.lengchuan.springBoot.Exception.MyException1; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController;
package com.lengchuan.springBoot.controller2; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-3-27 */ @RestController @RequestMapping("/demo2") public class DemoController2 { @RequestMapping("/default") public String defaultException() { throw new NullPointerException(); } @RequestMapping("/my")
// Path: SpringBoot-GlobalExceptionHandler/src/main/java/com/lengchuan/springBoot/Exception/MyException1.java // public class MyException1 extends Exception { // public MyException1() { // super(); // } // // public MyException1(String msg) { // super(msg); // } // } // Path: SpringBoot-GlobalExceptionHandler/src/main/java/com/lengchuan/springBoot/controller2/DemoController2.java import com.lengchuan.springBoot.Exception.MyException1; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; package com.lengchuan.springBoot.controller2; /** * @author lengchuan <lishuijun1992@gmail.com> * @date 17-3-27 */ @RestController @RequestMapping("/demo2") public class DemoController2 { @RequestMapping("/default") public String defaultException() { throw new NullPointerException(); } @RequestMapping("/my")
public String MyException() throws MyException1 {
xenit-eu/dynamic-extensions-for-alfresco
annotations-runtime/src/main/java/com/github/dynamicextensionsalfresco/webscripts/arguments/AttributeArgumentResolver.java
// Path: webscripts/src/main/java/com/github/dynamicextensionsalfresco/webscripts/AnnotationWebScriptRequest.java // public class AnnotationWebScriptRequest extends DelegatingWebScriptRequest implements WrappingWebScriptRequest { // // private final Map<String, Object> model = new LinkedHashMap<>(); // private Throwable thrownException = null; // // public AnnotationWebScriptRequest(WebScriptRequest request) { // super(request); // // } // // public WebScriptRequest getWebScriptRequest() { // return this.getNext(); // } // // // public Map<String, Object> getModel() { // return model; // } // // public Throwable getThrownException() { // return thrownException; // } // // public void setThrownException(Throwable thrownException) { // this.thrownException = thrownException; // } // // }
import java.lang.annotation.Annotation; import java.util.Map; import com.github.dynamicextensionsalfresco.webscripts.AnnotationWebScriptRequest; import com.github.dynamicextensionsalfresco.webscripts.annotations.Attribute; import org.springframework.extensions.webscripts.WebScriptRequest; import org.springframework.extensions.webscripts.WebScriptResponse; import org.springframework.util.StringUtils;
package com.github.dynamicextensionsalfresco.webscripts.arguments; public class AttributeArgumentResolver implements ArgumentResolver<Object, Attribute> { @Override public boolean supports(final Class<?> parameterType, final Class<? extends Annotation> annotationType) { return Attribute.class.equals(annotationType); } @Override public Object resolveArgument(final Class<?> argumentType, final Attribute attribute, String name, final WebScriptRequest request, final WebScriptResponse response) { Object value;
// Path: webscripts/src/main/java/com/github/dynamicextensionsalfresco/webscripts/AnnotationWebScriptRequest.java // public class AnnotationWebScriptRequest extends DelegatingWebScriptRequest implements WrappingWebScriptRequest { // // private final Map<String, Object> model = new LinkedHashMap<>(); // private Throwable thrownException = null; // // public AnnotationWebScriptRequest(WebScriptRequest request) { // super(request); // // } // // public WebScriptRequest getWebScriptRequest() { // return this.getNext(); // } // // // public Map<String, Object> getModel() { // return model; // } // // public Throwable getThrownException() { // return thrownException; // } // // public void setThrownException(Throwable thrownException) { // this.thrownException = thrownException; // } // // } // Path: annotations-runtime/src/main/java/com/github/dynamicextensionsalfresco/webscripts/arguments/AttributeArgumentResolver.java import java.lang.annotation.Annotation; import java.util.Map; import com.github.dynamicextensionsalfresco.webscripts.AnnotationWebScriptRequest; import com.github.dynamicextensionsalfresco.webscripts.annotations.Attribute; import org.springframework.extensions.webscripts.WebScriptRequest; import org.springframework.extensions.webscripts.WebScriptResponse; import org.springframework.util.StringUtils; package com.github.dynamicextensionsalfresco.webscripts.arguments; public class AttributeArgumentResolver implements ArgumentResolver<Object, Attribute> { @Override public boolean supports(final Class<?> parameterType, final Class<? extends Annotation> annotationType) { return Attribute.class.equals(annotationType); } @Override public Object resolveArgument(final Class<?> argumentType, final Attribute attribute, String name, final WebScriptRequest request, final WebScriptResponse response) { Object value;
final Map<String, Object> attributesByName = ((AnnotationWebScriptRequest) request).getModel();
xenit-eu/dynamic-extensions-for-alfresco
webscripts/src/main/java/com/github/dynamicextensionsalfresco/webscripts/resolutions/TemplateResolution.java
// Path: webscripts/src/main/java/com/github/dynamicextensionsalfresco/webscripts/AnnotationWebScriptRequest.java // public class AnnotationWebScriptRequest extends DelegatingWebScriptRequest implements WrappingWebScriptRequest { // // private final Map<String, Object> model = new LinkedHashMap<>(); // private Throwable thrownException = null; // // public AnnotationWebScriptRequest(WebScriptRequest request) { // super(request); // // } // // public WebScriptRequest getWebScriptRequest() { // return this.getNext(); // } // // // public Map<String, Object> getModel() { // return model; // } // // public Throwable getThrownException() { // return thrownException; // } // // public void setThrownException(Throwable thrownException) { // this.thrownException = thrownException; // } // // }
import com.github.dynamicextensionsalfresco.webscripts.AnnotationWebScriptRequest; import com.github.dynamicextensionsalfresco.webscripts.AnnotationWebscriptResponse; import com.github.dynamicextensionsalfresco.webscripts.UrlModel; import org.springframework.extensions.webscripts.*; import org.springframework.extensions.webscripts.json.JSONUtils; import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.HashMap; import java.util.Map;
package com.github.dynamicextensionsalfresco.webscripts.resolutions; /** * Can be used directly by controllers or implicitly by returning a Map. * * @author Laurent Van der Linden */ public class TemplateResolution extends AbstractResolution { private static final String URL_VARIABLE = "url"; private static final String WEBSCRIPT_VARIABLE = "webscript"; private static final String JSON_UTILS = "jsonUtils"; private String template; private Map<String,Object> model; public TemplateResolution() { this.model = new HashMap<String, Object>(3); } public TemplateResolution(Map<String, Object> model) { this.model = model; } public TemplateResolution(String template, Map<String, Object> model) { this.template = template; this.model = model; } public TemplateResolution(String template) { this.template = template; } @Override public void resolve() throws Exception {
// Path: webscripts/src/main/java/com/github/dynamicextensionsalfresco/webscripts/AnnotationWebScriptRequest.java // public class AnnotationWebScriptRequest extends DelegatingWebScriptRequest implements WrappingWebScriptRequest { // // private final Map<String, Object> model = new LinkedHashMap<>(); // private Throwable thrownException = null; // // public AnnotationWebScriptRequest(WebScriptRequest request) { // super(request); // // } // // public WebScriptRequest getWebScriptRequest() { // return this.getNext(); // } // // // public Map<String, Object> getModel() { // return model; // } // // public Throwable getThrownException() { // return thrownException; // } // // public void setThrownException(Throwable thrownException) { // this.thrownException = thrownException; // } // // } // Path: webscripts/src/main/java/com/github/dynamicextensionsalfresco/webscripts/resolutions/TemplateResolution.java import com.github.dynamicextensionsalfresco.webscripts.AnnotationWebScriptRequest; import com.github.dynamicextensionsalfresco.webscripts.AnnotationWebscriptResponse; import com.github.dynamicextensionsalfresco.webscripts.UrlModel; import org.springframework.extensions.webscripts.*; import org.springframework.extensions.webscripts.json.JSONUtils; import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.HashMap; import java.util.Map; package com.github.dynamicextensionsalfresco.webscripts.resolutions; /** * Can be used directly by controllers or implicitly by returning a Map. * * @author Laurent Van der Linden */ public class TemplateResolution extends AbstractResolution { private static final String URL_VARIABLE = "url"; private static final String WEBSCRIPT_VARIABLE = "webscript"; private static final String JSON_UTILS = "jsonUtils"; private String template; private Map<String,Object> model; public TemplateResolution() { this.model = new HashMap<String, Object>(3); } public TemplateResolution(Map<String, Object> model) { this.model = model; } public TemplateResolution(String template, Map<String, Object> model) { this.template = template; this.model = model; } public TemplateResolution(String template) { this.template = template; } @Override public void resolve() throws Exception {
final AnnotationWebScriptRequest request = getRequest();
iproduct/reactive-demos-java-9
completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/app/ProfilerApplication.java
// Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/resources/ProcessesRestResource.java // @Path("/processes") // @ApplicationScoped // public class ProcessesRestResource { // private Logger logger = LoggerFactory.getLogger(ProcessesRestResource.class); // // @Inject // Profiler profiler; // // @GET // @Produces(MediaType.APPLICATION_JSON) // public void getJavaProcesses(@Suspended AsyncResponse asyncResp) { // CompletableFuture.supplyAsync(() -> { // List<ProcessInfo> result = profiler.getJavaProcesses(); //List.of("A", "B", "C", "D"); //.stream().reduce("", (acc, item) -> acc + item); // System.out.println(result); // return result; // }).thenAccept(result -> asyncResp.resume(result)); // } // } // // Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/resources/StatsRestResource.java // @Path("/stats") // @ApplicationScoped // public class StatsRestResource { // private Logger logger = LoggerFactory.getLogger(StatsRestResource.class); // // private AtomicInteger i = new AtomicInteger(); // private SseBroadcaster broadcaster; // private volatile Builder builder; // // @Context // public void setSse(Sse sse) { // this.broadcaster = sse.newBroadcaster(); // this.builder = sse.newEventBuilder(); // } // // @GET // @Path("sse") // @Produces(MediaType.SERVER_SENT_EVENTS) // public void stats(@Context SseEventSink sink) { // broadcaster.register(sink); // } // // public void asyncProcessingCpuLoad(@ObservesAsync @CpuProfiling CpuLoad cpuLoad) { // OutboundSseEvent sseEvent = createStatsEvent(builder, cpuLoad); // broadcaster.broadcast(sseEvent); // // } // // private OutboundSseEvent createStatsEvent(final OutboundSseEvent.Builder builder, CpuLoad cpuLoad) { // OutboundSseEvent event = builder // .name("stats") // .data(CpuLoad.class, cpuLoad) // .mediaType(MediaType.APPLICATION_JSON_TYPE) // .build(); // return event; // } // }
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; import java.util.HashSet; import java.util.Set; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; import org.apache.cxf.jaxrs.sse.SseFeature; import org.iproduct.demo.profiler.server.resources.ProcessesRestResource; import org.iproduct.demo.profiler.server.resources.StatsRestResource;
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.iproduct.demo.profiler.server.app; @ApplicationPath("api") @ApplicationScoped public class ProfilerApplication extends Application {
// Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/resources/ProcessesRestResource.java // @Path("/processes") // @ApplicationScoped // public class ProcessesRestResource { // private Logger logger = LoggerFactory.getLogger(ProcessesRestResource.class); // // @Inject // Profiler profiler; // // @GET // @Produces(MediaType.APPLICATION_JSON) // public void getJavaProcesses(@Suspended AsyncResponse asyncResp) { // CompletableFuture.supplyAsync(() -> { // List<ProcessInfo> result = profiler.getJavaProcesses(); //List.of("A", "B", "C", "D"); //.stream().reduce("", (acc, item) -> acc + item); // System.out.println(result); // return result; // }).thenAccept(result -> asyncResp.resume(result)); // } // } // // Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/resources/StatsRestResource.java // @Path("/stats") // @ApplicationScoped // public class StatsRestResource { // private Logger logger = LoggerFactory.getLogger(StatsRestResource.class); // // private AtomicInteger i = new AtomicInteger(); // private SseBroadcaster broadcaster; // private volatile Builder builder; // // @Context // public void setSse(Sse sse) { // this.broadcaster = sse.newBroadcaster(); // this.builder = sse.newEventBuilder(); // } // // @GET // @Path("sse") // @Produces(MediaType.SERVER_SENT_EVENTS) // public void stats(@Context SseEventSink sink) { // broadcaster.register(sink); // } // // public void asyncProcessingCpuLoad(@ObservesAsync @CpuProfiling CpuLoad cpuLoad) { // OutboundSseEvent sseEvent = createStatsEvent(builder, cpuLoad); // broadcaster.broadcast(sseEvent); // // } // // private OutboundSseEvent createStatsEvent(final OutboundSseEvent.Builder builder, CpuLoad cpuLoad) { // OutboundSseEvent event = builder // .name("stats") // .data(CpuLoad.class, cpuLoad) // .mediaType(MediaType.APPLICATION_JSON_TYPE) // .build(); // return event; // } // } // Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/app/ProfilerApplication.java import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; import java.util.HashSet; import java.util.Set; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; import org.apache.cxf.jaxrs.sse.SseFeature; import org.iproduct.demo.profiler.server.resources.ProcessesRestResource; import org.iproduct.demo.profiler.server.resources.StatsRestResource; /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.iproduct.demo.profiler.server.app; @ApplicationPath("api") @ApplicationScoped public class ProfilerApplication extends Application {
@Inject private StatsRestResource statsRestService;
iproduct/reactive-demos-java-9
completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/app/ProfilerApplication.java
// Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/resources/ProcessesRestResource.java // @Path("/processes") // @ApplicationScoped // public class ProcessesRestResource { // private Logger logger = LoggerFactory.getLogger(ProcessesRestResource.class); // // @Inject // Profiler profiler; // // @GET // @Produces(MediaType.APPLICATION_JSON) // public void getJavaProcesses(@Suspended AsyncResponse asyncResp) { // CompletableFuture.supplyAsync(() -> { // List<ProcessInfo> result = profiler.getJavaProcesses(); //List.of("A", "B", "C", "D"); //.stream().reduce("", (acc, item) -> acc + item); // System.out.println(result); // return result; // }).thenAccept(result -> asyncResp.resume(result)); // } // } // // Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/resources/StatsRestResource.java // @Path("/stats") // @ApplicationScoped // public class StatsRestResource { // private Logger logger = LoggerFactory.getLogger(StatsRestResource.class); // // private AtomicInteger i = new AtomicInteger(); // private SseBroadcaster broadcaster; // private volatile Builder builder; // // @Context // public void setSse(Sse sse) { // this.broadcaster = sse.newBroadcaster(); // this.builder = sse.newEventBuilder(); // } // // @GET // @Path("sse") // @Produces(MediaType.SERVER_SENT_EVENTS) // public void stats(@Context SseEventSink sink) { // broadcaster.register(sink); // } // // public void asyncProcessingCpuLoad(@ObservesAsync @CpuProfiling CpuLoad cpuLoad) { // OutboundSseEvent sseEvent = createStatsEvent(builder, cpuLoad); // broadcaster.broadcast(sseEvent); // // } // // private OutboundSseEvent createStatsEvent(final OutboundSseEvent.Builder builder, CpuLoad cpuLoad) { // OutboundSseEvent event = builder // .name("stats") // .data(CpuLoad.class, cpuLoad) // .mediaType(MediaType.APPLICATION_JSON_TYPE) // .build(); // return event; // } // }
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; import java.util.HashSet; import java.util.Set; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; import org.apache.cxf.jaxrs.sse.SseFeature; import org.iproduct.demo.profiler.server.resources.ProcessesRestResource; import org.iproduct.demo.profiler.server.resources.StatsRestResource;
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.iproduct.demo.profiler.server.app; @ApplicationPath("api") @ApplicationScoped public class ProfilerApplication extends Application { @Inject private StatsRestResource statsRestService; // @Inject private StatsRestServiceRxJava2 statsRestService;
// Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/resources/ProcessesRestResource.java // @Path("/processes") // @ApplicationScoped // public class ProcessesRestResource { // private Logger logger = LoggerFactory.getLogger(ProcessesRestResource.class); // // @Inject // Profiler profiler; // // @GET // @Produces(MediaType.APPLICATION_JSON) // public void getJavaProcesses(@Suspended AsyncResponse asyncResp) { // CompletableFuture.supplyAsync(() -> { // List<ProcessInfo> result = profiler.getJavaProcesses(); //List.of("A", "B", "C", "D"); //.stream().reduce("", (acc, item) -> acc + item); // System.out.println(result); // return result; // }).thenAccept(result -> asyncResp.resume(result)); // } // } // // Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/resources/StatsRestResource.java // @Path("/stats") // @ApplicationScoped // public class StatsRestResource { // private Logger logger = LoggerFactory.getLogger(StatsRestResource.class); // // private AtomicInteger i = new AtomicInteger(); // private SseBroadcaster broadcaster; // private volatile Builder builder; // // @Context // public void setSse(Sse sse) { // this.broadcaster = sse.newBroadcaster(); // this.builder = sse.newEventBuilder(); // } // // @GET // @Path("sse") // @Produces(MediaType.SERVER_SENT_EVENTS) // public void stats(@Context SseEventSink sink) { // broadcaster.register(sink); // } // // public void asyncProcessingCpuLoad(@ObservesAsync @CpuProfiling CpuLoad cpuLoad) { // OutboundSseEvent sseEvent = createStatsEvent(builder, cpuLoad); // broadcaster.broadcast(sseEvent); // // } // // private OutboundSseEvent createStatsEvent(final OutboundSseEvent.Builder builder, CpuLoad cpuLoad) { // OutboundSseEvent event = builder // .name("stats") // .data(CpuLoad.class, cpuLoad) // .mediaType(MediaType.APPLICATION_JSON_TYPE) // .build(); // return event; // } // } // Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/app/ProfilerApplication.java import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; import java.util.HashSet; import java.util.Set; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; import org.apache.cxf.jaxrs.sse.SseFeature; import org.iproduct.demo.profiler.server.resources.ProcessesRestResource; import org.iproduct.demo.profiler.server.resources.StatsRestResource; /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.iproduct.demo.profiler.server.app; @ApplicationPath("api") @ApplicationScoped public class ProfilerApplication extends Application { @Inject private StatsRestResource statsRestService; // @Inject private StatsRestServiceRxJava2 statsRestService;
@Inject private ProcessesRestResource processesRestService;
iproduct/reactive-demos-java-9
completable-future-demo/src/org/iproduct/cfdemo/CompletableFutureComposition.java
// Path: completable-future-demo/src/org/iproduct/cfdemo/Currency.java // public enum Currency { // BGN, GBP, EUR, USD // }
import static org.iproduct.cfdemo.Currency.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException;
package org.iproduct.cfdemo; public class CompletableFutureComposition { public void testlCompletableFutureComposition() throws InterruptedException, ExecutionException { Double priceInEuro = CompletableFuture.supplyAsync(() -> getStockPrice("GOOGL")) .thenCombine(CompletableFuture.supplyAsync(() -> getExchangeRate(USD, EUR)), this::convertPrice) .exceptionally(throwable -> { System.out.println("Error: " + throwable.getMessage()); return -1d; }).get(); System.out.println("GOOGL stock price in Euro: " + priceInEuro ); } public Price getStockPrice(String stockSymbol) { switch (stockSymbol) { case "GOOGL" : return new Price(950.28, USD); case "AAPL" : return new Price(148.96, USD); case "MSFT" : return new Price(69.00, USD); case "FB" : return new Price(150.24, USD); default: throw new RuntimeException("Stocks symbol not found."); } }
// Path: completable-future-demo/src/org/iproduct/cfdemo/Currency.java // public enum Currency { // BGN, GBP, EUR, USD // } // Path: completable-future-demo/src/org/iproduct/cfdemo/CompletableFutureComposition.java import static org.iproduct.cfdemo.Currency.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; package org.iproduct.cfdemo; public class CompletableFutureComposition { public void testlCompletableFutureComposition() throws InterruptedException, ExecutionException { Double priceInEuro = CompletableFuture.supplyAsync(() -> getStockPrice("GOOGL")) .thenCombine(CompletableFuture.supplyAsync(() -> getExchangeRate(USD, EUR)), this::convertPrice) .exceptionally(throwable -> { System.out.println("Error: " + throwable.getMessage()); return -1d; }).get(); System.out.println("GOOGL stock price in Euro: " + priceInEuro ); } public Price getStockPrice(String stockSymbol) { switch (stockSymbol) { case "GOOGL" : return new Price(950.28, USD); case "AAPL" : return new Price(148.96, USD); case "MSFT" : return new Price(69.00, USD); case "FB" : return new Price(150.24, USD); default: throw new RuntimeException("Stocks symbol not found."); } }
public Double getExchangeRate(Currency from, Currency to) {
iproduct/reactive-demos-java-9
http2-client/src/org/iproduct/demo/profiler/client/ProfilerAppClient.java
// Path: http2-client/src/org/iproduct/demo/profiler/client/model/ProcessInfo.java // public class ProcessInfo implements Serializable { // private static final long serialVersionUID = -6705829915457870975L; // // private long pid; // private String command; // // public ProcessInfo() { // } // // public ProcessInfo(long pid, String command) { // this.pid = pid; // this.command = command; // } // // public long getPid() { // return pid; // } // // public void setPid(long pid) { // this.pid = pid; // } // // public String getCommand() { // return command; // } // // public void setCommand(String command) { // this.command = command; // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((command == null) ? 0 : command.hashCode()); // result = prime * result + (int) (pid ^ (pid >>> 32)); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // ProcessInfo other = (ProcessInfo) obj; // if (command == null) { // if (other.command != null) // return false; // } else if (!command.equals(other.command)) // return false; // if (pid != other.pid) // return false; // return true; // } // // public String toString() { // return "ProcessInfo[" + pid + ", " + command + "]"; // } // // }
import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.List; import org.iproduct.demo.profiler.client.model.ProcessInfo; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import jdk.incubator.http.HttpClient; import jdk.incubator.http.HttpRequest; import jdk.incubator.http.HttpResponse;
package org.iproduct.demo.profiler.client; //import javax.ws.rs.core.GenericType; //import javax.ws.rs.sse.SseEventSource; //import org.slf4j.Logger; //import org.slf4j.LoggerFactory; public class ProfilerAppClient { public static final String PROFILER_API_URL = "http://localhost:8080/rest/api/"; public static void main(String[] args) throws URISyntaxException, InterruptedException { HttpClient client = HttpClient.newHttpClient(); HttpRequest processesReq = HttpRequest.newBuilder() .uri(new URI(PROFILER_API_URL + "processes")) .GET() .build();
// Path: http2-client/src/org/iproduct/demo/profiler/client/model/ProcessInfo.java // public class ProcessInfo implements Serializable { // private static final long serialVersionUID = -6705829915457870975L; // // private long pid; // private String command; // // public ProcessInfo() { // } // // public ProcessInfo(long pid, String command) { // this.pid = pid; // this.command = command; // } // // public long getPid() { // return pid; // } // // public void setPid(long pid) { // this.pid = pid; // } // // public String getCommand() { // return command; // } // // public void setCommand(String command) { // this.command = command; // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((command == null) ? 0 : command.hashCode()); // result = prime * result + (int) (pid ^ (pid >>> 32)); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // ProcessInfo other = (ProcessInfo) obj; // if (command == null) { // if (other.command != null) // return false; // } else if (!command.equals(other.command)) // return false; // if (pid != other.pid) // return false; // return true; // } // // public String toString() { // return "ProcessInfo[" + pid + ", " + command + "]"; // } // // } // Path: http2-client/src/org/iproduct/demo/profiler/client/ProfilerAppClient.java import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.List; import org.iproduct.demo.profiler.client.model.ProcessInfo; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import jdk.incubator.http.HttpClient; import jdk.incubator.http.HttpRequest; import jdk.incubator.http.HttpResponse; package org.iproduct.demo.profiler.client; //import javax.ws.rs.core.GenericType; //import javax.ws.rs.sse.SseEventSource; //import org.slf4j.Logger; //import org.slf4j.LoggerFactory; public class ProfilerAppClient { public static final String PROFILER_API_URL = "http://localhost:8080/rest/api/"; public static void main(String[] args) throws URISyntaxException, InterruptedException { HttpClient client = HttpClient.newHttpClient(); HttpRequest processesReq = HttpRequest.newBuilder() .uri(new URI(PROFILER_API_URL + "processes")) .GET() .build();
TypeToken<ArrayList<ProcessInfo>> token = new TypeToken<ArrayList<ProcessInfo>>() {};
iproduct/reactive-demos-java-9
completable-future-demo/src/org/iproduct/cfdemo/CompletableFutureCompositionTimeout.java
// Path: completable-future-demo/src/org/iproduct/cfdemo/Currency.java // public enum Currency { // BGN, GBP, EUR, USD // }
import static org.iproduct.cfdemo.Currency.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException;
}).whenComplete((price, throwable) -> { if (price > 0) System.out.println("GOOGL stock price in Euro: " + price); else System.out.println("Timeout: Service took too long to respond."); }).join(); scheduler.shutdownNow(); } public Price getStockPrice(String stockSymbol) { //Simulate long running task try { Thread.sleep(1100); } catch (InterruptedException e) { e.printStackTrace(); } switch (stockSymbol) { case "GOOGL": return new Price(950.28, USD); case "AAPL": return new Price(148.96, USD); case "MSFT": return new Price(69.00, USD); case "FB": return new Price(150.24, USD); default: throw new RuntimeException("Stocks symbol not found."); } }
// Path: completable-future-demo/src/org/iproduct/cfdemo/Currency.java // public enum Currency { // BGN, GBP, EUR, USD // } // Path: completable-future-demo/src/org/iproduct/cfdemo/CompletableFutureCompositionTimeout.java import static org.iproduct.cfdemo.Currency.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; }).whenComplete((price, throwable) -> { if (price > 0) System.out.println("GOOGL stock price in Euro: " + price); else System.out.println("Timeout: Service took too long to respond."); }).join(); scheduler.shutdownNow(); } public Price getStockPrice(String stockSymbol) { //Simulate long running task try { Thread.sleep(1100); } catch (InterruptedException e) { e.printStackTrace(); } switch (stockSymbol) { case "GOOGL": return new Price(950.28, USD); case "AAPL": return new Price(148.96, USD); case "MSFT": return new Price(69.00, USD); case "FB": return new Price(150.24, USD); default: throw new RuntimeException("Stocks symbol not found."); } }
public Double getExchangeRate(Currency from, Currency to) {
iproduct/reactive-demos-java-9
modularity-demo/client/src/module-info.java
// Path: modularity-demo/provider/src/provider/MessageProvider.java // public interface MessageProvider { // String getMessage(); // } // // Path: modularity-demo/renderer/src/renderer/MessageRenderer.java // public interface MessageRenderer { // void render(); // void setMessageProvider(MessageProvider provider); // MessageProvider getMessageProvider(); // }
import provider.MessageProvider; import renderer.MessageRenderer;
module client { requires provider; requires renderer;
// Path: modularity-demo/provider/src/provider/MessageProvider.java // public interface MessageProvider { // String getMessage(); // } // // Path: modularity-demo/renderer/src/renderer/MessageRenderer.java // public interface MessageRenderer { // void render(); // void setMessageProvider(MessageProvider provider); // MessageProvider getMessageProvider(); // } // Path: modularity-demo/client/src/module-info.java import provider.MessageProvider; import renderer.MessageRenderer; module client { requires provider; requires renderer;
uses MessageProvider;
iproduct/reactive-demos-java-9
modularity-demo/client/src/module-info.java
// Path: modularity-demo/provider/src/provider/MessageProvider.java // public interface MessageProvider { // String getMessage(); // } // // Path: modularity-demo/renderer/src/renderer/MessageRenderer.java // public interface MessageRenderer { // void render(); // void setMessageProvider(MessageProvider provider); // MessageProvider getMessageProvider(); // }
import provider.MessageProvider; import renderer.MessageRenderer;
module client { requires provider; requires renderer; uses MessageProvider;
// Path: modularity-demo/provider/src/provider/MessageProvider.java // public interface MessageProvider { // String getMessage(); // } // // Path: modularity-demo/renderer/src/renderer/MessageRenderer.java // public interface MessageRenderer { // void render(); // void setMessageProvider(MessageProvider provider); // MessageProvider getMessageProvider(); // } // Path: modularity-demo/client/src/module-info.java import provider.MessageProvider; import renderer.MessageRenderer; module client { requires provider; requires renderer; uses MessageProvider;
uses MessageRenderer;
iproduct/reactive-demos-java-9
modularity-demo/client/src/client/HelloModularityClient.java
// Path: modularity-demo/provider/src/provider/MessageProvider.java // public interface MessageProvider { // String getMessage(); // } // // Path: modularity-demo/renderer/src/renderer/MessageRenderer.java // public interface MessageRenderer { // void render(); // void setMessageProvider(MessageProvider provider); // MessageProvider getMessageProvider(); // }
import java.util.Iterator; import java.util.ServiceLoader; import provider.MessageProvider; import renderer.MessageRenderer;
package client; //import provider.impl.HelloWorldMessageProvider; //import renderer.impl.StandardOutMessageRenderer; public class HelloModularityClient { public static void main(String[] args) { // MessageProvider provider = new MessageProvider();
// Path: modularity-demo/provider/src/provider/MessageProvider.java // public interface MessageProvider { // String getMessage(); // } // // Path: modularity-demo/renderer/src/renderer/MessageRenderer.java // public interface MessageRenderer { // void render(); // void setMessageProvider(MessageProvider provider); // MessageProvider getMessageProvider(); // } // Path: modularity-demo/client/src/client/HelloModularityClient.java import java.util.Iterator; import java.util.ServiceLoader; import provider.MessageProvider; import renderer.MessageRenderer; package client; //import provider.impl.HelloWorldMessageProvider; //import renderer.impl.StandardOutMessageRenderer; public class HelloModularityClient { public static void main(String[] args) { // MessageProvider provider = new MessageProvider();
ServiceLoader<MessageProvider> loaderProvider = ServiceLoader.load(MessageProvider.class);
iproduct/reactive-demos-java-9
modularity-demo/client/src/client/HelloModularityClient.java
// Path: modularity-demo/provider/src/provider/MessageProvider.java // public interface MessageProvider { // String getMessage(); // } // // Path: modularity-demo/renderer/src/renderer/MessageRenderer.java // public interface MessageRenderer { // void render(); // void setMessageProvider(MessageProvider provider); // MessageProvider getMessageProvider(); // }
import java.util.Iterator; import java.util.ServiceLoader; import provider.MessageProvider; import renderer.MessageRenderer;
package client; //import provider.impl.HelloWorldMessageProvider; //import renderer.impl.StandardOutMessageRenderer; public class HelloModularityClient { public static void main(String[] args) { // MessageProvider provider = new MessageProvider(); ServiceLoader<MessageProvider> loaderProvider = ServiceLoader.load(MessageProvider.class); Iterator<MessageProvider> iterProvider = loaderProvider.iterator(); if (!iterProvider.hasNext()) throw new RuntimeException("No MessageProvider providers found!"); MessageProvider provider = iterProvider.next(); // MessageRenderer renderer = new StandardOutMessageRenderer();
// Path: modularity-demo/provider/src/provider/MessageProvider.java // public interface MessageProvider { // String getMessage(); // } // // Path: modularity-demo/renderer/src/renderer/MessageRenderer.java // public interface MessageRenderer { // void render(); // void setMessageProvider(MessageProvider provider); // MessageProvider getMessageProvider(); // } // Path: modularity-demo/client/src/client/HelloModularityClient.java import java.util.Iterator; import java.util.ServiceLoader; import provider.MessageProvider; import renderer.MessageRenderer; package client; //import provider.impl.HelloWorldMessageProvider; //import renderer.impl.StandardOutMessageRenderer; public class HelloModularityClient { public static void main(String[] args) { // MessageProvider provider = new MessageProvider(); ServiceLoader<MessageProvider> loaderProvider = ServiceLoader.load(MessageProvider.class); Iterator<MessageProvider> iterProvider = loaderProvider.iterator(); if (!iterProvider.hasNext()) throw new RuntimeException("No MessageProvider providers found!"); MessageProvider provider = iterProvider.next(); // MessageRenderer renderer = new StandardOutMessageRenderer();
ServiceLoader<MessageRenderer> loaderRenderer = ServiceLoader.load(MessageRenderer.class);
iproduct/reactive-demos-java-9
completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/resources/StatsRestResource.java
// Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/model/CpuLoad.java // @JsonInclude(value = Include.NON_NULL) // public class CpuLoad implements Serializable { // private static final long serialVersionUID = -6705829915457870975L; // // private long timestamp; // private int load; // private boolean changed; // // public CpuLoad() { // } // // public CpuLoad(long timestamp, int load, boolean changed) { // this.timestamp = timestamp; // this.load = load; // this.changed = changed; // } // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public int getLoad() { // return load; // } // // public void setLoad(int load) { // this.load = load; // } // // public boolean isChanged() { // return changed; // } // // public void setChanged(boolean changed) { // this.changed = changed; // } // // public String toString() { // return "CpuLoad[" + timestamp + ", " + load + ", changed: " + changed + "]"; // } // // }
import javax.ws.rs.sse.SseBroadcaster; import javax.ws.rs.sse.SseEventSink; import org.iproduct.demo.profiler.cdi.qualifiers.CpuProfiling; import org.iproduct.demo.profiler.server.model.CpuLoad; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.atomic.AtomicInteger; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.event.ObservesAsync; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.sse.OutboundSseEvent; import javax.ws.rs.sse.OutboundSseEvent.Builder; import javax.ws.rs.sse.Sse;
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.iproduct.demo.profiler.server.resources; @Path("/stats") @ApplicationScoped public class StatsRestResource { private Logger logger = LoggerFactory.getLogger(StatsRestResource.class); private AtomicInteger i = new AtomicInteger(); private SseBroadcaster broadcaster; private volatile Builder builder; @Context public void setSse(Sse sse) { this.broadcaster = sse.newBroadcaster(); this.builder = sse.newEventBuilder(); } @GET @Path("sse") @Produces(MediaType.SERVER_SENT_EVENTS) public void stats(@Context SseEventSink sink) { broadcaster.register(sink); }
// Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/model/CpuLoad.java // @JsonInclude(value = Include.NON_NULL) // public class CpuLoad implements Serializable { // private static final long serialVersionUID = -6705829915457870975L; // // private long timestamp; // private int load; // private boolean changed; // // public CpuLoad() { // } // // public CpuLoad(long timestamp, int load, boolean changed) { // this.timestamp = timestamp; // this.load = load; // this.changed = changed; // } // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public int getLoad() { // return load; // } // // public void setLoad(int load) { // this.load = load; // } // // public boolean isChanged() { // return changed; // } // // public void setChanged(boolean changed) { // this.changed = changed; // } // // public String toString() { // return "CpuLoad[" + timestamp + ", " + load + ", changed: " + changed + "]"; // } // // } // Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/resources/StatsRestResource.java import javax.ws.rs.sse.SseBroadcaster; import javax.ws.rs.sse.SseEventSink; import org.iproduct.demo.profiler.cdi.qualifiers.CpuProfiling; import org.iproduct.demo.profiler.server.model.CpuLoad; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.atomic.AtomicInteger; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.event.ObservesAsync; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.sse.OutboundSseEvent; import javax.ws.rs.sse.OutboundSseEvent.Builder; import javax.ws.rs.sse.Sse; /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.iproduct.demo.profiler.server.resources; @Path("/stats") @ApplicationScoped public class StatsRestResource { private Logger logger = LoggerFactory.getLogger(StatsRestResource.class); private AtomicInteger i = new AtomicInteger(); private SseBroadcaster broadcaster; private volatile Builder builder; @Context public void setSse(Sse sse) { this.broadcaster = sse.newBroadcaster(); this.builder = sse.newEventBuilder(); } @GET @Path("sse") @Produces(MediaType.SERVER_SENT_EVENTS) public void stats(@Context SseEventSink sink) { broadcaster.register(sink); }
public void asyncProcessingCpuLoad(@ObservesAsync @CpuProfiling CpuLoad cpuLoad) {
iproduct/reactive-demos-java-9
modularity-demo-intellij/client/src/client/HelloModularityClient.java
// Path: modularity-demo/provider/src/provider/impl/HelloWorldMessageProvider.java // public class HelloWorldMessageProvider implements MessageProvider { // @Override // public String getMessage() { // return "Hello Java 9 Modularity!!!"; // } // } // // Path: modularity-demo/renderer/src/renderer/impl/StandardOutMessageRenderer.java // public class StandardOutMessageRenderer implements MessageRenderer { // private MessageProvider provider; // // @Override // public void render() { // if (provider == null) { // throw new RuntimeException( // "You must set the property messageProvider of class:" // + StandardOutMessageRenderer.class.getName()); // } // System.out.println(provider.getMessage()); // } // // @Override // public void setMessageProvider(MessageProvider provider) { // this.provider = provider; // } // // @Override // public MessageProvider getMessageProvider() { // return provider; // } // }
import provider.impl.HelloWorldMessageProvider; import renderer.impl.StandardOutMessageRenderer;
package client; public class HelloModularityClient { public static void main(String[] args) {
// Path: modularity-demo/provider/src/provider/impl/HelloWorldMessageProvider.java // public class HelloWorldMessageProvider implements MessageProvider { // @Override // public String getMessage() { // return "Hello Java 9 Modularity!!!"; // } // } // // Path: modularity-demo/renderer/src/renderer/impl/StandardOutMessageRenderer.java // public class StandardOutMessageRenderer implements MessageRenderer { // private MessageProvider provider; // // @Override // public void render() { // if (provider == null) { // throw new RuntimeException( // "You must set the property messageProvider of class:" // + StandardOutMessageRenderer.class.getName()); // } // System.out.println(provider.getMessage()); // } // // @Override // public void setMessageProvider(MessageProvider provider) { // this.provider = provider; // } // // @Override // public MessageProvider getMessageProvider() { // return provider; // } // } // Path: modularity-demo-intellij/client/src/client/HelloModularityClient.java import provider.impl.HelloWorldMessageProvider; import renderer.impl.StandardOutMessageRenderer; package client; public class HelloModularityClient { public static void main(String[] args) {
HelloWorldMessageProvider provider = new HelloWorldMessageProvider();
iproduct/reactive-demos-java-9
modularity-demo-intellij/client/src/client/HelloModularityClient.java
// Path: modularity-demo/provider/src/provider/impl/HelloWorldMessageProvider.java // public class HelloWorldMessageProvider implements MessageProvider { // @Override // public String getMessage() { // return "Hello Java 9 Modularity!!!"; // } // } // // Path: modularity-demo/renderer/src/renderer/impl/StandardOutMessageRenderer.java // public class StandardOutMessageRenderer implements MessageRenderer { // private MessageProvider provider; // // @Override // public void render() { // if (provider == null) { // throw new RuntimeException( // "You must set the property messageProvider of class:" // + StandardOutMessageRenderer.class.getName()); // } // System.out.println(provider.getMessage()); // } // // @Override // public void setMessageProvider(MessageProvider provider) { // this.provider = provider; // } // // @Override // public MessageProvider getMessageProvider() { // return provider; // } // }
import provider.impl.HelloWorldMessageProvider; import renderer.impl.StandardOutMessageRenderer;
package client; public class HelloModularityClient { public static void main(String[] args) { HelloWorldMessageProvider provider = new HelloWorldMessageProvider();
// Path: modularity-demo/provider/src/provider/impl/HelloWorldMessageProvider.java // public class HelloWorldMessageProvider implements MessageProvider { // @Override // public String getMessage() { // return "Hello Java 9 Modularity!!!"; // } // } // // Path: modularity-demo/renderer/src/renderer/impl/StandardOutMessageRenderer.java // public class StandardOutMessageRenderer implements MessageRenderer { // private MessageProvider provider; // // @Override // public void render() { // if (provider == null) { // throw new RuntimeException( // "You must set the property messageProvider of class:" // + StandardOutMessageRenderer.class.getName()); // } // System.out.println(provider.getMessage()); // } // // @Override // public void setMessageProvider(MessageProvider provider) { // this.provider = provider; // } // // @Override // public MessageProvider getMessageProvider() { // return provider; // } // } // Path: modularity-demo-intellij/client/src/client/HelloModularityClient.java import provider.impl.HelloWorldMessageProvider; import renderer.impl.StandardOutMessageRenderer; package client; public class HelloModularityClient { public static void main(String[] args) { HelloWorldMessageProvider provider = new HelloWorldMessageProvider();
StandardOutMessageRenderer renderer = new StandardOutMessageRenderer();
iproduct/reactive-demos-java-9
completable-future-jaxrs-cdi-jersey/src/main/java/org/iproduct/demo/profiler/server/app/ProfilerApplication.java
// Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/resources/ProcessesRestResource.java // @Path("/processes") // @ApplicationScoped // public class ProcessesRestResource { // private Logger logger = LoggerFactory.getLogger(ProcessesRestResource.class); // // @Inject // Profiler profiler; // // @GET // @Produces(MediaType.APPLICATION_JSON) // public void getJavaProcesses(@Suspended AsyncResponse asyncResp) { // CompletableFuture.supplyAsync(() -> { // List<ProcessInfo> result = profiler.getJavaProcesses(); //List.of("A", "B", "C", "D"); //.stream().reduce("", (acc, item) -> acc + item); // System.out.println(result); // return result; // }).thenAccept(result -> asyncResp.resume(result)); // } // } // // Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/resources/StatsRestResource.java // @Path("/stats") // @ApplicationScoped // public class StatsRestResource { // private Logger logger = LoggerFactory.getLogger(StatsRestResource.class); // // private AtomicInteger i = new AtomicInteger(); // private SseBroadcaster broadcaster; // private volatile Builder builder; // // @Context // public void setSse(Sse sse) { // this.broadcaster = sse.newBroadcaster(); // this.builder = sse.newEventBuilder(); // } // // @GET // @Path("sse") // @Produces(MediaType.SERVER_SENT_EVENTS) // public void stats(@Context SseEventSink sink) { // broadcaster.register(sink); // } // // public void asyncProcessingCpuLoad(@ObservesAsync @CpuProfiling CpuLoad cpuLoad) { // OutboundSseEvent sseEvent = createStatsEvent(builder, cpuLoad); // broadcaster.broadcast(sseEvent); // // } // // private OutboundSseEvent createStatsEvent(final OutboundSseEvent.Builder builder, CpuLoad cpuLoad) { // OutboundSseEvent event = builder // .name("stats") // .data(CpuLoad.class, cpuLoad) // .mediaType(MediaType.APPLICATION_JSON_TYPE) // .build(); // return event; // } // }
import org.iproduct.demo.profiler.server.resources.StatsRestResource; import javax.ws.rs.ApplicationPath; import org.glassfish.jersey.server.ResourceConfig; import org.iproduct.demo.profiler.server.resources.ProcessesRestResource;
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.iproduct.demo.profiler.server.app; @ApplicationPath("/api/*") public class ProfilerApplication extends ResourceConfig { public ProfilerApplication() {
// Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/resources/ProcessesRestResource.java // @Path("/processes") // @ApplicationScoped // public class ProcessesRestResource { // private Logger logger = LoggerFactory.getLogger(ProcessesRestResource.class); // // @Inject // Profiler profiler; // // @GET // @Produces(MediaType.APPLICATION_JSON) // public void getJavaProcesses(@Suspended AsyncResponse asyncResp) { // CompletableFuture.supplyAsync(() -> { // List<ProcessInfo> result = profiler.getJavaProcesses(); //List.of("A", "B", "C", "D"); //.stream().reduce("", (acc, item) -> acc + item); // System.out.println(result); // return result; // }).thenAccept(result -> asyncResp.resume(result)); // } // } // // Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/resources/StatsRestResource.java // @Path("/stats") // @ApplicationScoped // public class StatsRestResource { // private Logger logger = LoggerFactory.getLogger(StatsRestResource.class); // // private AtomicInteger i = new AtomicInteger(); // private SseBroadcaster broadcaster; // private volatile Builder builder; // // @Context // public void setSse(Sse sse) { // this.broadcaster = sse.newBroadcaster(); // this.builder = sse.newEventBuilder(); // } // // @GET // @Path("sse") // @Produces(MediaType.SERVER_SENT_EVENTS) // public void stats(@Context SseEventSink sink) { // broadcaster.register(sink); // } // // public void asyncProcessingCpuLoad(@ObservesAsync @CpuProfiling CpuLoad cpuLoad) { // OutboundSseEvent sseEvent = createStatsEvent(builder, cpuLoad); // broadcaster.broadcast(sseEvent); // // } // // private OutboundSseEvent createStatsEvent(final OutboundSseEvent.Builder builder, CpuLoad cpuLoad) { // OutboundSseEvent event = builder // .name("stats") // .data(CpuLoad.class, cpuLoad) // .mediaType(MediaType.APPLICATION_JSON_TYPE) // .build(); // return event; // } // } // Path: completable-future-jaxrs-cdi-jersey/src/main/java/org/iproduct/demo/profiler/server/app/ProfilerApplication.java import org.iproduct.demo.profiler.server.resources.StatsRestResource; import javax.ws.rs.ApplicationPath; import org.glassfish.jersey.server.ResourceConfig; import org.iproduct.demo.profiler.server.resources.ProcessesRestResource; /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.iproduct.demo.profiler.server.app; @ApplicationPath("/api/*") public class ProfilerApplication extends ResourceConfig { public ProfilerApplication() {
register(ProcessesRestResource.class);
iproduct/reactive-demos-java-9
completable-future-jaxrs-cdi-jersey/src/main/java/org/iproduct/demo/profiler/server/app/ProfilerApplication.java
// Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/resources/ProcessesRestResource.java // @Path("/processes") // @ApplicationScoped // public class ProcessesRestResource { // private Logger logger = LoggerFactory.getLogger(ProcessesRestResource.class); // // @Inject // Profiler profiler; // // @GET // @Produces(MediaType.APPLICATION_JSON) // public void getJavaProcesses(@Suspended AsyncResponse asyncResp) { // CompletableFuture.supplyAsync(() -> { // List<ProcessInfo> result = profiler.getJavaProcesses(); //List.of("A", "B", "C", "D"); //.stream().reduce("", (acc, item) -> acc + item); // System.out.println(result); // return result; // }).thenAccept(result -> asyncResp.resume(result)); // } // } // // Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/resources/StatsRestResource.java // @Path("/stats") // @ApplicationScoped // public class StatsRestResource { // private Logger logger = LoggerFactory.getLogger(StatsRestResource.class); // // private AtomicInteger i = new AtomicInteger(); // private SseBroadcaster broadcaster; // private volatile Builder builder; // // @Context // public void setSse(Sse sse) { // this.broadcaster = sse.newBroadcaster(); // this.builder = sse.newEventBuilder(); // } // // @GET // @Path("sse") // @Produces(MediaType.SERVER_SENT_EVENTS) // public void stats(@Context SseEventSink sink) { // broadcaster.register(sink); // } // // public void asyncProcessingCpuLoad(@ObservesAsync @CpuProfiling CpuLoad cpuLoad) { // OutboundSseEvent sseEvent = createStatsEvent(builder, cpuLoad); // broadcaster.broadcast(sseEvent); // // } // // private OutboundSseEvent createStatsEvent(final OutboundSseEvent.Builder builder, CpuLoad cpuLoad) { // OutboundSseEvent event = builder // .name("stats") // .data(CpuLoad.class, cpuLoad) // .mediaType(MediaType.APPLICATION_JSON_TYPE) // .build(); // return event; // } // }
import org.iproduct.demo.profiler.server.resources.StatsRestResource; import javax.ws.rs.ApplicationPath; import org.glassfish.jersey.server.ResourceConfig; import org.iproduct.demo.profiler.server.resources.ProcessesRestResource;
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.iproduct.demo.profiler.server.app; @ApplicationPath("/api/*") public class ProfilerApplication extends ResourceConfig { public ProfilerApplication() { register(ProcessesRestResource.class);
// Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/resources/ProcessesRestResource.java // @Path("/processes") // @ApplicationScoped // public class ProcessesRestResource { // private Logger logger = LoggerFactory.getLogger(ProcessesRestResource.class); // // @Inject // Profiler profiler; // // @GET // @Produces(MediaType.APPLICATION_JSON) // public void getJavaProcesses(@Suspended AsyncResponse asyncResp) { // CompletableFuture.supplyAsync(() -> { // List<ProcessInfo> result = profiler.getJavaProcesses(); //List.of("A", "B", "C", "D"); //.stream().reduce("", (acc, item) -> acc + item); // System.out.println(result); // return result; // }).thenAccept(result -> asyncResp.resume(result)); // } // } // // Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/resources/StatsRestResource.java // @Path("/stats") // @ApplicationScoped // public class StatsRestResource { // private Logger logger = LoggerFactory.getLogger(StatsRestResource.class); // // private AtomicInteger i = new AtomicInteger(); // private SseBroadcaster broadcaster; // private volatile Builder builder; // // @Context // public void setSse(Sse sse) { // this.broadcaster = sse.newBroadcaster(); // this.builder = sse.newEventBuilder(); // } // // @GET // @Path("sse") // @Produces(MediaType.SERVER_SENT_EVENTS) // public void stats(@Context SseEventSink sink) { // broadcaster.register(sink); // } // // public void asyncProcessingCpuLoad(@ObservesAsync @CpuProfiling CpuLoad cpuLoad) { // OutboundSseEvent sseEvent = createStatsEvent(builder, cpuLoad); // broadcaster.broadcast(sseEvent); // // } // // private OutboundSseEvent createStatsEvent(final OutboundSseEvent.Builder builder, CpuLoad cpuLoad) { // OutboundSseEvent event = builder // .name("stats") // .data(CpuLoad.class, cpuLoad) // .mediaType(MediaType.APPLICATION_JSON_TYPE) // .build(); // return event; // } // } // Path: completable-future-jaxrs-cdi-jersey/src/main/java/org/iproduct/demo/profiler/server/app/ProfilerApplication.java import org.iproduct.demo.profiler.server.resources.StatsRestResource; import javax.ws.rs.ApplicationPath; import org.glassfish.jersey.server.ResourceConfig; import org.iproduct.demo.profiler.server.resources.ProcessesRestResource; /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.iproduct.demo.profiler.server.app; @ApplicationPath("/api/*") public class ProfilerApplication extends ResourceConfig { public ProfilerApplication() { register(ProcessesRestResource.class);
register(StatsRestResource.class);
iproduct/reactive-demos-java-9
completable-future-jaxrs-cdi-jersey/src/main/java/org/iproduct/demo/profiler/server/resources/StatsRestResource.java
// Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/model/CpuLoad.java // @JsonInclude(value = Include.NON_NULL) // public class CpuLoad implements Serializable { // private static final long serialVersionUID = -6705829915457870975L; // // private long timestamp; // private int load; // private boolean changed; // // public CpuLoad() { // } // // public CpuLoad(long timestamp, int load, boolean changed) { // this.timestamp = timestamp; // this.load = load; // this.changed = changed; // } // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public int getLoad() { // return load; // } // // public void setLoad(int load) { // this.load = load; // } // // public boolean isChanged() { // return changed; // } // // public void setChanged(boolean changed) { // this.changed = changed; // } // // public String toString() { // return "CpuLoad[" + timestamp + ", " + load + ", changed: " + changed + "]"; // } // // }
import javax.ws.rs.sse.SseBroadcaster; import javax.ws.rs.sse.SseEventSink; import org.iproduct.demo.profiler.cdi.qualifiers.CpuProfiling; import org.iproduct.demo.profiler.server.model.CpuLoad; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.atomic.AtomicInteger; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.event.ObservesAsync; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.sse.OutboundSseEvent; import javax.ws.rs.sse.OutboundSseEvent.Builder; import javax.ws.rs.sse.Sse;
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.iproduct.demo.profiler.server.resources; @Path("/stats") @ApplicationScoped public class StatsRestResource { private Logger logger = LoggerFactory.getLogger(StatsRestResource.class); private AtomicInteger i = new AtomicInteger(); private SseBroadcaster broadcaster; private volatile Builder builder; @Context public void setSse(Sse sse) { this.broadcaster = sse.newBroadcaster(); this.builder = sse.newEventBuilder(); } @GET @Path("sse") @Produces(MediaType.SERVER_SENT_EVENTS) public void stats(@Context SseEventSink sink) { broadcaster.register(sink); }
// Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/model/CpuLoad.java // @JsonInclude(value = Include.NON_NULL) // public class CpuLoad implements Serializable { // private static final long serialVersionUID = -6705829915457870975L; // // private long timestamp; // private int load; // private boolean changed; // // public CpuLoad() { // } // // public CpuLoad(long timestamp, int load, boolean changed) { // this.timestamp = timestamp; // this.load = load; // this.changed = changed; // } // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public int getLoad() { // return load; // } // // public void setLoad(int load) { // this.load = load; // } // // public boolean isChanged() { // return changed; // } // // public void setChanged(boolean changed) { // this.changed = changed; // } // // public String toString() { // return "CpuLoad[" + timestamp + ", " + load + ", changed: " + changed + "]"; // } // // } // Path: completable-future-jaxrs-cdi-jersey/src/main/java/org/iproduct/demo/profiler/server/resources/StatsRestResource.java import javax.ws.rs.sse.SseBroadcaster; import javax.ws.rs.sse.SseEventSink; import org.iproduct.demo.profiler.cdi.qualifiers.CpuProfiling; import org.iproduct.demo.profiler.server.model.CpuLoad; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.atomic.AtomicInteger; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.event.ObservesAsync; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.sse.OutboundSseEvent; import javax.ws.rs.sse.OutboundSseEvent.Builder; import javax.ws.rs.sse.Sse; /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.iproduct.demo.profiler.server.resources; @Path("/stats") @ApplicationScoped public class StatsRestResource { private Logger logger = LoggerFactory.getLogger(StatsRestResource.class); private AtomicInteger i = new AtomicInteger(); private SseBroadcaster broadcaster; private volatile Builder builder; @Context public void setSse(Sse sse) { this.broadcaster = sse.newBroadcaster(); this.builder = sse.newEventBuilder(); } @GET @Path("sse") @Produces(MediaType.SERVER_SENT_EVENTS) public void stats(@Context SseEventSink sink) { broadcaster.register(sink); }
public void asyncProcessingCpuLoad(@ObservesAsync @CpuProfiling CpuLoad cpuLoad) {
iproduct/reactive-demos-java-9
completable-future-jaxrs-cdi-jersey-client/src/main/java/org/iproduct/demo/profiler/client/ProfilerAppClient.java
// Path: http2-client/src/org/iproduct/demo/profiler/client/model/ProcessInfo.java // public class ProcessInfo implements Serializable { // private static final long serialVersionUID = -6705829915457870975L; // // private long pid; // private String command; // // public ProcessInfo() { // } // // public ProcessInfo(long pid, String command) { // this.pid = pid; // this.command = command; // } // // public long getPid() { // return pid; // } // // public void setPid(long pid) { // this.pid = pid; // } // // public String getCommand() { // return command; // } // // public void setCommand(String command) { // this.command = command; // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((command == null) ? 0 : command.hashCode()); // result = prime * result + (int) (pid ^ (pid >>> 32)); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // ProcessInfo other = (ProcessInfo) obj; // if (command == null) { // if (other.command != null) // return false; // } else if (!command.equals(other.command)) // return false; // if (pid != other.pid) // return false; // return true; // } // // public String toString() { // return "ProcessInfo[" + pid + ", " + command + "]"; // } // // }
import java.util.Collections; import java.util.List; import java.util.concurrent.CompletionStage; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.GenericType; import javax.ws.rs.sse.SseEventSource; import org.iproduct.demo.profiler.client.model.ProcessInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory;
package org.iproduct.demo.profiler.client; // Run the ProfilerStreamingServer first (from completable-future-jaxrs-cdi-jersey project) public class ProfilerAppClient { public static final String PROFILER_API_URL = "http://localhost:8080/rest/api/"; public static Logger logger = LoggerFactory.getLogger(ProfilerAppClient.class); public static void main(String[] args) { // Default client instance Client client = ClientBuilder.newClient(); final WebTarget processes = client.target(PROFILER_API_URL + "processes"); final WebTarget stats = client.target(PROFILER_API_URL + "stats/sse");
// Path: http2-client/src/org/iproduct/demo/profiler/client/model/ProcessInfo.java // public class ProcessInfo implements Serializable { // private static final long serialVersionUID = -6705829915457870975L; // // private long pid; // private String command; // // public ProcessInfo() { // } // // public ProcessInfo(long pid, String command) { // this.pid = pid; // this.command = command; // } // // public long getPid() { // return pid; // } // // public void setPid(long pid) { // this.pid = pid; // } // // public String getCommand() { // return command; // } // // public void setCommand(String command) { // this.command = command; // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((command == null) ? 0 : command.hashCode()); // result = prime * result + (int) (pid ^ (pid >>> 32)); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // ProcessInfo other = (ProcessInfo) obj; // if (command == null) { // if (other.command != null) // return false; // } else if (!command.equals(other.command)) // return false; // if (pid != other.pid) // return false; // return true; // } // // public String toString() { // return "ProcessInfo[" + pid + ", " + command + "]"; // } // // } // Path: completable-future-jaxrs-cdi-jersey-client/src/main/java/org/iproduct/demo/profiler/client/ProfilerAppClient.java import java.util.Collections; import java.util.List; import java.util.concurrent.CompletionStage; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.GenericType; import javax.ws.rs.sse.SseEventSource; import org.iproduct.demo.profiler.client.model.ProcessInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; package org.iproduct.demo.profiler.client; // Run the ProfilerStreamingServer first (from completable-future-jaxrs-cdi-jersey project) public class ProfilerAppClient { public static final String PROFILER_API_URL = "http://localhost:8080/rest/api/"; public static Logger logger = LoggerFactory.getLogger(ProfilerAppClient.class); public static void main(String[] args) { // Default client instance Client client = ClientBuilder.newClient(); final WebTarget processes = client.target(PROFILER_API_URL + "processes"); final WebTarget stats = client.target(PROFILER_API_URL + "stats/sse");
CompletionStage<List<ProcessInfo>> processesStage = processes.request()
iproduct/reactive-demos-java-9
modularity-demo/renderer/src/renderer/MessageRenderer.java
// Path: modularity-demo/provider/src/provider/MessageProvider.java // public interface MessageProvider { // String getMessage(); // }
import provider.MessageProvider;
package renderer; public interface MessageRenderer { void render();
// Path: modularity-demo/provider/src/provider/MessageProvider.java // public interface MessageProvider { // String getMessage(); // } // Path: modularity-demo/renderer/src/renderer/MessageRenderer.java import provider.MessageProvider; package renderer; public interface MessageRenderer { void render();
void setMessageProvider(MessageProvider provider);
iproduct/reactive-demos-java-9
completable-future-jaxrs-cdi-jersey/src/main/java/org/iproduct/demo/profiler/server/ProfilerStreamingServer.java
// Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/app/ProfilerApplication.java // @ApplicationPath("api") // @ApplicationScoped // public class ProfilerApplication extends Application { // @Inject private StatsRestResource statsRestService; // // @Inject private StatsRestServiceRxJava2 statsRestService; // @Inject private ProcessesRestResource processesRestService; // // @Override // public Set<Object> getSingletons() { // final Set<Object> singletons = new HashSet<>(); // singletons.add(new SseFeature()); // singletons.add(statsRestService); // singletons.add(processesRestService); // singletons.add(new JacksonJsonProvider()); // return singletons; // } // }
import org.jboss.weld.environment.servlet.BeanManagerResourceBindingListener; import org.jboss.weld.environment.servlet.Listener; import java.net.URI; import javax.ws.rs.core.UriBuilder; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.HandlerList; import org.eclipse.jetty.servlet.DefaultServlet; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.servlet.ServletContainer; import org.iproduct.demo.profiler.server.app.ProfilerApplication;
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.iproduct.demo.profiler.server; //--add-modules=java.se.ee --permit-illegal-access --patch-module java.xml.ws.annotation=./myannotation.jar public final class ProfilerStreamingServer { private static final URI BASE_URI = UriBuilder.fromUri("http://localhost:8080/rest").port(8080).build(); public static void main(final String[] args) throws Exception { final Server server = new Server(8080); final ServletContainer jerseyServlet = new ServletContainer(); final ServletHolder jerseyServletHolder = new ServletHolder(jerseyServlet);
// Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/app/ProfilerApplication.java // @ApplicationPath("api") // @ApplicationScoped // public class ProfilerApplication extends Application { // @Inject private StatsRestResource statsRestService; // // @Inject private StatsRestServiceRxJava2 statsRestService; // @Inject private ProcessesRestResource processesRestService; // // @Override // public Set<Object> getSingletons() { // final Set<Object> singletons = new HashSet<>(); // singletons.add(new SseFeature()); // singletons.add(statsRestService); // singletons.add(processesRestService); // singletons.add(new JacksonJsonProvider()); // return singletons; // } // } // Path: completable-future-jaxrs-cdi-jersey/src/main/java/org/iproduct/demo/profiler/server/ProfilerStreamingServer.java import org.jboss.weld.environment.servlet.BeanManagerResourceBindingListener; import org.jboss.weld.environment.servlet.Listener; import java.net.URI; import javax.ws.rs.core.UriBuilder; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.HandlerList; import org.eclipse.jetty.servlet.DefaultServlet; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.servlet.ServletContainer; import org.iproduct.demo.profiler.server.app.ProfilerApplication; /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.iproduct.demo.profiler.server; //--add-modules=java.se.ee --permit-illegal-access --patch-module java.xml.ws.annotation=./myannotation.jar public final class ProfilerStreamingServer { private static final URI BASE_URI = UriBuilder.fromUri("http://localhost:8080/rest").port(8080).build(); public static void main(final String[] args) throws Exception { final Server server = new Server(8080); final ServletContainer jerseyServlet = new ServletContainer(); final ServletHolder jerseyServletHolder = new ServletHolder(jerseyServlet);
jerseyServletHolder.setInitParameter("javax.ws.rs.Application", ProfilerApplication.class.getName());
JavaWoW/JavaWoW
src/main/java/com/github/javawow/auth/handler/ReconnectVerifyHandler.java
// Path: src/main/java/com/github/javawow/auth/AuthServer.java // public final class AuthServer { // private static final int PORT = 3724; // private static final Logger LOGGER = LoggerFactory.getLogger(AuthServer.class); // private static final Scanner sc = new Scanner(System.in); // private static final EventLoopGroup bossGroup = new NioEventLoopGroup(); // private static final EventLoopGroup workerGroup = new NioEventLoopGroup(); // public static final AttributeKey<WoWSRP6Server> SRP_ATTR = AttributeKey.newInstance("SRP"); // // private AuthServer() { // } // // public static final void main(String[] args) { // ServerBootstrap b = new ServerBootstrap() // .group(bossGroup, workerGroup) // .channel(NioServerSocketChannel.class) // .childHandler(new ChannelInitializer<Channel>() { // @Override // protected void initChannel(Channel ch) throws Exception { // ch.pipeline().addLast("encoder", AuthEncoder.getInstance()); // ch.pipeline().addLast("decoder", new AuthDecoder()); // ch.pipeline().addLast("handler", AuthServerHandler.getInstance()); // } // }) // .option(ChannelOption.SO_BACKLOG, Integer.valueOf(NetUtil.SOMAXCONN)) // .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) // .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) // .childOption(ChannelOption.TCP_NODELAY, Boolean.TRUE) // .childOption(ChannelOption.SO_KEEPALIVE, Boolean.TRUE); // ChannelFuture cf = b.bind(PORT).addListener(f -> { // if (f.isSuccess()) { // LOGGER.info("Auth Server listening on port {}.", PORT); // } else { // LOGGER.error("Binding to port {} failed", Integer.valueOf(PORT), f.cause()); // } // }); // // Wait for the bind to complete // try { // cf.await(); // } catch (InterruptedException e) { // // Restore interrupted status // Thread.currentThread().interrupt(); // } // while (sc.hasNextLine()) { // if (sc.nextLine().equalsIgnoreCase("q")) { // System.out.println("Shutting down..."); // workerGroup.shutdownGracefully(); // bossGroup.shutdownGracefully(); // break; // } // } // } // } // // Path: src/main/java/com/github/javawow/auth/message/ReconnectProofMessage.java // @Immutable // public final class ReconnectProofMessage { // @SuppressWarnings("Immutable") // private final byte[] R1; // @SuppressWarnings("Immutable") // private final byte[] R2; // @SuppressWarnings("Immutable") // private final byte[] R3; // private final byte numKeys; // number of keys // // public ReconnectProofMessage(byte[] r1, byte[] r2, byte[] r3, byte numKeys) { // Objects.requireNonNull(r1, "r1 must not be null"); // Objects.requireNonNull(r2, "r2 must not be null"); // Objects.requireNonNull(r3, "r3 must not be null"); // if (r1.length != 16) { // throw new IllegalArgumentException("r1 must be length 16"); // } // if (r2.length != 20) { // throw new IllegalArgumentException("r2 must be length 20"); // } // if (r3.length != 20) { // throw new IllegalArgumentException("r3 must be length 20"); // } // this.R1 = Arrays.copyOf(r1, 16); // this.R2 = Arrays.copyOf(r2, 16); // this.R3 = Arrays.copyOf(r3, 16); // this.numKeys = numKeys; // } // // public final byte[] getR1() { // return Arrays.copyOf(R1, R1.length); // } // // public final byte[] getR2() { // return Arrays.copyOf(R2, R2.length); // } // // public final byte[] getR3() { // return Arrays.copyOf(R3, R3.length); // } // // public final byte getNumKeys() { // return numKeys; // } // }
import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.github.javawow.auth.AuthServer; import com.github.javawow.auth.message.ReconnectProofMessage; import io.netty.channel.Channel;
/* * Java World of Warcraft Emulation Project * Copyright (C) 2015-2020 JavaWoW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.github.javawow.auth.handler; public final class ReconnectVerifyHandler implements BasicAuthHandler<ReconnectProofMessage> { private static final Logger LOGGER = LoggerFactory.getLogger(ReconnectVerifyHandler.class); private static final ReconnectVerifyHandler INSTANCE = new ReconnectVerifyHandler(); private ReconnectVerifyHandler() { // singleton } public static final ReconnectVerifyHandler getInstance() { return INSTANCE; } @Override public final boolean hasValidState(Channel channel) {
// Path: src/main/java/com/github/javawow/auth/AuthServer.java // public final class AuthServer { // private static final int PORT = 3724; // private static final Logger LOGGER = LoggerFactory.getLogger(AuthServer.class); // private static final Scanner sc = new Scanner(System.in); // private static final EventLoopGroup bossGroup = new NioEventLoopGroup(); // private static final EventLoopGroup workerGroup = new NioEventLoopGroup(); // public static final AttributeKey<WoWSRP6Server> SRP_ATTR = AttributeKey.newInstance("SRP"); // // private AuthServer() { // } // // public static final void main(String[] args) { // ServerBootstrap b = new ServerBootstrap() // .group(bossGroup, workerGroup) // .channel(NioServerSocketChannel.class) // .childHandler(new ChannelInitializer<Channel>() { // @Override // protected void initChannel(Channel ch) throws Exception { // ch.pipeline().addLast("encoder", AuthEncoder.getInstance()); // ch.pipeline().addLast("decoder", new AuthDecoder()); // ch.pipeline().addLast("handler", AuthServerHandler.getInstance()); // } // }) // .option(ChannelOption.SO_BACKLOG, Integer.valueOf(NetUtil.SOMAXCONN)) // .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) // .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) // .childOption(ChannelOption.TCP_NODELAY, Boolean.TRUE) // .childOption(ChannelOption.SO_KEEPALIVE, Boolean.TRUE); // ChannelFuture cf = b.bind(PORT).addListener(f -> { // if (f.isSuccess()) { // LOGGER.info("Auth Server listening on port {}.", PORT); // } else { // LOGGER.error("Binding to port {} failed", Integer.valueOf(PORT), f.cause()); // } // }); // // Wait for the bind to complete // try { // cf.await(); // } catch (InterruptedException e) { // // Restore interrupted status // Thread.currentThread().interrupt(); // } // while (sc.hasNextLine()) { // if (sc.nextLine().equalsIgnoreCase("q")) { // System.out.println("Shutting down..."); // workerGroup.shutdownGracefully(); // bossGroup.shutdownGracefully(); // break; // } // } // } // } // // Path: src/main/java/com/github/javawow/auth/message/ReconnectProofMessage.java // @Immutable // public final class ReconnectProofMessage { // @SuppressWarnings("Immutable") // private final byte[] R1; // @SuppressWarnings("Immutable") // private final byte[] R2; // @SuppressWarnings("Immutable") // private final byte[] R3; // private final byte numKeys; // number of keys // // public ReconnectProofMessage(byte[] r1, byte[] r2, byte[] r3, byte numKeys) { // Objects.requireNonNull(r1, "r1 must not be null"); // Objects.requireNonNull(r2, "r2 must not be null"); // Objects.requireNonNull(r3, "r3 must not be null"); // if (r1.length != 16) { // throw new IllegalArgumentException("r1 must be length 16"); // } // if (r2.length != 20) { // throw new IllegalArgumentException("r2 must be length 20"); // } // if (r3.length != 20) { // throw new IllegalArgumentException("r3 must be length 20"); // } // this.R1 = Arrays.copyOf(r1, 16); // this.R2 = Arrays.copyOf(r2, 16); // this.R3 = Arrays.copyOf(r3, 16); // this.numKeys = numKeys; // } // // public final byte[] getR1() { // return Arrays.copyOf(R1, R1.length); // } // // public final byte[] getR2() { // return Arrays.copyOf(R2, R2.length); // } // // public final byte[] getR3() { // return Arrays.copyOf(R3, R3.length); // } // // public final byte getNumKeys() { // return numKeys; // } // } // Path: src/main/java/com/github/javawow/auth/handler/ReconnectVerifyHandler.java import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.github.javawow.auth.AuthServer; import com.github.javawow.auth.message.ReconnectProofMessage; import io.netty.channel.Channel; /* * Java World of Warcraft Emulation Project * Copyright (C) 2015-2020 JavaWoW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.github.javawow.auth.handler; public final class ReconnectVerifyHandler implements BasicAuthHandler<ReconnectProofMessage> { private static final Logger LOGGER = LoggerFactory.getLogger(ReconnectVerifyHandler.class); private static final ReconnectVerifyHandler INSTANCE = new ReconnectVerifyHandler(); private ReconnectVerifyHandler() { // singleton } public static final ReconnectVerifyHandler getInstance() { return INSTANCE; } @Override public final boolean hasValidState(Channel channel) {
return channel.attr(AuthServer.SRP_ATTR).get() != null;
JavaWoW/JavaWoW
src/main/java/com/github/javawow/auth/handler/RealmListRequestHandler.java
// Path: src/main/java/com/github/javawow/auth/AuthServer.java // public final class AuthServer { // private static final int PORT = 3724; // private static final Logger LOGGER = LoggerFactory.getLogger(AuthServer.class); // private static final Scanner sc = new Scanner(System.in); // private static final EventLoopGroup bossGroup = new NioEventLoopGroup(); // private static final EventLoopGroup workerGroup = new NioEventLoopGroup(); // public static final AttributeKey<WoWSRP6Server> SRP_ATTR = AttributeKey.newInstance("SRP"); // // private AuthServer() { // } // // public static final void main(String[] args) { // ServerBootstrap b = new ServerBootstrap() // .group(bossGroup, workerGroup) // .channel(NioServerSocketChannel.class) // .childHandler(new ChannelInitializer<Channel>() { // @Override // protected void initChannel(Channel ch) throws Exception { // ch.pipeline().addLast("encoder", AuthEncoder.getInstance()); // ch.pipeline().addLast("decoder", new AuthDecoder()); // ch.pipeline().addLast("handler", AuthServerHandler.getInstance()); // } // }) // .option(ChannelOption.SO_BACKLOG, Integer.valueOf(NetUtil.SOMAXCONN)) // .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) // .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) // .childOption(ChannelOption.TCP_NODELAY, Boolean.TRUE) // .childOption(ChannelOption.SO_KEEPALIVE, Boolean.TRUE); // ChannelFuture cf = b.bind(PORT).addListener(f -> { // if (f.isSuccess()) { // LOGGER.info("Auth Server listening on port {}.", PORT); // } else { // LOGGER.error("Binding to port {} failed", Integer.valueOf(PORT), f.cause()); // } // }); // // Wait for the bind to complete // try { // cf.await(); // } catch (InterruptedException e) { // // Restore interrupted status // Thread.currentThread().interrupt(); // } // while (sc.hasNextLine()) { // if (sc.nextLine().equalsIgnoreCase("q")) { // System.out.println("Shutting down..."); // workerGroup.shutdownGracefully(); // bossGroup.shutdownGracefully(); // break; // } // } // } // } // // Path: src/main/java/com/github/javawow/auth/message/RealmlistRequestMessage.java // @Immutable // public final class RealmlistRequestMessage { // private final int unk; // // public RealmlistRequestMessage(int unk) { // this.unk = unk; // } // // public final int getUnk() { // return unk; // } // } // // Path: src/main/java/com/github/javawow/data/output/LittleEndianWriterStream.java // public class LittleEndianWriterStream extends GenericLittleEndianWriter { // private int opcode; // private ByteArrayOutputStream baos; // // public LittleEndianWriterStream(int opcode) { // this(opcode, 32); // } // // public LittleEndianWriterStream(int opcode, int size) { // this.opcode = opcode; // this.baos = new ByteArrayOutputStream(size); // setByteOutputStream(new ByteArrayOutputByteStream(baos)); // } // // // public final byte[] toByteArray() { // // return baos.toByteArray(); // // } // // // public final int size() { // // return baos.size(); // // } // // public final ByteBufWoWPacket getPacket() { // return new ByteBufWoWPacket(opcode, Unpooled.wrappedBuffer(baos.toByteArray())); // } // // @Override // public final String toString() { // return HexTool.toString(baos.toByteArray()); // } // }
import io.netty.channel.Channel; import com.github.javawow.auth.AuthServer; import com.github.javawow.auth.message.RealmlistRequestMessage; import com.github.javawow.data.output.LittleEndianWriterStream;
/* * Java World of Warcraft Emulation Project * Copyright (C) 2015-2020 JavaWoW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.github.javawow.auth.handler; public final class RealmListRequestHandler implements BasicAuthHandler<RealmlistRequestMessage> { // private static final Logger LOGGER = LoggerFactory.getLogger(RealmListRequestHandler.class); private static final RealmListRequestHandler INSTANCE = new RealmListRequestHandler(); private RealmListRequestHandler() { // singleton } public static final RealmListRequestHandler getInstance() { return INSTANCE; } @Override public final boolean hasValidState(Channel channel) {
// Path: src/main/java/com/github/javawow/auth/AuthServer.java // public final class AuthServer { // private static final int PORT = 3724; // private static final Logger LOGGER = LoggerFactory.getLogger(AuthServer.class); // private static final Scanner sc = new Scanner(System.in); // private static final EventLoopGroup bossGroup = new NioEventLoopGroup(); // private static final EventLoopGroup workerGroup = new NioEventLoopGroup(); // public static final AttributeKey<WoWSRP6Server> SRP_ATTR = AttributeKey.newInstance("SRP"); // // private AuthServer() { // } // // public static final void main(String[] args) { // ServerBootstrap b = new ServerBootstrap() // .group(bossGroup, workerGroup) // .channel(NioServerSocketChannel.class) // .childHandler(new ChannelInitializer<Channel>() { // @Override // protected void initChannel(Channel ch) throws Exception { // ch.pipeline().addLast("encoder", AuthEncoder.getInstance()); // ch.pipeline().addLast("decoder", new AuthDecoder()); // ch.pipeline().addLast("handler", AuthServerHandler.getInstance()); // } // }) // .option(ChannelOption.SO_BACKLOG, Integer.valueOf(NetUtil.SOMAXCONN)) // .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) // .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) // .childOption(ChannelOption.TCP_NODELAY, Boolean.TRUE) // .childOption(ChannelOption.SO_KEEPALIVE, Boolean.TRUE); // ChannelFuture cf = b.bind(PORT).addListener(f -> { // if (f.isSuccess()) { // LOGGER.info("Auth Server listening on port {}.", PORT); // } else { // LOGGER.error("Binding to port {} failed", Integer.valueOf(PORT), f.cause()); // } // }); // // Wait for the bind to complete // try { // cf.await(); // } catch (InterruptedException e) { // // Restore interrupted status // Thread.currentThread().interrupt(); // } // while (sc.hasNextLine()) { // if (sc.nextLine().equalsIgnoreCase("q")) { // System.out.println("Shutting down..."); // workerGroup.shutdownGracefully(); // bossGroup.shutdownGracefully(); // break; // } // } // } // } // // Path: src/main/java/com/github/javawow/auth/message/RealmlistRequestMessage.java // @Immutable // public final class RealmlistRequestMessage { // private final int unk; // // public RealmlistRequestMessage(int unk) { // this.unk = unk; // } // // public final int getUnk() { // return unk; // } // } // // Path: src/main/java/com/github/javawow/data/output/LittleEndianWriterStream.java // public class LittleEndianWriterStream extends GenericLittleEndianWriter { // private int opcode; // private ByteArrayOutputStream baos; // // public LittleEndianWriterStream(int opcode) { // this(opcode, 32); // } // // public LittleEndianWriterStream(int opcode, int size) { // this.opcode = opcode; // this.baos = new ByteArrayOutputStream(size); // setByteOutputStream(new ByteArrayOutputByteStream(baos)); // } // // // public final byte[] toByteArray() { // // return baos.toByteArray(); // // } // // // public final int size() { // // return baos.size(); // // } // // public final ByteBufWoWPacket getPacket() { // return new ByteBufWoWPacket(opcode, Unpooled.wrappedBuffer(baos.toByteArray())); // } // // @Override // public final String toString() { // return HexTool.toString(baos.toByteArray()); // } // } // Path: src/main/java/com/github/javawow/auth/handler/RealmListRequestHandler.java import io.netty.channel.Channel; import com.github.javawow.auth.AuthServer; import com.github.javawow.auth.message.RealmlistRequestMessage; import com.github.javawow.data.output.LittleEndianWriterStream; /* * Java World of Warcraft Emulation Project * Copyright (C) 2015-2020 JavaWoW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.github.javawow.auth.handler; public final class RealmListRequestHandler implements BasicAuthHandler<RealmlistRequestMessage> { // private static final Logger LOGGER = LoggerFactory.getLogger(RealmListRequestHandler.class); private static final RealmListRequestHandler INSTANCE = new RealmListRequestHandler(); private RealmListRequestHandler() { // singleton } public static final RealmListRequestHandler getInstance() { return INSTANCE; } @Override public final boolean hasValidState(Channel channel) {
return channel.attr(AuthServer.SRP_ATTR).get() != null;
JavaWoW/JavaWoW
src/main/java/com/github/javawow/auth/handler/RealmListRequestHandler.java
// Path: src/main/java/com/github/javawow/auth/AuthServer.java // public final class AuthServer { // private static final int PORT = 3724; // private static final Logger LOGGER = LoggerFactory.getLogger(AuthServer.class); // private static final Scanner sc = new Scanner(System.in); // private static final EventLoopGroup bossGroup = new NioEventLoopGroup(); // private static final EventLoopGroup workerGroup = new NioEventLoopGroup(); // public static final AttributeKey<WoWSRP6Server> SRP_ATTR = AttributeKey.newInstance("SRP"); // // private AuthServer() { // } // // public static final void main(String[] args) { // ServerBootstrap b = new ServerBootstrap() // .group(bossGroup, workerGroup) // .channel(NioServerSocketChannel.class) // .childHandler(new ChannelInitializer<Channel>() { // @Override // protected void initChannel(Channel ch) throws Exception { // ch.pipeline().addLast("encoder", AuthEncoder.getInstance()); // ch.pipeline().addLast("decoder", new AuthDecoder()); // ch.pipeline().addLast("handler", AuthServerHandler.getInstance()); // } // }) // .option(ChannelOption.SO_BACKLOG, Integer.valueOf(NetUtil.SOMAXCONN)) // .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) // .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) // .childOption(ChannelOption.TCP_NODELAY, Boolean.TRUE) // .childOption(ChannelOption.SO_KEEPALIVE, Boolean.TRUE); // ChannelFuture cf = b.bind(PORT).addListener(f -> { // if (f.isSuccess()) { // LOGGER.info("Auth Server listening on port {}.", PORT); // } else { // LOGGER.error("Binding to port {} failed", Integer.valueOf(PORT), f.cause()); // } // }); // // Wait for the bind to complete // try { // cf.await(); // } catch (InterruptedException e) { // // Restore interrupted status // Thread.currentThread().interrupt(); // } // while (sc.hasNextLine()) { // if (sc.nextLine().equalsIgnoreCase("q")) { // System.out.println("Shutting down..."); // workerGroup.shutdownGracefully(); // bossGroup.shutdownGracefully(); // break; // } // } // } // } // // Path: src/main/java/com/github/javawow/auth/message/RealmlistRequestMessage.java // @Immutable // public final class RealmlistRequestMessage { // private final int unk; // // public RealmlistRequestMessage(int unk) { // this.unk = unk; // } // // public final int getUnk() { // return unk; // } // } // // Path: src/main/java/com/github/javawow/data/output/LittleEndianWriterStream.java // public class LittleEndianWriterStream extends GenericLittleEndianWriter { // private int opcode; // private ByteArrayOutputStream baos; // // public LittleEndianWriterStream(int opcode) { // this(opcode, 32); // } // // public LittleEndianWriterStream(int opcode, int size) { // this.opcode = opcode; // this.baos = new ByteArrayOutputStream(size); // setByteOutputStream(new ByteArrayOutputByteStream(baos)); // } // // // public final byte[] toByteArray() { // // return baos.toByteArray(); // // } // // // public final int size() { // // return baos.size(); // // } // // public final ByteBufWoWPacket getPacket() { // return new ByteBufWoWPacket(opcode, Unpooled.wrappedBuffer(baos.toByteArray())); // } // // @Override // public final String toString() { // return HexTool.toString(baos.toByteArray()); // } // }
import io.netty.channel.Channel; import com.github.javawow.auth.AuthServer; import com.github.javawow.auth.message.RealmlistRequestMessage; import com.github.javawow.data.output.LittleEndianWriterStream;
/* * Java World of Warcraft Emulation Project * Copyright (C) 2015-2020 JavaWoW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.github.javawow.auth.handler; public final class RealmListRequestHandler implements BasicAuthHandler<RealmlistRequestMessage> { // private static final Logger LOGGER = LoggerFactory.getLogger(RealmListRequestHandler.class); private static final RealmListRequestHandler INSTANCE = new RealmListRequestHandler(); private RealmListRequestHandler() { // singleton } public static final RealmListRequestHandler getInstance() { return INSTANCE; } @Override public final boolean hasValidState(Channel channel) { return channel.attr(AuthServer.SRP_ATTR).get() != null; } @Override public final void handleMessage(Channel channel, RealmlistRequestMessage msg) {
// Path: src/main/java/com/github/javawow/auth/AuthServer.java // public final class AuthServer { // private static final int PORT = 3724; // private static final Logger LOGGER = LoggerFactory.getLogger(AuthServer.class); // private static final Scanner sc = new Scanner(System.in); // private static final EventLoopGroup bossGroup = new NioEventLoopGroup(); // private static final EventLoopGroup workerGroup = new NioEventLoopGroup(); // public static final AttributeKey<WoWSRP6Server> SRP_ATTR = AttributeKey.newInstance("SRP"); // // private AuthServer() { // } // // public static final void main(String[] args) { // ServerBootstrap b = new ServerBootstrap() // .group(bossGroup, workerGroup) // .channel(NioServerSocketChannel.class) // .childHandler(new ChannelInitializer<Channel>() { // @Override // protected void initChannel(Channel ch) throws Exception { // ch.pipeline().addLast("encoder", AuthEncoder.getInstance()); // ch.pipeline().addLast("decoder", new AuthDecoder()); // ch.pipeline().addLast("handler", AuthServerHandler.getInstance()); // } // }) // .option(ChannelOption.SO_BACKLOG, Integer.valueOf(NetUtil.SOMAXCONN)) // .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) // .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) // .childOption(ChannelOption.TCP_NODELAY, Boolean.TRUE) // .childOption(ChannelOption.SO_KEEPALIVE, Boolean.TRUE); // ChannelFuture cf = b.bind(PORT).addListener(f -> { // if (f.isSuccess()) { // LOGGER.info("Auth Server listening on port {}.", PORT); // } else { // LOGGER.error("Binding to port {} failed", Integer.valueOf(PORT), f.cause()); // } // }); // // Wait for the bind to complete // try { // cf.await(); // } catch (InterruptedException e) { // // Restore interrupted status // Thread.currentThread().interrupt(); // } // while (sc.hasNextLine()) { // if (sc.nextLine().equalsIgnoreCase("q")) { // System.out.println("Shutting down..."); // workerGroup.shutdownGracefully(); // bossGroup.shutdownGracefully(); // break; // } // } // } // } // // Path: src/main/java/com/github/javawow/auth/message/RealmlistRequestMessage.java // @Immutable // public final class RealmlistRequestMessage { // private final int unk; // // public RealmlistRequestMessage(int unk) { // this.unk = unk; // } // // public final int getUnk() { // return unk; // } // } // // Path: src/main/java/com/github/javawow/data/output/LittleEndianWriterStream.java // public class LittleEndianWriterStream extends GenericLittleEndianWriter { // private int opcode; // private ByteArrayOutputStream baos; // // public LittleEndianWriterStream(int opcode) { // this(opcode, 32); // } // // public LittleEndianWriterStream(int opcode, int size) { // this.opcode = opcode; // this.baos = new ByteArrayOutputStream(size); // setByteOutputStream(new ByteArrayOutputByteStream(baos)); // } // // // public final byte[] toByteArray() { // // return baos.toByteArray(); // // } // // // public final int size() { // // return baos.size(); // // } // // public final ByteBufWoWPacket getPacket() { // return new ByteBufWoWPacket(opcode, Unpooled.wrappedBuffer(baos.toByteArray())); // } // // @Override // public final String toString() { // return HexTool.toString(baos.toByteArray()); // } // } // Path: src/main/java/com/github/javawow/auth/handler/RealmListRequestHandler.java import io.netty.channel.Channel; import com.github.javawow.auth.AuthServer; import com.github.javawow.auth.message.RealmlistRequestMessage; import com.github.javawow.data.output.LittleEndianWriterStream; /* * Java World of Warcraft Emulation Project * Copyright (C) 2015-2020 JavaWoW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.github.javawow.auth.handler; public final class RealmListRequestHandler implements BasicAuthHandler<RealmlistRequestMessage> { // private static final Logger LOGGER = LoggerFactory.getLogger(RealmListRequestHandler.class); private static final RealmListRequestHandler INSTANCE = new RealmListRequestHandler(); private RealmListRequestHandler() { // singleton } public static final RealmListRequestHandler getInstance() { return INSTANCE; } @Override public final boolean hasValidState(Channel channel) { return channel.attr(AuthServer.SRP_ATTR).get() != null; } @Override public final void handleMessage(Channel channel, RealmlistRequestMessage msg) {
LittleEndianWriterStream lews = new LittleEndianWriterStream(16);
JavaWoW/JavaWoW
src/main/java/com/github/javawow/realm/handler/BasicRealmHandler.java
// Path: src/main/java/com/github/javawow/data/input/SeekableLittleEndianAccessor.java // public interface SeekableLittleEndianAccessor extends LittleEndianAccessor { // void seek(int offset); // int getPosition(); // }
import com.github.javawow.data.input.SeekableLittleEndianAccessor; import io.netty.channel.Channel;
/* * Java World of Warcraft Emulation Project * Copyright (C) 2015-2020 JavaWoW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.github.javawow.realm.handler; public interface BasicRealmHandler { /** * Verifies if the current state is valid for the handler to be executed. * * @param channel The channel attempting to execute the handler. * @return {@code true} for a valid state, {@code false} otherwise */ boolean hasValidState(Channel channel); /** * Implement this method to handle the operation to perform when the handler is * called. * * @param channel The channel executing this handler. * @param slea The message from the client */
// Path: src/main/java/com/github/javawow/data/input/SeekableLittleEndianAccessor.java // public interface SeekableLittleEndianAccessor extends LittleEndianAccessor { // void seek(int offset); // int getPosition(); // } // Path: src/main/java/com/github/javawow/realm/handler/BasicRealmHandler.java import com.github.javawow.data.input.SeekableLittleEndianAccessor; import io.netty.channel.Channel; /* * Java World of Warcraft Emulation Project * Copyright (C) 2015-2020 JavaWoW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.github.javawow.realm.handler; public interface BasicRealmHandler { /** * Verifies if the current state is valid for the handler to be executed. * * @param channel The channel attempting to execute the handler. * @return {@code true} for a valid state, {@code false} otherwise */ boolean hasValidState(Channel channel); /** * Implement this method to handle the operation to perform when the handler is * called. * * @param channel The channel executing this handler. * @param slea The message from the client */
void handlePacket(Channel channel, SeekableLittleEndianAccessor slea);
campaignmonitor/createsend-java
src/com/createsend/util/jersey/UserAgentFilter.java
// Path: src/com/createsend/util/Configuration.java // public class Configuration { // public static Configuration Current = new Configuration(); // // private Properties properties; // private Configuration() { // properties = new Properties(); // // try { // InputStream configProperties = getClass().getClassLoader().getResourceAsStream("com/createsend/util/config.properties"); // if (configProperties == null) { // throw new FileNotFoundException("Could not find config.properties"); // } // properties.load(configProperties); // // InputStream createsendProperties = getClass().getClassLoader().getResourceAsStream("createsend.properties"); // if(createsendProperties != null) { // properties.load(createsendProperties); // } // } catch (IOException e) { // e.printStackTrace(); // } // } // // public void addPropertiesFile(String filename) throws IOException { // properties.load(ClassLoader.getSystemResourceAsStream(filename)); // } // // public String getApiEndpoint() { // return properties.getProperty("createsend.endpoint"); // } // // public String getOAuthBaseUri() { // return properties.getProperty("createsend.oauthbaseuri"); // } // // public String getWrapperVersion() { // return properties.getProperty("createsend.version"); // } // // public boolean isLoggingEnabled() { // return Boolean.parseBoolean(properties.getProperty("createsend.logging")); // } // }
import com.createsend.util.Configuration; import com.sun.jersey.api.client.ClientHandlerException; import com.sun.jersey.api.client.ClientRequest; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.filter.ClientFilter;
/** * Copyright (c) 2011 Toby Brain * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.createsend.util.jersey; /** * A ClientFilter to set the Java wrappers User-Agent */ public class UserAgentFilter extends ClientFilter { private static String userAgent; static { userAgent = String.format( "createsend-java v%s. %s v%s. %s v%s",
// Path: src/com/createsend/util/Configuration.java // public class Configuration { // public static Configuration Current = new Configuration(); // // private Properties properties; // private Configuration() { // properties = new Properties(); // // try { // InputStream configProperties = getClass().getClassLoader().getResourceAsStream("com/createsend/util/config.properties"); // if (configProperties == null) { // throw new FileNotFoundException("Could not find config.properties"); // } // properties.load(configProperties); // // InputStream createsendProperties = getClass().getClassLoader().getResourceAsStream("createsend.properties"); // if(createsendProperties != null) { // properties.load(createsendProperties); // } // } catch (IOException e) { // e.printStackTrace(); // } // } // // public void addPropertiesFile(String filename) throws IOException { // properties.load(ClassLoader.getSystemResourceAsStream(filename)); // } // // public String getApiEndpoint() { // return properties.getProperty("createsend.endpoint"); // } // // public String getOAuthBaseUri() { // return properties.getProperty("createsend.oauthbaseuri"); // } // // public String getWrapperVersion() { // return properties.getProperty("createsend.version"); // } // // public boolean isLoggingEnabled() { // return Boolean.parseBoolean(properties.getProperty("createsend.logging")); // } // } // Path: src/com/createsend/util/jersey/UserAgentFilter.java import com.createsend.util.Configuration; import com.sun.jersey.api.client.ClientHandlerException; import com.sun.jersey.api.client.ClientRequest; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.filter.ClientFilter; /** * Copyright (c) 2011 Toby Brain * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.createsend.util.jersey; /** * A ClientFilter to set the Java wrappers User-Agent */ public class UserAgentFilter extends ClientFilter { private static String userAgent; static { userAgent = String.format( "createsend-java v%s. %s v%s. %s v%s",
Configuration.Current.getWrapperVersion(),
campaignmonitor/createsend-java
src/com/createsend/models/transactional/response/MessageDetail.java
// Path: src/com/createsend/models/transactional/EmailContent.java // public class EmailContent { // // @JsonProperty("Html") // private String html; // // @JsonProperty("Text") // private String text; // // @JsonProperty("EmailVariables") // private List<String> emailVariables; // // @JsonProperty("InlineCss") // private boolean inlineCss; // // @JsonProperty("TrackOpens") // private boolean trackOpens; // // @JsonProperty("TrackClicks") // private boolean trackClicks; // // /** // * @return the html body. // */ // public String getHtml() { // return html; // } // // /** // * @return the text body. // */ // public String getText() { // return text; // } // // /** // * @return the data merge variables. // */ // public List<String> getEmailVariables() { // return emailVariables; // } // // /** // * @return true if inline css, false otherwise. // */ // public boolean isInlineCss() { // return inlineCss; // } // // /** // * @return true if track opens enabled, false otherwise. // */ // public boolean isTrackOpens() { // return trackOpens; // } // // /** // * @return true if track clicks enabled, false otherwise. // */ // public boolean isTrackClicks() { // return trackClicks; // } // // /** // * @param html html body content. // */ // public void setHtml(String html) { // this.html = html; // } // // /** // * @param text text body content. // */ // public void setText(String text) { // this.text = text; // } // // /** // * @param inlineCss enabled css inlining. // */ // public void setInlineCss(boolean inlineCss) { // this.inlineCss = inlineCss; // } // // /** // * @param trackOpens enabled open tracking. // */ // public void setTrackOpens(boolean trackOpens) { // this.trackOpens = trackOpens; // } // // /** // * @param trackClicks enable click tracking. // */ // public void setTrackClicks(boolean trackClicks) { // this.trackClicks = trackClicks; // } // // @Override // public String toString() { // return String.format("html\n: %s\n\n text\n: %s\n", html, text); // } // } // // Path: src/com/createsend/models/transactional/request/Attachment.java // public class Attachment { // // /** // * The original file name. // */ // public String Name; // // /** // * The Mime type. For example: "image/png". // */ // public String Type; // // /** // * Must be base64 encoded. // */ // public String Content; // // /** // * Base64 encodes the input stream and stores the result as the Content. // * @param inputStream // * @throws IOException // */ // public void base64EncodeContentStream(InputStream inputStream) throws IOException { // byte[] bytes = IOUtils.toByteArray(inputStream); // byte[] bytesBase64 = Base64.encodeBase64(bytes); // Content = new String(bytesBase64); // } // }
import com.createsend.models.transactional.EmailContent; import com.createsend.models.transactional.request.Attachment; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; import java.util.Map;
/** * Copyright (c) 2015 Richard Bremner * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.createsend.models.transactional.response; public class MessageDetail { @JsonProperty("From") private String from; @JsonProperty("Subject") private String subject; @JsonProperty("To") private List<String> to; @JsonProperty("CC") private List<String> cc; @JsonProperty("BCC") private List<String> bcc; @JsonProperty("ReplyTo") private String replyTo; @JsonProperty("Attachments")
// Path: src/com/createsend/models/transactional/EmailContent.java // public class EmailContent { // // @JsonProperty("Html") // private String html; // // @JsonProperty("Text") // private String text; // // @JsonProperty("EmailVariables") // private List<String> emailVariables; // // @JsonProperty("InlineCss") // private boolean inlineCss; // // @JsonProperty("TrackOpens") // private boolean trackOpens; // // @JsonProperty("TrackClicks") // private boolean trackClicks; // // /** // * @return the html body. // */ // public String getHtml() { // return html; // } // // /** // * @return the text body. // */ // public String getText() { // return text; // } // // /** // * @return the data merge variables. // */ // public List<String> getEmailVariables() { // return emailVariables; // } // // /** // * @return true if inline css, false otherwise. // */ // public boolean isInlineCss() { // return inlineCss; // } // // /** // * @return true if track opens enabled, false otherwise. // */ // public boolean isTrackOpens() { // return trackOpens; // } // // /** // * @return true if track clicks enabled, false otherwise. // */ // public boolean isTrackClicks() { // return trackClicks; // } // // /** // * @param html html body content. // */ // public void setHtml(String html) { // this.html = html; // } // // /** // * @param text text body content. // */ // public void setText(String text) { // this.text = text; // } // // /** // * @param inlineCss enabled css inlining. // */ // public void setInlineCss(boolean inlineCss) { // this.inlineCss = inlineCss; // } // // /** // * @param trackOpens enabled open tracking. // */ // public void setTrackOpens(boolean trackOpens) { // this.trackOpens = trackOpens; // } // // /** // * @param trackClicks enable click tracking. // */ // public void setTrackClicks(boolean trackClicks) { // this.trackClicks = trackClicks; // } // // @Override // public String toString() { // return String.format("html\n: %s\n\n text\n: %s\n", html, text); // } // } // // Path: src/com/createsend/models/transactional/request/Attachment.java // public class Attachment { // // /** // * The original file name. // */ // public String Name; // // /** // * The Mime type. For example: "image/png". // */ // public String Type; // // /** // * Must be base64 encoded. // */ // public String Content; // // /** // * Base64 encodes the input stream and stores the result as the Content. // * @param inputStream // * @throws IOException // */ // public void base64EncodeContentStream(InputStream inputStream) throws IOException { // byte[] bytes = IOUtils.toByteArray(inputStream); // byte[] bytesBase64 = Base64.encodeBase64(bytes); // Content = new String(bytesBase64); // } // } // Path: src/com/createsend/models/transactional/response/MessageDetail.java import com.createsend.models.transactional.EmailContent; import com.createsend.models.transactional.request.Attachment; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; import java.util.Map; /** * Copyright (c) 2015 Richard Bremner * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.createsend.models.transactional.response; public class MessageDetail { @JsonProperty("From") private String from; @JsonProperty("Subject") private String subject; @JsonProperty("To") private List<String> to; @JsonProperty("CC") private List<String> cc; @JsonProperty("BCC") private List<String> bcc; @JsonProperty("ReplyTo") private String replyTo; @JsonProperty("Attachments")
private List<Attachment> attachments;
campaignmonitor/createsend-java
src/com/createsend/models/transactional/response/MessageDetail.java
// Path: src/com/createsend/models/transactional/EmailContent.java // public class EmailContent { // // @JsonProperty("Html") // private String html; // // @JsonProperty("Text") // private String text; // // @JsonProperty("EmailVariables") // private List<String> emailVariables; // // @JsonProperty("InlineCss") // private boolean inlineCss; // // @JsonProperty("TrackOpens") // private boolean trackOpens; // // @JsonProperty("TrackClicks") // private boolean trackClicks; // // /** // * @return the html body. // */ // public String getHtml() { // return html; // } // // /** // * @return the text body. // */ // public String getText() { // return text; // } // // /** // * @return the data merge variables. // */ // public List<String> getEmailVariables() { // return emailVariables; // } // // /** // * @return true if inline css, false otherwise. // */ // public boolean isInlineCss() { // return inlineCss; // } // // /** // * @return true if track opens enabled, false otherwise. // */ // public boolean isTrackOpens() { // return trackOpens; // } // // /** // * @return true if track clicks enabled, false otherwise. // */ // public boolean isTrackClicks() { // return trackClicks; // } // // /** // * @param html html body content. // */ // public void setHtml(String html) { // this.html = html; // } // // /** // * @param text text body content. // */ // public void setText(String text) { // this.text = text; // } // // /** // * @param inlineCss enabled css inlining. // */ // public void setInlineCss(boolean inlineCss) { // this.inlineCss = inlineCss; // } // // /** // * @param trackOpens enabled open tracking. // */ // public void setTrackOpens(boolean trackOpens) { // this.trackOpens = trackOpens; // } // // /** // * @param trackClicks enable click tracking. // */ // public void setTrackClicks(boolean trackClicks) { // this.trackClicks = trackClicks; // } // // @Override // public String toString() { // return String.format("html\n: %s\n\n text\n: %s\n", html, text); // } // } // // Path: src/com/createsend/models/transactional/request/Attachment.java // public class Attachment { // // /** // * The original file name. // */ // public String Name; // // /** // * The Mime type. For example: "image/png". // */ // public String Type; // // /** // * Must be base64 encoded. // */ // public String Content; // // /** // * Base64 encodes the input stream and stores the result as the Content. // * @param inputStream // * @throws IOException // */ // public void base64EncodeContentStream(InputStream inputStream) throws IOException { // byte[] bytes = IOUtils.toByteArray(inputStream); // byte[] bytesBase64 = Base64.encodeBase64(bytes); // Content = new String(bytesBase64); // } // }
import com.createsend.models.transactional.EmailContent; import com.createsend.models.transactional.request.Attachment; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; import java.util.Map;
/** * Copyright (c) 2015 Richard Bremner * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.createsend.models.transactional.response; public class MessageDetail { @JsonProperty("From") private String from; @JsonProperty("Subject") private String subject; @JsonProperty("To") private List<String> to; @JsonProperty("CC") private List<String> cc; @JsonProperty("BCC") private List<String> bcc; @JsonProperty("ReplyTo") private String replyTo; @JsonProperty("Attachments") private List<Attachment> attachments; @JsonProperty("Body")
// Path: src/com/createsend/models/transactional/EmailContent.java // public class EmailContent { // // @JsonProperty("Html") // private String html; // // @JsonProperty("Text") // private String text; // // @JsonProperty("EmailVariables") // private List<String> emailVariables; // // @JsonProperty("InlineCss") // private boolean inlineCss; // // @JsonProperty("TrackOpens") // private boolean trackOpens; // // @JsonProperty("TrackClicks") // private boolean trackClicks; // // /** // * @return the html body. // */ // public String getHtml() { // return html; // } // // /** // * @return the text body. // */ // public String getText() { // return text; // } // // /** // * @return the data merge variables. // */ // public List<String> getEmailVariables() { // return emailVariables; // } // // /** // * @return true if inline css, false otherwise. // */ // public boolean isInlineCss() { // return inlineCss; // } // // /** // * @return true if track opens enabled, false otherwise. // */ // public boolean isTrackOpens() { // return trackOpens; // } // // /** // * @return true if track clicks enabled, false otherwise. // */ // public boolean isTrackClicks() { // return trackClicks; // } // // /** // * @param html html body content. // */ // public void setHtml(String html) { // this.html = html; // } // // /** // * @param text text body content. // */ // public void setText(String text) { // this.text = text; // } // // /** // * @param inlineCss enabled css inlining. // */ // public void setInlineCss(boolean inlineCss) { // this.inlineCss = inlineCss; // } // // /** // * @param trackOpens enabled open tracking. // */ // public void setTrackOpens(boolean trackOpens) { // this.trackOpens = trackOpens; // } // // /** // * @param trackClicks enable click tracking. // */ // public void setTrackClicks(boolean trackClicks) { // this.trackClicks = trackClicks; // } // // @Override // public String toString() { // return String.format("html\n: %s\n\n text\n: %s\n", html, text); // } // } // // Path: src/com/createsend/models/transactional/request/Attachment.java // public class Attachment { // // /** // * The original file name. // */ // public String Name; // // /** // * The Mime type. For example: "image/png". // */ // public String Type; // // /** // * Must be base64 encoded. // */ // public String Content; // // /** // * Base64 encodes the input stream and stores the result as the Content. // * @param inputStream // * @throws IOException // */ // public void base64EncodeContentStream(InputStream inputStream) throws IOException { // byte[] bytes = IOUtils.toByteArray(inputStream); // byte[] bytesBase64 = Base64.encodeBase64(bytes); // Content = new String(bytesBase64); // } // } // Path: src/com/createsend/models/transactional/response/MessageDetail.java import com.createsend.models.transactional.EmailContent; import com.createsend.models.transactional.request.Attachment; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; import java.util.Map; /** * Copyright (c) 2015 Richard Bremner * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.createsend.models.transactional.response; public class MessageDetail { @JsonProperty("From") private String from; @JsonProperty("Subject") private String subject; @JsonProperty("To") private List<String> to; @JsonProperty("CC") private List<String> cc; @JsonProperty("BCC") private List<String> bcc; @JsonProperty("ReplyTo") private String replyTo; @JsonProperty("Attachments") private List<Attachment> attachments; @JsonProperty("Body")
private EmailContent body;
campaignmonitor/createsend-java
src/com/createsend/models/transactional/request/SmartEmailRequest.java
// Path: src/com/createsend/models/subscribers/ConsentToTrack.java // public enum ConsentToTrack { // UNCHANGED("Unchanged"), // YES("Yes"), // NO("No"); // // private String value; // // ConsentToTrack(String value) { // this.value = value; // } // // @JsonCreator // public static ConsentToTrack forValue(String value) { // for (ConsentToTrack type : ConsentToTrack.values()) { // if (type.value.toLowerCase().equals(value.toLowerCase())) { // return type; // } // } // // return null; // } // }
import com.fasterxml.jackson.annotation.JsonIgnore; import java.util.*; import com.createsend.models.subscribers.ConsentToTrack;
/** * Copyright (c) 2015 Richard Bremner * * Permission is hereby granted, free of charge, To any person obtaining a copy * of this software and associated documentation files (the "Software"), To deal * in the Software without restriction, including without limitation the rights * To use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and To permit persons To whom the Software is * furnished To do so, subject To the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.createsend.models.transactional.request; public class SmartEmailRequest { @JsonIgnore private UUID smartEmailId; private List<String> to = new ArrayList<>(); private List<String> cc = new ArrayList<>(); private List<String> bcc = new ArrayList<>(); private List<Attachment> attachments = new ArrayList<>(); private Map<String, String> data = new HashMap<>(); private boolean addRecipientsToList;
// Path: src/com/createsend/models/subscribers/ConsentToTrack.java // public enum ConsentToTrack { // UNCHANGED("Unchanged"), // YES("Yes"), // NO("No"); // // private String value; // // ConsentToTrack(String value) { // this.value = value; // } // // @JsonCreator // public static ConsentToTrack forValue(String value) { // for (ConsentToTrack type : ConsentToTrack.values()) { // if (type.value.toLowerCase().equals(value.toLowerCase())) { // return type; // } // } // // return null; // } // } // Path: src/com/createsend/models/transactional/request/SmartEmailRequest.java import com.fasterxml.jackson.annotation.JsonIgnore; import java.util.*; import com.createsend.models.subscribers.ConsentToTrack; /** * Copyright (c) 2015 Richard Bremner * * Permission is hereby granted, free of charge, To any person obtaining a copy * of this software and associated documentation files (the "Software"), To deal * in the Software without restriction, including without limitation the rights * To use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and To permit persons To whom the Software is * furnished To do so, subject To the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.createsend.models.transactional.request; public class SmartEmailRequest { @JsonIgnore private UUID smartEmailId; private List<String> to = new ArrayList<>(); private List<String> cc = new ArrayList<>(); private List<String> bcc = new ArrayList<>(); private List<Attachment> attachments = new ArrayList<>(); private Map<String, String> data = new HashMap<>(); private boolean addRecipientsToList;
private ConsentToTrack consentToTrack;
campaignmonitor/createsend-java
src/com/createsend/util/JerseyClient.java
// Path: src/com/createsend/models/PagedResult.java // public class PagedResult<T> { // public T[] Results; // public String ResultsOrderedBy; // public String OrderDirection; // public int PageNumber; // public int PageSize; // public int RecordsOnThisPage; // public int TotalNumberOfRecords; // public int NumberOfPages; // // @Override // public String toString() { // return String.format("{ Results: %s, ResultsOrderedBy: %s, OrderDirection: %s, PageNumber: %s, PageSize: %s, RecordsOnThisPage: %s, TotalNumberOfRecords: %s, NumberOfPages: %s }", // Arrays.deepToString(Results), ResultsOrderedBy, OrderDirection, PageNumber, // PageSize, RecordsOnThisPage, TotalNumberOfRecords, // NumberOfPages); // } // } // // Path: src/com/createsend/util/exceptions/CreateSendException.java // public class CreateSendException extends Exception { // private static final long serialVersionUID = 1695317869199799783L; // // public CreateSendException(String message) { // super(message); // } // }
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import com.createsend.models.PagedResult; import com.createsend.util.exceptions.CreateSendException; import com.createsend.util.jersey.ResourceFactory;
/** * Copyright (c) 2011 Toby Brain * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.createsend.util; public interface JerseyClient { public AuthenticationDetails getAuthenticationDetails(); public void setAuthenticationDetails(AuthenticationDetails authDetails);
// Path: src/com/createsend/models/PagedResult.java // public class PagedResult<T> { // public T[] Results; // public String ResultsOrderedBy; // public String OrderDirection; // public int PageNumber; // public int PageSize; // public int RecordsOnThisPage; // public int TotalNumberOfRecords; // public int NumberOfPages; // // @Override // public String toString() { // return String.format("{ Results: %s, ResultsOrderedBy: %s, OrderDirection: %s, PageNumber: %s, PageSize: %s, RecordsOnThisPage: %s, TotalNumberOfRecords: %s, NumberOfPages: %s }", // Arrays.deepToString(Results), ResultsOrderedBy, OrderDirection, PageNumber, // PageSize, RecordsOnThisPage, TotalNumberOfRecords, // NumberOfPages); // } // } // // Path: src/com/createsend/util/exceptions/CreateSendException.java // public class CreateSendException extends Exception { // private static final long serialVersionUID = 1695317869199799783L; // // public CreateSendException(String message) { // super(message); // } // } // Path: src/com/createsend/util/JerseyClient.java import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import com.createsend.models.PagedResult; import com.createsend.util.exceptions.CreateSendException; import com.createsend.util.jersey.ResourceFactory; /** * Copyright (c) 2011 Toby Brain * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.createsend.util; public interface JerseyClient { public AuthenticationDetails getAuthenticationDetails(); public void setAuthenticationDetails(AuthenticationDetails authDetails);
public <T> T get(Class<T> klass, String... pathElements) throws CreateSendException;
campaignmonitor/createsend-java
src/com/createsend/util/JerseyClient.java
// Path: src/com/createsend/models/PagedResult.java // public class PagedResult<T> { // public T[] Results; // public String ResultsOrderedBy; // public String OrderDirection; // public int PageNumber; // public int PageSize; // public int RecordsOnThisPage; // public int TotalNumberOfRecords; // public int NumberOfPages; // // @Override // public String toString() { // return String.format("{ Results: %s, ResultsOrderedBy: %s, OrderDirection: %s, PageNumber: %s, PageSize: %s, RecordsOnThisPage: %s, TotalNumberOfRecords: %s, NumberOfPages: %s }", // Arrays.deepToString(Results), ResultsOrderedBy, OrderDirection, PageNumber, // PageSize, RecordsOnThisPage, TotalNumberOfRecords, // NumberOfPages); // } // } // // Path: src/com/createsend/util/exceptions/CreateSendException.java // public class CreateSendException extends Exception { // private static final long serialVersionUID = 1695317869199799783L; // // public CreateSendException(String message) { // super(message); // } // }
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import com.createsend.models.PagedResult; import com.createsend.util.exceptions.CreateSendException; import com.createsend.util.jersey.ResourceFactory;
/** * Copyright (c) 2011 Toby Brain * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.createsend.util; public interface JerseyClient { public AuthenticationDetails getAuthenticationDetails(); public void setAuthenticationDetails(AuthenticationDetails authDetails); public <T> T get(Class<T> klass, String... pathElements) throws CreateSendException; public <T> T get(Class<T> klass, MultivaluedMap<String, String> queryString, String... pathElements) throws CreateSendException; public <T> T get(Class<T> klass, ErrorDeserialiser<?> errorDeserialiser, String... pathElements) throws CreateSendException; public <T> T get(Class<T> klass, MultivaluedMap<String, String> queryString, ResourceFactory resourceFactory, String... pathElements) throws CreateSendException;
// Path: src/com/createsend/models/PagedResult.java // public class PagedResult<T> { // public T[] Results; // public String ResultsOrderedBy; // public String OrderDirection; // public int PageNumber; // public int PageSize; // public int RecordsOnThisPage; // public int TotalNumberOfRecords; // public int NumberOfPages; // // @Override // public String toString() { // return String.format("{ Results: %s, ResultsOrderedBy: %s, OrderDirection: %s, PageNumber: %s, PageSize: %s, RecordsOnThisPage: %s, TotalNumberOfRecords: %s, NumberOfPages: %s }", // Arrays.deepToString(Results), ResultsOrderedBy, OrderDirection, PageNumber, // PageSize, RecordsOnThisPage, TotalNumberOfRecords, // NumberOfPages); // } // } // // Path: src/com/createsend/util/exceptions/CreateSendException.java // public class CreateSendException extends Exception { // private static final long serialVersionUID = 1695317869199799783L; // // public CreateSendException(String message) { // super(message); // } // } // Path: src/com/createsend/util/JerseyClient.java import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import com.createsend.models.PagedResult; import com.createsend.util.exceptions.CreateSendException; import com.createsend.util.jersey.ResourceFactory; /** * Copyright (c) 2011 Toby Brain * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.createsend.util; public interface JerseyClient { public AuthenticationDetails getAuthenticationDetails(); public void setAuthenticationDetails(AuthenticationDetails authDetails); public <T> T get(Class<T> klass, String... pathElements) throws CreateSendException; public <T> T get(Class<T> klass, MultivaluedMap<String, String> queryString, String... pathElements) throws CreateSendException; public <T> T get(Class<T> klass, ErrorDeserialiser<?> errorDeserialiser, String... pathElements) throws CreateSendException; public <T> T get(Class<T> klass, MultivaluedMap<String, String> queryString, ResourceFactory resourceFactory, String... pathElements) throws CreateSendException;
public <T> PagedResult<T> getPagedResult(Integer page, Integer pageSize, String orderField,
campaignmonitor/createsend-java
src/com/createsend/models/campaigns/ListsAndSegments.java
// Path: src/com/createsend/models/segments/Segment.java // public class Segment { // public String ListID; // public String SegmentID; // public String Title; // // public Integer ActiveSubscribers; // public RuleGroup[] RuleGroups; // // @Override // public String toString() { // return String.format("{ ListID: %s, SegmentID: %s, Title: %s, Active: %d, Rule Groups: %s }", ListID, // SegmentID, Title, ActiveSubscribers, Arrays.deepToString(RuleGroups)); // } // }
import com.createsend.models.lists.ListBasics; import com.createsend.models.segments.Segment; import java.util.Arrays;
/** * Copyright (c) 2011 Toby Brain * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.createsend.models.campaigns; public class ListsAndSegments { public ListBasics[] Lists;
// Path: src/com/createsend/models/segments/Segment.java // public class Segment { // public String ListID; // public String SegmentID; // public String Title; // // public Integer ActiveSubscribers; // public RuleGroup[] RuleGroups; // // @Override // public String toString() { // return String.format("{ ListID: %s, SegmentID: %s, Title: %s, Active: %d, Rule Groups: %s }", ListID, // SegmentID, Title, ActiveSubscribers, Arrays.deepToString(RuleGroups)); // } // } // Path: src/com/createsend/models/campaigns/ListsAndSegments.java import com.createsend.models.lists.ListBasics; import com.createsend.models.segments.Segment; import java.util.Arrays; /** * Copyright (c) 2011 Toby Brain * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.createsend.models.campaigns; public class ListsAndSegments { public ListBasics[] Lists;
public Segment[] Segments;
campaignmonitor/createsend-java
src/com/createsend/models/transactional/response/SmartEmailProperties.java
// Path: src/com/createsend/models/transactional/EmailContent.java // public class EmailContent { // // @JsonProperty("Html") // private String html; // // @JsonProperty("Text") // private String text; // // @JsonProperty("EmailVariables") // private List<String> emailVariables; // // @JsonProperty("InlineCss") // private boolean inlineCss; // // @JsonProperty("TrackOpens") // private boolean trackOpens; // // @JsonProperty("TrackClicks") // private boolean trackClicks; // // /** // * @return the html body. // */ // public String getHtml() { // return html; // } // // /** // * @return the text body. // */ // public String getText() { // return text; // } // // /** // * @return the data merge variables. // */ // public List<String> getEmailVariables() { // return emailVariables; // } // // /** // * @return true if inline css, false otherwise. // */ // public boolean isInlineCss() { // return inlineCss; // } // // /** // * @return true if track opens enabled, false otherwise. // */ // public boolean isTrackOpens() { // return trackOpens; // } // // /** // * @return true if track clicks enabled, false otherwise. // */ // public boolean isTrackClicks() { // return trackClicks; // } // // /** // * @param html html body content. // */ // public void setHtml(String html) { // this.html = html; // } // // /** // * @param text text body content. // */ // public void setText(String text) { // this.text = text; // } // // /** // * @param inlineCss enabled css inlining. // */ // public void setInlineCss(boolean inlineCss) { // this.inlineCss = inlineCss; // } // // /** // * @param trackOpens enabled open tracking. // */ // public void setTrackOpens(boolean trackOpens) { // this.trackOpens = trackOpens; // } // // /** // * @param trackClicks enable click tracking. // */ // public void setTrackClicks(boolean trackClicks) { // this.trackClicks = trackClicks; // } // // @Override // public String toString() { // return String.format("html\n: %s\n\n text\n: %s\n", html, text); // } // }
import com.fasterxml.jackson.annotation.JsonProperty; import com.createsend.models.transactional.EmailContent;
/** * Copyright (c) 2015 Richard Bremner * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.createsend.models.transactional.response; public class SmartEmailProperties { @JsonProperty("From") private String from; @JsonProperty("ReplyTo") private String replyTo; @JsonProperty("Subject") private String subject; @JsonProperty("TextPreviewUrl") private String textPreviewUrl; @JsonProperty("HtmlPreviewUrl") private String htmlPreviewUrl; @JsonProperty("Content")
// Path: src/com/createsend/models/transactional/EmailContent.java // public class EmailContent { // // @JsonProperty("Html") // private String html; // // @JsonProperty("Text") // private String text; // // @JsonProperty("EmailVariables") // private List<String> emailVariables; // // @JsonProperty("InlineCss") // private boolean inlineCss; // // @JsonProperty("TrackOpens") // private boolean trackOpens; // // @JsonProperty("TrackClicks") // private boolean trackClicks; // // /** // * @return the html body. // */ // public String getHtml() { // return html; // } // // /** // * @return the text body. // */ // public String getText() { // return text; // } // // /** // * @return the data merge variables. // */ // public List<String> getEmailVariables() { // return emailVariables; // } // // /** // * @return true if inline css, false otherwise. // */ // public boolean isInlineCss() { // return inlineCss; // } // // /** // * @return true if track opens enabled, false otherwise. // */ // public boolean isTrackOpens() { // return trackOpens; // } // // /** // * @return true if track clicks enabled, false otherwise. // */ // public boolean isTrackClicks() { // return trackClicks; // } // // /** // * @param html html body content. // */ // public void setHtml(String html) { // this.html = html; // } // // /** // * @param text text body content. // */ // public void setText(String text) { // this.text = text; // } // // /** // * @param inlineCss enabled css inlining. // */ // public void setInlineCss(boolean inlineCss) { // this.inlineCss = inlineCss; // } // // /** // * @param trackOpens enabled open tracking. // */ // public void setTrackOpens(boolean trackOpens) { // this.trackOpens = trackOpens; // } // // /** // * @param trackClicks enable click tracking. // */ // public void setTrackClicks(boolean trackClicks) { // this.trackClicks = trackClicks; // } // // @Override // public String toString() { // return String.format("html\n: %s\n\n text\n: %s\n", html, text); // } // } // Path: src/com/createsend/models/transactional/response/SmartEmailProperties.java import com.fasterxml.jackson.annotation.JsonProperty; import com.createsend.models.transactional.EmailContent; /** * Copyright (c) 2015 Richard Bremner * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.createsend.models.transactional.response; public class SmartEmailProperties { @JsonProperty("From") private String from; @JsonProperty("ReplyTo") private String replyTo; @JsonProperty("Subject") private String subject; @JsonProperty("TextPreviewUrl") private String textPreviewUrl; @JsonProperty("HtmlPreviewUrl") private String htmlPreviewUrl; @JsonProperty("Content")
private EmailContent content;
campaignmonitor/createsend-java
src/com/createsend/models/transactional/request/ClassicEmailRequest.java
// Path: src/com/createsend/models/subscribers/ConsentToTrack.java // public enum ConsentToTrack { // UNCHANGED("Unchanged"), // YES("Yes"), // NO("No"); // // private String value; // // ConsentToTrack(String value) { // this.value = value; // } // // @JsonCreator // public static ConsentToTrack forValue(String value) { // for (ConsentToTrack type : ConsentToTrack.values()) { // if (type.value.toLowerCase().equals(value.toLowerCase())) { // return type; // } // } // // return null; // } // } // // Path: src/com/createsend/models/transactional/EmailContent.java // public class EmailContent { // // @JsonProperty("Html") // private String html; // // @JsonProperty("Text") // private String text; // // @JsonProperty("EmailVariables") // private List<String> emailVariables; // // @JsonProperty("InlineCss") // private boolean inlineCss; // // @JsonProperty("TrackOpens") // private boolean trackOpens; // // @JsonProperty("TrackClicks") // private boolean trackClicks; // // /** // * @return the html body. // */ // public String getHtml() { // return html; // } // // /** // * @return the text body. // */ // public String getText() { // return text; // } // // /** // * @return the data merge variables. // */ // public List<String> getEmailVariables() { // return emailVariables; // } // // /** // * @return true if inline css, false otherwise. // */ // public boolean isInlineCss() { // return inlineCss; // } // // /** // * @return true if track opens enabled, false otherwise. // */ // public boolean isTrackOpens() { // return trackOpens; // } // // /** // * @return true if track clicks enabled, false otherwise. // */ // public boolean isTrackClicks() { // return trackClicks; // } // // /** // * @param html html body content. // */ // public void setHtml(String html) { // this.html = html; // } // // /** // * @param text text body content. // */ // public void setText(String text) { // this.text = text; // } // // /** // * @param inlineCss enabled css inlining. // */ // public void setInlineCss(boolean inlineCss) { // this.inlineCss = inlineCss; // } // // /** // * @param trackOpens enabled open tracking. // */ // public void setTrackOpens(boolean trackOpens) { // this.trackOpens = trackOpens; // } // // /** // * @param trackClicks enable click tracking. // */ // public void setTrackClicks(boolean trackClicks) { // this.trackClicks = trackClicks; // } // // @Override // public String toString() { // return String.format("html\n: %s\n\n text\n: %s\n", html, text); // } // }
import com.createsend.models.subscribers.ConsentToTrack; import com.createsend.models.transactional.EmailContent; import java.util.ArrayList; import java.util.Iterator; import java.util.List;
* Should Clicks be tracked. */ private boolean trackClicks; /** * The Consent to track value of the recipients */ private ConsentToTrack consentToTrack; public ClassicEmailRequest(String to, ConsentToTrack consentToTrack) { if (to == null || to.length() == 0) { throw new IllegalArgumentException("Must supply a TO address"); } if (consentToTrack == null) { throw new IllegalArgumentException("Must supply a ConsentToTrack value"); } this.to.add(to); this.consentToTrack = consentToTrack; } public void setSubject(String subject) { this.subject = subject; } public String getSubject() { return subject; }
// Path: src/com/createsend/models/subscribers/ConsentToTrack.java // public enum ConsentToTrack { // UNCHANGED("Unchanged"), // YES("Yes"), // NO("No"); // // private String value; // // ConsentToTrack(String value) { // this.value = value; // } // // @JsonCreator // public static ConsentToTrack forValue(String value) { // for (ConsentToTrack type : ConsentToTrack.values()) { // if (type.value.toLowerCase().equals(value.toLowerCase())) { // return type; // } // } // // return null; // } // } // // Path: src/com/createsend/models/transactional/EmailContent.java // public class EmailContent { // // @JsonProperty("Html") // private String html; // // @JsonProperty("Text") // private String text; // // @JsonProperty("EmailVariables") // private List<String> emailVariables; // // @JsonProperty("InlineCss") // private boolean inlineCss; // // @JsonProperty("TrackOpens") // private boolean trackOpens; // // @JsonProperty("TrackClicks") // private boolean trackClicks; // // /** // * @return the html body. // */ // public String getHtml() { // return html; // } // // /** // * @return the text body. // */ // public String getText() { // return text; // } // // /** // * @return the data merge variables. // */ // public List<String> getEmailVariables() { // return emailVariables; // } // // /** // * @return true if inline css, false otherwise. // */ // public boolean isInlineCss() { // return inlineCss; // } // // /** // * @return true if track opens enabled, false otherwise. // */ // public boolean isTrackOpens() { // return trackOpens; // } // // /** // * @return true if track clicks enabled, false otherwise. // */ // public boolean isTrackClicks() { // return trackClicks; // } // // /** // * @param html html body content. // */ // public void setHtml(String html) { // this.html = html; // } // // /** // * @param text text body content. // */ // public void setText(String text) { // this.text = text; // } // // /** // * @param inlineCss enabled css inlining. // */ // public void setInlineCss(boolean inlineCss) { // this.inlineCss = inlineCss; // } // // /** // * @param trackOpens enabled open tracking. // */ // public void setTrackOpens(boolean trackOpens) { // this.trackOpens = trackOpens; // } // // /** // * @param trackClicks enable click tracking. // */ // public void setTrackClicks(boolean trackClicks) { // this.trackClicks = trackClicks; // } // // @Override // public String toString() { // return String.format("html\n: %s\n\n text\n: %s\n", html, text); // } // } // Path: src/com/createsend/models/transactional/request/ClassicEmailRequest.java import com.createsend.models.subscribers.ConsentToTrack; import com.createsend.models.transactional.EmailContent; import java.util.ArrayList; import java.util.Iterator; import java.util.List; * Should Clicks be tracked. */ private boolean trackClicks; /** * The Consent to track value of the recipients */ private ConsentToTrack consentToTrack; public ClassicEmailRequest(String to, ConsentToTrack consentToTrack) { if (to == null || to.length() == 0) { throw new IllegalArgumentException("Must supply a TO address"); } if (consentToTrack == null) { throw new IllegalArgumentException("Must supply a ConsentToTrack value"); } this.to.add(to); this.consentToTrack = consentToTrack; } public void setSubject(String subject) { this.subject = subject; } public String getSubject() { return subject; }
public void setContent(EmailContent content) {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/CreditCardCreateRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/Checkout.java // @Data // @NoArgsConstructor // @AllArgsConstructor // @EqualsAndHashCode(callSuper=false) // public static class ShippingAddress { // private String address1; // private String address2; // private String city; // private String state; // private String zip; // private String country; // private String region; // private String postalcode; // } // // Path: src/main/java/com/lookfirst/wepay/api/CreditCard.java // @Data // public class CreditCard implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the credit_card. */ // public String creditCardId; // /** The string that identifies the credit_card such as MasterCard xxxxxx4769. */ // public String creditCardName; // /** The state that the credit card is in. */ // public String state; // /** The name on the card (ie "Bob Smith"). */ // public String userName; // /** The email address of the user who owns the card. */ // public String email; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // public String referenceId; // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Checkout.ShippingAddress; import com.lookfirst.wepay.api.CreditCard;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/credit_card * * This call allows you to pass credit card information and receive back a credit_card_id. You will then be able to use that credit_card_id on * the /checkout/create call to execute a payment immediately with that credit card (similar to how the preapproval_id on /checkout/create * works). Note that you will need to call the /checkout/create call OR the /credit_card/authorize call within 30 minutes or the credit card will expire. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/Checkout.java // @Data // @NoArgsConstructor // @AllArgsConstructor // @EqualsAndHashCode(callSuper=false) // public static class ShippingAddress { // private String address1; // private String address2; // private String city; // private String state; // private String zip; // private String country; // private String region; // private String postalcode; // } // // Path: src/main/java/com/lookfirst/wepay/api/CreditCard.java // @Data // public class CreditCard implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the credit_card. */ // public String creditCardId; // /** The string that identifies the credit_card such as MasterCard xxxxxx4769. */ // public String creditCardName; // /** The state that the credit card is in. */ // public String state; // /** The name on the card (ie "Bob Smith"). */ // public String userName; // /** The email address of the user who owns the card. */ // public String email; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // public String referenceId; // } // Path: src/main/java/com/lookfirst/wepay/api/req/CreditCardCreateRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Checkout.ShippingAddress; import com.lookfirst.wepay.api.CreditCard; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/credit_card * * This call allows you to pass credit card information and receive back a credit_card_id. You will then be able to use that credit_card_id on * the /checkout/create call to execute a payment immediately with that credit card (similar to how the preapproval_id on /checkout/create * works). Note that you will need to call the /checkout/create call OR the /credit_card/authorize call within 30 minutes or the credit card will expire. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class CreditCardCreateRequest extends WePayRequest<CreditCard> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/CreditCardCreateRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/Checkout.java // @Data // @NoArgsConstructor // @AllArgsConstructor // @EqualsAndHashCode(callSuper=false) // public static class ShippingAddress { // private String address1; // private String address2; // private String city; // private String state; // private String zip; // private String country; // private String region; // private String postalcode; // } // // Path: src/main/java/com/lookfirst/wepay/api/CreditCard.java // @Data // public class CreditCard implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the credit_card. */ // public String creditCardId; // /** The string that identifies the credit_card such as MasterCard xxxxxx4769. */ // public String creditCardName; // /** The state that the credit card is in. */ // public String state; // /** The name on the card (ie "Bob Smith"). */ // public String userName; // /** The email address of the user who owns the card. */ // public String email; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // public String referenceId; // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Checkout.ShippingAddress; import com.lookfirst.wepay.api.CreditCard;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/credit_card * * This call allows you to pass credit card information and receive back a credit_card_id. You will then be able to use that credit_card_id on * the /checkout/create call to execute a payment immediately with that credit card (similar to how the preapproval_id on /checkout/create * works). Note that you will need to call the /checkout/create call OR the /credit_card/authorize call within 30 minutes or the credit card will expire. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class CreditCardCreateRequest extends WePayRequest<CreditCard> { /** Yes The ID your your API application. You can find it on your app dashboard. */ private Long clientId; /** Yes The number on the credit card. */ private Long ccNumber; /** Yes The CVV (AKA card security code, CVV2, CVC etc) on the card. */ private Integer cvv; /** Yes The expiration month on the credit card. */ private Integer expirationMonth; /** Yes The expiration year on the credit card. */ private Integer expirationYear; /** Yes The full name of the user that the card belongs to. */ private String userName; /** Yes The email address of the user the card belongs to. */ private String email; /** * Yes * The billing address on the card. It should be a valid JSON object (not a JSON serialized string) with the following format: * {"address1":"380 Portage Ave","address2":"","city":"Palo Alto","state":"CA","zip":"94306","country":"US"}. */
// Path: src/main/java/com/lookfirst/wepay/api/Checkout.java // @Data // @NoArgsConstructor // @AllArgsConstructor // @EqualsAndHashCode(callSuper=false) // public static class ShippingAddress { // private String address1; // private String address2; // private String city; // private String state; // private String zip; // private String country; // private String region; // private String postalcode; // } // // Path: src/main/java/com/lookfirst/wepay/api/CreditCard.java // @Data // public class CreditCard implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the credit_card. */ // public String creditCardId; // /** The string that identifies the credit_card such as MasterCard xxxxxx4769. */ // public String creditCardName; // /** The state that the credit card is in. */ // public String state; // /** The name on the card (ie "Bob Smith"). */ // public String userName; // /** The email address of the user who owns the card. */ // public String email; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // public String referenceId; // } // Path: src/main/java/com/lookfirst/wepay/api/req/CreditCardCreateRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Checkout.ShippingAddress; import com.lookfirst.wepay.api.CreditCard; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/credit_card * * This call allows you to pass credit card information and receive back a credit_card_id. You will then be able to use that credit_card_id on * the /checkout/create call to execute a payment immediately with that credit card (similar to how the preapproval_id on /checkout/create * works). Note that you will need to call the /checkout/create call OR the /credit_card/authorize call within 30 minutes or the credit card will expire. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class CreditCardCreateRequest extends WePayRequest<CreditCard> { /** Yes The ID your your API application. You can find it on your app dashboard. */ private Long clientId; /** Yes The number on the credit card. */ private Long ccNumber; /** Yes The CVV (AKA card security code, CVV2, CVC etc) on the card. */ private Integer cvv; /** Yes The expiration month on the credit card. */ private Integer expirationMonth; /** Yes The expiration year on the credit card. */ private Integer expirationYear; /** Yes The full name of the user that the card belongs to. */ private String userName; /** Yes The email address of the user the card belongs to. */ private String email; /** * Yes * The billing address on the card. It should be a valid JSON object (not a JSON serialized string) with the following format: * {"address1":"380 Portage Ave","address2":"","city":"Palo Alto","state":"CA","zip":"94306","country":"US"}. */
private ShippingAddress address;
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/Checkout.java
// Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum FeePayer { payer, payee, payer_from_app, payee_from_app } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum State { // action_required { // @Override // public String toString() { return "action required"; } // }, // active, // approved, // authorized, // available, // cancelled, // captured, // charged_back { // @Override // public String toString() { return "charged back"; } // }, // completed, // deleted, // disabled, // ended, // expired, // failed, // invalid, // new_ { // @Override // public String toString() { return "new"; } // }, // pending, // refunded, // registered, // reserved, // retrying, // revoked, // settled, // started, // stopped, // transition, // trial // }
import com.lookfirst.wepay.api.Constants.FeePayer; import com.lookfirst.wepay.api.Constants.State; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import java.math.BigDecimal;
package com.lookfirst.wepay.api; /** * https://stage.wepay.com/developer/reference/checkout * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class Checkout extends CheckoutUri { private static final long serialVersionUID = 1L; /** The unique ID of the payment account that the money will go into. */ private Long accountId; /** The unique ID of the preapproval associated with the checkout (if applicable). */ private Long preapprovalId; /** The state the checkout is in. See the section on IPN for a listing of all states. */
// Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum FeePayer { payer, payee, payer_from_app, payee_from_app } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum State { // action_required { // @Override // public String toString() { return "action required"; } // }, // active, // approved, // authorized, // available, // cancelled, // captured, // charged_back { // @Override // public String toString() { return "charged back"; } // }, // completed, // deleted, // disabled, // ended, // expired, // failed, // invalid, // new_ { // @Override // public String toString() { return "new"; } // }, // pending, // refunded, // registered, // reserved, // retrying, // revoked, // settled, // started, // stopped, // transition, // trial // } // Path: src/main/java/com/lookfirst/wepay/api/Checkout.java import com.lookfirst.wepay.api.Constants.FeePayer; import com.lookfirst.wepay.api.Constants.State; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import java.math.BigDecimal; package com.lookfirst.wepay.api; /** * https://stage.wepay.com/developer/reference/checkout * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class Checkout extends CheckoutUri { private static final long serialVersionUID = 1L; /** The unique ID of the payment account that the money will go into. */ private Long accountId; /** The unique ID of the preapproval associated with the checkout (if applicable). */ private Long preapprovalId; /** The state the checkout is in. See the section on IPN for a listing of all states. */
private State state;
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/Checkout.java
// Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum FeePayer { payer, payee, payer_from_app, payee_from_app } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum State { // action_required { // @Override // public String toString() { return "action required"; } // }, // active, // approved, // authorized, // available, // cancelled, // captured, // charged_back { // @Override // public String toString() { return "charged back"; } // }, // completed, // deleted, // disabled, // ended, // expired, // failed, // invalid, // new_ { // @Override // public String toString() { return "new"; } // }, // pending, // refunded, // registered, // reserved, // retrying, // revoked, // settled, // started, // stopped, // transition, // trial // }
import com.lookfirst.wepay.api.Constants.FeePayer; import com.lookfirst.wepay.api.Constants.State; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import java.math.BigDecimal;
package com.lookfirst.wepay.api; /** * https://stage.wepay.com/developer/reference/checkout * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class Checkout extends CheckoutUri { private static final long serialVersionUID = 1L; /** The unique ID of the payment account that the money will go into. */ private Long accountId; /** The unique ID of the preapproval associated with the checkout (if applicable). */ private Long preapprovalId; /** The state the checkout is in. See the section on IPN for a listing of all states. */ private State state; /** The payment description that will show up on payer's credit card statement. (255) */ private String softDescriptor; /** The short description of the checkout. */ private String shortDescription; /** The long description of the checkout (if available). */ private String longDescription; /** The currency used (always USD for now). */ private String currency; /** The dollar amount of the checkout object. This will always be the amount you passed in /checkout/create */ private BigDecimal amount; /** The dollar amount of the WePay fee. */ private BigDecimal fee; /** The total dollar amount paid by the payer. */ private BigDecimal gross; /** The amount that the application received in fees. App fees go into the API application's WePay account. */ private BigDecimal appFee; /** Who is paying the fee (either "payer" for the person paying or "payee" for the person receiving the money). */
// Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum FeePayer { payer, payee, payer_from_app, payee_from_app } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum State { // action_required { // @Override // public String toString() { return "action required"; } // }, // active, // approved, // authorized, // available, // cancelled, // captured, // charged_back { // @Override // public String toString() { return "charged back"; } // }, // completed, // deleted, // disabled, // ended, // expired, // failed, // invalid, // new_ { // @Override // public String toString() { return "new"; } // }, // pending, // refunded, // registered, // reserved, // retrying, // revoked, // settled, // started, // stopped, // transition, // trial // } // Path: src/main/java/com/lookfirst/wepay/api/Checkout.java import com.lookfirst.wepay.api.Constants.FeePayer; import com.lookfirst.wepay.api.Constants.State; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import java.math.BigDecimal; package com.lookfirst.wepay.api; /** * https://stage.wepay.com/developer/reference/checkout * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class Checkout extends CheckoutUri { private static final long serialVersionUID = 1L; /** The unique ID of the payment account that the money will go into. */ private Long accountId; /** The unique ID of the preapproval associated with the checkout (if applicable). */ private Long preapprovalId; /** The state the checkout is in. See the section on IPN for a listing of all states. */ private State state; /** The payment description that will show up on payer's credit card statement. (255) */ private String softDescriptor; /** The short description of the checkout. */ private String shortDescription; /** The long description of the checkout (if available). */ private String longDescription; /** The currency used (always USD for now). */ private String currency; /** The dollar amount of the checkout object. This will always be the amount you passed in /checkout/create */ private BigDecimal amount; /** The dollar amount of the WePay fee. */ private BigDecimal fee; /** The total dollar amount paid by the payer. */ private BigDecimal gross; /** The amount that the application received in fees. App fees go into the API application's WePay account. */ private BigDecimal appFee; /** Who is paying the fee (either "payer" for the person paying or "payee" for the person receiving the money). */
private FeePayer feePayer;
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/WithdrawalCreateRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum Mode { iframe, regular } // // Path: src/main/java/com/lookfirst/wepay/api/Withdrawal.java // @Data // @EqualsAndHashCode(callSuper=false) // public class Withdrawal implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the withdrawal. */ // private Long withdrawalId; // /** The unique ID of the account that the money is coming from. */ // private Long accountId; // /** The state that the withdrawal is in See the section on payment states for a list of possible states. */ // private State state; // /** The uri that the account owner will return to after completing the withdrawal. Set to app homepage if not passed in /withdrawal/create. */ // private String redirectUri; // /** The uri that you will send the account owner to to complete the withdrawal. */ // private String withdrawalUri; // /** The uri that we will post notifications to each time the state on this withdrawal changes. */ // private String callbackUri; // /** The amount on money withdrawn from the WePay account to the bank account. */ // private BigDecimal amount; // /** The currency used, default "USD" ("USD" for now). */ // private String currency; // /** A short description for the reason of the withdrawal (255 characters). */ // private String note; // /** Whether the recipient of the money has been confirmed (for bank withdrawals this is the receiving bank account). */ // private boolean recipientConfirmed; // /** The type of withdrawal. Will be "check" for a sent paper check, or "ach" for a withdrawal to a bank account. */ // private WithdrawalType type; // /** The unixtime when the withdrawal was created. */ // private Long createTime; // /** The unixtime when the withdrawal was captured and credited to the payee's bank account. Returns 0 if withdrawal is not yet captured. */ // private Long captureTime; // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Constants.Mode; import com.lookfirst.wepay.api.Withdrawal;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/withdrawal * * This call allows you to create a withdrawal object. A withdrawal object represents * the movement of money from a WePay account to a bank account. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum Mode { iframe, regular } // // Path: src/main/java/com/lookfirst/wepay/api/Withdrawal.java // @Data // @EqualsAndHashCode(callSuper=false) // public class Withdrawal implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the withdrawal. */ // private Long withdrawalId; // /** The unique ID of the account that the money is coming from. */ // private Long accountId; // /** The state that the withdrawal is in See the section on payment states for a list of possible states. */ // private State state; // /** The uri that the account owner will return to after completing the withdrawal. Set to app homepage if not passed in /withdrawal/create. */ // private String redirectUri; // /** The uri that you will send the account owner to to complete the withdrawal. */ // private String withdrawalUri; // /** The uri that we will post notifications to each time the state on this withdrawal changes. */ // private String callbackUri; // /** The amount on money withdrawn from the WePay account to the bank account. */ // private BigDecimal amount; // /** The currency used, default "USD" ("USD" for now). */ // private String currency; // /** A short description for the reason of the withdrawal (255 characters). */ // private String note; // /** Whether the recipient of the money has been confirmed (for bank withdrawals this is the receiving bank account). */ // private boolean recipientConfirmed; // /** The type of withdrawal. Will be "check" for a sent paper check, or "ach" for a withdrawal to a bank account. */ // private WithdrawalType type; // /** The unixtime when the withdrawal was created. */ // private Long createTime; // /** The unixtime when the withdrawal was captured and credited to the payee's bank account. Returns 0 if withdrawal is not yet captured. */ // private Long captureTime; // } // Path: src/main/java/com/lookfirst/wepay/api/req/WithdrawalCreateRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Constants.Mode; import com.lookfirst.wepay.api.Withdrawal; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/withdrawal * * This call allows you to create a withdrawal object. A withdrawal object represents * the movement of money from a WePay account to a bank account. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class WithdrawalCreateRequest extends WePayRequest<Withdrawal> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/WithdrawalCreateRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum Mode { iframe, regular } // // Path: src/main/java/com/lookfirst/wepay/api/Withdrawal.java // @Data // @EqualsAndHashCode(callSuper=false) // public class Withdrawal implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the withdrawal. */ // private Long withdrawalId; // /** The unique ID of the account that the money is coming from. */ // private Long accountId; // /** The state that the withdrawal is in See the section on payment states for a list of possible states. */ // private State state; // /** The uri that the account owner will return to after completing the withdrawal. Set to app homepage if not passed in /withdrawal/create. */ // private String redirectUri; // /** The uri that you will send the account owner to to complete the withdrawal. */ // private String withdrawalUri; // /** The uri that we will post notifications to each time the state on this withdrawal changes. */ // private String callbackUri; // /** The amount on money withdrawn from the WePay account to the bank account. */ // private BigDecimal amount; // /** The currency used, default "USD" ("USD" for now). */ // private String currency; // /** A short description for the reason of the withdrawal (255 characters). */ // private String note; // /** Whether the recipient of the money has been confirmed (for bank withdrawals this is the receiving bank account). */ // private boolean recipientConfirmed; // /** The type of withdrawal. Will be "check" for a sent paper check, or "ach" for a withdrawal to a bank account. */ // private WithdrawalType type; // /** The unixtime when the withdrawal was created. */ // private Long createTime; // /** The unixtime when the withdrawal was captured and credited to the payee's bank account. Returns 0 if withdrawal is not yet captured. */ // private Long captureTime; // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Constants.Mode; import com.lookfirst.wepay.api.Withdrawal;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/withdrawal * * This call allows you to create a withdrawal object. A withdrawal object represents * the movement of money from a WePay account to a bank account. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class WithdrawalCreateRequest extends WePayRequest<Withdrawal> { /** The unique ID of the WePay account the money will be withdrawn from. */ private String accountId; /** The uri that the account owner will be sent to after they authorize the withdrawal. Defaults to the application homepage. */ private String redirectUri; /** The uri that will receive POST notifications each time the withdrawal changes state. See the IPN tutorial for more details. Needs to be a full uri (ex https://www.wepay.com ) and must NOT be localhost or 127.0.0.1 or include wepay.com. Max 2083 chars. */ private String callbackUri; /** The uri that the payer will be redirected to if cookies cannot be set in the iframe; will only work if mode is iframe. */ private String fallbackUri; /** A short description of the withdrawal (255 characters). */ private String note; /** What mode the withdrawal will be displayed in. The options are 'iframe' or 'regular'. Choose 'iframe' if this is an iframe withdrawal. Mode defaults to 'regular'. */
// Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum Mode { iframe, regular } // // Path: src/main/java/com/lookfirst/wepay/api/Withdrawal.java // @Data // @EqualsAndHashCode(callSuper=false) // public class Withdrawal implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the withdrawal. */ // private Long withdrawalId; // /** The unique ID of the account that the money is coming from. */ // private Long accountId; // /** The state that the withdrawal is in See the section on payment states for a list of possible states. */ // private State state; // /** The uri that the account owner will return to after completing the withdrawal. Set to app homepage if not passed in /withdrawal/create. */ // private String redirectUri; // /** The uri that you will send the account owner to to complete the withdrawal. */ // private String withdrawalUri; // /** The uri that we will post notifications to each time the state on this withdrawal changes. */ // private String callbackUri; // /** The amount on money withdrawn from the WePay account to the bank account. */ // private BigDecimal amount; // /** The currency used, default "USD" ("USD" for now). */ // private String currency; // /** A short description for the reason of the withdrawal (255 characters). */ // private String note; // /** Whether the recipient of the money has been confirmed (for bank withdrawals this is the receiving bank account). */ // private boolean recipientConfirmed; // /** The type of withdrawal. Will be "check" for a sent paper check, or "ach" for a withdrawal to a bank account. */ // private WithdrawalType type; // /** The unixtime when the withdrawal was created. */ // private Long createTime; // /** The unixtime when the withdrawal was captured and credited to the payee's bank account. Returns 0 if withdrawal is not yet captured. */ // private Long captureTime; // } // Path: src/main/java/com/lookfirst/wepay/api/req/WithdrawalCreateRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Constants.Mode; import com.lookfirst.wepay.api.Withdrawal; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/withdrawal * * This call allows you to create a withdrawal object. A withdrawal object represents * the movement of money from a WePay account to a bank account. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class WithdrawalCreateRequest extends WePayRequest<Withdrawal> { /** The unique ID of the WePay account the money will be withdrawn from. */ private String accountId; /** The uri that the account owner will be sent to after they authorize the withdrawal. Defaults to the application homepage. */ private String redirectUri; /** The uri that will receive POST notifications each time the withdrawal changes state. See the IPN tutorial for more details. Needs to be a full uri (ex https://www.wepay.com ) and must NOT be localhost or 127.0.0.1 or include wepay.com. Max 2083 chars. */ private String callbackUri; /** The uri that the payer will be redirected to if cookies cannot be set in the iframe; will only work if mode is iframe. */ private String fallbackUri; /** A short description of the withdrawal (255 characters). */ private String note; /** What mode the withdrawal will be displayed in. The options are 'iframe' or 'regular'. Choose 'iframe' if this is an iframe withdrawal. Mode defaults to 'regular'. */
private Mode mode;
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/Withdrawal.java
// Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum State { // action_required { // @Override // public String toString() { return "action required"; } // }, // active, // approved, // authorized, // available, // cancelled, // captured, // charged_back { // @Override // public String toString() { return "charged back"; } // }, // completed, // deleted, // disabled, // ended, // expired, // failed, // invalid, // new_ { // @Override // public String toString() { return "new"; } // }, // pending, // refunded, // registered, // reserved, // retrying, // revoked, // settled, // started, // stopped, // transition, // trial // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum WithdrawalType { check, ach }
import com.lookfirst.wepay.api.Constants.State; import com.lookfirst.wepay.api.Constants.WithdrawalType; import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serializable; import java.math.BigDecimal;
package com.lookfirst.wepay.api; /** * https://stage.wepay.com/developer/reference/withdrawal * * This call allows you to lookup the details of a withdrawal. * A withdrawal object represents the movement of money from a WePay * account to a bank account. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class Withdrawal implements Serializable { private static final long serialVersionUID = 1L; /** The unique ID of the withdrawal. */ private Long withdrawalId; /** The unique ID of the account that the money is coming from. */ private Long accountId; /** The state that the withdrawal is in See the section on payment states for a list of possible states. */
// Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum State { // action_required { // @Override // public String toString() { return "action required"; } // }, // active, // approved, // authorized, // available, // cancelled, // captured, // charged_back { // @Override // public String toString() { return "charged back"; } // }, // completed, // deleted, // disabled, // ended, // expired, // failed, // invalid, // new_ { // @Override // public String toString() { return "new"; } // }, // pending, // refunded, // registered, // reserved, // retrying, // revoked, // settled, // started, // stopped, // transition, // trial // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum WithdrawalType { check, ach } // Path: src/main/java/com/lookfirst/wepay/api/Withdrawal.java import com.lookfirst.wepay.api.Constants.State; import com.lookfirst.wepay.api.Constants.WithdrawalType; import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serializable; import java.math.BigDecimal; package com.lookfirst.wepay.api; /** * https://stage.wepay.com/developer/reference/withdrawal * * This call allows you to lookup the details of a withdrawal. * A withdrawal object represents the movement of money from a WePay * account to a bank account. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class Withdrawal implements Serializable { private static final long serialVersionUID = 1L; /** The unique ID of the withdrawal. */ private Long withdrawalId; /** The unique ID of the account that the money is coming from. */ private Long accountId; /** The state that the withdrawal is in See the section on payment states for a list of possible states. */
private State state;
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/Withdrawal.java
// Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum State { // action_required { // @Override // public String toString() { return "action required"; } // }, // active, // approved, // authorized, // available, // cancelled, // captured, // charged_back { // @Override // public String toString() { return "charged back"; } // }, // completed, // deleted, // disabled, // ended, // expired, // failed, // invalid, // new_ { // @Override // public String toString() { return "new"; } // }, // pending, // refunded, // registered, // reserved, // retrying, // revoked, // settled, // started, // stopped, // transition, // trial // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum WithdrawalType { check, ach }
import com.lookfirst.wepay.api.Constants.State; import com.lookfirst.wepay.api.Constants.WithdrawalType; import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serializable; import java.math.BigDecimal;
package com.lookfirst.wepay.api; /** * https://stage.wepay.com/developer/reference/withdrawal * * This call allows you to lookup the details of a withdrawal. * A withdrawal object represents the movement of money from a WePay * account to a bank account. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class Withdrawal implements Serializable { private static final long serialVersionUID = 1L; /** The unique ID of the withdrawal. */ private Long withdrawalId; /** The unique ID of the account that the money is coming from. */ private Long accountId; /** The state that the withdrawal is in See the section on payment states for a list of possible states. */ private State state; /** The uri that the account owner will return to after completing the withdrawal. Set to app homepage if not passed in /withdrawal/create. */ private String redirectUri; /** The uri that you will send the account owner to to complete the withdrawal. */ private String withdrawalUri; /** The uri that we will post notifications to each time the state on this withdrawal changes. */ private String callbackUri; /** The amount on money withdrawn from the WePay account to the bank account. */ private BigDecimal amount; /** The currency used, default "USD" ("USD" for now). */ private String currency; /** A short description for the reason of the withdrawal (255 characters). */ private String note; /** Whether the recipient of the money has been confirmed (for bank withdrawals this is the receiving bank account). */ private boolean recipientConfirmed; /** The type of withdrawal. Will be "check" for a sent paper check, or "ach" for a withdrawal to a bank account. */
// Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum State { // action_required { // @Override // public String toString() { return "action required"; } // }, // active, // approved, // authorized, // available, // cancelled, // captured, // charged_back { // @Override // public String toString() { return "charged back"; } // }, // completed, // deleted, // disabled, // ended, // expired, // failed, // invalid, // new_ { // @Override // public String toString() { return "new"; } // }, // pending, // refunded, // registered, // reserved, // retrying, // revoked, // settled, // started, // stopped, // transition, // trial // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum WithdrawalType { check, ach } // Path: src/main/java/com/lookfirst/wepay/api/Withdrawal.java import com.lookfirst.wepay.api.Constants.State; import com.lookfirst.wepay.api.Constants.WithdrawalType; import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serializable; import java.math.BigDecimal; package com.lookfirst.wepay.api; /** * https://stage.wepay.com/developer/reference/withdrawal * * This call allows you to lookup the details of a withdrawal. * A withdrawal object represents the movement of money from a WePay * account to a bank account. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class Withdrawal implements Serializable { private static final long serialVersionUID = 1L; /** The unique ID of the withdrawal. */ private Long withdrawalId; /** The unique ID of the account that the money is coming from. */ private Long accountId; /** The state that the withdrawal is in See the section on payment states for a list of possible states. */ private State state; /** The uri that the account owner will return to after completing the withdrawal. Set to app homepage if not passed in /withdrawal/create. */ private String redirectUri; /** The uri that you will send the account owner to to complete the withdrawal. */ private String withdrawalUri; /** The uri that we will post notifications to each time the state on this withdrawal changes. */ private String callbackUri; /** The amount on money withdrawn from the WePay account to the bank account. */ private BigDecimal amount; /** The currency used, default "USD" ("USD" for now). */ private String currency; /** A short description for the reason of the withdrawal (255 characters). */ private String note; /** Whether the recipient of the money has been confirmed (for bank withdrawals this is the receiving bank account). */ private boolean recipientConfirmed; /** The type of withdrawal. Will be "check" for a sent paper check, or "ach" for a withdrawal to a bank account. */
private WithdrawalType type;
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/CheckoutState.java
// Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum State { // action_required { // @Override // public String toString() { return "action required"; } // }, // active, // approved, // authorized, // available, // cancelled, // captured, // charged_back { // @Override // public String toString() { return "charged back"; } // }, // completed, // deleted, // disabled, // ended, // expired, // failed, // invalid, // new_ { // @Override // public String toString() { return "new"; } // }, // pending, // refunded, // registered, // reserved, // retrying, // revoked, // settled, // started, // stopped, // transition, // trial // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Constants.State;
package com.lookfirst.wepay.api; /** * https://stage.wepay.com/developer/reference/checkout * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=true) public class CheckoutState extends CheckoutId { private static final long serialVersionUID = 1L; /** The state the payment is in. See the IPN section for a list of payment states. */
// Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum State { // action_required { // @Override // public String toString() { return "action required"; } // }, // active, // approved, // authorized, // available, // cancelled, // captured, // charged_back { // @Override // public String toString() { return "charged back"; } // }, // completed, // deleted, // disabled, // ended, // expired, // failed, // invalid, // new_ { // @Override // public String toString() { return "new"; } // }, // pending, // refunded, // registered, // reserved, // retrying, // revoked, // settled, // started, // stopped, // transition, // trial // } // Path: src/main/java/com/lookfirst/wepay/api/CheckoutState.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Constants.State; package com.lookfirst.wepay.api; /** * https://stage.wepay.com/developer/reference/checkout * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=true) public class CheckoutState extends CheckoutId { private static final long serialVersionUID = 1L; /** The state the payment is in. See the IPN section for a list of payment states. */
private State state;
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/AccountGetReserveDetails.java
// Path: src/main/java/com/lookfirst/wepay/api/AccountReserve.java // @Data // public class AccountReserve extends AccountId { // private static final long serialVersionUID = 1L; // // /** The currency of the above amounts. For now this will always be USD. */ // private String currency; // /** The actual amount of money in dollars that is reserved and is not available for withdrawal (ie the minimum balance). */ // private BigDecimal reservedAmount; // /** An array of time/amount pairs up to the next 10 withdrawals based on current balance, the reserves and withdrawals schedules. It will be empty if withdrawals are not yet configured or if there is no balance. */ // private List<WithdrawalSchedule> withdrawalsSchedule; // // @Data // private class WithdrawalSchedule { // private Long time; // private BigDecimal amount; // } // }
import com.lookfirst.wepay.api.AccountReserve; import lombok.Data; import lombok.EqualsAndHashCode;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * This call allows you to add or update all incomplete items for an account like KYC info, bank account, etc. It will return a URL that a user can visit to update info for his or her account. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/AccountReserve.java // @Data // public class AccountReserve extends AccountId { // private static final long serialVersionUID = 1L; // // /** The currency of the above amounts. For now this will always be USD. */ // private String currency; // /** The actual amount of money in dollars that is reserved and is not available for withdrawal (ie the minimum balance). */ // private BigDecimal reservedAmount; // /** An array of time/amount pairs up to the next 10 withdrawals based on current balance, the reserves and withdrawals schedules. It will be empty if withdrawals are not yet configured or if there is no balance. */ // private List<WithdrawalSchedule> withdrawalsSchedule; // // @Data // private class WithdrawalSchedule { // private Long time; // private BigDecimal amount; // } // } // Path: src/main/java/com/lookfirst/wepay/api/req/AccountGetReserveDetails.java import com.lookfirst.wepay.api.AccountReserve; import lombok.Data; import lombok.EqualsAndHashCode; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * This call allows you to add or update all incomplete items for an account like KYC info, bank account, etc. It will return a URL that a user can visit to update info for his or her account. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class AccountGetReserveDetails extends WePayRequest<AccountReserve> {
lookfirst/WePay-Java-SDK
src/test/java/com/lookfirst/wepay/AccountTest.java
// Path: src/main/java/com/lookfirst/wepay/api/WePayAccount.java // @Data // @EqualsAndHashCode(callSuper=false) // public class WePayAccount extends AccountUri { // private static final long serialVersionUID = 1L; // // /** The name of the account. */ // private String name; // /** The state of the account: active, disabled or deleted. */ // private String state; // /** The account description. */ // private String description; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // private String referenceId; // /** The maximum amount in dollars (including fees) that you can charge for payments to this account. */ // private String paymentLimit; // /** An array of Google Analytics domains associated with the app. */ // private List<String> gaqDomains; // /** The theme object associated with the App (if applicable). */ // private ThemeObject themeObject; // /** Returns "verified" if the account has been verified and "unverified" if it has not. If the account has pending verification, then it is "pending". */ // private String verificationState; // /** If the account is "unverified" then you can send the user to this url to verify their account. */ // private String verificationUrl; // /** The account type. Can be "personal", "nonprofit", or "business". */ // private String type; // /** The unixtime when the account was created. */ // private Long createTime; // /** Array of account balances for each currency. */ // private List<AccountBalance> balances; // /** Array of account incoming and outgoing payments status for each currency. */ // private List<AccountStatus> statuses; // /** Array of action strings explaining all the actions that are required to make this account active. It will be empty if no action is required. */ // private List<String> actionReasons; // /** The account's country of origin 2-letter ISO code (e.g. 'US') */ // private String country; // /** Array of supported currency strings for this account (e.g. ["USD"]). Only "USD" is supported for now. */ // private List<String> currencies; // } // // Path: src/main/java/com/lookfirst/wepay/api/req/AccountFindRequest.java // @Data // @EqualsAndHashCode(callSuper=false) // public class AccountFindRequest extends WePayRequest<List<WePayAccount>> { // // /** The name of the account you are searching for. */ // private String name; // /** The reference ID of the account you are searching for (set by the app in in /account/create or account/modify). */ // private String referenceId; // /** Sort the results of the search by time created. Use 'DESC' for most recent to least recent. Use 'ASC' for least recent to most recent. Defaults to 'DESC'. */ // private SortOrder sortOrder; // // /** */ // @Override // public String getEndpoint() { // return "/account/find"; // } // } // // Path: src/test/java/com/lookfirst/wepay/util/FakeDataProvider.java // @AllArgsConstructor // public class FakeDataProvider implements DataProvider { // @NonNull // final String data; // // @Override // public InputStream getData(String uri, String postJson, String token) throws IOException { // return new ByteArrayInputStream(data.getBytes()); // } // }
import com.lookfirst.wepay.api.WePayAccount; import com.lookfirst.wepay.api.req.AccountFindRequest; import com.lookfirst.wepay.util.FakeDataProvider; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import java.util.List;
"\"description\":\"this account is just an example.\",\n" + "\"reference_id\":\"123abc\",\n" + "\"type\":\"personal\",\n" + "\"create_time\":1367958263,\n" + "\"country\": \"US\",\n" + "\"currencies\": [\"USD\"],\n" + "\"balances\":[\n" + "{\n" + "\"currency\":\"USD\",\n" + "\"balance\":390.50,\n" + "\"incoming_pending_amount\":635.30,\n" + "\"outgoing_pending_amount\":210.00,\n" + "\"reserved_amount\":0,\n" + "\"disputed_amount\":0,\n" + "\"withdrawal_period\":\"daily\",\n" + "\"withdrawal_next_time\":1370112217,\n" + "\"withdrawal_bank_name\":\"WellsFargo XXXXX3102\"\n" + "}\n" + "],\n" + "\"statuses\":[\n" + "{\n" + "\"currency\":\"USD\",\n" + "\"incoming_payments_status\":\"ok\",\n" + "\"outgoing_payments_status\":\"ok\"\n" + "}\n" + "],\n" + "\"action_reasons\":[]\n" + "}\n" + "]\n";
// Path: src/main/java/com/lookfirst/wepay/api/WePayAccount.java // @Data // @EqualsAndHashCode(callSuper=false) // public class WePayAccount extends AccountUri { // private static final long serialVersionUID = 1L; // // /** The name of the account. */ // private String name; // /** The state of the account: active, disabled or deleted. */ // private String state; // /** The account description. */ // private String description; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // private String referenceId; // /** The maximum amount in dollars (including fees) that you can charge for payments to this account. */ // private String paymentLimit; // /** An array of Google Analytics domains associated with the app. */ // private List<String> gaqDomains; // /** The theme object associated with the App (if applicable). */ // private ThemeObject themeObject; // /** Returns "verified" if the account has been verified and "unverified" if it has not. If the account has pending verification, then it is "pending". */ // private String verificationState; // /** If the account is "unverified" then you can send the user to this url to verify their account. */ // private String verificationUrl; // /** The account type. Can be "personal", "nonprofit", or "business". */ // private String type; // /** The unixtime when the account was created. */ // private Long createTime; // /** Array of account balances for each currency. */ // private List<AccountBalance> balances; // /** Array of account incoming and outgoing payments status for each currency. */ // private List<AccountStatus> statuses; // /** Array of action strings explaining all the actions that are required to make this account active. It will be empty if no action is required. */ // private List<String> actionReasons; // /** The account's country of origin 2-letter ISO code (e.g. 'US') */ // private String country; // /** Array of supported currency strings for this account (e.g. ["USD"]). Only "USD" is supported for now. */ // private List<String> currencies; // } // // Path: src/main/java/com/lookfirst/wepay/api/req/AccountFindRequest.java // @Data // @EqualsAndHashCode(callSuper=false) // public class AccountFindRequest extends WePayRequest<List<WePayAccount>> { // // /** The name of the account you are searching for. */ // private String name; // /** The reference ID of the account you are searching for (set by the app in in /account/create or account/modify). */ // private String referenceId; // /** Sort the results of the search by time created. Use 'DESC' for most recent to least recent. Use 'ASC' for least recent to most recent. Defaults to 'DESC'. */ // private SortOrder sortOrder; // // /** */ // @Override // public String getEndpoint() { // return "/account/find"; // } // } // // Path: src/test/java/com/lookfirst/wepay/util/FakeDataProvider.java // @AllArgsConstructor // public class FakeDataProvider implements DataProvider { // @NonNull // final String data; // // @Override // public InputStream getData(String uri, String postJson, String token) throws IOException { // return new ByteArrayInputStream(data.getBytes()); // } // } // Path: src/test/java/com/lookfirst/wepay/AccountTest.java import com.lookfirst.wepay.api.WePayAccount; import com.lookfirst.wepay.api.req.AccountFindRequest; import com.lookfirst.wepay.util.FakeDataProvider; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import java.util.List; "\"description\":\"this account is just an example.\",\n" + "\"reference_id\":\"123abc\",\n" + "\"type\":\"personal\",\n" + "\"create_time\":1367958263,\n" + "\"country\": \"US\",\n" + "\"currencies\": [\"USD\"],\n" + "\"balances\":[\n" + "{\n" + "\"currency\":\"USD\",\n" + "\"balance\":390.50,\n" + "\"incoming_pending_amount\":635.30,\n" + "\"outgoing_pending_amount\":210.00,\n" + "\"reserved_amount\":0,\n" + "\"disputed_amount\":0,\n" + "\"withdrawal_period\":\"daily\",\n" + "\"withdrawal_next_time\":1370112217,\n" + "\"withdrawal_bank_name\":\"WellsFargo XXXXX3102\"\n" + "}\n" + "],\n" + "\"statuses\":[\n" + "{\n" + "\"currency\":\"USD\",\n" + "\"incoming_payments_status\":\"ok\",\n" + "\"outgoing_payments_status\":\"ok\"\n" + "}\n" + "],\n" + "\"action_reasons\":[]\n" + "}\n" + "]\n";
WePayApi api = new WePayApi(key, new FakeDataProvider(response));
lookfirst/WePay-Java-SDK
src/test/java/com/lookfirst/wepay/AccountTest.java
// Path: src/main/java/com/lookfirst/wepay/api/WePayAccount.java // @Data // @EqualsAndHashCode(callSuper=false) // public class WePayAccount extends AccountUri { // private static final long serialVersionUID = 1L; // // /** The name of the account. */ // private String name; // /** The state of the account: active, disabled or deleted. */ // private String state; // /** The account description. */ // private String description; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // private String referenceId; // /** The maximum amount in dollars (including fees) that you can charge for payments to this account. */ // private String paymentLimit; // /** An array of Google Analytics domains associated with the app. */ // private List<String> gaqDomains; // /** The theme object associated with the App (if applicable). */ // private ThemeObject themeObject; // /** Returns "verified" if the account has been verified and "unverified" if it has not. If the account has pending verification, then it is "pending". */ // private String verificationState; // /** If the account is "unverified" then you can send the user to this url to verify their account. */ // private String verificationUrl; // /** The account type. Can be "personal", "nonprofit", or "business". */ // private String type; // /** The unixtime when the account was created. */ // private Long createTime; // /** Array of account balances for each currency. */ // private List<AccountBalance> balances; // /** Array of account incoming and outgoing payments status for each currency. */ // private List<AccountStatus> statuses; // /** Array of action strings explaining all the actions that are required to make this account active. It will be empty if no action is required. */ // private List<String> actionReasons; // /** The account's country of origin 2-letter ISO code (e.g. 'US') */ // private String country; // /** Array of supported currency strings for this account (e.g. ["USD"]). Only "USD" is supported for now. */ // private List<String> currencies; // } // // Path: src/main/java/com/lookfirst/wepay/api/req/AccountFindRequest.java // @Data // @EqualsAndHashCode(callSuper=false) // public class AccountFindRequest extends WePayRequest<List<WePayAccount>> { // // /** The name of the account you are searching for. */ // private String name; // /** The reference ID of the account you are searching for (set by the app in in /account/create or account/modify). */ // private String referenceId; // /** Sort the results of the search by time created. Use 'DESC' for most recent to least recent. Use 'ASC' for least recent to most recent. Defaults to 'DESC'. */ // private SortOrder sortOrder; // // /** */ // @Override // public String getEndpoint() { // return "/account/find"; // } // } // // Path: src/test/java/com/lookfirst/wepay/util/FakeDataProvider.java // @AllArgsConstructor // public class FakeDataProvider implements DataProvider { // @NonNull // final String data; // // @Override // public InputStream getData(String uri, String postJson, String token) throws IOException { // return new ByteArrayInputStream(data.getBytes()); // } // }
import com.lookfirst.wepay.api.WePayAccount; import com.lookfirst.wepay.api.req.AccountFindRequest; import com.lookfirst.wepay.util.FakeDataProvider; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import java.util.List;
"\"type\":\"personal\",\n" + "\"create_time\":1367958263,\n" + "\"country\": \"US\",\n" + "\"currencies\": [\"USD\"],\n" + "\"balances\":[\n" + "{\n" + "\"currency\":\"USD\",\n" + "\"balance\":390.50,\n" + "\"incoming_pending_amount\":635.30,\n" + "\"outgoing_pending_amount\":210.00,\n" + "\"reserved_amount\":0,\n" + "\"disputed_amount\":0,\n" + "\"withdrawal_period\":\"daily\",\n" + "\"withdrawal_next_time\":1370112217,\n" + "\"withdrawal_bank_name\":\"WellsFargo XXXXX3102\"\n" + "}\n" + "],\n" + "\"statuses\":[\n" + "{\n" + "\"currency\":\"USD\",\n" + "\"incoming_payments_status\":\"ok\",\n" + "\"outgoing_payments_status\":\"ok\"\n" + "}\n" + "],\n" + "\"action_reasons\":[]\n" + "}\n" + "]\n"; WePayApi api = new WePayApi(key, new FakeDataProvider(response));
// Path: src/main/java/com/lookfirst/wepay/api/WePayAccount.java // @Data // @EqualsAndHashCode(callSuper=false) // public class WePayAccount extends AccountUri { // private static final long serialVersionUID = 1L; // // /** The name of the account. */ // private String name; // /** The state of the account: active, disabled or deleted. */ // private String state; // /** The account description. */ // private String description; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // private String referenceId; // /** The maximum amount in dollars (including fees) that you can charge for payments to this account. */ // private String paymentLimit; // /** An array of Google Analytics domains associated with the app. */ // private List<String> gaqDomains; // /** The theme object associated with the App (if applicable). */ // private ThemeObject themeObject; // /** Returns "verified" if the account has been verified and "unverified" if it has not. If the account has pending verification, then it is "pending". */ // private String verificationState; // /** If the account is "unverified" then you can send the user to this url to verify their account. */ // private String verificationUrl; // /** The account type. Can be "personal", "nonprofit", or "business". */ // private String type; // /** The unixtime when the account was created. */ // private Long createTime; // /** Array of account balances for each currency. */ // private List<AccountBalance> balances; // /** Array of account incoming and outgoing payments status for each currency. */ // private List<AccountStatus> statuses; // /** Array of action strings explaining all the actions that are required to make this account active. It will be empty if no action is required. */ // private List<String> actionReasons; // /** The account's country of origin 2-letter ISO code (e.g. 'US') */ // private String country; // /** Array of supported currency strings for this account (e.g. ["USD"]). Only "USD" is supported for now. */ // private List<String> currencies; // } // // Path: src/main/java/com/lookfirst/wepay/api/req/AccountFindRequest.java // @Data // @EqualsAndHashCode(callSuper=false) // public class AccountFindRequest extends WePayRequest<List<WePayAccount>> { // // /** The name of the account you are searching for. */ // private String name; // /** The reference ID of the account you are searching for (set by the app in in /account/create or account/modify). */ // private String referenceId; // /** Sort the results of the search by time created. Use 'DESC' for most recent to least recent. Use 'ASC' for least recent to most recent. Defaults to 'DESC'. */ // private SortOrder sortOrder; // // /** */ // @Override // public String getEndpoint() { // return "/account/find"; // } // } // // Path: src/test/java/com/lookfirst/wepay/util/FakeDataProvider.java // @AllArgsConstructor // public class FakeDataProvider implements DataProvider { // @NonNull // final String data; // // @Override // public InputStream getData(String uri, String postJson, String token) throws IOException { // return new ByteArrayInputStream(data.getBytes()); // } // } // Path: src/test/java/com/lookfirst/wepay/AccountTest.java import com.lookfirst.wepay.api.WePayAccount; import com.lookfirst.wepay.api.req.AccountFindRequest; import com.lookfirst.wepay.util.FakeDataProvider; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import java.util.List; "\"type\":\"personal\",\n" + "\"create_time\":1367958263,\n" + "\"country\": \"US\",\n" + "\"currencies\": [\"USD\"],\n" + "\"balances\":[\n" + "{\n" + "\"currency\":\"USD\",\n" + "\"balance\":390.50,\n" + "\"incoming_pending_amount\":635.30,\n" + "\"outgoing_pending_amount\":210.00,\n" + "\"reserved_amount\":0,\n" + "\"disputed_amount\":0,\n" + "\"withdrawal_period\":\"daily\",\n" + "\"withdrawal_next_time\":1370112217,\n" + "\"withdrawal_bank_name\":\"WellsFargo XXXXX3102\"\n" + "}\n" + "],\n" + "\"statuses\":[\n" + "{\n" + "\"currency\":\"USD\",\n" + "\"incoming_payments_status\":\"ok\",\n" + "\"outgoing_payments_status\":\"ok\"\n" + "}\n" + "],\n" + "\"action_reasons\":[]\n" + "}\n" + "]\n"; WePayApi api = new WePayApi(key, new FakeDataProvider(response));
AccountFindRequest find = new AccountFindRequest();
lookfirst/WePay-Java-SDK
src/test/java/com/lookfirst/wepay/AccountTest.java
// Path: src/main/java/com/lookfirst/wepay/api/WePayAccount.java // @Data // @EqualsAndHashCode(callSuper=false) // public class WePayAccount extends AccountUri { // private static final long serialVersionUID = 1L; // // /** The name of the account. */ // private String name; // /** The state of the account: active, disabled or deleted. */ // private String state; // /** The account description. */ // private String description; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // private String referenceId; // /** The maximum amount in dollars (including fees) that you can charge for payments to this account. */ // private String paymentLimit; // /** An array of Google Analytics domains associated with the app. */ // private List<String> gaqDomains; // /** The theme object associated with the App (if applicable). */ // private ThemeObject themeObject; // /** Returns "verified" if the account has been verified and "unverified" if it has not. If the account has pending verification, then it is "pending". */ // private String verificationState; // /** If the account is "unverified" then you can send the user to this url to verify their account. */ // private String verificationUrl; // /** The account type. Can be "personal", "nonprofit", or "business". */ // private String type; // /** The unixtime when the account was created. */ // private Long createTime; // /** Array of account balances for each currency. */ // private List<AccountBalance> balances; // /** Array of account incoming and outgoing payments status for each currency. */ // private List<AccountStatus> statuses; // /** Array of action strings explaining all the actions that are required to make this account active. It will be empty if no action is required. */ // private List<String> actionReasons; // /** The account's country of origin 2-letter ISO code (e.g. 'US') */ // private String country; // /** Array of supported currency strings for this account (e.g. ["USD"]). Only "USD" is supported for now. */ // private List<String> currencies; // } // // Path: src/main/java/com/lookfirst/wepay/api/req/AccountFindRequest.java // @Data // @EqualsAndHashCode(callSuper=false) // public class AccountFindRequest extends WePayRequest<List<WePayAccount>> { // // /** The name of the account you are searching for. */ // private String name; // /** The reference ID of the account you are searching for (set by the app in in /account/create or account/modify). */ // private String referenceId; // /** Sort the results of the search by time created. Use 'DESC' for most recent to least recent. Use 'ASC' for least recent to most recent. Defaults to 'DESC'. */ // private SortOrder sortOrder; // // /** */ // @Override // public String getEndpoint() { // return "/account/find"; // } // } // // Path: src/test/java/com/lookfirst/wepay/util/FakeDataProvider.java // @AllArgsConstructor // public class FakeDataProvider implements DataProvider { // @NonNull // final String data; // // @Override // public InputStream getData(String uri, String postJson, String token) throws IOException { // return new ByteArrayInputStream(data.getBytes()); // } // }
import com.lookfirst.wepay.api.WePayAccount; import com.lookfirst.wepay.api.req.AccountFindRequest; import com.lookfirst.wepay.util.FakeDataProvider; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import java.util.List;
"\"create_time\":1367958263,\n" + "\"country\": \"US\",\n" + "\"currencies\": [\"USD\"],\n" + "\"balances\":[\n" + "{\n" + "\"currency\":\"USD\",\n" + "\"balance\":390.50,\n" + "\"incoming_pending_amount\":635.30,\n" + "\"outgoing_pending_amount\":210.00,\n" + "\"reserved_amount\":0,\n" + "\"disputed_amount\":0,\n" + "\"withdrawal_period\":\"daily\",\n" + "\"withdrawal_next_time\":1370112217,\n" + "\"withdrawal_bank_name\":\"WellsFargo XXXXX3102\"\n" + "}\n" + "],\n" + "\"statuses\":[\n" + "{\n" + "\"currency\":\"USD\",\n" + "\"incoming_payments_status\":\"ok\",\n" + "\"outgoing_payments_status\":\"ok\"\n" + "}\n" + "],\n" + "\"action_reasons\":[]\n" + "}\n" + "]\n"; WePayApi api = new WePayApi(key, new FakeDataProvider(response)); AccountFindRequest find = new AccountFindRequest();
// Path: src/main/java/com/lookfirst/wepay/api/WePayAccount.java // @Data // @EqualsAndHashCode(callSuper=false) // public class WePayAccount extends AccountUri { // private static final long serialVersionUID = 1L; // // /** The name of the account. */ // private String name; // /** The state of the account: active, disabled or deleted. */ // private String state; // /** The account description. */ // private String description; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // private String referenceId; // /** The maximum amount in dollars (including fees) that you can charge for payments to this account. */ // private String paymentLimit; // /** An array of Google Analytics domains associated with the app. */ // private List<String> gaqDomains; // /** The theme object associated with the App (if applicable). */ // private ThemeObject themeObject; // /** Returns "verified" if the account has been verified and "unverified" if it has not. If the account has pending verification, then it is "pending". */ // private String verificationState; // /** If the account is "unverified" then you can send the user to this url to verify their account. */ // private String verificationUrl; // /** The account type. Can be "personal", "nonprofit", or "business". */ // private String type; // /** The unixtime when the account was created. */ // private Long createTime; // /** Array of account balances for each currency. */ // private List<AccountBalance> balances; // /** Array of account incoming and outgoing payments status for each currency. */ // private List<AccountStatus> statuses; // /** Array of action strings explaining all the actions that are required to make this account active. It will be empty if no action is required. */ // private List<String> actionReasons; // /** The account's country of origin 2-letter ISO code (e.g. 'US') */ // private String country; // /** Array of supported currency strings for this account (e.g. ["USD"]). Only "USD" is supported for now. */ // private List<String> currencies; // } // // Path: src/main/java/com/lookfirst/wepay/api/req/AccountFindRequest.java // @Data // @EqualsAndHashCode(callSuper=false) // public class AccountFindRequest extends WePayRequest<List<WePayAccount>> { // // /** The name of the account you are searching for. */ // private String name; // /** The reference ID of the account you are searching for (set by the app in in /account/create or account/modify). */ // private String referenceId; // /** Sort the results of the search by time created. Use 'DESC' for most recent to least recent. Use 'ASC' for least recent to most recent. Defaults to 'DESC'. */ // private SortOrder sortOrder; // // /** */ // @Override // public String getEndpoint() { // return "/account/find"; // } // } // // Path: src/test/java/com/lookfirst/wepay/util/FakeDataProvider.java // @AllArgsConstructor // public class FakeDataProvider implements DataProvider { // @NonNull // final String data; // // @Override // public InputStream getData(String uri, String postJson, String token) throws IOException { // return new ByteArrayInputStream(data.getBytes()); // } // } // Path: src/test/java/com/lookfirst/wepay/AccountTest.java import com.lookfirst.wepay.api.WePayAccount; import com.lookfirst.wepay.api.req.AccountFindRequest; import com.lookfirst.wepay.util.FakeDataProvider; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import java.util.List; "\"create_time\":1367958263,\n" + "\"country\": \"US\",\n" + "\"currencies\": [\"USD\"],\n" + "\"balances\":[\n" + "{\n" + "\"currency\":\"USD\",\n" + "\"balance\":390.50,\n" + "\"incoming_pending_amount\":635.30,\n" + "\"outgoing_pending_amount\":210.00,\n" + "\"reserved_amount\":0,\n" + "\"disputed_amount\":0,\n" + "\"withdrawal_period\":\"daily\",\n" + "\"withdrawal_next_time\":1370112217,\n" + "\"withdrawal_bank_name\":\"WellsFargo XXXXX3102\"\n" + "}\n" + "],\n" + "\"statuses\":[\n" + "{\n" + "\"currency\":\"USD\",\n" + "\"incoming_payments_status\":\"ok\",\n" + "\"outgoing_payments_status\":\"ok\"\n" + "}\n" + "],\n" + "\"action_reasons\":[]\n" + "}\n" + "]\n"; WePayApi api = new WePayApi(key, new FakeDataProvider(response)); AccountFindRequest find = new AccountFindRequest();
List<WePayAccount> accounts = api.execute("token", find);
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/AccountGetTaxRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/AccountTax.java // @Data // public class AccountTax implements Serializable { // private static final long serialVersionUID = 1L; // // /** The tax tables for the account. */ // private String taxes; // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.AccountTax;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * This call lets you get the tax rates for an account. They will be in the same format as detailed in the /account/set_tax call. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Deprecated @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/AccountTax.java // @Data // public class AccountTax implements Serializable { // private static final long serialVersionUID = 1L; // // /** The tax tables for the account. */ // private String taxes; // } // Path: src/main/java/com/lookfirst/wepay/api/req/AccountGetTaxRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.AccountTax; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * This call lets you get the tax rates for an account. They will be in the same format as detailed in the /account/set_tax call. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Deprecated @Data @EqualsAndHashCode(callSuper=false)
public class AccountGetTaxRequest extends WePayRequest<AccountTax> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/UserRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/WePayUser.java // @Data // public class WePayUser implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the user. */ // private String userId; // /** The first name of the user */ // private String firstName; // /** The last name of the user */ // private String lastName; // /** The email of the user */ // private String email; // /** Either "registered" if the user has registered, or "pending" if the user still needs to confirm their registration */ // private String state; // // /** Either "registered" if the user has registered, or "pending" if the user still needs to confirm their registration */ // public boolean isRegistered() { // return state != null && state.equals("registered"); // } // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.WePayUser;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/user * * This call allows you to lookup the details of the user associated with the access token you are using to make the call. * * There are no arguments necessary for this call. Only an access token is required. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/WePayUser.java // @Data // public class WePayUser implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the user. */ // private String userId; // /** The first name of the user */ // private String firstName; // /** The last name of the user */ // private String lastName; // /** The email of the user */ // private String email; // /** Either "registered" if the user has registered, or "pending" if the user still needs to confirm their registration */ // private String state; // // /** Either "registered" if the user has registered, or "pending" if the user still needs to confirm their registration */ // public boolean isRegistered() { // return state != null && state.equals("registered"); // } // } // Path: src/main/java/com/lookfirst/wepay/api/req/UserRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.WePayUser; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/user * * This call allows you to lookup the details of the user associated with the access token you are using to make the call. * * There are no arguments necessary for this call. Only an access token is required. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class UserRequest extends WePayRequest<WePayUser> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/CheckoutCancelRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/CheckoutState.java // @Data // @EqualsAndHashCode(callSuper=true) // public class CheckoutState extends CheckoutId { // private static final long serialVersionUID = 1L; // // /** The state the payment is in. See the IPN section for a list of payment states. */ // private State state; // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.CheckoutState;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/checkout * * Cancels the payment associated with the checkout created by the application. Checkout must be in "new" or "authorized" state. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/CheckoutState.java // @Data // @EqualsAndHashCode(callSuper=true) // public class CheckoutState extends CheckoutId { // private static final long serialVersionUID = 1L; // // /** The state the payment is in. See the IPN section for a list of payment states. */ // private State state; // } // Path: src/main/java/com/lookfirst/wepay/api/req/CheckoutCancelRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.CheckoutState; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/checkout * * Cancels the payment associated with the checkout created by the application. Checkout must be in "new" or "authorized" state. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class CheckoutCancelRequest extends WePayRequest<CheckoutState> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/AccountModifyRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/AccountUri.java // @Data // @EqualsAndHashCode(callSuper=true) // public class AccountUri extends AccountId { // private static final long serialVersionUID = 1L; // // /** The URI to add or update info for the specified account id. Do not store the returned URI on your side as it can change. */ // private String uri; // } // // Path: src/main/java/com/lookfirst/wepay/api/ThemeObject.java // @Data // public class ThemeObject implements Serializable { // private static final long serialVersionUID = 1L; // // /** Sets a name for the theme */ // public String name; // /** Sets colors on important elements such as headers */ // public String primaryColor; // /** Sets colors on secondary elements such as info boxes, and the focus styles on text inputs */ // public String secondaryColor; // /** Sets the background color for the page frame on onsite pages, and the iframe background on iframe checkouts */ // public String backgroundColor; // /** Sets the color on primary action buttons */ // public String buttonColor; // }
import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.AccountUri; import com.lookfirst.wepay.api.ThemeObject;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * Updates the specified properties. If reference_id is passed it MUST be unique for the user/application pair. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/AccountUri.java // @Data // @EqualsAndHashCode(callSuper=true) // public class AccountUri extends AccountId { // private static final long serialVersionUID = 1L; // // /** The URI to add or update info for the specified account id. Do not store the returned URI on your side as it can change. */ // private String uri; // } // // Path: src/main/java/com/lookfirst/wepay/api/ThemeObject.java // @Data // public class ThemeObject implements Serializable { // private static final long serialVersionUID = 1L; // // /** Sets a name for the theme */ // public String name; // /** Sets colors on important elements such as headers */ // public String primaryColor; // /** Sets colors on secondary elements such as info boxes, and the focus styles on text inputs */ // public String secondaryColor; // /** Sets the background color for the page frame on onsite pages, and the iframe background on iframe checkouts */ // public String backgroundColor; // /** Sets the color on primary action buttons */ // public String buttonColor; // } // Path: src/main/java/com/lookfirst/wepay/api/req/AccountModifyRequest.java import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.AccountUri; import com.lookfirst.wepay.api.ThemeObject; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * Updates the specified properties. If reference_id is passed it MUST be unique for the user/application pair. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class AccountModifyRequest extends WePayRequest<AccountUri> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/AccountModifyRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/AccountUri.java // @Data // @EqualsAndHashCode(callSuper=true) // public class AccountUri extends AccountId { // private static final long serialVersionUID = 1L; // // /** The URI to add or update info for the specified account id. Do not store the returned URI on your side as it can change. */ // private String uri; // } // // Path: src/main/java/com/lookfirst/wepay/api/ThemeObject.java // @Data // public class ThemeObject implements Serializable { // private static final long serialVersionUID = 1L; // // /** Sets a name for the theme */ // public String name; // /** Sets colors on important elements such as headers */ // public String primaryColor; // /** Sets colors on secondary elements such as info boxes, and the focus styles on text inputs */ // public String secondaryColor; // /** Sets the background color for the page frame on onsite pages, and the iframe background on iframe checkouts */ // public String backgroundColor; // /** Sets the color on primary action buttons */ // public String buttonColor; // }
import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.AccountUri; import com.lookfirst.wepay.api.ThemeObject;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * Updates the specified properties. If reference_id is passed it MUST be unique for the user/application pair. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class AccountModifyRequest extends WePayRequest<AccountUri> { /** The unique ID of the account you want to modify. */ private Long accountId; /** The name of the account you want to modify. */ private String name; /** The description of the account you want to modify. */ private String description; /** The reference id of the account. Can be any integer, but must be unique for the application/user pair. */ private String referenceId; /** The uri for an image that you want to use for the accounts icon. This image will be used in the co-branded checkout process. */ private String imageUri; /** The list of Google Analytics account ids that WePay will throw events to and use for tracking. */ private List<String> gaqDomains; /** The theme object you want to be used for account's checkout flows, withdrawal flows, and emails */
// Path: src/main/java/com/lookfirst/wepay/api/AccountUri.java // @Data // @EqualsAndHashCode(callSuper=true) // public class AccountUri extends AccountId { // private static final long serialVersionUID = 1L; // // /** The URI to add or update info for the specified account id. Do not store the returned URI on your side as it can change. */ // private String uri; // } // // Path: src/main/java/com/lookfirst/wepay/api/ThemeObject.java // @Data // public class ThemeObject implements Serializable { // private static final long serialVersionUID = 1L; // // /** Sets a name for the theme */ // public String name; // /** Sets colors on important elements such as headers */ // public String primaryColor; // /** Sets colors on secondary elements such as info boxes, and the focus styles on text inputs */ // public String secondaryColor; // /** Sets the background color for the page frame on onsite pages, and the iframe background on iframe checkouts */ // public String backgroundColor; // /** Sets the color on primary action buttons */ // public String buttonColor; // } // Path: src/main/java/com/lookfirst/wepay/api/req/AccountModifyRequest.java import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.AccountUri; import com.lookfirst.wepay.api.ThemeObject; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * Updates the specified properties. If reference_id is passed it MUST be unique for the user/application pair. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class AccountModifyRequest extends WePayRequest<AccountUri> { /** The unique ID of the account you want to modify. */ private Long accountId; /** The name of the account you want to modify. */ private String name; /** The description of the account you want to modify. */ private String description; /** The reference id of the account. Can be any integer, but must be unique for the application/user pair. */ private String referenceId; /** The uri for an image that you want to use for the accounts icon. This image will be used in the co-branded checkout process. */ private String imageUri; /** The list of Google Analytics account ids that WePay will throw events to and use for tracking. */ private List<String> gaqDomains; /** The theme object you want to be used for account's checkout flows, withdrawal flows, and emails */
private ThemeObject themeObject;
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/PreapprovalFindRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/Preapproval.java // @Data // public class Preapproval implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the preapproval. */ // private Long preapprovalId; // /** The uri that you send the user to so they can enter their payment info and approve the preapproval. */ // private String preapprovalUri; // /** A uri that you can send the user to if they need to update their payment method. */ // private String manageUri; // /** The unique ID of the WePay account where the money will go. */ // private Long accountId; // // /** A short description of what the payer is being charged for. */ // private String shortDescription; // /** A longer description of what the payer is being charged for (if set). */ // private String longDescription; // // /** The currency that any charges will take place in (for now always USD). */ // private String currency; // /** The amount in dollars that the application can charge the payer automatically every period. */ // private BigDecimal amount; // /** Who is paying the fee (either "payer" for the person paying, "payee" for the person receiving the money, "payer_from_app" if payer is paying for app fee and the app is paying WePay fees, or "payee_from_app" if payee is paying for app fee and app is paying for WePay fees). */ // private FeePayer feePayer; // /** The state that the preapproval is in. See the object states page for the full list. */ // private State state; // /** The uri that the payer will be redirected to after approving the preapproval. */ // private String redirectUri; // /** The fee that will go to the API application's account (if set). Limited to 20% of the preapproval amount. */ // private BigDecimal appFee; // /** How often the API application can execute payments for a payer with this preapproval. Can be: hourly, daily, weekly, biweekly, monthly, bimonthly, quarterly, yearly, and once. Once period is if you only want to get authorization for a future charge and don't need it to be recurring. */ // private String period; // /** The number of times the API application can execute payments per period. */ // private Integer frequency; // /** When the API application can begin executing payments with this preapproval. Will be a unix timestamp. */ // private Long startTime; // /** The last time that the API application can execute a payment with this preapproval. Will be a unix timestamp. */ // private Long endTime; // /** The reference_id passed by the application (if set). */ // private String referenceId; // /** The uri which instant payment notifications will be sent to. */ // private String callbackUri; // /** The shipping address that the payer entered (if applicable). It will be in the following format: // // US Addresses: // {"address1":"380 Portage Ave","address2":"","city":"Palo Alto","state":"CA","zip":"94306","country":"US"}. // // Non-US Addresses: // {"address1":"100 Main St","address2":"","city":"Toronto","region":"ON","postcode":"M4E 1Z5","country":"CA"} // // Use ISO 3166-1 codes when specifying the country. // */ // private ShippingAddress address; // /** The amount that was paid in shipping fees (if any). */ // private BigDecimal shippingFee; // /** The dollar amount of taxes paid (if any). */ // private BigDecimal tax; // /** Whether or not the preapproval automatically executes the payments every period. */ // private boolean autoRecur; // /** The name of the payer. */ // private String payerName; // /** The email of the payer. */ // private String payeeEmail; // /** The unixtime when the preapproval was created. */ // private Long createTime; // /** The unixtime of the next scheduled charge +/- 5 minutes (will only show up for approved auto_recur preapprovals). */ // private Long nextDueTime; // /** The checkout ID of the last successful checkout (state captured) for the preapproval. */ // private Long lastCheckoutId; // /** The unixtime when the last successful checkout occurred. */ // private Long lastCheckoutTime; // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum SortOrder { ASC, DESC } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum State { // action_required { // @Override // public String toString() { return "action required"; } // }, // active, // approved, // authorized, // available, // cancelled, // captured, // charged_back { // @Override // public String toString() { return "charged back"; } // }, // completed, // deleted, // disabled, // ended, // expired, // failed, // invalid, // new_ { // @Override // public String toString() { return "new"; } // }, // pending, // refunded, // registered, // reserved, // retrying, // revoked, // settled, // started, // stopped, // transition, // trial // }
import java.math.BigDecimal; import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Preapproval; import com.lookfirst.wepay.api.Constants.SortOrder; import com.lookfirst.wepay.api.Constants.State;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/preapproval * * This call lets you search the preapprovals associated with an account or an application. * If account_id is blank, then the response will be all preapprovals for the application. * Otherwise, it will be specifically for that account. You can search by state and/or reference_id, * and the response will be an array of all the matching preapprovals. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/Preapproval.java // @Data // public class Preapproval implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the preapproval. */ // private Long preapprovalId; // /** The uri that you send the user to so they can enter their payment info and approve the preapproval. */ // private String preapprovalUri; // /** A uri that you can send the user to if they need to update their payment method. */ // private String manageUri; // /** The unique ID of the WePay account where the money will go. */ // private Long accountId; // // /** A short description of what the payer is being charged for. */ // private String shortDescription; // /** A longer description of what the payer is being charged for (if set). */ // private String longDescription; // // /** The currency that any charges will take place in (for now always USD). */ // private String currency; // /** The amount in dollars that the application can charge the payer automatically every period. */ // private BigDecimal amount; // /** Who is paying the fee (either "payer" for the person paying, "payee" for the person receiving the money, "payer_from_app" if payer is paying for app fee and the app is paying WePay fees, or "payee_from_app" if payee is paying for app fee and app is paying for WePay fees). */ // private FeePayer feePayer; // /** The state that the preapproval is in. See the object states page for the full list. */ // private State state; // /** The uri that the payer will be redirected to after approving the preapproval. */ // private String redirectUri; // /** The fee that will go to the API application's account (if set). Limited to 20% of the preapproval amount. */ // private BigDecimal appFee; // /** How often the API application can execute payments for a payer with this preapproval. Can be: hourly, daily, weekly, biweekly, monthly, bimonthly, quarterly, yearly, and once. Once period is if you only want to get authorization for a future charge and don't need it to be recurring. */ // private String period; // /** The number of times the API application can execute payments per period. */ // private Integer frequency; // /** When the API application can begin executing payments with this preapproval. Will be a unix timestamp. */ // private Long startTime; // /** The last time that the API application can execute a payment with this preapproval. Will be a unix timestamp. */ // private Long endTime; // /** The reference_id passed by the application (if set). */ // private String referenceId; // /** The uri which instant payment notifications will be sent to. */ // private String callbackUri; // /** The shipping address that the payer entered (if applicable). It will be in the following format: // // US Addresses: // {"address1":"380 Portage Ave","address2":"","city":"Palo Alto","state":"CA","zip":"94306","country":"US"}. // // Non-US Addresses: // {"address1":"100 Main St","address2":"","city":"Toronto","region":"ON","postcode":"M4E 1Z5","country":"CA"} // // Use ISO 3166-1 codes when specifying the country. // */ // private ShippingAddress address; // /** The amount that was paid in shipping fees (if any). */ // private BigDecimal shippingFee; // /** The dollar amount of taxes paid (if any). */ // private BigDecimal tax; // /** Whether or not the preapproval automatically executes the payments every period. */ // private boolean autoRecur; // /** The name of the payer. */ // private String payerName; // /** The email of the payer. */ // private String payeeEmail; // /** The unixtime when the preapproval was created. */ // private Long createTime; // /** The unixtime of the next scheduled charge +/- 5 minutes (will only show up for approved auto_recur preapprovals). */ // private Long nextDueTime; // /** The checkout ID of the last successful checkout (state captured) for the preapproval. */ // private Long lastCheckoutId; // /** The unixtime when the last successful checkout occurred. */ // private Long lastCheckoutTime; // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum SortOrder { ASC, DESC } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum State { // action_required { // @Override // public String toString() { return "action required"; } // }, // active, // approved, // authorized, // available, // cancelled, // captured, // charged_back { // @Override // public String toString() { return "charged back"; } // }, // completed, // deleted, // disabled, // ended, // expired, // failed, // invalid, // new_ { // @Override // public String toString() { return "new"; } // }, // pending, // refunded, // registered, // reserved, // retrying, // revoked, // settled, // started, // stopped, // transition, // trial // } // Path: src/main/java/com/lookfirst/wepay/api/req/PreapprovalFindRequest.java import java.math.BigDecimal; import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Preapproval; import com.lookfirst.wepay.api.Constants.SortOrder; import com.lookfirst.wepay.api.Constants.State; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/preapproval * * This call lets you search the preapprovals associated with an account or an application. * If account_id is blank, then the response will be all preapprovals for the application. * Otherwise, it will be specifically for that account. You can search by state and/or reference_id, * and the response will be an array of all the matching preapprovals. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class PreapprovalFindRequest extends WePayRequest<Preapproval> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/PreapprovalFindRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/Preapproval.java // @Data // public class Preapproval implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the preapproval. */ // private Long preapprovalId; // /** The uri that you send the user to so they can enter their payment info and approve the preapproval. */ // private String preapprovalUri; // /** A uri that you can send the user to if they need to update their payment method. */ // private String manageUri; // /** The unique ID of the WePay account where the money will go. */ // private Long accountId; // // /** A short description of what the payer is being charged for. */ // private String shortDescription; // /** A longer description of what the payer is being charged for (if set). */ // private String longDescription; // // /** The currency that any charges will take place in (for now always USD). */ // private String currency; // /** The amount in dollars that the application can charge the payer automatically every period. */ // private BigDecimal amount; // /** Who is paying the fee (either "payer" for the person paying, "payee" for the person receiving the money, "payer_from_app" if payer is paying for app fee and the app is paying WePay fees, or "payee_from_app" if payee is paying for app fee and app is paying for WePay fees). */ // private FeePayer feePayer; // /** The state that the preapproval is in. See the object states page for the full list. */ // private State state; // /** The uri that the payer will be redirected to after approving the preapproval. */ // private String redirectUri; // /** The fee that will go to the API application's account (if set). Limited to 20% of the preapproval amount. */ // private BigDecimal appFee; // /** How often the API application can execute payments for a payer with this preapproval. Can be: hourly, daily, weekly, biweekly, monthly, bimonthly, quarterly, yearly, and once. Once period is if you only want to get authorization for a future charge and don't need it to be recurring. */ // private String period; // /** The number of times the API application can execute payments per period. */ // private Integer frequency; // /** When the API application can begin executing payments with this preapproval. Will be a unix timestamp. */ // private Long startTime; // /** The last time that the API application can execute a payment with this preapproval. Will be a unix timestamp. */ // private Long endTime; // /** The reference_id passed by the application (if set). */ // private String referenceId; // /** The uri which instant payment notifications will be sent to. */ // private String callbackUri; // /** The shipping address that the payer entered (if applicable). It will be in the following format: // // US Addresses: // {"address1":"380 Portage Ave","address2":"","city":"Palo Alto","state":"CA","zip":"94306","country":"US"}. // // Non-US Addresses: // {"address1":"100 Main St","address2":"","city":"Toronto","region":"ON","postcode":"M4E 1Z5","country":"CA"} // // Use ISO 3166-1 codes when specifying the country. // */ // private ShippingAddress address; // /** The amount that was paid in shipping fees (if any). */ // private BigDecimal shippingFee; // /** The dollar amount of taxes paid (if any). */ // private BigDecimal tax; // /** Whether or not the preapproval automatically executes the payments every period. */ // private boolean autoRecur; // /** The name of the payer. */ // private String payerName; // /** The email of the payer. */ // private String payeeEmail; // /** The unixtime when the preapproval was created. */ // private Long createTime; // /** The unixtime of the next scheduled charge +/- 5 minutes (will only show up for approved auto_recur preapprovals). */ // private Long nextDueTime; // /** The checkout ID of the last successful checkout (state captured) for the preapproval. */ // private Long lastCheckoutId; // /** The unixtime when the last successful checkout occurred. */ // private Long lastCheckoutTime; // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum SortOrder { ASC, DESC } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum State { // action_required { // @Override // public String toString() { return "action required"; } // }, // active, // approved, // authorized, // available, // cancelled, // captured, // charged_back { // @Override // public String toString() { return "charged back"; } // }, // completed, // deleted, // disabled, // ended, // expired, // failed, // invalid, // new_ { // @Override // public String toString() { return "new"; } // }, // pending, // refunded, // registered, // reserved, // retrying, // revoked, // settled, // started, // stopped, // transition, // trial // }
import java.math.BigDecimal; import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Preapproval; import com.lookfirst.wepay.api.Constants.SortOrder; import com.lookfirst.wepay.api.Constants.State;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/preapproval * * This call lets you search the preapprovals associated with an account or an application. * If account_id is blank, then the response will be all preapprovals for the application. * Otherwise, it will be specifically for that account. You can search by state and/or reference_id, * and the response will be an array of all the matching preapprovals. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class PreapprovalFindRequest extends WePayRequest<Preapproval> { /** The unique ID of the account whose preapprovals you are searching. If empty, then the response will be all preapprovals for the application. */ private Long accountId; /** The state of the preapproval you are searching for. */
// Path: src/main/java/com/lookfirst/wepay/api/Preapproval.java // @Data // public class Preapproval implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the preapproval. */ // private Long preapprovalId; // /** The uri that you send the user to so they can enter their payment info and approve the preapproval. */ // private String preapprovalUri; // /** A uri that you can send the user to if they need to update their payment method. */ // private String manageUri; // /** The unique ID of the WePay account where the money will go. */ // private Long accountId; // // /** A short description of what the payer is being charged for. */ // private String shortDescription; // /** A longer description of what the payer is being charged for (if set). */ // private String longDescription; // // /** The currency that any charges will take place in (for now always USD). */ // private String currency; // /** The amount in dollars that the application can charge the payer automatically every period. */ // private BigDecimal amount; // /** Who is paying the fee (either "payer" for the person paying, "payee" for the person receiving the money, "payer_from_app" if payer is paying for app fee and the app is paying WePay fees, or "payee_from_app" if payee is paying for app fee and app is paying for WePay fees). */ // private FeePayer feePayer; // /** The state that the preapproval is in. See the object states page for the full list. */ // private State state; // /** The uri that the payer will be redirected to after approving the preapproval. */ // private String redirectUri; // /** The fee that will go to the API application's account (if set). Limited to 20% of the preapproval amount. */ // private BigDecimal appFee; // /** How often the API application can execute payments for a payer with this preapproval. Can be: hourly, daily, weekly, biweekly, monthly, bimonthly, quarterly, yearly, and once. Once period is if you only want to get authorization for a future charge and don't need it to be recurring. */ // private String period; // /** The number of times the API application can execute payments per period. */ // private Integer frequency; // /** When the API application can begin executing payments with this preapproval. Will be a unix timestamp. */ // private Long startTime; // /** The last time that the API application can execute a payment with this preapproval. Will be a unix timestamp. */ // private Long endTime; // /** The reference_id passed by the application (if set). */ // private String referenceId; // /** The uri which instant payment notifications will be sent to. */ // private String callbackUri; // /** The shipping address that the payer entered (if applicable). It will be in the following format: // // US Addresses: // {"address1":"380 Portage Ave","address2":"","city":"Palo Alto","state":"CA","zip":"94306","country":"US"}. // // Non-US Addresses: // {"address1":"100 Main St","address2":"","city":"Toronto","region":"ON","postcode":"M4E 1Z5","country":"CA"} // // Use ISO 3166-1 codes when specifying the country. // */ // private ShippingAddress address; // /** The amount that was paid in shipping fees (if any). */ // private BigDecimal shippingFee; // /** The dollar amount of taxes paid (if any). */ // private BigDecimal tax; // /** Whether or not the preapproval automatically executes the payments every period. */ // private boolean autoRecur; // /** The name of the payer. */ // private String payerName; // /** The email of the payer. */ // private String payeeEmail; // /** The unixtime when the preapproval was created. */ // private Long createTime; // /** The unixtime of the next scheduled charge +/- 5 minutes (will only show up for approved auto_recur preapprovals). */ // private Long nextDueTime; // /** The checkout ID of the last successful checkout (state captured) for the preapproval. */ // private Long lastCheckoutId; // /** The unixtime when the last successful checkout occurred. */ // private Long lastCheckoutTime; // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum SortOrder { ASC, DESC } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum State { // action_required { // @Override // public String toString() { return "action required"; } // }, // active, // approved, // authorized, // available, // cancelled, // captured, // charged_back { // @Override // public String toString() { return "charged back"; } // }, // completed, // deleted, // disabled, // ended, // expired, // failed, // invalid, // new_ { // @Override // public String toString() { return "new"; } // }, // pending, // refunded, // registered, // reserved, // retrying, // revoked, // settled, // started, // stopped, // transition, // trial // } // Path: src/main/java/com/lookfirst/wepay/api/req/PreapprovalFindRequest.java import java.math.BigDecimal; import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Preapproval; import com.lookfirst.wepay.api.Constants.SortOrder; import com.lookfirst.wepay.api.Constants.State; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/preapproval * * This call lets you search the preapprovals associated with an account or an application. * If account_id is blank, then the response will be all preapprovals for the application. * Otherwise, it will be specifically for that account. You can search by state and/or reference_id, * and the response will be an array of all the matching preapprovals. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class PreapprovalFindRequest extends WePayRequest<Preapproval> { /** The unique ID of the account whose preapprovals you are searching. If empty, then the response will be all preapprovals for the application. */ private Long accountId; /** The state of the preapproval you are searching for. */
private State state;
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/CreditCardDeleteRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/CreditCard.java // @Data // public class CreditCard implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the credit_card. */ // public String creditCardId; // /** The string that identifies the credit_card such as MasterCard xxxxxx4769. */ // public String creditCardName; // /** The state that the credit card is in. */ // public String state; // /** The name on the card (ie "Bob Smith"). */ // public String userName; // /** The email address of the user who owns the card. */ // public String email; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // public String referenceId; // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.CreditCard;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/credit_card * * Delete the credit card when you don't need it anymore. Note that you won't be able to use this card to make payments any more. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/CreditCard.java // @Data // public class CreditCard implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the credit_card. */ // public String creditCardId; // /** The string that identifies the credit_card such as MasterCard xxxxxx4769. */ // public String creditCardName; // /** The state that the credit card is in. */ // public String state; // /** The name on the card (ie "Bob Smith"). */ // public String userName; // /** The email address of the user who owns the card. */ // public String email; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // public String referenceId; // } // Path: src/main/java/com/lookfirst/wepay/api/req/CreditCardDeleteRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.CreditCard; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/credit_card * * Delete the credit card when you don't need it anymore. Note that you won't be able to use this card to make payments any more. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class CreditCardDeleteRequest extends WePayRequest<CreditCard> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/AccountSetTaxRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/AccountTax.java // @Data // public class AccountTax implements Serializable { // private static final long serialVersionUID = 1L; // // /** The tax tables for the account. */ // private String taxes; // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.AccountTax;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * This call lets you set tax rates for an account that will be applied to checkouts created for this account. * Taxes are only applied on a checkout if the "charge_tax" parameter is set to true when the checkout is created. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Deprecated @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/AccountTax.java // @Data // public class AccountTax implements Serializable { // private static final long serialVersionUID = 1L; // // /** The tax tables for the account. */ // private String taxes; // } // Path: src/main/java/com/lookfirst/wepay/api/req/AccountSetTaxRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.AccountTax; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * This call lets you set tax rates for an account that will be applied to checkouts created for this account. * Taxes are only applied on a checkout if the "charge_tax" parameter is set to true when the checkout is created. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Deprecated @Data @EqualsAndHashCode(callSuper=false)
public class AccountSetTaxRequest extends WePayRequest<AccountTax> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/PreapprovalCancelRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/Preapproval.java // @Data // public class Preapproval implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the preapproval. */ // private Long preapprovalId; // /** The uri that you send the user to so they can enter their payment info and approve the preapproval. */ // private String preapprovalUri; // /** A uri that you can send the user to if they need to update their payment method. */ // private String manageUri; // /** The unique ID of the WePay account where the money will go. */ // private Long accountId; // // /** A short description of what the payer is being charged for. */ // private String shortDescription; // /** A longer description of what the payer is being charged for (if set). */ // private String longDescription; // // /** The currency that any charges will take place in (for now always USD). */ // private String currency; // /** The amount in dollars that the application can charge the payer automatically every period. */ // private BigDecimal amount; // /** Who is paying the fee (either "payer" for the person paying, "payee" for the person receiving the money, "payer_from_app" if payer is paying for app fee and the app is paying WePay fees, or "payee_from_app" if payee is paying for app fee and app is paying for WePay fees). */ // private FeePayer feePayer; // /** The state that the preapproval is in. See the object states page for the full list. */ // private State state; // /** The uri that the payer will be redirected to after approving the preapproval. */ // private String redirectUri; // /** The fee that will go to the API application's account (if set). Limited to 20% of the preapproval amount. */ // private BigDecimal appFee; // /** How often the API application can execute payments for a payer with this preapproval. Can be: hourly, daily, weekly, biweekly, monthly, bimonthly, quarterly, yearly, and once. Once period is if you only want to get authorization for a future charge and don't need it to be recurring. */ // private String period; // /** The number of times the API application can execute payments per period. */ // private Integer frequency; // /** When the API application can begin executing payments with this preapproval. Will be a unix timestamp. */ // private Long startTime; // /** The last time that the API application can execute a payment with this preapproval. Will be a unix timestamp. */ // private Long endTime; // /** The reference_id passed by the application (if set). */ // private String referenceId; // /** The uri which instant payment notifications will be sent to. */ // private String callbackUri; // /** The shipping address that the payer entered (if applicable). It will be in the following format: // // US Addresses: // {"address1":"380 Portage Ave","address2":"","city":"Palo Alto","state":"CA","zip":"94306","country":"US"}. // // Non-US Addresses: // {"address1":"100 Main St","address2":"","city":"Toronto","region":"ON","postcode":"M4E 1Z5","country":"CA"} // // Use ISO 3166-1 codes when specifying the country. // */ // private ShippingAddress address; // /** The amount that was paid in shipping fees (if any). */ // private BigDecimal shippingFee; // /** The dollar amount of taxes paid (if any). */ // private BigDecimal tax; // /** Whether or not the preapproval automatically executes the payments every period. */ // private boolean autoRecur; // /** The name of the payer. */ // private String payerName; // /** The email of the payer. */ // private String payeeEmail; // /** The unixtime when the preapproval was created. */ // private Long createTime; // /** The unixtime of the next scheduled charge +/- 5 minutes (will only show up for approved auto_recur preapprovals). */ // private Long nextDueTime; // /** The checkout ID of the last successful checkout (state captured) for the preapproval. */ // private Long lastCheckoutId; // /** The unixtime when the last successful checkout occurred. */ // private Long lastCheckoutTime; // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Preapproval;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/preapproval * * Allows you to cancel the preapproval. If cancelled the preapproval cannot be used to execute payments. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/Preapproval.java // @Data // public class Preapproval implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the preapproval. */ // private Long preapprovalId; // /** The uri that you send the user to so they can enter their payment info and approve the preapproval. */ // private String preapprovalUri; // /** A uri that you can send the user to if they need to update their payment method. */ // private String manageUri; // /** The unique ID of the WePay account where the money will go. */ // private Long accountId; // // /** A short description of what the payer is being charged for. */ // private String shortDescription; // /** A longer description of what the payer is being charged for (if set). */ // private String longDescription; // // /** The currency that any charges will take place in (for now always USD). */ // private String currency; // /** The amount in dollars that the application can charge the payer automatically every period. */ // private BigDecimal amount; // /** Who is paying the fee (either "payer" for the person paying, "payee" for the person receiving the money, "payer_from_app" if payer is paying for app fee and the app is paying WePay fees, or "payee_from_app" if payee is paying for app fee and app is paying for WePay fees). */ // private FeePayer feePayer; // /** The state that the preapproval is in. See the object states page for the full list. */ // private State state; // /** The uri that the payer will be redirected to after approving the preapproval. */ // private String redirectUri; // /** The fee that will go to the API application's account (if set). Limited to 20% of the preapproval amount. */ // private BigDecimal appFee; // /** How often the API application can execute payments for a payer with this preapproval. Can be: hourly, daily, weekly, biweekly, monthly, bimonthly, quarterly, yearly, and once. Once period is if you only want to get authorization for a future charge and don't need it to be recurring. */ // private String period; // /** The number of times the API application can execute payments per period. */ // private Integer frequency; // /** When the API application can begin executing payments with this preapproval. Will be a unix timestamp. */ // private Long startTime; // /** The last time that the API application can execute a payment with this preapproval. Will be a unix timestamp. */ // private Long endTime; // /** The reference_id passed by the application (if set). */ // private String referenceId; // /** The uri which instant payment notifications will be sent to. */ // private String callbackUri; // /** The shipping address that the payer entered (if applicable). It will be in the following format: // // US Addresses: // {"address1":"380 Portage Ave","address2":"","city":"Palo Alto","state":"CA","zip":"94306","country":"US"}. // // Non-US Addresses: // {"address1":"100 Main St","address2":"","city":"Toronto","region":"ON","postcode":"M4E 1Z5","country":"CA"} // // Use ISO 3166-1 codes when specifying the country. // */ // private ShippingAddress address; // /** The amount that was paid in shipping fees (if any). */ // private BigDecimal shippingFee; // /** The dollar amount of taxes paid (if any). */ // private BigDecimal tax; // /** Whether or not the preapproval automatically executes the payments every period. */ // private boolean autoRecur; // /** The name of the payer. */ // private String payerName; // /** The email of the payer. */ // private String payeeEmail; // /** The unixtime when the preapproval was created. */ // private Long createTime; // /** The unixtime of the next scheduled charge +/- 5 minutes (will only show up for approved auto_recur preapprovals). */ // private Long nextDueTime; // /** The checkout ID of the last successful checkout (state captured) for the preapproval. */ // private Long lastCheckoutId; // /** The unixtime when the last successful checkout occurred. */ // private Long lastCheckoutTime; // } // Path: src/main/java/com/lookfirst/wepay/api/req/PreapprovalCancelRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Preapproval; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/preapproval * * Allows you to cancel the preapproval. If cancelled the preapproval cannot be used to execute payments. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class PreapprovalCancelRequest extends WePayRequest<Preapproval> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/CheckoutModifyRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/Checkout.java // @Data // @EqualsAndHashCode(callSuper=false) // public class Checkout extends CheckoutUri { // private static final long serialVersionUID = 1L; // // /** The unique ID of the payment account that the money will go into. */ // private Long accountId; // /** The unique ID of the preapproval associated with the checkout (if applicable). */ // private Long preapprovalId; // /** The state the checkout is in. See the section on IPN for a listing of all states. */ // private State state; // /** The payment description that will show up on payer's credit card statement. (255) */ // private String softDescriptor; // /** The short description of the checkout. */ // private String shortDescription; // /** The long description of the checkout (if available). */ // private String longDescription; // /** The currency used (always USD for now). */ // private String currency; // /** The dollar amount of the checkout object. This will always be the amount you passed in /checkout/create */ // private BigDecimal amount; // /** The dollar amount of the WePay fee. */ // private BigDecimal fee; // /** The total dollar amount paid by the payer. */ // private BigDecimal gross; // /** The amount that the application received in fees. App fees go into the API application's WePay account. */ // private BigDecimal appFee; // /** Who is paying the fee (either "payer" for the person paying or "payee" for the person receiving the money). */ // private FeePayer feePayer; // /** The unique reference_id passed by the application (if available). */ // private String referenceId; // /** The uri the payer will be redirected to after payment (if available). */ // private String redirectUri; // /** The uri which Instant Payment Notifications will be sent to. */ // private String callbackUri; // /** The uri that payers can visit to open a dispute for this checkout. */ // private String disputeUri; // /** The email address of the person paying (only returned if a payment has been made). */ // private String payerEmail; // /** The name of the person paying (only returned if a payment has been made). */ // private String payerName; // /** If the payment was canceled, the reason why. */ // private String cancelReason; // /** If the payment was refunded the reason why. */ // private String refundReason; // /** A boolean value. Default is true. If set to true then the payment will not automatically be released to the account and will be held by WePay in payment state 'reserved'. To release funds to the account you must call /checkout/capture */ // private boolean autoCapture; // /** A boolean value. Default is false. If set to true then the payer will be required to enter their shipping address when paying. */ // private boolean requireShipping; // /** // * If 'require_shipping' was set to true and the payment was made, this will be the shipping address that the payer entered. // * It will be in the following format: {"address1":"455 Portage Ave","address2":"Suite B","city":"Palo Alto","state":"CA","zip":"94306","country":"US"} // */ // private ShippingAddress shippingAddress; // /** The dollar amount of taxes paid. */ // private String tax; // /** If this checkout has been fully or partially refunded, this has the amount that has been refunded so far. */ // private BigDecimal amountRefunded; // /** If this checkout has been fully or partially charged back, this has the amount that has been charged back so far. */ // private BigDecimal amountChargedBack; // // /** The unixtime when the checkout was created. */ // private Long createTime; // // /** */ // @Data // @NoArgsConstructor // @AllArgsConstructor // @EqualsAndHashCode(callSuper=false) // public static class ShippingAddress { // private String address1; // private String address2; // private String city; // private String state; // private String zip; // private String country; // private String region; // private String postalcode; // } // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Checkout;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/checkout * * This call allows you to modify the callback_uri of a checkout. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/Checkout.java // @Data // @EqualsAndHashCode(callSuper=false) // public class Checkout extends CheckoutUri { // private static final long serialVersionUID = 1L; // // /** The unique ID of the payment account that the money will go into. */ // private Long accountId; // /** The unique ID of the preapproval associated with the checkout (if applicable). */ // private Long preapprovalId; // /** The state the checkout is in. See the section on IPN for a listing of all states. */ // private State state; // /** The payment description that will show up on payer's credit card statement. (255) */ // private String softDescriptor; // /** The short description of the checkout. */ // private String shortDescription; // /** The long description of the checkout (if available). */ // private String longDescription; // /** The currency used (always USD for now). */ // private String currency; // /** The dollar amount of the checkout object. This will always be the amount you passed in /checkout/create */ // private BigDecimal amount; // /** The dollar amount of the WePay fee. */ // private BigDecimal fee; // /** The total dollar amount paid by the payer. */ // private BigDecimal gross; // /** The amount that the application received in fees. App fees go into the API application's WePay account. */ // private BigDecimal appFee; // /** Who is paying the fee (either "payer" for the person paying or "payee" for the person receiving the money). */ // private FeePayer feePayer; // /** The unique reference_id passed by the application (if available). */ // private String referenceId; // /** The uri the payer will be redirected to after payment (if available). */ // private String redirectUri; // /** The uri which Instant Payment Notifications will be sent to. */ // private String callbackUri; // /** The uri that payers can visit to open a dispute for this checkout. */ // private String disputeUri; // /** The email address of the person paying (only returned if a payment has been made). */ // private String payerEmail; // /** The name of the person paying (only returned if a payment has been made). */ // private String payerName; // /** If the payment was canceled, the reason why. */ // private String cancelReason; // /** If the payment was refunded the reason why. */ // private String refundReason; // /** A boolean value. Default is true. If set to true then the payment will not automatically be released to the account and will be held by WePay in payment state 'reserved'. To release funds to the account you must call /checkout/capture */ // private boolean autoCapture; // /** A boolean value. Default is false. If set to true then the payer will be required to enter their shipping address when paying. */ // private boolean requireShipping; // /** // * If 'require_shipping' was set to true and the payment was made, this will be the shipping address that the payer entered. // * It will be in the following format: {"address1":"455 Portage Ave","address2":"Suite B","city":"Palo Alto","state":"CA","zip":"94306","country":"US"} // */ // private ShippingAddress shippingAddress; // /** The dollar amount of taxes paid. */ // private String tax; // /** If this checkout has been fully or partially refunded, this has the amount that has been refunded so far. */ // private BigDecimal amountRefunded; // /** If this checkout has been fully or partially charged back, this has the amount that has been charged back so far. */ // private BigDecimal amountChargedBack; // // /** The unixtime when the checkout was created. */ // private Long createTime; // // /** */ // @Data // @NoArgsConstructor // @AllArgsConstructor // @EqualsAndHashCode(callSuper=false) // public static class ShippingAddress { // private String address1; // private String address2; // private String city; // private String state; // private String zip; // private String country; // private String region; // private String postalcode; // } // } // Path: src/main/java/com/lookfirst/wepay/api/req/CheckoutModifyRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Checkout; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/checkout * * This call allows you to modify the callback_uri of a checkout. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class CheckoutModifyRequest extends WePayRequest<Checkout> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/UserResendConfirmationRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/WePayUser.java // @Data // public class WePayUser implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the user. */ // private String userId; // /** The first name of the user */ // private String firstName; // /** The last name of the user */ // private String lastName; // /** The email of the user */ // private String email; // /** Either "registered" if the user has registered, or "pending" if the user still needs to confirm their registration */ // private String state; // // /** Either "registered" if the user has registered, or "pending" if the user still needs to confirm their registration */ // public boolean isRegistered() { // return state != null && state.equals("registered"); // } // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.WePayUser;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/user * * For users who were registered via the /user/register call, this API call lets you resend the API registration confirmation email. * * There are no arguments necessary for this call. Only an access token is required. * * @author Jon Scott Stevens * @author Jeff Schnitzer * @deprecated https://www.wepay.com/developer/reference/user-2011-01-15 */ @Data @EqualsAndHashCode(callSuper=false) @Deprecated
// Path: src/main/java/com/lookfirst/wepay/api/WePayUser.java // @Data // public class WePayUser implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the user. */ // private String userId; // /** The first name of the user */ // private String firstName; // /** The last name of the user */ // private String lastName; // /** The email of the user */ // private String email; // /** Either "registered" if the user has registered, or "pending" if the user still needs to confirm their registration */ // private String state; // // /** Either "registered" if the user has registered, or "pending" if the user still needs to confirm their registration */ // public boolean isRegistered() { // return state != null && state.equals("registered"); // } // } // Path: src/main/java/com/lookfirst/wepay/api/req/UserResendConfirmationRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.WePayUser; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/user * * For users who were registered via the /user/register call, this API call lets you resend the API registration confirmation email. * * There are no arguments necessary for this call. Only an access token is required. * * @author Jon Scott Stevens * @author Jeff Schnitzer * @deprecated https://www.wepay.com/developer/reference/user-2011-01-15 */ @Data @EqualsAndHashCode(callSuper=false) @Deprecated
public class UserResendConfirmationRequest extends WePayRequest<WePayUser> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/AccountCreateRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/AccountUri.java // @Data // @EqualsAndHashCode(callSuper=true) // public class AccountUri extends AccountId { // private static final long serialVersionUID = 1L; // // /** The URI to add or update info for the specified account id. Do not store the returned URI on your side as it can change. */ // private String uri; // } // // Path: src/main/java/com/lookfirst/wepay/api/ThemeObject.java // @Data // public class ThemeObject implements Serializable { // private static final long serialVersionUID = 1L; // // /** Sets a name for the theme */ // public String name; // /** Sets colors on important elements such as headers */ // public String primaryColor; // /** Sets colors on secondary elements such as info boxes, and the focus styles on text inputs */ // public String secondaryColor; // /** Sets the background color for the page frame on onsite pages, and the iframe background on iframe checkouts */ // public String backgroundColor; // /** Sets the color on primary action buttons */ // public String buttonColor; // }
import com.lookfirst.wepay.api.AccountUri; import com.lookfirst.wepay.api.ThemeObject; import lombok.Data; import lombok.EqualsAndHashCode; import java.util.List;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * Creates a new payment account for the user associated with the access token used to make this call. * If reference_id is passed, it MUST be unique for the application/user pair or an error will be returned. * NOTE: You cannot create an account with the word 'wepay' in it. This is to prevent phishing attacks. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/AccountUri.java // @Data // @EqualsAndHashCode(callSuper=true) // public class AccountUri extends AccountId { // private static final long serialVersionUID = 1L; // // /** The URI to add or update info for the specified account id. Do not store the returned URI on your side as it can change. */ // private String uri; // } // // Path: src/main/java/com/lookfirst/wepay/api/ThemeObject.java // @Data // public class ThemeObject implements Serializable { // private static final long serialVersionUID = 1L; // // /** Sets a name for the theme */ // public String name; // /** Sets colors on important elements such as headers */ // public String primaryColor; // /** Sets colors on secondary elements such as info boxes, and the focus styles on text inputs */ // public String secondaryColor; // /** Sets the background color for the page frame on onsite pages, and the iframe background on iframe checkouts */ // public String backgroundColor; // /** Sets the color on primary action buttons */ // public String buttonColor; // } // Path: src/main/java/com/lookfirst/wepay/api/req/AccountCreateRequest.java import com.lookfirst.wepay.api.AccountUri; import com.lookfirst.wepay.api.ThemeObject; import lombok.Data; import lombok.EqualsAndHashCode; import java.util.List; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * Creates a new payment account for the user associated with the access token used to make this call. * If reference_id is passed, it MUST be unique for the application/user pair or an error will be returned. * NOTE: You cannot create an account with the word 'wepay' in it. This is to prevent phishing attacks. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class AccountCreateRequest extends WePayRequest<AccountUri> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/AccountCreateRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/AccountUri.java // @Data // @EqualsAndHashCode(callSuper=true) // public class AccountUri extends AccountId { // private static final long serialVersionUID = 1L; // // /** The URI to add or update info for the specified account id. Do not store the returned URI on your side as it can change. */ // private String uri; // } // // Path: src/main/java/com/lookfirst/wepay/api/ThemeObject.java // @Data // public class ThemeObject implements Serializable { // private static final long serialVersionUID = 1L; // // /** Sets a name for the theme */ // public String name; // /** Sets colors on important elements such as headers */ // public String primaryColor; // /** Sets colors on secondary elements such as info boxes, and the focus styles on text inputs */ // public String secondaryColor; // /** Sets the background color for the page frame on onsite pages, and the iframe background on iframe checkouts */ // public String backgroundColor; // /** Sets the color on primary action buttons */ // public String buttonColor; // }
import com.lookfirst.wepay.api.AccountUri; import com.lookfirst.wepay.api.ThemeObject; import lombok.Data; import lombok.EqualsAndHashCode; import java.util.List;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * Creates a new payment account for the user associated with the access token used to make this call. * If reference_id is passed, it MUST be unique for the application/user pair or an error will be returned. * NOTE: You cannot create an account with the word 'wepay' in it. This is to prevent phishing attacks. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class AccountCreateRequest extends WePayRequest<AccountUri> { /** The name of the account you want to create. */ private String name; /** The description of the account you want to create. */ private String description; /** The reference id of the account. Must be unique for the application/user pair. */ private String referenceId; /** The type of account you are creating. Can be "nonprofit", "business", or "personal". */ private String type; /** The uri for an image that you want to use for the accounts icon. This image will be used in the co-branded checkout process. */ private String imageUri; /** The list of Google Analytics account ids that WePay will throw events to and use for tracking. */ private List<String> gaqDomains; /** The theme object you want to be used for account's checkout flows, withdrawal flows, and emails */
// Path: src/main/java/com/lookfirst/wepay/api/AccountUri.java // @Data // @EqualsAndHashCode(callSuper=true) // public class AccountUri extends AccountId { // private static final long serialVersionUID = 1L; // // /** The URI to add or update info for the specified account id. Do not store the returned URI on your side as it can change. */ // private String uri; // } // // Path: src/main/java/com/lookfirst/wepay/api/ThemeObject.java // @Data // public class ThemeObject implements Serializable { // private static final long serialVersionUID = 1L; // // /** Sets a name for the theme */ // public String name; // /** Sets colors on important elements such as headers */ // public String primaryColor; // /** Sets colors on secondary elements such as info boxes, and the focus styles on text inputs */ // public String secondaryColor; // /** Sets the background color for the page frame on onsite pages, and the iframe background on iframe checkouts */ // public String backgroundColor; // /** Sets the color on primary action buttons */ // public String buttonColor; // } // Path: src/main/java/com/lookfirst/wepay/api/req/AccountCreateRequest.java import com.lookfirst.wepay.api.AccountUri; import com.lookfirst.wepay.api.ThemeObject; import lombok.Data; import lombok.EqualsAndHashCode; import java.util.List; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * Creates a new payment account for the user associated with the access token used to make this call. * If reference_id is passed, it MUST be unique for the application/user pair or an error will be returned. * NOTE: You cannot create an account with the word 'wepay' in it. This is to prevent phishing attacks. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class AccountCreateRequest extends WePayRequest<AccountUri> { /** The name of the account you want to create. */ private String name; /** The description of the account you want to create. */ private String description; /** The reference id of the account. Must be unique for the application/user pair. */ private String referenceId; /** The type of account you are creating. Can be "nonprofit", "business", or "personal". */ private String type; /** The uri for an image that you want to use for the accounts icon. This image will be used in the co-branded checkout process. */ private String imageUri; /** The list of Google Analytics account ids that WePay will throw events to and use for tracking. */ private List<String> gaqDomains; /** The theme object you want to be used for account's checkout flows, withdrawal flows, and emails */
private ThemeObject themeObject;
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/CreditCardRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/CreditCard.java // @Data // public class CreditCard implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the credit_card. */ // public String creditCardId; // /** The string that identifies the credit_card such as MasterCard xxxxxx4769. */ // public String creditCardName; // /** The state that the credit card is in. */ // public String state; // /** The name on the card (ie "Bob Smith"). */ // public String userName; // /** The email address of the user who owns the card. */ // public String email; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // public String referenceId; // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.CreditCard;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/credit_card * * This call allows you to lookup the details of the a credit card that you have tokenized. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/CreditCard.java // @Data // public class CreditCard implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the credit_card. */ // public String creditCardId; // /** The string that identifies the credit_card such as MasterCard xxxxxx4769. */ // public String creditCardName; // /** The state that the credit card is in. */ // public String state; // /** The name on the card (ie "Bob Smith"). */ // public String userName; // /** The email address of the user who owns the card. */ // public String email; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // public String referenceId; // } // Path: src/main/java/com/lookfirst/wepay/api/req/CreditCardRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.CreditCard; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/credit_card * * This call allows you to lookup the details of the a credit card that you have tokenized. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class CreditCardRequest extends WePayRequest<CreditCard> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/Preapproval.java
// Path: src/main/java/com/lookfirst/wepay/api/Checkout.java // @Data // @NoArgsConstructor // @AllArgsConstructor // @EqualsAndHashCode(callSuper=false) // public static class ShippingAddress { // private String address1; // private String address2; // private String city; // private String state; // private String zip; // private String country; // private String region; // private String postalcode; // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum FeePayer { payer, payee, payer_from_app, payee_from_app } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum State { // action_required { // @Override // public String toString() { return "action required"; } // }, // active, // approved, // authorized, // available, // cancelled, // captured, // charged_back { // @Override // public String toString() { return "charged back"; } // }, // completed, // deleted, // disabled, // ended, // expired, // failed, // invalid, // new_ { // @Override // public String toString() { return "new"; } // }, // pending, // refunded, // registered, // reserved, // retrying, // revoked, // settled, // started, // stopped, // transition, // trial // }
import java.io.Serializable; import java.math.BigDecimal; import lombok.Data; import com.lookfirst.wepay.api.Checkout.ShippingAddress; import com.lookfirst.wepay.api.Constants.FeePayer; import com.lookfirst.wepay.api.Constants.State;
package com.lookfirst.wepay.api; /** * This call allows you to lookup the details of a payment preapproval on WePay. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data public class Preapproval implements Serializable { private static final long serialVersionUID = 1L; /** The unique ID of the preapproval. */ private Long preapprovalId; /** The uri that you send the user to so they can enter their payment info and approve the preapproval. */ private String preapprovalUri; /** A uri that you can send the user to if they need to update their payment method. */ private String manageUri; /** The unique ID of the WePay account where the money will go. */ private Long accountId; /** A short description of what the payer is being charged for. */ private String shortDescription; /** A longer description of what the payer is being charged for (if set). */ private String longDescription; /** The currency that any charges will take place in (for now always USD). */ private String currency; /** The amount in dollars that the application can charge the payer automatically every period. */ private BigDecimal amount; /** Who is paying the fee (either "payer" for the person paying, "payee" for the person receiving the money, "payer_from_app" if payer is paying for app fee and the app is paying WePay fees, or "payee_from_app" if payee is paying for app fee and app is paying for WePay fees). */
// Path: src/main/java/com/lookfirst/wepay/api/Checkout.java // @Data // @NoArgsConstructor // @AllArgsConstructor // @EqualsAndHashCode(callSuper=false) // public static class ShippingAddress { // private String address1; // private String address2; // private String city; // private String state; // private String zip; // private String country; // private String region; // private String postalcode; // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum FeePayer { payer, payee, payer_from_app, payee_from_app } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum State { // action_required { // @Override // public String toString() { return "action required"; } // }, // active, // approved, // authorized, // available, // cancelled, // captured, // charged_back { // @Override // public String toString() { return "charged back"; } // }, // completed, // deleted, // disabled, // ended, // expired, // failed, // invalid, // new_ { // @Override // public String toString() { return "new"; } // }, // pending, // refunded, // registered, // reserved, // retrying, // revoked, // settled, // started, // stopped, // transition, // trial // } // Path: src/main/java/com/lookfirst/wepay/api/Preapproval.java import java.io.Serializable; import java.math.BigDecimal; import lombok.Data; import com.lookfirst.wepay.api.Checkout.ShippingAddress; import com.lookfirst.wepay.api.Constants.FeePayer; import com.lookfirst.wepay.api.Constants.State; package com.lookfirst.wepay.api; /** * This call allows you to lookup the details of a payment preapproval on WePay. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data public class Preapproval implements Serializable { private static final long serialVersionUID = 1L; /** The unique ID of the preapproval. */ private Long preapprovalId; /** The uri that you send the user to so they can enter their payment info and approve the preapproval. */ private String preapprovalUri; /** A uri that you can send the user to if they need to update their payment method. */ private String manageUri; /** The unique ID of the WePay account where the money will go. */ private Long accountId; /** A short description of what the payer is being charged for. */ private String shortDescription; /** A longer description of what the payer is being charged for (if set). */ private String longDescription; /** The currency that any charges will take place in (for now always USD). */ private String currency; /** The amount in dollars that the application can charge the payer automatically every period. */ private BigDecimal amount; /** Who is paying the fee (either "payer" for the person paying, "payee" for the person receiving the money, "payer_from_app" if payer is paying for app fee and the app is paying WePay fees, or "payee_from_app" if payee is paying for app fee and app is paying for WePay fees). */
private FeePayer feePayer;
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/Preapproval.java
// Path: src/main/java/com/lookfirst/wepay/api/Checkout.java // @Data // @NoArgsConstructor // @AllArgsConstructor // @EqualsAndHashCode(callSuper=false) // public static class ShippingAddress { // private String address1; // private String address2; // private String city; // private String state; // private String zip; // private String country; // private String region; // private String postalcode; // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum FeePayer { payer, payee, payer_from_app, payee_from_app } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum State { // action_required { // @Override // public String toString() { return "action required"; } // }, // active, // approved, // authorized, // available, // cancelled, // captured, // charged_back { // @Override // public String toString() { return "charged back"; } // }, // completed, // deleted, // disabled, // ended, // expired, // failed, // invalid, // new_ { // @Override // public String toString() { return "new"; } // }, // pending, // refunded, // registered, // reserved, // retrying, // revoked, // settled, // started, // stopped, // transition, // trial // }
import java.io.Serializable; import java.math.BigDecimal; import lombok.Data; import com.lookfirst.wepay.api.Checkout.ShippingAddress; import com.lookfirst.wepay.api.Constants.FeePayer; import com.lookfirst.wepay.api.Constants.State;
package com.lookfirst.wepay.api; /** * This call allows you to lookup the details of a payment preapproval on WePay. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data public class Preapproval implements Serializable { private static final long serialVersionUID = 1L; /** The unique ID of the preapproval. */ private Long preapprovalId; /** The uri that you send the user to so they can enter their payment info and approve the preapproval. */ private String preapprovalUri; /** A uri that you can send the user to if they need to update their payment method. */ private String manageUri; /** The unique ID of the WePay account where the money will go. */ private Long accountId; /** A short description of what the payer is being charged for. */ private String shortDescription; /** A longer description of what the payer is being charged for (if set). */ private String longDescription; /** The currency that any charges will take place in (for now always USD). */ private String currency; /** The amount in dollars that the application can charge the payer automatically every period. */ private BigDecimal amount; /** Who is paying the fee (either "payer" for the person paying, "payee" for the person receiving the money, "payer_from_app" if payer is paying for app fee and the app is paying WePay fees, or "payee_from_app" if payee is paying for app fee and app is paying for WePay fees). */ private FeePayer feePayer; /** The state that the preapproval is in. See the object states page for the full list. */
// Path: src/main/java/com/lookfirst/wepay/api/Checkout.java // @Data // @NoArgsConstructor // @AllArgsConstructor // @EqualsAndHashCode(callSuper=false) // public static class ShippingAddress { // private String address1; // private String address2; // private String city; // private String state; // private String zip; // private String country; // private String region; // private String postalcode; // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum FeePayer { payer, payee, payer_from_app, payee_from_app } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum State { // action_required { // @Override // public String toString() { return "action required"; } // }, // active, // approved, // authorized, // available, // cancelled, // captured, // charged_back { // @Override // public String toString() { return "charged back"; } // }, // completed, // deleted, // disabled, // ended, // expired, // failed, // invalid, // new_ { // @Override // public String toString() { return "new"; } // }, // pending, // refunded, // registered, // reserved, // retrying, // revoked, // settled, // started, // stopped, // transition, // trial // } // Path: src/main/java/com/lookfirst/wepay/api/Preapproval.java import java.io.Serializable; import java.math.BigDecimal; import lombok.Data; import com.lookfirst.wepay.api.Checkout.ShippingAddress; import com.lookfirst.wepay.api.Constants.FeePayer; import com.lookfirst.wepay.api.Constants.State; package com.lookfirst.wepay.api; /** * This call allows you to lookup the details of a payment preapproval on WePay. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data public class Preapproval implements Serializable { private static final long serialVersionUID = 1L; /** The unique ID of the preapproval. */ private Long preapprovalId; /** The uri that you send the user to so they can enter their payment info and approve the preapproval. */ private String preapprovalUri; /** A uri that you can send the user to if they need to update their payment method. */ private String manageUri; /** The unique ID of the WePay account where the money will go. */ private Long accountId; /** A short description of what the payer is being charged for. */ private String shortDescription; /** A longer description of what the payer is being charged for (if set). */ private String longDescription; /** The currency that any charges will take place in (for now always USD). */ private String currency; /** The amount in dollars that the application can charge the payer automatically every period. */ private BigDecimal amount; /** Who is paying the fee (either "payer" for the person paying, "payee" for the person receiving the money, "payer_from_app" if payer is paying for app fee and the app is paying WePay fees, or "payee_from_app" if payee is paying for app fee and app is paying for WePay fees). */ private FeePayer feePayer; /** The state that the preapproval is in. See the object states page for the full list. */
private State state;
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/Preapproval.java
// Path: src/main/java/com/lookfirst/wepay/api/Checkout.java // @Data // @NoArgsConstructor // @AllArgsConstructor // @EqualsAndHashCode(callSuper=false) // public static class ShippingAddress { // private String address1; // private String address2; // private String city; // private String state; // private String zip; // private String country; // private String region; // private String postalcode; // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum FeePayer { payer, payee, payer_from_app, payee_from_app } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum State { // action_required { // @Override // public String toString() { return "action required"; } // }, // active, // approved, // authorized, // available, // cancelled, // captured, // charged_back { // @Override // public String toString() { return "charged back"; } // }, // completed, // deleted, // disabled, // ended, // expired, // failed, // invalid, // new_ { // @Override // public String toString() { return "new"; } // }, // pending, // refunded, // registered, // reserved, // retrying, // revoked, // settled, // started, // stopped, // transition, // trial // }
import java.io.Serializable; import java.math.BigDecimal; import lombok.Data; import com.lookfirst.wepay.api.Checkout.ShippingAddress; import com.lookfirst.wepay.api.Constants.FeePayer; import com.lookfirst.wepay.api.Constants.State;
package com.lookfirst.wepay.api; /** * This call allows you to lookup the details of a payment preapproval on WePay. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data public class Preapproval implements Serializable { private static final long serialVersionUID = 1L; /** The unique ID of the preapproval. */ private Long preapprovalId; /** The uri that you send the user to so they can enter their payment info and approve the preapproval. */ private String preapprovalUri; /** A uri that you can send the user to if they need to update their payment method. */ private String manageUri; /** The unique ID of the WePay account where the money will go. */ private Long accountId; /** A short description of what the payer is being charged for. */ private String shortDescription; /** A longer description of what the payer is being charged for (if set). */ private String longDescription; /** The currency that any charges will take place in (for now always USD). */ private String currency; /** The amount in dollars that the application can charge the payer automatically every period. */ private BigDecimal amount; /** Who is paying the fee (either "payer" for the person paying, "payee" for the person receiving the money, "payer_from_app" if payer is paying for app fee and the app is paying WePay fees, or "payee_from_app" if payee is paying for app fee and app is paying for WePay fees). */ private FeePayer feePayer; /** The state that the preapproval is in. See the object states page for the full list. */ private State state; /** The uri that the payer will be redirected to after approving the preapproval. */ private String redirectUri; /** The fee that will go to the API application's account (if set). Limited to 20% of the preapproval amount. */ private BigDecimal appFee; /** How often the API application can execute payments for a payer with this preapproval. Can be: hourly, daily, weekly, biweekly, monthly, bimonthly, quarterly, yearly, and once. Once period is if you only want to get authorization for a future charge and don't need it to be recurring. */ private String period; /** The number of times the API application can execute payments per period. */ private Integer frequency; /** When the API application can begin executing payments with this preapproval. Will be a unix timestamp. */ private Long startTime; /** The last time that the API application can execute a payment with this preapproval. Will be a unix timestamp. */ private Long endTime; /** The reference_id passed by the application (if set). */ private String referenceId; /** The uri which instant payment notifications will be sent to. */ private String callbackUri; /** The shipping address that the payer entered (if applicable). It will be in the following format: US Addresses: {"address1":"380 Portage Ave","address2":"","city":"Palo Alto","state":"CA","zip":"94306","country":"US"}. Non-US Addresses: {"address1":"100 Main St","address2":"","city":"Toronto","region":"ON","postcode":"M4E 1Z5","country":"CA"} Use ISO 3166-1 codes when specifying the country. */
// Path: src/main/java/com/lookfirst/wepay/api/Checkout.java // @Data // @NoArgsConstructor // @AllArgsConstructor // @EqualsAndHashCode(callSuper=false) // public static class ShippingAddress { // private String address1; // private String address2; // private String city; // private String state; // private String zip; // private String country; // private String region; // private String postalcode; // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum FeePayer { payer, payee, payer_from_app, payee_from_app } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum State { // action_required { // @Override // public String toString() { return "action required"; } // }, // active, // approved, // authorized, // available, // cancelled, // captured, // charged_back { // @Override // public String toString() { return "charged back"; } // }, // completed, // deleted, // disabled, // ended, // expired, // failed, // invalid, // new_ { // @Override // public String toString() { return "new"; } // }, // pending, // refunded, // registered, // reserved, // retrying, // revoked, // settled, // started, // stopped, // transition, // trial // } // Path: src/main/java/com/lookfirst/wepay/api/Preapproval.java import java.io.Serializable; import java.math.BigDecimal; import lombok.Data; import com.lookfirst.wepay.api.Checkout.ShippingAddress; import com.lookfirst.wepay.api.Constants.FeePayer; import com.lookfirst.wepay.api.Constants.State; package com.lookfirst.wepay.api; /** * This call allows you to lookup the details of a payment preapproval on WePay. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data public class Preapproval implements Serializable { private static final long serialVersionUID = 1L; /** The unique ID of the preapproval. */ private Long preapprovalId; /** The uri that you send the user to so they can enter their payment info and approve the preapproval. */ private String preapprovalUri; /** A uri that you can send the user to if they need to update their payment method. */ private String manageUri; /** The unique ID of the WePay account where the money will go. */ private Long accountId; /** A short description of what the payer is being charged for. */ private String shortDescription; /** A longer description of what the payer is being charged for (if set). */ private String longDescription; /** The currency that any charges will take place in (for now always USD). */ private String currency; /** The amount in dollars that the application can charge the payer automatically every period. */ private BigDecimal amount; /** Who is paying the fee (either "payer" for the person paying, "payee" for the person receiving the money, "payer_from_app" if payer is paying for app fee and the app is paying WePay fees, or "payee_from_app" if payee is paying for app fee and app is paying for WePay fees). */ private FeePayer feePayer; /** The state that the preapproval is in. See the object states page for the full list. */ private State state; /** The uri that the payer will be redirected to after approving the preapproval. */ private String redirectUri; /** The fee that will go to the API application's account (if set). Limited to 20% of the preapproval amount. */ private BigDecimal appFee; /** How often the API application can execute payments for a payer with this preapproval. Can be: hourly, daily, weekly, biweekly, monthly, bimonthly, quarterly, yearly, and once. Once period is if you only want to get authorization for a future charge and don't need it to be recurring. */ private String period; /** The number of times the API application can execute payments per period. */ private Integer frequency; /** When the API application can begin executing payments with this preapproval. Will be a unix timestamp. */ private Long startTime; /** The last time that the API application can execute a payment with this preapproval. Will be a unix timestamp. */ private Long endTime; /** The reference_id passed by the application (if set). */ private String referenceId; /** The uri which instant payment notifications will be sent to. */ private String callbackUri; /** The shipping address that the payer entered (if applicable). It will be in the following format: US Addresses: {"address1":"380 Portage Ave","address2":"","city":"Palo Alto","state":"CA","zip":"94306","country":"US"}. Non-US Addresses: {"address1":"100 Main St","address2":"","city":"Toronto","region":"ON","postcode":"M4E 1Z5","country":"CA"} Use ISO 3166-1 codes when specifying the country. */
private ShippingAddress address;
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/AppRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/AppUri.java // @Data // public class AppUri implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the app. */ // private String clientId; // /** The approval status of the API application. */ // private String status; // /** The theme object associated with the App (if applicable). */ // private ThemeObject themeObject; // /** An array of Google Analytics domains associated with the app. */ // private List<String> gaqDomains; // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.AppUri;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/app * * This call allows you to lookup the details of your API application. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/AppUri.java // @Data // public class AppUri implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the app. */ // private String clientId; // /** The approval status of the API application. */ // private String status; // /** The theme object associated with the App (if applicable). */ // private ThemeObject themeObject; // /** An array of Google Analytics domains associated with the app. */ // private List<String> gaqDomains; // } // Path: src/main/java/com/lookfirst/wepay/api/req/AppRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.AppUri; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/app * * This call allows you to lookup the details of your API application. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class AppRequest extends WePayRequest<AppUri> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/TokenRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/Token.java // @Data // public class Token implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique user ID of the user */ // private String userId; // /** The access token that you can use to make calls on behalf of the user */ // private String accessToken; // /** The token type - for now only "BEARER" is supported */ // private String tokenType; // /** How much time till the access_token expires. If NULL or not present, the access token will be valid until the user revokes the access_token */ // private String expiresIn; // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Token;
package com.lookfirst.wepay.api.req; /** * Once you have sent the user through the authorization end point and they have returned with a code, * you can use that code to retrieve and access token for that user. The redirect uri and state * (if passed) will need to be the same as in the in /v2/oauth2/authorize step * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/Token.java // @Data // public class Token implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique user ID of the user */ // private String userId; // /** The access token that you can use to make calls on behalf of the user */ // private String accessToken; // /** The token type - for now only "BEARER" is supported */ // private String tokenType; // /** How much time till the access_token expires. If NULL or not present, the access token will be valid until the user revokes the access_token */ // private String expiresIn; // } // Path: src/main/java/com/lookfirst/wepay/api/req/TokenRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Token; package com.lookfirst.wepay.api.req; /** * Once you have sent the user through the authorization end point and they have returned with a code, * you can use that code to retrieve and access token for that user. The redirect uri and state * (if passed) will need to be the same as in the in /v2/oauth2/authorize step * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class TokenRequest extends WePayRequest<Token> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/TransferRefundRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/TransferState.java // @Deprecated // @Data // @EqualsAndHashCode(callSuper=false) // public class TransferState implements Serializable { // private static final long serialVersionUID = 1L; // // /** Yes The unique ID of the transfer you refunded. */ // private String transferId; // /** The state that the refund is in (new, sent, or failed). */ // public String state; // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.TransferState;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/disbursement * * This call allows you to refund a transfer. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Deprecated @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/TransferState.java // @Deprecated // @Data // @EqualsAndHashCode(callSuper=false) // public class TransferState implements Serializable { // private static final long serialVersionUID = 1L; // // /** Yes The unique ID of the transfer you refunded. */ // private String transferId; // /** The state that the refund is in (new, sent, or failed). */ // public String state; // } // Path: src/main/java/com/lookfirst/wepay/api/req/TransferRefundRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.TransferState; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/disbursement * * This call allows you to refund a transfer. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Deprecated @Data @EqualsAndHashCode(callSuper=false)
public class TransferRefundRequest extends WePayRequest<TransferState> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/AccountDeleteRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/AccountId.java // @Data // public class AccountId implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the account. */ // private Long accountId; // /** The state of the account. */ // private String state; // // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.AccountId;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * Deletes the account specified. The use associated with the access token used must have permission to delete the account. * An account may not be deleted if it has a balance, pending bills, pending payments, or has ordered a debit card. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/AccountId.java // @Data // public class AccountId implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the account. */ // private Long accountId; // /** The state of the account. */ // private String state; // // } // Path: src/main/java/com/lookfirst/wepay/api/req/AccountDeleteRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.AccountId; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * Deletes the account specified. The use associated with the access token used must have permission to delete the account. * An account may not be deleted if it has a balance, pending bills, pending payments, or has ordered a debit card. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class AccountDeleteRequest extends WePayRequest<AccountId> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/CheckoutRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/Checkout.java // @Data // @EqualsAndHashCode(callSuper=false) // public class Checkout extends CheckoutUri { // private static final long serialVersionUID = 1L; // // /** The unique ID of the payment account that the money will go into. */ // private Long accountId; // /** The unique ID of the preapproval associated with the checkout (if applicable). */ // private Long preapprovalId; // /** The state the checkout is in. See the section on IPN for a listing of all states. */ // private State state; // /** The payment description that will show up on payer's credit card statement. (255) */ // private String softDescriptor; // /** The short description of the checkout. */ // private String shortDescription; // /** The long description of the checkout (if available). */ // private String longDescription; // /** The currency used (always USD for now). */ // private String currency; // /** The dollar amount of the checkout object. This will always be the amount you passed in /checkout/create */ // private BigDecimal amount; // /** The dollar amount of the WePay fee. */ // private BigDecimal fee; // /** The total dollar amount paid by the payer. */ // private BigDecimal gross; // /** The amount that the application received in fees. App fees go into the API application's WePay account. */ // private BigDecimal appFee; // /** Who is paying the fee (either "payer" for the person paying or "payee" for the person receiving the money). */ // private FeePayer feePayer; // /** The unique reference_id passed by the application (if available). */ // private String referenceId; // /** The uri the payer will be redirected to after payment (if available). */ // private String redirectUri; // /** The uri which Instant Payment Notifications will be sent to. */ // private String callbackUri; // /** The uri that payers can visit to open a dispute for this checkout. */ // private String disputeUri; // /** The email address of the person paying (only returned if a payment has been made). */ // private String payerEmail; // /** The name of the person paying (only returned if a payment has been made). */ // private String payerName; // /** If the payment was canceled, the reason why. */ // private String cancelReason; // /** If the payment was refunded the reason why. */ // private String refundReason; // /** A boolean value. Default is true. If set to true then the payment will not automatically be released to the account and will be held by WePay in payment state 'reserved'. To release funds to the account you must call /checkout/capture */ // private boolean autoCapture; // /** A boolean value. Default is false. If set to true then the payer will be required to enter their shipping address when paying. */ // private boolean requireShipping; // /** // * If 'require_shipping' was set to true and the payment was made, this will be the shipping address that the payer entered. // * It will be in the following format: {"address1":"455 Portage Ave","address2":"Suite B","city":"Palo Alto","state":"CA","zip":"94306","country":"US"} // */ // private ShippingAddress shippingAddress; // /** The dollar amount of taxes paid. */ // private String tax; // /** If this checkout has been fully or partially refunded, this has the amount that has been refunded so far. */ // private BigDecimal amountRefunded; // /** If this checkout has been fully or partially charged back, this has the amount that has been charged back so far. */ // private BigDecimal amountChargedBack; // // /** The unixtime when the checkout was created. */ // private Long createTime; // // /** */ // @Data // @NoArgsConstructor // @AllArgsConstructor // @EqualsAndHashCode(callSuper=false) // public static class ShippingAddress { // private String address1; // private String address2; // private String city; // private String state; // private String zip; // private String country; // private String region; // private String postalcode; // } // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Checkout;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/checkout * * This call allows you to lookup the details of a specific checkout on WePay using the checkout_id. * Response parameters marked "if available" will only show up if they have values. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/Checkout.java // @Data // @EqualsAndHashCode(callSuper=false) // public class Checkout extends CheckoutUri { // private static final long serialVersionUID = 1L; // // /** The unique ID of the payment account that the money will go into. */ // private Long accountId; // /** The unique ID of the preapproval associated with the checkout (if applicable). */ // private Long preapprovalId; // /** The state the checkout is in. See the section on IPN for a listing of all states. */ // private State state; // /** The payment description that will show up on payer's credit card statement. (255) */ // private String softDescriptor; // /** The short description of the checkout. */ // private String shortDescription; // /** The long description of the checkout (if available). */ // private String longDescription; // /** The currency used (always USD for now). */ // private String currency; // /** The dollar amount of the checkout object. This will always be the amount you passed in /checkout/create */ // private BigDecimal amount; // /** The dollar amount of the WePay fee. */ // private BigDecimal fee; // /** The total dollar amount paid by the payer. */ // private BigDecimal gross; // /** The amount that the application received in fees. App fees go into the API application's WePay account. */ // private BigDecimal appFee; // /** Who is paying the fee (either "payer" for the person paying or "payee" for the person receiving the money). */ // private FeePayer feePayer; // /** The unique reference_id passed by the application (if available). */ // private String referenceId; // /** The uri the payer will be redirected to after payment (if available). */ // private String redirectUri; // /** The uri which Instant Payment Notifications will be sent to. */ // private String callbackUri; // /** The uri that payers can visit to open a dispute for this checkout. */ // private String disputeUri; // /** The email address of the person paying (only returned if a payment has been made). */ // private String payerEmail; // /** The name of the person paying (only returned if a payment has been made). */ // private String payerName; // /** If the payment was canceled, the reason why. */ // private String cancelReason; // /** If the payment was refunded the reason why. */ // private String refundReason; // /** A boolean value. Default is true. If set to true then the payment will not automatically be released to the account and will be held by WePay in payment state 'reserved'. To release funds to the account you must call /checkout/capture */ // private boolean autoCapture; // /** A boolean value. Default is false. If set to true then the payer will be required to enter their shipping address when paying. */ // private boolean requireShipping; // /** // * If 'require_shipping' was set to true and the payment was made, this will be the shipping address that the payer entered. // * It will be in the following format: {"address1":"455 Portage Ave","address2":"Suite B","city":"Palo Alto","state":"CA","zip":"94306","country":"US"} // */ // private ShippingAddress shippingAddress; // /** The dollar amount of taxes paid. */ // private String tax; // /** If this checkout has been fully or partially refunded, this has the amount that has been refunded so far. */ // private BigDecimal amountRefunded; // /** If this checkout has been fully or partially charged back, this has the amount that has been charged back so far. */ // private BigDecimal amountChargedBack; // // /** The unixtime when the checkout was created. */ // private Long createTime; // // /** */ // @Data // @NoArgsConstructor // @AllArgsConstructor // @EqualsAndHashCode(callSuper=false) // public static class ShippingAddress { // private String address1; // private String address2; // private String city; // private String state; // private String zip; // private String country; // private String region; // private String postalcode; // } // } // Path: src/main/java/com/lookfirst/wepay/api/req/CheckoutRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Checkout; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/checkout * * This call allows you to lookup the details of a specific checkout on WePay using the checkout_id. * Response parameters marked "if available" will only show up if they have values. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class CheckoutRequest extends WePayRequest<Checkout> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/PreapprovalModifyRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/Preapproval.java // @Data // public class Preapproval implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the preapproval. */ // private Long preapprovalId; // /** The uri that you send the user to so they can enter their payment info and approve the preapproval. */ // private String preapprovalUri; // /** A uri that you can send the user to if they need to update their payment method. */ // private String manageUri; // /** The unique ID of the WePay account where the money will go. */ // private Long accountId; // // /** A short description of what the payer is being charged for. */ // private String shortDescription; // /** A longer description of what the payer is being charged for (if set). */ // private String longDescription; // // /** The currency that any charges will take place in (for now always USD). */ // private String currency; // /** The amount in dollars that the application can charge the payer automatically every period. */ // private BigDecimal amount; // /** Who is paying the fee (either "payer" for the person paying, "payee" for the person receiving the money, "payer_from_app" if payer is paying for app fee and the app is paying WePay fees, or "payee_from_app" if payee is paying for app fee and app is paying for WePay fees). */ // private FeePayer feePayer; // /** The state that the preapproval is in. See the object states page for the full list. */ // private State state; // /** The uri that the payer will be redirected to after approving the preapproval. */ // private String redirectUri; // /** The fee that will go to the API application's account (if set). Limited to 20% of the preapproval amount. */ // private BigDecimal appFee; // /** How often the API application can execute payments for a payer with this preapproval. Can be: hourly, daily, weekly, biweekly, monthly, bimonthly, quarterly, yearly, and once. Once period is if you only want to get authorization for a future charge and don't need it to be recurring. */ // private String period; // /** The number of times the API application can execute payments per period. */ // private Integer frequency; // /** When the API application can begin executing payments with this preapproval. Will be a unix timestamp. */ // private Long startTime; // /** The last time that the API application can execute a payment with this preapproval. Will be a unix timestamp. */ // private Long endTime; // /** The reference_id passed by the application (if set). */ // private String referenceId; // /** The uri which instant payment notifications will be sent to. */ // private String callbackUri; // /** The shipping address that the payer entered (if applicable). It will be in the following format: // // US Addresses: // {"address1":"380 Portage Ave","address2":"","city":"Palo Alto","state":"CA","zip":"94306","country":"US"}. // // Non-US Addresses: // {"address1":"100 Main St","address2":"","city":"Toronto","region":"ON","postcode":"M4E 1Z5","country":"CA"} // // Use ISO 3166-1 codes when specifying the country. // */ // private ShippingAddress address; // /** The amount that was paid in shipping fees (if any). */ // private BigDecimal shippingFee; // /** The dollar amount of taxes paid (if any). */ // private BigDecimal tax; // /** Whether or not the preapproval automatically executes the payments every period. */ // private boolean autoRecur; // /** The name of the payer. */ // private String payerName; // /** The email of the payer. */ // private String payeeEmail; // /** The unixtime when the preapproval was created. */ // private Long createTime; // /** The unixtime of the next scheduled charge +/- 5 minutes (will only show up for approved auto_recur preapprovals). */ // private Long nextDueTime; // /** The checkout ID of the last successful checkout (state captured) for the preapproval. */ // private Long lastCheckoutId; // /** The unixtime when the last successful checkout occurred. */ // private Long lastCheckoutTime; // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Preapproval;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/preapproval * * This call allows you to modify the callback_uri on a preapproval. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/Preapproval.java // @Data // public class Preapproval implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the preapproval. */ // private Long preapprovalId; // /** The uri that you send the user to so they can enter their payment info and approve the preapproval. */ // private String preapprovalUri; // /** A uri that you can send the user to if they need to update their payment method. */ // private String manageUri; // /** The unique ID of the WePay account where the money will go. */ // private Long accountId; // // /** A short description of what the payer is being charged for. */ // private String shortDescription; // /** A longer description of what the payer is being charged for (if set). */ // private String longDescription; // // /** The currency that any charges will take place in (for now always USD). */ // private String currency; // /** The amount in dollars that the application can charge the payer automatically every period. */ // private BigDecimal amount; // /** Who is paying the fee (either "payer" for the person paying, "payee" for the person receiving the money, "payer_from_app" if payer is paying for app fee and the app is paying WePay fees, or "payee_from_app" if payee is paying for app fee and app is paying for WePay fees). */ // private FeePayer feePayer; // /** The state that the preapproval is in. See the object states page for the full list. */ // private State state; // /** The uri that the payer will be redirected to after approving the preapproval. */ // private String redirectUri; // /** The fee that will go to the API application's account (if set). Limited to 20% of the preapproval amount. */ // private BigDecimal appFee; // /** How often the API application can execute payments for a payer with this preapproval. Can be: hourly, daily, weekly, biweekly, monthly, bimonthly, quarterly, yearly, and once. Once period is if you only want to get authorization for a future charge and don't need it to be recurring. */ // private String period; // /** The number of times the API application can execute payments per period. */ // private Integer frequency; // /** When the API application can begin executing payments with this preapproval. Will be a unix timestamp. */ // private Long startTime; // /** The last time that the API application can execute a payment with this preapproval. Will be a unix timestamp. */ // private Long endTime; // /** The reference_id passed by the application (if set). */ // private String referenceId; // /** The uri which instant payment notifications will be sent to. */ // private String callbackUri; // /** The shipping address that the payer entered (if applicable). It will be in the following format: // // US Addresses: // {"address1":"380 Portage Ave","address2":"","city":"Palo Alto","state":"CA","zip":"94306","country":"US"}. // // Non-US Addresses: // {"address1":"100 Main St","address2":"","city":"Toronto","region":"ON","postcode":"M4E 1Z5","country":"CA"} // // Use ISO 3166-1 codes when specifying the country. // */ // private ShippingAddress address; // /** The amount that was paid in shipping fees (if any). */ // private BigDecimal shippingFee; // /** The dollar amount of taxes paid (if any). */ // private BigDecimal tax; // /** Whether or not the preapproval automatically executes the payments every period. */ // private boolean autoRecur; // /** The name of the payer. */ // private String payerName; // /** The email of the payer. */ // private String payeeEmail; // /** The unixtime when the preapproval was created. */ // private Long createTime; // /** The unixtime of the next scheduled charge +/- 5 minutes (will only show up for approved auto_recur preapprovals). */ // private Long nextDueTime; // /** The checkout ID of the last successful checkout (state captured) for the preapproval. */ // private Long lastCheckoutId; // /** The unixtime when the last successful checkout occurred. */ // private Long lastCheckoutTime; // } // Path: src/main/java/com/lookfirst/wepay/api/req/PreapprovalModifyRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Preapproval; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/preapproval * * This call allows you to modify the callback_uri on a preapproval. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class PreapprovalModifyRequest extends WePayRequest<Preapproval> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/AccountBalanceRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/AccountBalance.java // @Data // public class AccountBalance implements Serializable { // private static final long serialVersionUID = 1L; // // /** The currency of the above amounts. For now this will always be USD. */ // private String currency; // private BigDecimal balance; // private BigDecimal incomingPendingAmount; // private BigDecimal outgoingPendingAmount; // /** The actual amount of money in dollars that is reserved and is not available for withdrawal (ie the minimum balance). */ // private BigDecimal reservedAmount; // /** The actual amount of money in dollars that is currently in dispute between the payee and the payer and is not available for withdrawal. */ // private BigDecimal disputedAmount; // /** "daily" */ // private String withdrawalPeriod; // /** Unix time */ // private Long withdrawalNextTime; // /** Name of the bank */ // private String withdrawalBankName; // // /** Older api */ // // /** The pending balance of the account. */ // @Deprecated // private BigDecimal pendingBalance; // /** The actual amount of money that has cleared and is available to the account. */ // @Deprecated // private BigDecimal availableBalance; // /** The actual amount of money in dollars that is pending. */ // @Deprecated // private BigDecimal pendingAmount; // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.AccountBalance;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * Gets the balance for the account. * * @author Jon Scott Stevens * @author Jeff Schnitzer * * @deprecated Data is now returned as part of /account */ @Deprecated @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/AccountBalance.java // @Data // public class AccountBalance implements Serializable { // private static final long serialVersionUID = 1L; // // /** The currency of the above amounts. For now this will always be USD. */ // private String currency; // private BigDecimal balance; // private BigDecimal incomingPendingAmount; // private BigDecimal outgoingPendingAmount; // /** The actual amount of money in dollars that is reserved and is not available for withdrawal (ie the minimum balance). */ // private BigDecimal reservedAmount; // /** The actual amount of money in dollars that is currently in dispute between the payee and the payer and is not available for withdrawal. */ // private BigDecimal disputedAmount; // /** "daily" */ // private String withdrawalPeriod; // /** Unix time */ // private Long withdrawalNextTime; // /** Name of the bank */ // private String withdrawalBankName; // // /** Older api */ // // /** The pending balance of the account. */ // @Deprecated // private BigDecimal pendingBalance; // /** The actual amount of money that has cleared and is available to the account. */ // @Deprecated // private BigDecimal availableBalance; // /** The actual amount of money in dollars that is pending. */ // @Deprecated // private BigDecimal pendingAmount; // } // Path: src/main/java/com/lookfirst/wepay/api/req/AccountBalanceRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.AccountBalance; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * Gets the balance for the account. * * @author Jon Scott Stevens * @author Jeff Schnitzer * * @deprecated Data is now returned as part of /account */ @Deprecated @Data @EqualsAndHashCode(callSuper=false)
public class AccountBalanceRequest extends WePayRequest<AccountBalance> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/AccountAddBankRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/AddBank.java // @Data // public class AddBank implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the account. */ // private Long accountId; // /** The URI to add the bank account to the specified acocunt id. */ // private String addBankUri; // // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum Mode { iframe, regular }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.AddBank; import com.lookfirst.wepay.api.Constants.Mode;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * This call allows you to add a bank account to a specified account. * It will return a URL that a user can visit to add a bank account to their account. * In addition, add_bank will allow you to change bank accounts if one was previously set. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Deprecated @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/AddBank.java // @Data // public class AddBank implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the account. */ // private Long accountId; // /** The URI to add the bank account to the specified acocunt id. */ // private String addBankUri; // // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum Mode { iframe, regular } // Path: src/main/java/com/lookfirst/wepay/api/req/AccountAddBankRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.AddBank; import com.lookfirst.wepay.api.Constants.Mode; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * This call allows you to add a bank account to a specified account. * It will return a URL that a user can visit to add a bank account to their account. * In addition, add_bank will allow you to change bank accounts if one was previously set. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Deprecated @Data @EqualsAndHashCode(callSuper=false)
public class AccountAddBankRequest extends WePayRequest<AddBank> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/AccountAddBankRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/AddBank.java // @Data // public class AddBank implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the account. */ // private Long accountId; // /** The URI to add the bank account to the specified acocunt id. */ // private String addBankUri; // // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum Mode { iframe, regular }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.AddBank; import com.lookfirst.wepay.api.Constants.Mode;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * This call allows you to add a bank account to a specified account. * It will return a URL that a user can visit to add a bank account to their account. * In addition, add_bank will allow you to change bank accounts if one was previously set. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Deprecated @Data @EqualsAndHashCode(callSuper=false) public class AccountAddBankRequest extends WePayRequest<AddBank> { /** The unique ID of the account you want to get the balance of. */ private Long accountId; /** What mode the process will be displayed in. The options are 'iframe' or 'regular'. Choose iframe if you would like to frame the process on your site. Mode defaults to 'regular'. */
// Path: src/main/java/com/lookfirst/wepay/api/AddBank.java // @Data // public class AddBank implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the account. */ // private Long accountId; // /** The URI to add the bank account to the specified acocunt id. */ // private String addBankUri; // // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum Mode { iframe, regular } // Path: src/main/java/com/lookfirst/wepay/api/req/AccountAddBankRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.AddBank; import com.lookfirst.wepay.api.Constants.Mode; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * This call allows you to add a bank account to a specified account. * It will return a URL that a user can visit to add a bank account to their account. * In addition, add_bank will allow you to change bank accounts if one was previously set. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Deprecated @Data @EqualsAndHashCode(callSuper=false) public class AccountAddBankRequest extends WePayRequest<AddBank> { /** The unique ID of the account you want to get the balance of. */ private Long accountId; /** What mode the process will be displayed in. The options are 'iframe' or 'regular'. Choose iframe if you would like to frame the process on your site. Mode defaults to 'regular'. */
private Mode mode;
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/UserRegisterRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/Token.java // @Data // public class Token implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique user ID of the user */ // private String userId; // /** The access token that you can use to make calls on behalf of the user */ // private String accessToken; // /** The token type - for now only "BEARER" is supported */ // private String tokenType; // /** How much time till the access_token expires. If NULL or not present, the access token will be valid until the user revokes the access_token */ // private String expiresIn; // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Token;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/user * * Registers a new user and returns an access token for that user. If the call fails for any * reason the application must use the normal /oauth2/authorize flow to obtain authorization from the user. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/Token.java // @Data // public class Token implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique user ID of the user */ // private String userId; // /** The access token that you can use to make calls on behalf of the user */ // private String accessToken; // /** The token type - for now only "BEARER" is supported */ // private String tokenType; // /** How much time till the access_token expires. If NULL or not present, the access token will be valid until the user revokes the access_token */ // private String expiresIn; // } // Path: src/main/java/com/lookfirst/wepay/api/req/UserRegisterRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Token; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/user * * Registers a new user and returns an access token for that user. If the call fails for any * reason the application must use the normal /oauth2/authorize flow to obtain authorization from the user. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class UserRegisterRequest extends WePayRequest<Token> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/CreditCardAuthorizeRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/CreditCard.java // @Data // public class CreditCard implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the credit_card. */ // public String creditCardId; // /** The string that identifies the credit_card such as MasterCard xxxxxx4769. */ // public String creditCardName; // /** The state that the credit card is in. */ // public String state; // /** The name on the card (ie "Bob Smith"). */ // public String userName; // /** The email address of the user who owns the card. */ // public String email; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // public String referenceId; // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.CreditCard;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/credit_card * * You should only use this call if you are not going to immediately make the /checkout/create call * with the credit_card_id. This call will authorize the card and let you use it at a later time or * date (for crowdfunding, subscriptions, etc). If you don’t call /credit_card/authorize or * /checkout/create within 30 minutes then the credit card will expire. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/CreditCard.java // @Data // public class CreditCard implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the credit_card. */ // public String creditCardId; // /** The string that identifies the credit_card such as MasterCard xxxxxx4769. */ // public String creditCardName; // /** The state that the credit card is in. */ // public String state; // /** The name on the card (ie "Bob Smith"). */ // public String userName; // /** The email address of the user who owns the card. */ // public String email; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // public String referenceId; // } // Path: src/main/java/com/lookfirst/wepay/api/req/CreditCardAuthorizeRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.CreditCard; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/credit_card * * You should only use this call if you are not going to immediately make the /checkout/create call * with the credit_card_id. This call will authorize the card and let you use it at a later time or * date (for crowdfunding, subscriptions, etc). If you don’t call /credit_card/authorize or * /checkout/create within 30 minutes then the credit card will expire. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class CreditCardAuthorizeRequest extends WePayRequest<CreditCard> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/AccountRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/WePayAccount.java // @Data // @EqualsAndHashCode(callSuper=false) // public class WePayAccount extends AccountUri { // private static final long serialVersionUID = 1L; // // /** The name of the account. */ // private String name; // /** The state of the account: active, disabled or deleted. */ // private String state; // /** The account description. */ // private String description; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // private String referenceId; // /** The maximum amount in dollars (including fees) that you can charge for payments to this account. */ // private String paymentLimit; // /** An array of Google Analytics domains associated with the app. */ // private List<String> gaqDomains; // /** The theme object associated with the App (if applicable). */ // private ThemeObject themeObject; // /** Returns "verified" if the account has been verified and "unverified" if it has not. If the account has pending verification, then it is "pending". */ // private String verificationState; // /** If the account is "unverified" then you can send the user to this url to verify their account. */ // private String verificationUrl; // /** The account type. Can be "personal", "nonprofit", or "business". */ // private String type; // /** The unixtime when the account was created. */ // private Long createTime; // /** Array of account balances for each currency. */ // private List<AccountBalance> balances; // /** Array of account incoming and outgoing payments status for each currency. */ // private List<AccountStatus> statuses; // /** Array of action strings explaining all the actions that are required to make this account active. It will be empty if no action is required. */ // private List<String> actionReasons; // /** The account's country of origin 2-letter ISO code (e.g. 'US') */ // private String country; // /** Array of supported currency strings for this account (e.g. ["USD"]). Only "USD" is supported for now. */ // private List<String> currencies; // }
import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.WePayAccount;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * This call allows you to lookup the details of the a payment account on WePay. * The payment account must belong to the user associated with the access token used to make the call. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/WePayAccount.java // @Data // @EqualsAndHashCode(callSuper=false) // public class WePayAccount extends AccountUri { // private static final long serialVersionUID = 1L; // // /** The name of the account. */ // private String name; // /** The state of the account: active, disabled or deleted. */ // private String state; // /** The account description. */ // private String description; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // private String referenceId; // /** The maximum amount in dollars (including fees) that you can charge for payments to this account. */ // private String paymentLimit; // /** An array of Google Analytics domains associated with the app. */ // private List<String> gaqDomains; // /** The theme object associated with the App (if applicable). */ // private ThemeObject themeObject; // /** Returns "verified" if the account has been verified and "unverified" if it has not. If the account has pending verification, then it is "pending". */ // private String verificationState; // /** If the account is "unverified" then you can send the user to this url to verify their account. */ // private String verificationUrl; // /** The account type. Can be "personal", "nonprofit", or "business". */ // private String type; // /** The unixtime when the account was created. */ // private Long createTime; // /** Array of account balances for each currency. */ // private List<AccountBalance> balances; // /** Array of account incoming and outgoing payments status for each currency. */ // private List<AccountStatus> statuses; // /** Array of action strings explaining all the actions that are required to make this account active. It will be empty if no action is required. */ // private List<String> actionReasons; // /** The account's country of origin 2-letter ISO code (e.g. 'US') */ // private String country; // /** Array of supported currency strings for this account (e.g. ["USD"]). Only "USD" is supported for now. */ // private List<String> currencies; // } // Path: src/main/java/com/lookfirst/wepay/api/req/AccountRequest.java import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.WePayAccount; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * This call allows you to lookup the details of the a payment account on WePay. * The payment account must belong to the user associated with the access token used to make the call. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class AccountRequest extends WePayRequest<WePayAccount> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/WithdrawalFindRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/Withdrawal.java // @Data // @EqualsAndHashCode(callSuper=false) // public class Withdrawal implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the withdrawal. */ // private Long withdrawalId; // /** The unique ID of the account that the money is coming from. */ // private Long accountId; // /** The state that the withdrawal is in See the section on payment states for a list of possible states. */ // private State state; // /** The uri that the account owner will return to after completing the withdrawal. Set to app homepage if not passed in /withdrawal/create. */ // private String redirectUri; // /** The uri that you will send the account owner to to complete the withdrawal. */ // private String withdrawalUri; // /** The uri that we will post notifications to each time the state on this withdrawal changes. */ // private String callbackUri; // /** The amount on money withdrawn from the WePay account to the bank account. */ // private BigDecimal amount; // /** The currency used, default "USD" ("USD" for now). */ // private String currency; // /** A short description for the reason of the withdrawal (255 characters). */ // private String note; // /** Whether the recipient of the money has been confirmed (for bank withdrawals this is the receiving bank account). */ // private boolean recipientConfirmed; // /** The type of withdrawal. Will be "check" for a sent paper check, or "ach" for a withdrawal to a bank account. */ // private WithdrawalType type; // /** The unixtime when the withdrawal was created. */ // private Long createTime; // /** The unixtime when the withdrawal was captured and credited to the payee's bank account. Returns 0 if withdrawal is not yet captured. */ // private Long captureTime; // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum SortOrder { ASC, DESC }
import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Withdrawal; import com.lookfirst.wepay.api.Constants.SortOrder;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/withdrawal * * This call allows you to find withdrawals. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/Withdrawal.java // @Data // @EqualsAndHashCode(callSuper=false) // public class Withdrawal implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the withdrawal. */ // private Long withdrawalId; // /** The unique ID of the account that the money is coming from. */ // private Long accountId; // /** The state that the withdrawal is in See the section on payment states for a list of possible states. */ // private State state; // /** The uri that the account owner will return to after completing the withdrawal. Set to app homepage if not passed in /withdrawal/create. */ // private String redirectUri; // /** The uri that you will send the account owner to to complete the withdrawal. */ // private String withdrawalUri; // /** The uri that we will post notifications to each time the state on this withdrawal changes. */ // private String callbackUri; // /** The amount on money withdrawn from the WePay account to the bank account. */ // private BigDecimal amount; // /** The currency used, default "USD" ("USD" for now). */ // private String currency; // /** A short description for the reason of the withdrawal (255 characters). */ // private String note; // /** Whether the recipient of the money has been confirmed (for bank withdrawals this is the receiving bank account). */ // private boolean recipientConfirmed; // /** The type of withdrawal. Will be "check" for a sent paper check, or "ach" for a withdrawal to a bank account. */ // private WithdrawalType type; // /** The unixtime when the withdrawal was created. */ // private Long createTime; // /** The unixtime when the withdrawal was captured and credited to the payee's bank account. Returns 0 if withdrawal is not yet captured. */ // private Long captureTime; // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum SortOrder { ASC, DESC } // Path: src/main/java/com/lookfirst/wepay/api/req/WithdrawalFindRequest.java import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Withdrawal; import com.lookfirst.wepay.api.Constants.SortOrder; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/withdrawal * * This call allows you to find withdrawals. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class WithdrawalFindRequest extends WePayRequest<List<Withdrawal>> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/WithdrawalFindRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/Withdrawal.java // @Data // @EqualsAndHashCode(callSuper=false) // public class Withdrawal implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the withdrawal. */ // private Long withdrawalId; // /** The unique ID of the account that the money is coming from. */ // private Long accountId; // /** The state that the withdrawal is in See the section on payment states for a list of possible states. */ // private State state; // /** The uri that the account owner will return to after completing the withdrawal. Set to app homepage if not passed in /withdrawal/create. */ // private String redirectUri; // /** The uri that you will send the account owner to to complete the withdrawal. */ // private String withdrawalUri; // /** The uri that we will post notifications to each time the state on this withdrawal changes. */ // private String callbackUri; // /** The amount on money withdrawn from the WePay account to the bank account. */ // private BigDecimal amount; // /** The currency used, default "USD" ("USD" for now). */ // private String currency; // /** A short description for the reason of the withdrawal (255 characters). */ // private String note; // /** Whether the recipient of the money has been confirmed (for bank withdrawals this is the receiving bank account). */ // private boolean recipientConfirmed; // /** The type of withdrawal. Will be "check" for a sent paper check, or "ach" for a withdrawal to a bank account. */ // private WithdrawalType type; // /** The unixtime when the withdrawal was created. */ // private Long createTime; // /** The unixtime when the withdrawal was captured and credited to the payee's bank account. Returns 0 if withdrawal is not yet captured. */ // private Long captureTime; // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum SortOrder { ASC, DESC }
import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Withdrawal; import com.lookfirst.wepay.api.Constants.SortOrder;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/withdrawal * * This call allows you to find withdrawals. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class WithdrawalFindRequest extends WePayRequest<List<Withdrawal>> { /** The unique ID of the account you want to look up withdrawals for. */ private String accountId; /** The maximum number of withdrawals that will be returned. */ private Integer limit; /** If more than "limit" withdrawals are found, where to start in the withdrawal list. */ private Integer start; /** Sort the results of the search by time created. Use 'DESC' for most recent to least recent. Use 'ASC' for least recent to most recent. Defaults to 'DESC'. */
// Path: src/main/java/com/lookfirst/wepay/api/Withdrawal.java // @Data // @EqualsAndHashCode(callSuper=false) // public class Withdrawal implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique ID of the withdrawal. */ // private Long withdrawalId; // /** The unique ID of the account that the money is coming from. */ // private Long accountId; // /** The state that the withdrawal is in See the section on payment states for a list of possible states. */ // private State state; // /** The uri that the account owner will return to after completing the withdrawal. Set to app homepage if not passed in /withdrawal/create. */ // private String redirectUri; // /** The uri that you will send the account owner to to complete the withdrawal. */ // private String withdrawalUri; // /** The uri that we will post notifications to each time the state on this withdrawal changes. */ // private String callbackUri; // /** The amount on money withdrawn from the WePay account to the bank account. */ // private BigDecimal amount; // /** The currency used, default "USD" ("USD" for now). */ // private String currency; // /** A short description for the reason of the withdrawal (255 characters). */ // private String note; // /** Whether the recipient of the money has been confirmed (for bank withdrawals this is the receiving bank account). */ // private boolean recipientConfirmed; // /** The type of withdrawal. Will be "check" for a sent paper check, or "ach" for a withdrawal to a bank account. */ // private WithdrawalType type; // /** The unixtime when the withdrawal was created. */ // private Long createTime; // /** The unixtime when the withdrawal was captured and credited to the payee's bank account. Returns 0 if withdrawal is not yet captured. */ // private Long captureTime; // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum SortOrder { ASC, DESC } // Path: src/main/java/com/lookfirst/wepay/api/req/WithdrawalFindRequest.java import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.Withdrawal; import com.lookfirst.wepay.api.Constants.SortOrder; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/withdrawal * * This call allows you to find withdrawals. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class WithdrawalFindRequest extends WePayRequest<List<Withdrawal>> { /** The unique ID of the account you want to look up withdrawals for. */ private String accountId; /** The maximum number of withdrawals that will be returned. */ private Integer limit; /** If more than "limit" withdrawals are found, where to start in the withdrawal list. */ private Integer start; /** Sort the results of the search by time created. Use 'DESC' for most recent to least recent. Use 'ASC' for least recent to most recent. Defaults to 'DESC'. */
private SortOrder sortOrder;
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/TransferFind.java
// Path: src/main/java/com/lookfirst/wepay/api/Transfer.java // @Deprecated // @Data // @EqualsAndHashCode(callSuper=true) // public class Transfer extends TransferInstruction { // private static final long serialVersionUID = 1L; // // /** The unique ID of the transfer. */ // public String transferId; // /** The unique ID of the account the money is coming from. */ // public String accountId; // /** No The unique ID of the disbursement you want to look up transfers for. */ // public String disbursementId; // /** The state that the disbursement is in (new, sent, or failed). */ // public String state; // }
import com.lookfirst.wepay.api.Transfer; import lombok.Data; import lombok.EqualsAndHashCode; import java.util.List;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/disbursement * * This call allows you to find transfers associated with an account. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Deprecated @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/Transfer.java // @Deprecated // @Data // @EqualsAndHashCode(callSuper=true) // public class Transfer extends TransferInstruction { // private static final long serialVersionUID = 1L; // // /** The unique ID of the transfer. */ // public String transferId; // /** The unique ID of the account the money is coming from. */ // public String accountId; // /** No The unique ID of the disbursement you want to look up transfers for. */ // public String disbursementId; // /** The state that the disbursement is in (new, sent, or failed). */ // public String state; // } // Path: src/main/java/com/lookfirst/wepay/api/req/TransferFind.java import com.lookfirst.wepay.api.Transfer; import lombok.Data; import lombok.EqualsAndHashCode; import java.util.List; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/disbursement * * This call allows you to find transfers associated with an account. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Deprecated @Data @EqualsAndHashCode(callSuper=false)
public class TransferFind extends WePayRequest<List<Transfer>> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/AccountFindRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/WePayAccount.java // @Data // @EqualsAndHashCode(callSuper=false) // public class WePayAccount extends AccountUri { // private static final long serialVersionUID = 1L; // // /** The name of the account. */ // private String name; // /** The state of the account: active, disabled or deleted. */ // private String state; // /** The account description. */ // private String description; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // private String referenceId; // /** The maximum amount in dollars (including fees) that you can charge for payments to this account. */ // private String paymentLimit; // /** An array of Google Analytics domains associated with the app. */ // private List<String> gaqDomains; // /** The theme object associated with the App (if applicable). */ // private ThemeObject themeObject; // /** Returns "verified" if the account has been verified and "unverified" if it has not. If the account has pending verification, then it is "pending". */ // private String verificationState; // /** If the account is "unverified" then you can send the user to this url to verify their account. */ // private String verificationUrl; // /** The account type. Can be "personal", "nonprofit", or "business". */ // private String type; // /** The unixtime when the account was created. */ // private Long createTime; // /** Array of account balances for each currency. */ // private List<AccountBalance> balances; // /** Array of account incoming and outgoing payments status for each currency. */ // private List<AccountStatus> statuses; // /** Array of action strings explaining all the actions that are required to make this account active. It will be empty if no action is required. */ // private List<String> actionReasons; // /** The account's country of origin 2-letter ISO code (e.g. 'US') */ // private String country; // /** Array of supported currency strings for this account (e.g. ["USD"]). Only "USD" is supported for now. */ // private List<String> currencies; // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum SortOrder { ASC, DESC }
import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.WePayAccount; import com.lookfirst.wepay.api.Constants.SortOrder;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * This call lets you search the accounts of the user associated with the access token used to make the call. * You can search by name or reference_id, and the response will be an array of all the matching accounts. * If both name and reference_id are blank, this will return an array of all of the user's accounts. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
// Path: src/main/java/com/lookfirst/wepay/api/WePayAccount.java // @Data // @EqualsAndHashCode(callSuper=false) // public class WePayAccount extends AccountUri { // private static final long serialVersionUID = 1L; // // /** The name of the account. */ // private String name; // /** The state of the account: active, disabled or deleted. */ // private String state; // /** The account description. */ // private String description; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // private String referenceId; // /** The maximum amount in dollars (including fees) that you can charge for payments to this account. */ // private String paymentLimit; // /** An array of Google Analytics domains associated with the app. */ // private List<String> gaqDomains; // /** The theme object associated with the App (if applicable). */ // private ThemeObject themeObject; // /** Returns "verified" if the account has been verified and "unverified" if it has not. If the account has pending verification, then it is "pending". */ // private String verificationState; // /** If the account is "unverified" then you can send the user to this url to verify their account. */ // private String verificationUrl; // /** The account type. Can be "personal", "nonprofit", or "business". */ // private String type; // /** The unixtime when the account was created. */ // private Long createTime; // /** Array of account balances for each currency. */ // private List<AccountBalance> balances; // /** Array of account incoming and outgoing payments status for each currency. */ // private List<AccountStatus> statuses; // /** Array of action strings explaining all the actions that are required to make this account active. It will be empty if no action is required. */ // private List<String> actionReasons; // /** The account's country of origin 2-letter ISO code (e.g. 'US') */ // private String country; // /** Array of supported currency strings for this account (e.g. ["USD"]). Only "USD" is supported for now. */ // private List<String> currencies; // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum SortOrder { ASC, DESC } // Path: src/main/java/com/lookfirst/wepay/api/req/AccountFindRequest.java import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.WePayAccount; import com.lookfirst.wepay.api.Constants.SortOrder; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * This call lets you search the accounts of the user associated with the access token used to make the call. * You can search by name or reference_id, and the response will be an array of all the matching accounts. * If both name and reference_id are blank, this will return an array of all of the user's accounts. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false)
public class AccountFindRequest extends WePayRequest<List<WePayAccount>> {
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/api/req/AccountFindRequest.java
// Path: src/main/java/com/lookfirst/wepay/api/WePayAccount.java // @Data // @EqualsAndHashCode(callSuper=false) // public class WePayAccount extends AccountUri { // private static final long serialVersionUID = 1L; // // /** The name of the account. */ // private String name; // /** The state of the account: active, disabled or deleted. */ // private String state; // /** The account description. */ // private String description; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // private String referenceId; // /** The maximum amount in dollars (including fees) that you can charge for payments to this account. */ // private String paymentLimit; // /** An array of Google Analytics domains associated with the app. */ // private List<String> gaqDomains; // /** The theme object associated with the App (if applicable). */ // private ThemeObject themeObject; // /** Returns "verified" if the account has been verified and "unverified" if it has not. If the account has pending verification, then it is "pending". */ // private String verificationState; // /** If the account is "unverified" then you can send the user to this url to verify their account. */ // private String verificationUrl; // /** The account type. Can be "personal", "nonprofit", or "business". */ // private String type; // /** The unixtime when the account was created. */ // private Long createTime; // /** Array of account balances for each currency. */ // private List<AccountBalance> balances; // /** Array of account incoming and outgoing payments status for each currency. */ // private List<AccountStatus> statuses; // /** Array of action strings explaining all the actions that are required to make this account active. It will be empty if no action is required. */ // private List<String> actionReasons; // /** The account's country of origin 2-letter ISO code (e.g. 'US') */ // private String country; // /** Array of supported currency strings for this account (e.g. ["USD"]). Only "USD" is supported for now. */ // private List<String> currencies; // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum SortOrder { ASC, DESC }
import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.WePayAccount; import com.lookfirst.wepay.api.Constants.SortOrder;
package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * This call lets you search the accounts of the user associated with the access token used to make the call. * You can search by name or reference_id, and the response will be an array of all the matching accounts. * If both name and reference_id are blank, this will return an array of all of the user's accounts. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class AccountFindRequest extends WePayRequest<List<WePayAccount>> { /** The name of the account you are searching for. */ private String name; /** The reference ID of the account you are searching for (set by the app in in /account/create or account/modify). */ private String referenceId; /** Sort the results of the search by time created. Use 'DESC' for most recent to least recent. Use 'ASC' for least recent to most recent. Defaults to 'DESC'. */
// Path: src/main/java/com/lookfirst/wepay/api/WePayAccount.java // @Data // @EqualsAndHashCode(callSuper=false) // public class WePayAccount extends AccountUri { // private static final long serialVersionUID = 1L; // // /** The name of the account. */ // private String name; // /** The state of the account: active, disabled or deleted. */ // private String state; // /** The account description. */ // private String description; // /** The unique reference ID of the account (this is set by the application in the /account/create or /account/modify call). */ // private String referenceId; // /** The maximum amount in dollars (including fees) that you can charge for payments to this account. */ // private String paymentLimit; // /** An array of Google Analytics domains associated with the app. */ // private List<String> gaqDomains; // /** The theme object associated with the App (if applicable). */ // private ThemeObject themeObject; // /** Returns "verified" if the account has been verified and "unverified" if it has not. If the account has pending verification, then it is "pending". */ // private String verificationState; // /** If the account is "unverified" then you can send the user to this url to verify their account. */ // private String verificationUrl; // /** The account type. Can be "personal", "nonprofit", or "business". */ // private String type; // /** The unixtime when the account was created. */ // private Long createTime; // /** Array of account balances for each currency. */ // private List<AccountBalance> balances; // /** Array of account incoming and outgoing payments status for each currency. */ // private List<AccountStatus> statuses; // /** Array of action strings explaining all the actions that are required to make this account active. It will be empty if no action is required. */ // private List<String> actionReasons; // /** The account's country of origin 2-letter ISO code (e.g. 'US') */ // private String country; // /** Array of supported currency strings for this account (e.g. ["USD"]). Only "USD" is supported for now. */ // private List<String> currencies; // } // // Path: src/main/java/com/lookfirst/wepay/api/Constants.java // public static enum SortOrder { ASC, DESC } // Path: src/main/java/com/lookfirst/wepay/api/req/AccountFindRequest.java import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; import com.lookfirst.wepay.api.WePayAccount; import com.lookfirst.wepay.api.Constants.SortOrder; package com.lookfirst.wepay.api.req; /** * https://stage.wepay.com/developer/reference/account * * This call lets you search the accounts of the user associated with the access token used to make the call. * You can search by name or reference_id, and the response will be an array of all the matching accounts. * If both name and reference_id are blank, this will return an array of all of the user's accounts. * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Data @EqualsAndHashCode(callSuper=false) public class AccountFindRequest extends WePayRequest<List<WePayAccount>> { /** The name of the account you are searching for. */ private String name; /** The reference ID of the account you are searching for (set by the app in in /account/create or account/modify). */ private String referenceId; /** Sort the results of the search by time created. Use 'DESC' for most recent to least recent. Use 'ASC' for least recent to most recent. Defaults to 'DESC'. */
private SortOrder sortOrder;
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/WePayApi.java
// Path: src/main/java/com/lookfirst/wepay/api/Token.java // @Data // public class Token implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique user ID of the user */ // private String userId; // /** The access token that you can use to make calls on behalf of the user */ // private String accessToken; // /** The token type - for now only "BEARER" is supported */ // private String tokenType; // /** How much time till the access_token expires. If NULL or not present, the access token will be valid until the user revokes the access_token */ // private String expiresIn; // } // // Path: src/main/java/com/lookfirst/wepay/api/req/TokenRequest.java // @Data // @EqualsAndHashCode(callSuper=false) // public class TokenRequest extends WePayRequest<Token> { // // public static final String ENDPOINT = "/oauth2/token"; // // /** Yes The client ID issued to the app by WePay - see your client ID on your app screen */ // private Long clientId; // /** Yes The uri the user will be redirected to after authorization. Must be the same as passed in /v2/oauth2/authorize */ // private String redirectUri; // /** Yes The client secret issued to the app by WePay - see your client secret on your app screen */ // private String clientSecret; // /** Yes The code returned by /v2/oauth2/authorize */ // private String code; // // /** */ // @Override // public String getEndpoint() { // return "/oauth2/token"; // } // // } // // Path: src/main/java/com/lookfirst/wepay/api/req/WePayRequest.java // public abstract class WePayRequest<T> { // @JsonIgnore // public abstract String getEndpoint(); // } // // Path: src/main/java/com/lookfirst/wepay/util/DataProvider.java // public interface DataProvider { // InputStream getData(String uri, String postJson, String token) throws IOException; // }
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.PropertyNamingStrategy; import com.fasterxml.jackson.databind.SerializationFeature; import com.lookfirst.wepay.api.Token; import com.lookfirst.wepay.api.req.TokenRequest; import com.lookfirst.wepay.api.req.WePayRequest; import com.lookfirst.wepay.util.DataProvider; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.lang.reflect.ParameterizedType; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.nio.charset.Charset; import java.util.Arrays; import java.util.List;
package com.lookfirst.wepay; /** * Implements a way to communicate with the WePayApi. * * https://www.wepay.com/developer/reference * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Slf4j @NoArgsConstructor public class WePayApi { /** * Scope fields * Passed into Wepay::getAuthorizationUri as array * * https://stage.wepay.com/developer/reference/permissions */ @AllArgsConstructor public enum Scope { MANAGE_ACCOUNTS ("manage_accounts"), // Open and interact with accounts VIEW_BALANCE ("view_balance"), // View account balances COLLECT_PAYMENTS ("collect_payments"), // Create and interact with checkouts REFUND_PAYMENTS ("refund_payments"), // Refund checkouts VIEW_USER ("view_user"), // Get details about authenticated user PREAPPROVE_PAYMENTS ("preapprove_payments"),// preapproval SEND_MONEY ("send_money"); // /disbursement & /transfer private String scope; public static List<Scope> getAll() { return Arrays.asList(values()); } public String toString() { return scope; } } /** */ public static final ObjectMapper MAPPER = new ObjectMapper(); static { // For the UserDetails bean (an others), we send an empty bean. MAPPER.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); // Makes for nice java property/method names MAPPER.setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES); // If wepay adds properties, we shouldn't blow up MAPPER.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); // Don't send null properties to wepay MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL); // This saves us the mess of enums that conflict with java keywords (eg Checkout.State.new_) MAPPER.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); MAPPER.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); } /** */ private static final String STAGING_URL = "https://stage.wepayapi.com/v2"; private static final String PROD_URL = "https://wepayapi.com/v2"; /** */ private String currentUrl; /** */ @Getter @Setter private WePayKey key; /** Timeout in milliseconds */ @Getter @Setter int timeout; /** Number of retries if the connection fails */ @Getter @Setter int retries; /** For unit testing. */
// Path: src/main/java/com/lookfirst/wepay/api/Token.java // @Data // public class Token implements Serializable { // private static final long serialVersionUID = 1L; // // /** The unique user ID of the user */ // private String userId; // /** The access token that you can use to make calls on behalf of the user */ // private String accessToken; // /** The token type - for now only "BEARER" is supported */ // private String tokenType; // /** How much time till the access_token expires. If NULL or not present, the access token will be valid until the user revokes the access_token */ // private String expiresIn; // } // // Path: src/main/java/com/lookfirst/wepay/api/req/TokenRequest.java // @Data // @EqualsAndHashCode(callSuper=false) // public class TokenRequest extends WePayRequest<Token> { // // public static final String ENDPOINT = "/oauth2/token"; // // /** Yes The client ID issued to the app by WePay - see your client ID on your app screen */ // private Long clientId; // /** Yes The uri the user will be redirected to after authorization. Must be the same as passed in /v2/oauth2/authorize */ // private String redirectUri; // /** Yes The client secret issued to the app by WePay - see your client secret on your app screen */ // private String clientSecret; // /** Yes The code returned by /v2/oauth2/authorize */ // private String code; // // /** */ // @Override // public String getEndpoint() { // return "/oauth2/token"; // } // // } // // Path: src/main/java/com/lookfirst/wepay/api/req/WePayRequest.java // public abstract class WePayRequest<T> { // @JsonIgnore // public abstract String getEndpoint(); // } // // Path: src/main/java/com/lookfirst/wepay/util/DataProvider.java // public interface DataProvider { // InputStream getData(String uri, String postJson, String token) throws IOException; // } // Path: src/main/java/com/lookfirst/wepay/WePayApi.java import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.PropertyNamingStrategy; import com.fasterxml.jackson.databind.SerializationFeature; import com.lookfirst.wepay.api.Token; import com.lookfirst.wepay.api.req.TokenRequest; import com.lookfirst.wepay.api.req.WePayRequest; import com.lookfirst.wepay.util.DataProvider; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.lang.reflect.ParameterizedType; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.nio.charset.Charset; import java.util.Arrays; import java.util.List; package com.lookfirst.wepay; /** * Implements a way to communicate with the WePayApi. * * https://www.wepay.com/developer/reference * * @author Jon Scott Stevens * @author Jeff Schnitzer */ @Slf4j @NoArgsConstructor public class WePayApi { /** * Scope fields * Passed into Wepay::getAuthorizationUri as array * * https://stage.wepay.com/developer/reference/permissions */ @AllArgsConstructor public enum Scope { MANAGE_ACCOUNTS ("manage_accounts"), // Open and interact with accounts VIEW_BALANCE ("view_balance"), // View account balances COLLECT_PAYMENTS ("collect_payments"), // Create and interact with checkouts REFUND_PAYMENTS ("refund_payments"), // Refund checkouts VIEW_USER ("view_user"), // Get details about authenticated user PREAPPROVE_PAYMENTS ("preapprove_payments"),// preapproval SEND_MONEY ("send_money"); // /disbursement & /transfer private String scope; public static List<Scope> getAll() { return Arrays.asList(values()); } public String toString() { return scope; } } /** */ public static final ObjectMapper MAPPER = new ObjectMapper(); static { // For the UserDetails bean (an others), we send an empty bean. MAPPER.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); // Makes for nice java property/method names MAPPER.setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES); // If wepay adds properties, we shouldn't blow up MAPPER.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); // Don't send null properties to wepay MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL); // This saves us the mess of enums that conflict with java keywords (eg Checkout.State.new_) MAPPER.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); MAPPER.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); } /** */ private static final String STAGING_URL = "https://stage.wepayapi.com/v2"; private static final String PROD_URL = "https://wepayapi.com/v2"; /** */ private String currentUrl; /** */ @Getter @Setter private WePayKey key; /** Timeout in milliseconds */ @Getter @Setter int timeout; /** Number of retries if the connection fails */ @Getter @Setter int retries; /** For unit testing. */
private DataProvider dataProvider;