Skip to content

Commit

Permalink
Releasing v3.24.1. Please check the changelog for the updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-thushitamariaselvan committed Feb 23, 2024
1 parent 618b359 commit e148f2b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### v3.24.1 (2024-02-23)
* * *

* Fixed Custom field case conversion issue

### v3.24.0 (2024-01-04)
* * *

Expand Down
4 changes: 4 additions & 0 deletions lib/ChargeBee/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public static function toUnderscoreFromCamelCase($str)
return "_" . strtolower($c[1]);
};

if (preg_match('/_/', $str)) {
return $str;
}

return preg_replace_callback('/([A-Z])/', $func, $str);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/ChargeBee/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

final class Version
{
const VERSION = '3.24.0';
const VERSION = '3.24.1';
}

?>
12 changes: 6 additions & 6 deletions test/ChargeBee/SampleData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class ChargeBee_SampleData
{
public function simpleSubscription()
public static function simpleSubscription()
{
return [
'subscription' => [
Expand All @@ -16,7 +16,7 @@ public function simpleSubscription()
];
}

public function nestedSubscription()
public static function nestedSubscription()
{
return [
'subscription' => [
Expand All @@ -30,7 +30,7 @@ public function nestedSubscription()
];
}

public function testSubscription()
public static function testSubscription()
{
return [
'subscription' => [
Expand All @@ -40,14 +40,14 @@ public function testSubscription()
];
}

public function listSubscriptions()
public static function listSubscriptions()
{
return [
self::testSubscription(), self::testSubscription()
];
}

public function sampleEvent()
public static function sampleEvent()
{
return [
'event' => [
Expand Down Expand Up @@ -89,7 +89,7 @@ public function sampleEvent()
];
}

public function webhookData()
public static function webhookData()
{
return '{ "content": { "card": { "card_type": "visa", "customer_id": "8avPlNabxST86", "expiry_month": 10, "expiry_year": 2012, "gateway": "chargebee", "iin": "411111", "last4": "1111", "masked_number": "411111******1111", "object": "credit_card", "status": "valid" }, "customer": { "card_status": "valid", "created_at": 1339951248, "email": "[email protected]", "id": "8avPlNabxST86", "object": "customer" }, "invoice": { "amount": 900, "end_date": 1339951248, "id": "3", "line_items": [ { "amount": 900, "date_from": 1339951248, "date_to": 1342543248, "description": "Plan (1 x No Trial) Charges for term (17-Jun-2012 - 17-Jul-2012)", "object": "line_item", "quantity": 1, "unit_amount": 900 } ], "object": "invoice", "paid_on": 1339951249, "recurring": true, "start_date": 1339951248, "status": "paid", "sub_total": 900, "subscription_id": "8avPlNabxST86" }, "subscription": { "activated_at": 1339951248, "created_at": 1339951248, "current_term_end": 1342543248, "current_term_start": 1339951248, "due_invoices_count": 0, "id": "8avPlNabxST86", "object": "subscription", "plan_id": "no_trial", "plan_quantity": 1, "status": "active" }, "transaction": { "amount": 900, "date": 1339951249, "gateway": "chargebee", "id": "txn_HoR7OrcNacEsxKR", "id_at_gateway": "cb_HoR7OrcNacEsxMS", "invoice_id": "3", "masked_card_number": "411111******1111", "object": "transaction", "status": "success", "subscription_id": "8avPlNabxST86", "type": "payment" } }, "event_type": "payment_succeeded", "id": "ev_HoR7OrcNacEsxgT", "object": "event", "occurred_at": 1339951249, "webhook_status": "scheduled" }';
}
Expand Down
4 changes: 4 additions & 0 deletions test/ChargeBee/UtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ public function testSerialize()
{
$before = [
"id" => "sub_KyVq7DNSNM7CSD",
"cf_URL" => "www.chargebee.com",
"cf_Single_line" => "Single line custom field",
"planId" => "free",
"addons" => [
["id" => "monitor", "quantity" => 2], ["id" => "ssl"]
Expand All @@ -23,6 +25,8 @@ public function testSerialize()

$after = [
"id" => "sub_KyVq7DNSNM7CSD",
"cf_URL" => "www.chargebee.com",
"cf_Single_line" => "Single line custom field",
"plan_id" => "free",
"addons[id][0]" => "monitor",
"addons[quantity][0]"=>2,
Expand Down

0 comments on commit e148f2b

Please sign in to comment.