Skip to content

Commit be56b6e

Browse files
author
Thomas Hunziker
committed
Release 2.2.14
1 parent 3b8f149 commit be56b6e

11 files changed

+204
-420
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Add this dependency to your project's POM:
2323
<dependency>
2424
<groupId>com.postfinancecheckout</groupId>
2525
<artifactId>postfinancecheckout-java-sdk</artifactId>
26-
<version>2.2.13</version>
26+
<version>2.2.14</version>
2727
<scope>compile</scope>
2828
</dependency>
2929
```
@@ -33,7 +33,7 @@ Add this dependency to your project's POM:
3333
Add this dependency to your project's build file:
3434

3535
```groovy
36-
compile "com.postfinancecheckout:postfinancecheckout-java-sdk:2.2.13"
36+
compile "com.postfinancecheckout:postfinancecheckout-java-sdk:2.2.14"
3737
```
3838

3939
### Others
@@ -46,7 +46,7 @@ mvn clean package
4646

4747
Then manually install the following JARs:
4848

49-
* `target/postfinancecheckout-java-sdk-2.2.13.jar`
49+
* `target/postfinancecheckout-java-sdk-2.2.14.jar`
5050
* `target/lib/*.jar`
5151

5252
## Usage

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'idea'
22
apply plugin: 'eclipse'
33

44
group = 'com.postfinancecheckout'
5-
version = '2.2.13'
5+
version = '2.2.14'
66

77
buildscript {
88
repositories {

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ lazy val root = (project in file(".")).
22
settings(
33
organization := "com.postfinancecheckout",
44
name := "postfinancecheckout-java-sdk",
5-
version := "2.2.13",
5+
version := "2.2.14",
66
scalaVersion := "2.11.4",
77
scalacOptions ++= Seq("-feature"),
88
javacOptions in compile ++= Seq("-Xlint:deprecation"),

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<artifactId>postfinancecheckout-java-sdk</artifactId>
66
<packaging>jar</packaging>
77
<name>postfinancecheckout-java-sdk</name>
8-
<version>2.2.13</version>
8+
<version>2.2.14</version>
99
<url>https://www.postfinance.ch/checkout</url>
1010
<description>The SDK for simplifying the integration with PostFinance Checkout API.</description>
1111
<scm>

src/test/java/com/postfinancecheckout/sdk/test/PaymentTerminalTillServiceTest.java

Lines changed: 0 additions & 105 deletions
This file was deleted.

src/test/java/com/postfinancecheckout/sdk/test/RefundServiceTest.java

Lines changed: 36 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private TransactionCreate getTransactionPayload() {
5050
.amountIncludingTax(BigDecimal.valueOf(29.95))
5151
.sku("red-t-shirt-123");
5252

53-
// Customer Billind Address
53+
// Customer Billing Address
5454
AddressCreate billingAddress = new AddressCreate();
5555
billingAddress.city("Winterthur")
5656
.country("CH")
@@ -150,64 +150,42 @@ public void readTest() {
150150
* This operation creates and executes a refund of a particular transaction.
151151
*/
152152
@Test
153-
public void refundTest() {
154-
try {
155-
Transaction transaction = this.apiClient.getTransactionService().create(this.spaceId, this.getTransactionPayload());
156-
// wait for transaction to be authorized
157-
for (int i = 1; i <= 5; i++) {
158-
if (transaction.getState() == TransactionState.AUTHORIZED) {
159-
break;
160-
}
161-
System.out.println("Waiting for transaction for be authorized --- transaction current state: " + transaction.getState());
162-
163-
try {
164-
Thread.sleep(i * 15000);
165-
} catch (InterruptedException e) {
166-
System.err.println(e.getMessage());
167-
}
168-
transaction = this.apiClient.getTransactionService().read(this.spaceId, transaction.getId());
169-
}
170-
if (transaction.getState() == TransactionState.AUTHORIZED) {
171-
transaction = this.apiClient.getTransactionService().processWithoutUserInteraction(this.spaceId, transaction.getId());
172-
for (int i = 1; i <= 5; i++) {
173-
if (
174-
transaction.getState() == TransactionState.FULFILL ||
175-
transaction.getState() == TransactionState.FAILED
176-
) {
177-
break;
178-
}
179-
180-
try {
181-
Thread.sleep(i * 15000);
182-
} catch (InterruptedException e) {
183-
System.err.println(e.getMessage());
184-
}
185-
transaction = this.apiClient.getTransactionService().read(this.spaceId, transaction.getId());
186-
}
187-
188-
if (transaction.getState() == TransactionState.FULFILL) {
189-
TransactionCompletion transactionCompletion = this.apiClient.getTransactionCompletionService().completeOffline(this.spaceId, transaction.getId());
190-
Assert.assertEquals(
191-
"Transaction completion successful",
192-
transactionCompletion.getState(),
193-
TransactionCompletionState.SUCCESSFUL
194-
);
195-
196-
transaction = this.apiClient.getTransactionService().read(transaction.getLinkedSpaceId(), transactionCompletion.getLinkedTransaction());
197-
Refund refund = this.apiClient.getRefundService().refund(this.spaceId, getRefundPayload(transaction));
198-
199-
Assert.assertEquals(
200-
"Refund successful",
201-
refund.getState(),
202-
RefundState.SUCCESSFUL
203-
);
204-
}
205-
} else {
206-
Assert.assertTrue(transaction.getState() != TransactionState.AUTHORIZED);
153+
public void refundTest() throws Exception {
154+
Transaction transaction = this.apiClient.getTransactionService().create(this.spaceId, this.getTransactionPayload());
155+
transaction = this.apiClient.getTransactionService().processWithoutUserInteraction(spaceId, transaction.getId());
156+
// wait for transaction to be authorized
157+
for (int i = 1; i <= 10; i++) {
158+
if (
159+
transaction.getState() == TransactionState.FULFILL ||
160+
transaction.getState() == TransactionState.FAILED
161+
) {
162+
break;
207163
}
208-
} catch (Exception e) {
209-
e.printStackTrace();
210-
}
164+
165+
try {
166+
Thread.sleep(i * 500);
167+
} catch (InterruptedException e) {
168+
System.err.println(e.getMessage());
169+
}
170+
transaction = this.apiClient.getTransactionService().read(this.spaceId, transaction.getId());
171+
}
172+
Assert.assertEquals(TransactionState.FULFILL, transaction.getState());
173+
174+
TransactionCompletion transactionCompletion = this.apiClient.getTransactionCompletionService().completeOffline(this.spaceId, transaction.getId());
175+
Assert.assertEquals(
176+
"Transaction completion successful",
177+
transactionCompletion.getState(),
178+
TransactionCompletionState.SUCCESSFUL
179+
);
180+
181+
transaction = this.apiClient.getTransactionService().read(transaction.getLinkedSpaceId(), transactionCompletion.getLinkedTransaction());
182+
Refund refund = this.apiClient.getRefundService().refund(this.spaceId, getRefundPayload(transaction));
183+
184+
Assert.assertEquals(
185+
"Refund successful",
186+
refund.getState(),
187+
RefundState.SUCCESSFUL
188+
);
211189
}
212190

213191
/**

0 commit comments

Comments
 (0)