diff --git a/API_VERSION b/API_VERSION index fb725068586..012d1278dbd 100644 --- a/API_VERSION +++ b/API_VERSION @@ -1 +1 @@ -2025-09-30.clover \ No newline at end of file +0de52cdca31a7c51c6d11187fc88ab23ea3a1c5b \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index d8fc29df4d5..012d1278dbd 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -3254488ad9df6baaabe4c802afb68791838928b5 \ No newline at end of file +0de52cdca31a7c51c6d11187fc88ab23ea3a1c5b \ No newline at end of file diff --git a/src/test/java/com/stripe/functional/GeneratedExamples.java b/src/test/java/com/stripe/functional/GeneratedExamples.java index d90d7528726..b136d4042fd 100644 --- a/src/test/java/com/stripe/functional/GeneratedExamples.java +++ b/src/test/java/com/stripe/functional/GeneratedExamples.java @@ -12807,6 +12807,73 @@ public void testPromotionCodesGet2ServicesNonNamespaced() throws StripeException @Test public void testPromotionCodesPost() throws StripeException { + PromotionCodeCreateParams params = + PromotionCodeCreateParams.builder() + .setPromotion( + PromotionCodeCreateParams.Promotion.builder() + .setType(PromotionCodeCreateParams.Promotion.Type.COUPON) + .setCoupon("Z4OV52SU") + .build()) + .build(); + + PromotionCode promotionCode = PromotionCode.create(params); + assertNotNull(promotionCode); + verifyRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + "/v1/promotion_codes", + params.toMap(), + null); + } + + @Test + public void testPromotionCodesPostServices() throws StripeException { + StripeClient client = new StripeClient(networkSpy); + + com.stripe.param.PromotionCodeCreateParams params = + com.stripe.param.PromotionCodeCreateParams.builder() + .setPromotion( + com.stripe.param.PromotionCodeCreateParams.Promotion.builder() + .setType(com.stripe.param.PromotionCodeCreateParams.Promotion.Type.COUPON) + .setCoupon("Z4OV52SU") + .build()) + .build(); + + com.stripe.model.PromotionCode promotionCode = client.v1().promotionCodes().create(params); + assertNotNull(promotionCode); + verifyRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + "/v1/promotion_codes", + params.toMap(), + null); + } + + @Test + public void testPromotionCodesPostServicesNonNamespaced() throws StripeException { + StripeClient client = new StripeClient(networkSpy); + + com.stripe.param.PromotionCodeCreateParams params = + com.stripe.param.PromotionCodeCreateParams.builder() + .setPromotion( + com.stripe.param.PromotionCodeCreateParams.Promotion.builder() + .setType(com.stripe.param.PromotionCodeCreateParams.Promotion.Type.COUPON) + .setCoupon("Z4OV52SU") + .build()) + .build(); + + com.stripe.model.PromotionCode promotionCode = client.promotionCodes().create(params); + assertNotNull(promotionCode); + verifyRequest( + BaseAddress.API, + ApiResource.RequestMethod.POST, + "/v1/promotion_codes", + params.toMap(), + null); + } + + @Test + public void testPromotionCodesPost2() throws StripeException { PromotionCode resource = PromotionCode.retrieve("promo_xxxxxxxxxxxxx"); PromotionCodeUpdateParams params = @@ -12823,7 +12890,7 @@ public void testPromotionCodesPost() throws StripeException { } @Test - public void testPromotionCodesPostServices() throws StripeException { + public void testPromotionCodesPost2Services() throws StripeException { StripeClient client = new StripeClient(networkSpy); com.stripe.param.PromotionCodeUpdateParams params = @@ -12843,7 +12910,7 @@ public void testPromotionCodesPostServices() throws StripeException { } @Test - public void testPromotionCodesPostServicesNonNamespaced() throws StripeException { + public void testPromotionCodesPost2ServicesNonNamespaced() throws StripeException { StripeClient client = new StripeClient(networkSpy); com.stripe.param.PromotionCodeUpdateParams params = diff --git a/src/test/java/com/stripe/functional/PromotionCodeTest.java b/src/test/java/com/stripe/functional/PromotionCodeTest.java deleted file mode 100644 index 3252c08951d..00000000000 --- a/src/test/java/com/stripe/functional/PromotionCodeTest.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.stripe.functional; - -import static org.junit.jupiter.api.Assertions.assertNotNull; - -import com.stripe.BaseStripeTest; -import com.stripe.exception.StripeException; -import com.stripe.model.PromotionCode; -import com.stripe.model.PromotionCodeCollection; -import com.stripe.net.ApiResource; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Test; - -public class PromotionCodeTest extends BaseStripeTest { - public static final String PROMOTION_CODE_ID = "promo_123"; - - private PromotionCode getPromotionCodeFixture() throws StripeException { - final PromotionCode promotionCode = PromotionCode.retrieve(PROMOTION_CODE_ID); - resetNetworkSpy(); - return promotionCode; - } - - @Test - public void testCreate() throws StripeException { - final Map params = new HashMap<>(); - params.put("coupon", "co_123"); - params.put("code", "MYCODE"); - - final PromotionCode promotionCode = PromotionCode.create(params); - - assertNotNull(promotionCode); - verifyRequest(ApiResource.RequestMethod.POST, String.format("/v1/promotion_codes"), params); - } - - @Test - public void testRetrieve() throws StripeException { - final PromotionCode promotionCode = PromotionCode.retrieve(PROMOTION_CODE_ID); - - assertNotNull(promotionCode); - verifyRequest( - ApiResource.RequestMethod.GET, String.format("/v1/promotion_codes/%s", PROMOTION_CODE_ID)); - } - - @Test - public void testUpdate() throws StripeException { - final PromotionCode promotionCode = getPromotionCodeFixture(); - - final Map metadata = new HashMap<>(); - metadata.put("key", "value"); - final Map params = new HashMap<>(); - params.put("metadata", metadata); - - final PromotionCode updatedPromotionCode = promotionCode.update(params); - - assertNotNull(updatedPromotionCode); - verifyRequest( - ApiResource.RequestMethod.POST, - String.format("/v1/promotion_codes/%s", promotionCode.getId()), - params); - } - - @Test - public void testList() throws StripeException { - final Map params = new HashMap<>(); - params.put("limit", 1); - - final PromotionCodeCollection promotionCodes = PromotionCode.list(params); - - assertNotNull(promotionCodes); - verifyRequest(ApiResource.RequestMethod.GET, String.format("/v1/promotion_codes")); - } -}