#Java / Spring Boot Client Library for SSO Gateway
@Autowired
private PaymentsClient paymentsClient;
Table below provides a quick summary for the configuration options:
Property | Type | Default Value | Required | Description |
---|---|---|---|---|
server | String | http://localhost:2060 | Yes | Server URL |
connection | ConnectionConfiguration | No | Connection Settings |
social:
server : "https://payments.mydomain.com"
Address address = new Address()
.withCountry("USA").withState("NY").withCity("NY")
.withLine1("MainStreet 1").withLine2("LongRoad").withPostalCode("2815");
Account account = new Account()
.withUsername(username)
.withPhone(new Phone("12-123-123"))
.withAddress(address)
.withCurrency(Currency.USD)
.withEmail(email)
.withVatNumber("12345678")
;
URI uri = paymentsClient.createAccount(account, null, null);
String id = UriUtils.extractId(uri);
Account buyer = paymentsClient.getAccount(SecurityUtil.getPrincipalName(), null, null);
CreditCard card = new CreditCard()
.address(new Address().country("USA").city("NY").line1("Main Street 1"))
.cardType(CardType.VISA_DEBIT)
.currency(Currency.USD)
.cvc("123")
.number("4000056655665556")
.expirationMonth(11)
.expirationYear(2020)
.last4("1234")
.name("TDD Jack")
;
URI uriCard = paymentsClient.addCard(card,user.getId());
String cardId = paymentsClient.extractId(uriCard);
public static final PRICE_MONTLY = new BigDecimal("12.00");
public static final PAYABLE = "ACME Service Subscription";
public static final PAYABLE_CATEGORY = "SasS";
public static final PAYABLE_DESCR = "Monthly Fee";
public Payment makeSubscriptionPayment(Account buyer) {
Payable payable = new Payable()
.withName(PAYABLE)
.withCategory(PAYABLE_CATEGORY)
.withDescription(PAYABLE_DESCR)
.withImg(application.getIcon());
return new Payment()
.withAmount(PRICE_MONTLY)
.withCurrency(Currency.USD)
.withBuyer(buyer)
.withPayable(payable)
.withStatement(payable.getName());
}
Account buyer = paymentsClient.getAccount(SecurityUtil.getPrincipalName(), null, null);
Payment payment = makePayment(buyer);
URI uri = paymentsClient.submitPayment(payment, null, null);
String id = UriUtils.extractId(uri);
payment.setUuid(id);
paymentsClient.chargePayment(payment, null, null);
Comments and Discussion