Giter Club home page Giter Club logo

securepay4j's Introduction

securepay4J

Java client library for the Australia Post Secure Pay Periodic XML api.

The client is fairly basic but allows three core operations

storeCard -- essentially stores the a credit card in the secure pay system for later use.

updateStoredCard-- update the stored credit card details for the credit card - to replace a new card.

debitStoredCard - bill a credit card that was previously stored.

Note: we use a bcrypt salted hash of the card as the card id, so every time you call CreditCard.generateCardID you will get a different ID even if its for the same credit card.

SecurePay use the term PayorId and ClientID interchangeably. Both terms are incorrect as it is actually an id for the card not a client or payor. This is why this api uses the term 'card id'.

SecurePay does not use the CVV so you don't need to capture it.

Make certain you clear the CVV and CardNo from the CreditCard object after calling addPayor or updatePayor.

Example usage:

Merchant merchant = new TestMerchantImp();

	SecurePay securePay = new SecurePay(merchant);
	
	System.out.println(securePay.getMessageID());
	System.out.println(securePay.getTimestamp());
	
	CreditCard card = new CreditCard();
	card.setCardNo("4444333322221111");
	card.setExpiry(CCYear._2019, CCMonth.AUG);
	card.generateCardID();
	
	
	try
	{
		System.out.println("CardID:" + card.getCardID());
		securePay.storeCard(card);
		
		// Change the expiry date.
		card.setExpiry(CCYear._2019, CCMonth.AUG);
		
		// update the stored card details.
		securePay.updateStoredCard(card);
		
		card.clearCardNo();
		card.clearCVV();
		
		SecurePayResponse response = securePay.debitStoredCard(card.getCardID(), "INV: 1234", SecurePay.asMoney("25.08"));
		
		if (response.isSuccessful())
			System.out.println("Success: transactionID=" + response.getTransactionID());
		else
			System.out.println(response.toString());
		
	}
	catch (SecurePayException e)
	{
		
		System.out.println("Exception: " + e.getMessage());
		e.printStackTrace();
		fail("Exception thrown");
	}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.