Skip to content

Commit

Permalink
Merge pull request vindi#103 from cedran/master
Browse files Browse the repository at this point in the history
fix: adjusting BillPaid webhook flow for when it is subscription and when it is not
  • Loading branch information
cedran authored Aug 12, 2024
2 parents fb7f816 + 431a59e commit da82ebb
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions Model/Payment/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,18 @@ public function findOrCreate(Order $order)
if ($vindiCustomerId) {
if ($order->getPayment()->getMethod() == "vindi_pix") {
$customerVindi = $this->getVindiCustomerData($customer->getId());
$additionalInfo = $order->getPayment()->getAdditionalInformation();
$taxVatOrder = str_replace([' ', '-', '.'], '', $additionalInfo['document'] ?? '');
if ($customerVindi['registry_code'] != $taxVatOrder) {
$updateData = [
'registry_code' => $taxVatOrder,
];
$this->updateVindiCustomer($vindiCustomerId, $updateData);
$customer->setTaxvat($additionalInfo['document'] ?? '');
$this->customerRepository->save($customer);

if (is_array($customerVindi)) {
$additionalInfo = $order->getPayment()->getAdditionalInformation();
$taxVatOrder = str_replace([' ', '-', '.'], '', $additionalInfo['document'] ?? '');
if ($customerVindi['registry_code'] != $taxVatOrder) {
$updateData = [
'registry_code' => $taxVatOrder,
];
$this->updateVindiCustomer($vindiCustomerId, $updateData);
$customer->setTaxvat($additionalInfo['document'] ?? '');
$this->customerRepository->save($customer);
}
}
}

Expand Down

0 comments on commit da82ebb

Please sign in to comment.