Compare commits

..

35 commits

Author SHA1 Message Date
Ramon Gutierrez
857c573ae5 Merge branch '799-subscription-support' into 809-loyalty-system-support 2024-10-14 07:22:24 +08:00
Ramon Gutierrez
a724b00ce7 Include email in customer info endpoint #809 2024-10-10 04:03:30 +08:00
Ramon Gutierrez
0a4ea563d9 Fix response format of loyalty registration to remove unnecessary array #809 2024-10-07 08:11:29 +08:00
Ramon Gutierrez
d1059797a5 Simplify loyalty register result format #809 2024-10-07 07:01:47 +08:00
Ramon Gutierrez
bd655a459a Add loyalty connector and register endpoint #809 2024-10-07 06:28:57 +08:00
Ramon Gutierrez
b79f2f2dfb Merge branch 'master' into 799-subscription-support 2024-10-02 14:01:32 +08:00
Ramon Gutierrez
d2a0638ffa Fix customer retrieval from paymongo #799 2024-10-02 13:28:27 +08:00
Ramon Gutierrez
5056637b66 Add email field to subscription entity #799 2024-10-02 13:27:37 +08:00
Ramon Gutierrez
1fd883b07b Consolidate subscription setup payment intent checking and initial activation when applicable #799 2024-08-26 08:01:00 +08:00
Ramon Gutierrez
40c629eee3 Add endpoint for activating a subscription #799 2024-08-24 18:00:38 +08:00
Ramon Gutierrez
aa85198b7a Add subscription entity #799 2024-08-24 07:50:50 +08:00
Ramon Gutierrez
62f11c9ef5 Fix json payload structure for payment intent checking #799 2024-08-23 07:51:53 +08:00
Ramon Gutierrez
9dbaf92698 Add missing basic auth to payment intent endpoint #799 2024-08-23 05:07:11 +08:00
Ramon Gutierrez
d7cc0fc3de Add endpoint for re-checking payment intent status #799 2024-08-22 06:19:42 +08:00
Ramon Gutierrez
8c61a27376 Fix handling of payment intent values when returning created sub details #799 2024-08-21 07:44:08 +08:00
Ramon Gutierrez
0d9da221a7 Fix expected format from paymongo subscription endpoints #799 2024-08-21 01:16:43 +08:00
Ramon Gutierrez
919b56688d Add endpoint for creating subscriptions, sync updating of customers with paymongo API if record exists #799 2024-08-13 05:45:46 +08:00
Ramon Gutierrez
7af20f3d69 Replace sub fee endpoint with complete plan details #799 2024-08-12 16:30:49 +08:00
Ramon Gutierrez
b3548fcc50 Add null check for subscription fee on paymongo connector #799 2024-08-12 06:52:13 +08:00
Ramon Gutierrez
5a2f57492d Tie battery sizes to subscription plans #799 2024-08-12 06:50:01 +08:00
Ramon Gutierrez
debb399e96 Add support for handling multiple paymongo accounts #799 2024-08-12 05:09:58 +08:00
Ramon Gutierrez
e3649c3d2d Fix URL format of subscription fee endpoint #799 2024-08-11 15:26:48 +08:00
Ramon Gutierrez
4f5560f6f7 Update subscription fee endpoint to be specific to each vehicle model #799 2024-08-11 15:05:20 +08:00
Ramon Gutierrez
b67f960055 Add subscription MSRP field to battery sizes #799 2024-08-10 05:38:58 +08:00
Ramon Gutierrez
219d5c09d3 Add endpoint for subscription paymongo public key #799 2024-08-10 05:26:04 +08:00
Ramon Gutierrez
96a7cc929e Add email to customer info endpoint #799 2024-08-03 06:31:35 +08:00
Ramon Gutierrez
fe4806f41a Add endpoint for retrieving subscription fee #799 2024-08-03 06:31:12 +08:00
Ramon Gutierrez
17e583e11a Merge branch 'master' into 799-subscription-support 2024-07-31 18:08:45 +08:00
Ramon Gutierrez
a911b8c6c1 Merge branch 'master' into 799-subscription-support 2024-07-24 15:02:58 +08:00
Ramon Gutierrez
ab64161afb Add placeholder customer vehicle sub getter #799 2024-05-10 14:42:58 +08:00
Ramon Gutierrez
627b3da748 Disallow editing of IDs of static content #799 2024-05-05 07:14:26 +08:00
Ramon Gutierrez
48d87ae119 Retrieve subscription data with customer vehicle info endpoint #799 2024-05-05 07:13:07 +08:00
Ramon Gutierrez
2ccd1e0e2d Use proper getter for static content API #799 2024-04-29 18:07:00 +08:00
Ramon Gutierrez
c9cb6e8b53 Add markdown support to static content form view #799 2024-04-27 01:45:25 +08:00
Ramon Gutierrez
d9d4ffbecf Add static content endpoint for customer app #799 2024-04-27 01:44:39 +08:00
30 changed files with 1245 additions and 192 deletions

View file

@ -312,4 +312,46 @@ apiv2_insurance_premiums_banner:
apiv2_insurance_body_types:
path: /apiv2/insurance/body_types
controller: App\Controller\CustomerAppAPI\InsuranceController::getBodyTypes
methods: [GET]
methods: [GET]
apiv2_loyalty_register:
path: /apiv2/loyalty/register
controller: App\Controller\CustomerAppAPI\LoyaltyController::register
methods: [POST]
# static content
apiv2_static_content:
path: /apiv2/static_content/{id}
controller: App\Controller\CustomerAppAPI\StaticContentController::getContent
methods: [GET]
# subscription
apiv2_subscription_plan_details:
path: /apiv2/subscription/vehicle/{vid}/plan
controller: App\Controller\CustomerAppAPI\SubscriptionController::getPlanDetails
methods: [GET]
#apiv2_subscription_paymongo_public_key:
# path: /apiv2/subscription/ppk
# controller: App\Controller\CustomerAppAPI\SubscriptionController::getPaymongoPublicKey
# methods: [GET]
apiv2_subscription_create:
path: /apiv2/subscription
controller: App\Controller\CustomerAppAPI\SubscriptionController::createSubscription
methods: [POST]
apiv2_subscription_finalize:
path: /apiv2/subscription/{id}/finalize
controller: App\Controller\CustomerAppAPI\SubscriptionController::finalizeSubscription
methods: [GET]
#apiv2_subscription_payment_intent:
# path: /apiv2/subscription/payment_intent/{pi_id}
# controller: App\Controller\CustomerAppAPI\SubscriptionController::getPaymentIntent
# methods: [GET]
#apiv2_subscription_activate:
# path: /apiv2/subscription/{id}/activate
# controller: App\Controller\CustomerAppAPI\SubscriptionController::activateSubscription
# methods: [POST]

View file

@ -17,6 +17,13 @@ parameters:
ios_app_version: "%env(IOS_APP_VERSION)%"
insurance_premiums_banner_url: "%env(INSURANCE_PREMIUMS_BANNER_URL)%"
enabled_hub_filters: "%env(ENABLED_HUB_FILTERS)%"
insurance_paymongo_public_key: "%env(INSURANCE_PAYMONGO_PUBLIC_KEY)%"
insurance_paymongo_secret_key: "%env(INSURANCE_PAYMONGO_SECRET_KEY)%"
insurance_paymongo_webhook_id: "%env(INSURANCE_PAYMONGO_WEBHOOK_ID)%"
subscription_paymongo_public_key: "%env(SUBSCRIPTION_PAYMONGO_PUBLIC_KEY)%"
subscription_paymongo_secret_key: "%env(SUBSCRIPTION_PAYMONGO_SECRET_KEY)%"
subscription_paymongo_webhook_id: "%env(SUBSCRIPTION_PAYMONGO_WEBHOOK_ID)%"
subscription_months: "%env(SUBSCRIPTION_MONTHS)%"
services:
# default configuration for services in *this* file
@ -114,7 +121,6 @@ services:
arguments:
$em: "@doctrine.orm.entity_manager"
$paymongo: "@App\\Service\\PayMongoConnector"
$webhook_id: "%env(PAYMONGO_WEBHOOK_ID)%"
# rider tracker service
App\Service\RiderTracker:
@ -238,8 +244,13 @@ services:
App\Service\PayMongoConnector:
arguments:
$base_url: "%env(PAYMONGO_BASE_URL)%"
$public_key: "%env(PAYMONGO_PUBLIC_KEY)%"
$secret_key: "%env(PAYMONGO_SECRET_KEY)%"
# loyalty system connector
App\Service\LoyaltyConnector:
arguments:
$base_url: "%env(LOYALTY_BASE_URL)%"
$api_key: "%env(LOYALTY_API_KEY)%"
$secret_key: "%env(LOYALTY_SECRET_KEY)%"
# entity listener for customer vehicle warranty code history
App\EntityListener\CustomerVehicleSerialListener:

View file

@ -6,6 +6,7 @@ use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Doctrine\ORM\EntityManagerInterface;
@ -19,14 +20,18 @@ class ProcessLatePaymongoTransactionsCommand extends Command
{
protected $em;
protected $paymongo;
protected $webhook_id;
public function __construct(EntityManagerInterface $em, PayMongoConnector $paymongo, $webhook_id)
public function __construct(EntityManagerInterface $em, PayMongoConnector $paymongo, ParameterBagInterface $params)
{
$this->em = $em;
$this->webhook_id = $params->get('insurance_paymongo_webhook_id');
$this->paymongo = $paymongo;
$this->webhook_id = $webhook_id;
$this->paymongo->initialize(
$params->get('insurance_paymongo_public_key'),
$params->get('insurance_paymongo_secret_key')
);
parent::__construct();
}

View file

@ -9,11 +9,24 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use App\Service\PayMongoConnector;
use Catalyst\MenuBundle\Annotation\Menu;
class BatterySizeController extends Controller
{
protected $pm;
public function __construct(PayMongoConnector $pm, ParameterBagInterface $params)
{
$this->pm = $pm;
$this->pm->initialize(
$params->get('subscription_paymongo_public_key'),
$params->get('subscription_paymongo_secret_key'),
);
}
/**
* @Menu(selected="bsize_list")
*/
@ -130,7 +143,8 @@ class BatterySizeController extends Controller
->setTIPriceMotolite($req->request->get('tip_motolite'))
->setTIPricePremium($req->request->get('tip_premium'))
->setTIPriceOther($req->request->get('tip_other'))
->setTIPriceLazada($req->request->get('tip_lazada'));
->setTIPriceLazada($req->request->get('tip_lazada'))
->setSubRecurringFee($req->request->get('sub_recurring_fee'));
}
public function addSubmit(Request $req, ValidatorInterface $validator)
@ -167,6 +181,9 @@ class BatterySizeController extends Controller
$em->persist($row);
$em->flush();
// create new paymongo subscription plan
$this->pm->createOrUpdateSubPlan($row);
// return successful response
return $this->json([
'success' => 'Changes have been saved!'
@ -234,6 +251,9 @@ class BatterySizeController extends Controller
// validated! save the entity
$em->flush();
// find if paymongo subscription plan exists, then update accordingly
$this->pm->createOrUpdateSubPlan($row);
// return successful response
return $this->json([