Add null check for subscription fee on paymongo connector #799

This commit is contained in:
Ramon Gutierrez 2024-08-12 06:52:13 +08:00
parent 5a2f57492d
commit b3548fcc50

View file

@ -99,7 +99,7 @@ class PayMongoConnector
$body = [
'data' => [
'attributes' => [
'amount' => (int)$plan_data['amount'],
'amount' => $plan_data['amount'],
'currency' => 'PHP',
'description' => $plan_data['description'],
'interval' => $plan_data['interval'],
@ -118,7 +118,7 @@ class PayMongoConnector
$body = [
'data' => [
'attributes' => [
'amount' => (int)$plan_data['amount'],
'amount' => $plan_data['amount'],
],
],
];
@ -154,7 +154,7 @@ class PayMongoConnector
// create new plan
$result = $this->createPlan([
'name' => "RESQ Subscription",
'amount' => bcmul($bsize->getSubRecurringFee(), 100),
'amount' => (int)bcmul($bsize->getSubRecurringFee() ?? 0, 100),
'description' => "Motolite Battery Subscription Plan",
'interval' => 'monthly',
'interval_count' => 1,