spreedly-client


License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

com.ticketfly
ArtifactId

ArtifactId

spreedly-client_2.11
Last Version

Last Version

1.1.2
Release Date

Release Date

Type

Type

jar
Description

Description

spreedly-client
spreedly-client
Project URL

Project URL

https://github.com/Ticketfly/spreedly-scala
Project Organization

Project Organization

com.ticketfly
Source Code Management

Source Code Management

https://github.com/Ticketfly/spreedly-scala

Download spreedly-client_2.11

How to add to project

<!-- https://jarcasting.com/artifacts/com.ticketfly/spreedly-client_2.11/ -->
<dependency>
    <groupId>com.ticketfly</groupId>
    <artifactId>spreedly-client_2.11</artifactId>
    <version>1.1.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.ticketfly/spreedly-client_2.11/
implementation 'com.ticketfly:spreedly-client_2.11:1.1.2'
// https://jarcasting.com/artifacts/com.ticketfly/spreedly-client_2.11/
implementation ("com.ticketfly:spreedly-client_2.11:1.1.2")
'com.ticketfly:spreedly-client_2.11:jar:1.1.2'
<dependency org="com.ticketfly" name="spreedly-client_2.11" rev="1.1.2">
  <artifact name="spreedly-client_2.11" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.ticketfly', module='spreedly-client_2.11', version='1.1.2')
)
libraryDependencies += "com.ticketfly" % "spreedly-client_2.11" % "1.1.2"
[com.ticketfly/spreedly-client_2.11 "1.1.2"]

Dependencies

compile (8)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.7
cc.protea.spreedly : spreedly jar 0.9.2
com.typesafe.akka : akka-actor_2.11 jar 2.3.11
com.typesafe.akka : akka-slf4j_2.11 jar 2.3.11
io.spray : spray-http_2.11 jar 1.3.3
io.spray : spray-httpx_2.11 jar 1.3.3
io.spray : spray-can_2.11 jar 1.3.3
io.spray : spray-util_2.11 jar 1.3.3

provided (2)

Group / Artifact Type Version
org.scoverage : scalac-scoverage-runtime_2.11 jar 1.0.4
org.scoverage : scalac-scoverage-plugin_2.11 jar 1.0.4

test (4)

Group / Artifact Type Version
com.typesafe.akka : akka-testkit_2.11 jar 2.3.11
io.spray : spray-testkit_2.11 jar 1.3.3
org.specs2 : specs2_2.11 jar 2.4.2
org.scalatest : scalatest_2.11 jar 2.2.1

Project Modules

There are no modules declared in this project.

spreedly-scala Build Status Coverage Status Maven Central

Async Spreedly payment service client library. Wraps external requests in Futures and parses XML into domain transfer objects.

Usage

Include as a dependency in build.sbt

libraryDependencies += "com.ticketfly" %% "spreedly-client" % "1.1.0"

Exposes SpreedlyClient which is the core interaction class for performing REST actions against payment gateways. It marshals success & error responses into Spreedly DTOs.

JAXB is recommended by Typesafe as an efficient way to serialize XML over the wire. The mappings are largely from spreedly-java (MIT license).

import com.ticketfly.spreedly._

val config = SpreedlyConfiguration("environmentToken", "accessSecret")
val spreedlyClient = new SpreedlyClient(config)

// Make a purchase of $1 using a gateway token and payment method token
spreedlyClient.purchase("gaToken", "pmToken", 100, "USD").map(response => {
    if (response.succeeded) log.info(s"Successfully completed purchase with token ${response.getToken}")
    else log.error(s"Could not complete purchase, response errors: ${response.errors.toString}")
}) recover {
    case e: SpreedlyException => {
      log.error(s"Error contacting Spreedly service: ${e.getMessage}")
      throw e
    }
}

Test

sbt clean coverage test

Terminology

Authorize & Capture

An authorize call will contact the gateway to verify whether a transaction can take place and funds can be transferred. If able to proceed, a capture is then required to perform the fund transfer.

Purchase

Immediately transfer funds through payment gateway if transaction is approved.

Redact

In most cases, Spreedly will not permit you to delete resources (gateway accounts, payments, etc) since their history is permanent. Instead, they allow you to redact these resources, making them inactive and scrubbing them of sensitive information. Spreedly will not charge storage fees for redacted resources.

Retain

By default, payment methods are created and their tokens are short-lived, expiring after a few minutes. Gateway accounts, however, are automatically retained by default when called via normal, authenticated channel. Spreedly allows you to retain customer payment methods by an explicit API call or by passing a retain_on_success to purchase, verify, or authorize calls.

Recache

Certain sensitive data such as credit card CVV cannot be retained by Spreedly. Instead, they can be recached for a period of time in order to maintain the original payment method and its token.

Credit

A transaction credit is the same as a refund.

Void

Cancel a charge that hasn't yet taken place by issuing a void.

License

The MIT License (MIT)

Copyright (c) 2015-2016 Ticketfly, Inc

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.

com.ticketfly

Ticketfly

Versions

Version
1.1.2
1.1.0
1.0.0