-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds payment item update feature (#77)
- Loading branch information
1 parent
c909733
commit 623d443
Showing
3 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/java/com/iyzipay/request/UpdatePaymentItemRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.iyzipay.request; | ||
|
||
import com.iyzipay.Request; | ||
import com.iyzipay.ToStringRequestBuilder; | ||
|
||
import java.math.BigDecimal; | ||
|
||
public class UpdatePaymentItemRequest extends Request { | ||
|
||
private String subMerchantKey; | ||
private Long paymentTransactionId; | ||
private BigDecimal subMerchantPrice; | ||
|
||
public String getSubMerchantKey() { | ||
return subMerchantKey; | ||
} | ||
|
||
public void setSubMerchantKey(String subMerchantKey) { | ||
this.subMerchantKey = subMerchantKey; | ||
} | ||
|
||
public Long getPaymentTransactionId() { | ||
return paymentTransactionId; | ||
} | ||
|
||
public void setPaymentTransactionId(Long paymentTransactionId) { | ||
this.paymentTransactionId = paymentTransactionId; | ||
} | ||
|
||
public BigDecimal getSubMerchantPrice() { | ||
return subMerchantPrice; | ||
} | ||
|
||
public void setSubMerchantPrice(BigDecimal subMerchantPrice) { | ||
this.subMerchantPrice = subMerchantPrice; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return new ToStringRequestBuilder(this) | ||
.appendSuper(super.toString()) | ||
.append("subMerchantKey", subMerchantKey) | ||
.append("paymentTransactionId", paymentTransactionId) | ||
.append("subMerchantPrice", subMerchantPrice) | ||
.toString(); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/test/java/com/iyzipay/sample/PaymentItemUpdateSample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.iyzipay.sample; | ||
|
||
import com.iyzipay.model.Locale; | ||
import com.iyzipay.model.PaymentItem; | ||
import com.iyzipay.model.Status; | ||
import com.iyzipay.request.UpdatePaymentItemRequest; | ||
import org.junit.Test; | ||
|
||
import java.math.BigDecimal; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNull; | ||
|
||
public class PaymentItemUpdateSample extends Sample { | ||
|
||
@Test | ||
public void should_update_payment_item() { | ||
UpdatePaymentItemRequest request = new UpdatePaymentItemRequest(); | ||
request.setLocale(Locale.TR.getValue()); | ||
request.setConversationId("123456789"); | ||
request.setPaymentTransactionId(9999999L); | ||
request.setSubMerchantPrice(new BigDecimal("sub-merchant-price")); | ||
request.setSubMerchantKey("sub-merchant-key"); | ||
|
||
PaymentItem paymentItem = PaymentItem.update(request, options); | ||
|
||
System.out.println(paymentItem); | ||
|
||
assertEquals(Status.SUCCESS.getValue(), paymentItem.getStatus()); | ||
assertEquals(Locale.TR.getValue(), paymentItem.getLocale()); | ||
assertEquals("123456789", paymentItem.getConversationId()); | ||
assertNull(paymentItem.getErrorCode()); | ||
assertNull(paymentItem.getErrorMessage()); | ||
assertNull(paymentItem.getErrorGroup()); | ||
} | ||
} |