From dc55007155341dea5a493c47c0148ae0c64da3b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Corr=C3=AAa=20Gomes?= Date: Wed, 11 Jan 2023 10:16:36 -0500 Subject: [PATCH 1/4] Adding trial days --- web/app/Lib/EnsureBilling.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/app/Lib/EnsureBilling.php b/web/app/Lib/EnsureBilling.php index 3211326a1..138841322 100644 --- a/web/app/Lib/EnsureBilling.php +++ b/web/app/Lib/EnsureBilling.php @@ -15,6 +15,7 @@ class EnsureBilling public const INTERVAL_ONE_TIME = "ONE_TIME"; public const INTERVAL_EVERY_30_DAYS = "EVERY_30_DAYS"; public const INTERVAL_ANNUAL = "ANNUAL"; + public const TRIAL_DAYS = 7; private static $RECURRING_INTERVALS = [ self::INTERVAL_EVERY_30_DAYS, self::INTERVAL_ANNUAL @@ -148,6 +149,7 @@ private static function requestRecurringPayment(Session $session, array $config, ], "returnUrl" => $returnUrl, "test" => !self::isProd(), + "trialDays": self::TRIAL_DAYS, ], ] ); @@ -164,6 +166,7 @@ private static function requestOneTimePayment(Session $session, array $config, s "price" => ["amount" => $config["amount"], "currencyCode" => $config["currencyCode"]], "returnUrl" => $returnUrl, "test" => !self::isProd(), + "trialDays": self::TRIAL_DAYS, ], ] ); @@ -229,12 +232,14 @@ private static function queryOrException(Session $session, $query): array $lineItems: [AppSubscriptionLineItemInput!]! $returnUrl: URL! $test: Boolean + $trialDays: Int ) { appSubscriptionCreate( name: $name lineItems: $lineItems returnUrl: $returnUrl test: $test + trialDays: $trialDays ) { confirmationUrl userErrors { @@ -250,12 +255,14 @@ private static function queryOrException(Session $session, $query): array $price: MoneyInput! $returnUrl: URL! $test: Boolean + $trialDays: Int ) { appPurchaseOneTimeCreate( name: $name price: $price returnUrl: $returnUrl test: $test + trialDays: $trialDays ) { confirmationUrl userErrors { From 3cd6b47a165d6db1d2ddabee1c520b496016fa4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Corr=C3=AAa=20Gomes?= Date: Thu, 12 Jan 2023 12:17:39 -0500 Subject: [PATCH 2/4] Moving trialDays from const to config --- web/app/Lib/EnsureBilling.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/web/app/Lib/EnsureBilling.php b/web/app/Lib/EnsureBilling.php index 138841322..7a6568cac 100644 --- a/web/app/Lib/EnsureBilling.php +++ b/web/app/Lib/EnsureBilling.php @@ -15,7 +15,6 @@ class EnsureBilling public const INTERVAL_ONE_TIME = "ONE_TIME"; public const INTERVAL_EVERY_30_DAYS = "EVERY_30_DAYS"; public const INTERVAL_ANNUAL = "ANNUAL"; - public const TRIAL_DAYS = 7; private static $RECURRING_INTERVALS = [ self::INTERVAL_EVERY_30_DAYS, self::INTERVAL_ANNUAL @@ -149,7 +148,7 @@ private static function requestRecurringPayment(Session $session, array $config, ], "returnUrl" => $returnUrl, "test" => !self::isProd(), - "trialDays": self::TRIAL_DAYS, + "trialDays": $config["trialDays"], ], ] ); @@ -166,7 +165,7 @@ private static function requestOneTimePayment(Session $session, array $config, s "price" => ["amount" => $config["amount"], "currencyCode" => $config["currencyCode"]], "returnUrl" => $returnUrl, "test" => !self::isProd(), - "trialDays": self::TRIAL_DAYS, + "trialDays": $config["trialDays"], ], ] ); From 96eb34700b90303c0555afd161ff52d616ab7676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Corr=C3=AAa=20Gomes?= Date: Sun, 30 Jul 2023 16:02:46 -0400 Subject: [PATCH 3/4] Update web/app/Lib/EnsureBilling.php Co-authored-by: Nils Ringersma --- web/app/Lib/EnsureBilling.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/app/Lib/EnsureBilling.php b/web/app/Lib/EnsureBilling.php index 7a6568cac..ea67df20e 100644 --- a/web/app/Lib/EnsureBilling.php +++ b/web/app/Lib/EnsureBilling.php @@ -148,7 +148,7 @@ private static function requestRecurringPayment(Session $session, array $config, ], "returnUrl" => $returnUrl, "test" => !self::isProd(), - "trialDays": $config["trialDays"], + "trialDays" => $config["trialDays"], ], ] ); From c840411e51318e01cf97fece9be8d3e393055a32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Corr=C3=AAa=20Gomes?= Date: Sun, 30 Jul 2023 16:02:54 -0400 Subject: [PATCH 4/4] Update web/app/Lib/EnsureBilling.php Co-authored-by: Nils Ringersma --- web/app/Lib/EnsureBilling.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/app/Lib/EnsureBilling.php b/web/app/Lib/EnsureBilling.php index ea67df20e..8153bbd46 100644 --- a/web/app/Lib/EnsureBilling.php +++ b/web/app/Lib/EnsureBilling.php @@ -165,7 +165,7 @@ private static function requestOneTimePayment(Session $session, array $config, s "price" => ["amount" => $config["amount"], "currencyCode" => $config["currencyCode"]], "returnUrl" => $returnUrl, "test" => !self::isProd(), - "trialDays": $config["trialDays"], + "trialDays" => $config["trialDays"], ], ] );