From 482f53d7554df9227c9cd31179a7e39f9f7d86e0 Mon Sep 17 00:00:00 2001 From: AnasNaouchi Date: Tue, 11 Jul 2023 16:52:41 +0700 Subject: [PATCH] Added missing metadata to scheduled charge --- file.ser | Bin 0 -> 552 bytes local.properties | 8 ++++++++ .../omise/models/schedules/ChargeSchedule.java | 7 +++++++ .../co/omise/live/LiveScheduleRequestTest.java | 16 ++++++++++------ 4 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 file.ser create mode 100644 local.properties diff --git a/file.ser b/file.ser new file mode 100644 index 0000000000000000000000000000000000000000..6f31c5cc1754ec0ee3ce1b2a9078b61c2c254a94 GIT binary patch literal 552 zcmZ9J&2AGh5XXltNvf1D1r>6uc!BH{kqd$55ZJ0H&>r?S>m4Odytc7t)1-$yMd8FF zRO&MnBzTox`VM&WAwdqdJTrgIZ|3jod#HH_FNNutLVD^HCMV@PJt0h~`OnYBkU!lX zM({X=7g)0C36?Wt8j_G!l4hU6BQZv)`x-Mvc?#`Ia%P~J9C;pS&!|*UDHCX-mFMKV zG@7B6OmK#=LOqHgp`92v ziYF$=m}NonaY%m&k3f&)njAPsyPVVN2T!vJ34Vv34!(VV^ZROg6G4;&&i}5|%}Tf0 aVs5Pks7|;n!yb<_h6cXPI>HnoW$j;OFt&;S literal 0 HcmV?d00001 diff --git a/local.properties b/local.properties new file mode 100644 index 00000000..aefd46d2 --- /dev/null +++ b/local.properties @@ -0,0 +1,8 @@ +## This file must *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. +# +# Location of the SDK. This is only used by Gradle. +# For customization when using a Version Control System, please read the +# header note. +#Tue Jul 11 00:17:04 ICT 2023 +sdk.dir=/Users/anass.n/Library/Android/sdk diff --git a/src/main/java/co/omise/models/schedules/ChargeSchedule.java b/src/main/java/co/omise/models/schedules/ChargeSchedule.java index fc95e087..c255e402 100644 --- a/src/main/java/co/omise/models/schedules/ChargeSchedule.java +++ b/src/main/java/co/omise/models/schedules/ChargeSchedule.java @@ -92,6 +92,9 @@ public static class Params extends co.omise.models.Params { @JsonProperty private String description; + @JsonProperty + private Map metadata; + public Params amount(long amount) { this.amount = amount; return this; @@ -116,5 +119,9 @@ public Params description(String description) { this.description = description; return this; } + public Params metadata(Map metadata) { + this.metadata = metadata; + return this; + } } } \ No newline at end of file diff --git a/src/test/java/co/omise/live/LiveScheduleRequestTest.java b/src/test/java/co/omise/live/LiveScheduleRequestTest.java index 1b217b72..d20e3a09 100644 --- a/src/test/java/co/omise/live/LiveScheduleRequestTest.java +++ b/src/test/java/co/omise/live/LiveScheduleRequestTest.java @@ -11,6 +11,8 @@ import org.junit.Test; import java.io.IOException; +import java.util.HashMap; +import java.util.Map; import static org.junit.Assert.*; @@ -24,7 +26,7 @@ public void setup() throws Exception { } @Test - @Ignore("only hit the network when we need to.") + //@Ignore("only hit the network when we need to.") public void testLiveScheduleListGet() throws IOException, OmiseException { Request> request = new Schedule.ListRequestBuilder() @@ -63,7 +65,7 @@ public void testLiveScheduleGet() throws IOException, OmiseException { .name("testLiveSchedule") .number("4242424242424242") .securityCode("123") - .expiration(10, 2020)) + .expiration(7, 2023)) .build(); Token token = client.sendRequest(tokenRequest); @@ -75,18 +77,20 @@ public void testLiveScheduleGet() throws IOException, OmiseException { .build(); Customer customer = client.sendRequest(customerRequest); - + Map metadata = new HashMap<>(); + metadata.put("testKey","testData"); Request scheduleRequest = new Schedule.CreateRequestBuilder() .every(1) - .period(SchedulePeriod.Week) + .period(SchedulePeriod.Day) .on(new ScheduleOn.Params().weekdays(Weekdays.Friday)) .endDate(LocalDate.now().withFieldAdded(DurationFieldType.years(), 99)) .charge(new ChargeSchedule.Params() .customer(customer.getId()) .amount(2000) .currency("THB") - .description("Monthly membership fee")) - .build(); + .description("Monthly membership fee") + .metadata(metadata) + ).build(); Schedule createdSchedule = client.sendRequest(scheduleRequest);