diff --git a/Controller/Webhook/Index.php b/Controller/Webhook/Index.php index a3fbfac..9bebf00 100644 --- a/Controller/Webhook/Index.php +++ b/Controller/Webhook/Index.php @@ -129,7 +129,7 @@ public function execute() case self::EVENT_WEBHOOK_PING: break; case self::EVENT_ORDER_PENDING_PAYMENT: - if (isset($body['data']['object']["charges"]) && !$this->isCardPayment($body['data']['object']["charges"]["data"][0]["payment_method"]["object"])){ + if (isset($body['data']['object']["charges"])){ $this->missingOrder->recover_order($body); } $order = $this->webhookRepository->findByMetadataOrderId($body); @@ -142,9 +142,6 @@ public function execute() } break; case self::EVENT_ORDER_PAID: - if ($this->isCardPayment($body['data']['object']["charges"]["data"][0]["payment_method"]["object"])){ - $this->missingOrder->recover_order($body); - } $this->webhookRepository->payOrder($body); break; @@ -175,8 +172,4 @@ private function sendJsonResponse($data, $httpStatusCode) return $resultRaw; } - private function isCardPayment(string $paymentMethod):bool { - return $paymentMethod == "card_payment"; - } - } diff --git a/Observer/DataAssignObserver.php b/Observer/DataAssignObserver.php index b2815c9..e6b4fcb 100644 --- a/Observer/DataAssignObserver.php +++ b/Observer/DataAssignObserver.php @@ -11,35 +11,15 @@ class DataAssignObserver extends AbstractDataAssignObserver { public const PAYMENT_METHOD = 'payment_method'; - public const CC_TYPE = 'cc_type'; - public const CC_EXP_YEAR = 'cc_exp_year'; - public const CC_EXP_MONTH = 'cc_exp_month'; - public const CC_BIN = 'cc_bin'; - public const CC_LAST_4 = 'cc_last_4'; - public const CARD_TOKEN = 'card_token'; - public const MONTHLY_INSTALLMENTS = 'monthly_installments'; - public const SAVED_CARD = 'saved_card'; - public const SAVED_CARD_LATER = 'saved_card_later'; public const IFRAME_PAYMENT = 'iframe_payment'; public const ORDER_ID = 'order_id'; public const TXN_ID = 'txn_id'; - public const CARD_TYPE = 'card_type'; public const REFERENCE = 'reference'; /** * @var string[] */ protected array $additionalInformationList = [ self::PAYMENT_METHOD, - self::CC_TYPE, - self::CARD_TYPE, - self::CC_EXP_YEAR, - self::CC_EXP_MONTH, - self::CC_BIN, - self::CC_LAST_4, - self::CARD_TOKEN, - self::MONTHLY_INSTALLMENTS, - self::SAVED_CARD, - self::SAVED_CARD_LATER, self::IFRAME_PAYMENT, self::ORDER_ID, self::TXN_ID, diff --git a/Service/MissingOrders.php b/Service/MissingOrders.php index fbe0a11..acebfb7 100644 --- a/Service/MissingOrders.php +++ b/Service/MissingOrders.php @@ -185,7 +185,6 @@ public function recover_order($event){ 'payment_method' => $this->getPaymentMethod($femsaOrder["charges"]["data"][0]["payment_method"]["object"]), 'femsa_customer_id' => $femsaCustomer["customer_id"] ]; - $additionalInformation= array_merge($additionalInformation, $this->getAdditionalInformation($femsaOrder)); $quoteCreated->getPayment()->setAdditionalInformation( $additionalInformation); // Collect Totals & Save Quote $quoteCreated->collectTotals()->save(); @@ -212,21 +211,6 @@ public function recover_order($event){ } private function getAdditionalInformation(array $femsaOrder) :array{ - switch ($femsaOrder["charges"]["data"][0]["payment_method"]["object"]){ - case "card_payment": - return [ - 'cc_type' => $femsaOrder["charges"]["data"][0]["payment_method"]["brand"], - 'card_type' => $femsaOrder["charges"]["data"][0]["payment_method"]["type"], - 'cc_exp_month' => $femsaOrder["charges"]["data"][0]["payment_method"]["exp_month"], - 'cc_exp_year' => $femsaOrder["charges"]["data"][0]["payment_method"]["exp_year"], - 'cc_bin' => null, - 'cc_last_4' => $femsaOrder["charges"]["data"][0]["payment_method"]["last4"], - 'card_token' => null, - ]; - case "bank_transfer_payment": - case "cash_payment": - return []; - } return []; } private function updateFemsaReference(string $chargeId, string $orderId){ diff --git a/view/frontend/web/template/payment/banktransfer/form.html b/view/frontend/web/template/payment/banktransfer/form.html deleted file mode 100644 index e69de29..0000000 diff --git a/view/frontend/web/template/payment/creditcard/form.html b/view/frontend/web/template/payment/creditcard/form.html deleted file mode 100644 index 0659adf..0000000 --- a/view/frontend/web/template/payment/creditcard/form.html +++ /dev/null @@ -1,54 +0,0 @@ -
- - - - - - - - \ No newline at end of file