Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify Spreedly Client usage idioms #20

Open
mfornos opened this issue Oct 4, 2015 · 0 comments
Open

Simplify Spreedly Client usage idioms #20

mfornos opened this issue Oct 4, 2015 · 0 comments
Labels
Milestone

Comments

@mfornos
Copy link
Contributor

mfornos commented Oct 4, 2015

Suggestion 1 TENTATIVE

Fluent command builder like:

Transaction txn = PurchaseOnGateway.for(client)
    .amount(1234)
    .currency("EUR")
    .retainOnSuccess(true)
    .orderId("XYZ")
    .email("x@x.com")
    .merchantName("Descriptor name")
    .execute(); // here we can override client tokens if needed, or executeAsync();

Instead of this kind of interaction:

String gatewayToken = "XKqtfVWFvZgbwmrN5ZFdMZpB1XN";
String paymentMethodToken = "U6LMHXfN6ZkOPUdXWKx6xO8DydG";

Map<String, String> options = new HashMap<String, String>();
options.put(RETAIN_ON_SUCCESS, "true");
options.put(CURRENCY_CODE, "EUR");
options.put(ORDER_ID, "XYZ");
options.put(EMAIL, "email@example.com");
options.put(MERCHANT_NAME_DESCRIPTOR, "Descriptor name");

Transaction txn = client.purchaseOnGateway(gatewayToken, paymentMethodToken, 1234, options);
@mfornos mfornos added the design label Oct 4, 2015
@mfornos mfornos modified the milestone: 0.1.0 Release Oct 4, 2015
@mfornos mfornos changed the title Simplify interaction patterns Simplify Spreedly Client usage idioms Oct 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant