diff --git a/composer.json b/composer.json index 5fafdc1..ff0ef21 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "pagarme/ecommerce-module-core", "description": "Core component for Pagar.me e-commerce platform modules.", "license": "MIT", - "version": "2.7.0", + "version": "2.7.1", "authors": [ { "name":"Open Source Team" diff --git a/src/Kernel/Services/APIService.php b/src/Kernel/Services/APIService.php index 5611cc9..d1831eb 100644 --- a/src/Kernel/Services/APIService.php +++ b/src/Kernel/Services/APIService.php @@ -171,7 +171,11 @@ private function getRequestMetaData($orderRequest) $metadata->moduleVersion = $versionService->getModuleVersion(); $metadata->coreVersion = $versionService->getCoreVersion(); $metadata->platformVersion = $versionService->getPlatformVersion(); - if($this->hasCreditCardInPayments($orderRequest->payments) && !empty(MPSetup::getInstallmentType())){ + if ( + property_exists($orderRequest, "payments") && + $this->hasCreditCardInPayments($orderRequest->payments) && + !empty(MPSetup::getInstallmentType()) + ) { $metadata->interestType = MPSetup::getInstallmentType(); } return $metadata; @@ -180,7 +184,7 @@ private function getRequestMetaData($orderRequest) private function hasCreditCardInPayments($payments) { foreach ($payments as $payment) { - if($payment->paymentMethod === TransactionType::CREDIT_CARD) { + if ($payment->paymentMethod === TransactionType::CREDIT_CARD) { return true; } } @@ -291,7 +295,7 @@ public function createSubscription(Subscription $subscription) $endpoint = $this->getAPIBaseEndpoint(); $subscription->addMetaData( - json_decode(json_encode($this->getRequestMetaData()), true) + json_decode(json_encode($this->getRequestMetaData($subscription)), true) ); $subscriptionRequest = $subscription->convertToSDKRequest(); diff --git a/src/Recurrence/Services/ResponseHandlers/SubscriptionHandler.php b/src/Recurrence/Services/ResponseHandlers/SubscriptionHandler.php index 80fb2bb..0e7c39d 100644 --- a/src/Recurrence/Services/ResponseHandlers/SubscriptionHandler.php +++ b/src/Recurrence/Services/ResponseHandlers/SubscriptionHandler.php @@ -87,6 +87,11 @@ private function handleSubscriptionStatusPaid(Subscription $subscription) return $cantCreateReason; } + private function handleSubscriptionStatusProcessing(Subscription $subscription) + { + return $this->handleSubscriptionStatusPaid($subscription); + } + private function handleSubscriptionStatusPending(Subscription $subscription) { $order = $this->order;