mich3lang3lo
Forum Replies Created
-
Muito obrigado Ricardo, fico no aguardo.
Tenha um ótimo fim de semana.
Olá pessoal! Tudo bem?
Estou respondendo a mensagem anterior com uma atualização: conseguimos identificar exatamente a causa do erro e uma correção mínima que resolve o cenário “Recorrência + Split Dokan”.
Causa raiz confirmadaNo fluxo de cartão de crédito, o plugin monta o payload de criação do pedido (
ws/orders) com:charges[0].recurring(INITIAL/SUBSEQUENT) quando é compra recorrentecharges[0].splits.receivers[].configurations.liablesempre presente no split do Dokan, inclusive quando o valor éfalse(o campo existe no payload)
Quando esses dois itens aparecem juntos, a API retorna:
40002 – invalid_parameter (charges[0].recurring)
RECURRING PAYMENT IS NOT VALID FOR SPLIT TRANSACTIONS WITH LIABLE CONFIGURATIONOu seja: para recorrência, a API não aceita “liable configuration” no split (mesmo
liable=false, apenas existir o campo já dispara o erro). Onde isso ocorre no plugin (para facilitar revisão)- Entrada WooCommerce (cartão):
pagbank-connect/src/Connect/Standalone/CreditCard.php(process_payment) - Payload / charges / recurring:
pagbank-connect/src/Connect/Payments/CreditCard.php(prepare) - Split Dokan + liable:
pagbank-connect/src/Integrations/Dokan/DokanSplitManager.php(setLiable no receiver do marketplace e vendor)pagbank-connect/src/Object/Receiver.php(setter grava emconfigurations['liable'])
- Envio HTTP:
pagbank-connect/src/Traits/ProcessPayment.php(makeRequest->ws/orders) - Log do payload:
pagbank-connect/src/Helpers/Api.php(log de params)
Solução mínima (patch sugerido)
Quando a cobrança é recorrente (INITIAL ou SUBSEQUENT), o plugin deve remover completamente
configurations.liablede todos os receivers do split antes de enviar o request.
Importante: não setarliable=false, mas sim não enviar o campo (unset), pois o erro ocorre quando a “liable configuration” existe no payload.Abaixo segue um patch simples aplicado no builder de cartão (ponto central), antes do envio:
--- a/pagbank-connect/src/Connect/Payments/CreditCard.php +++ b/pagbank-connect/src/Connect/Payments/CreditCard.php @@ elseif (\RM_PagBank\Integrations\GeneralSplitManager::shouldApplySplit($this->order)) { $splitData = \RM_PagBank\Integrations\GeneralSplitManager::buildSplitData($this->order, 'CREDIT_CARD'); $charge->setSplits($splitData->jsonSerialize()); } //endregion + + // PagBank does not allow liable configuration on recurring charges. + if ($this->isRecurringCharge()) { + $splitPayload = $charge->getSplits(); + if (!empty($splitPayload['receivers']) && is_array($splitPayload['receivers'])) { + foreach ($splitPayload['receivers'] as &$receiver) { + if (isset($receiver['configurations']['liable'])) { + unset($receiver['configurations']['liable']); + } + if (isset($receiver['configurations']) && empty($receiver['configurations'])) { + unset($receiver['configurations']); + } + } + unset($receiver); + $charge->setSplits($splitPayload); + } + } @@ $return['charges'] = [$charge]; return $return; } + + protected function isRecurringCharge(): bool + { + return (bool) $this->order->get_meta('_pagbank_recurring_initial') + || wc_string_to_bool((string) $this->order->get_meta('_pagbank_is_recurring')); + }Comportamento após o patch
- Recorrência + Split Dokan: o request mantém
recurring, mantémsplits, mas semconfigurations.liable→ deixa de retornar 40002. - Pagamento único: continua enviando
liablenormalmente (nenhuma alteração). - Não removemos outros campos de split (chargeback/custody etc.).
Pedido
Vocês poderiam validar se esse é o comportamento esperado e, se sim, incorporar algo equivalente no plugin (ou expor um filtro/hook para ajustar o payload antes do POST)?
Se preferirem, eu posso também enviar um log sanitizado do payload “antes/depois” para comprovar a diferença no request.
Obrigado!
Matheus RI am getting an error after using the custom code @teodor-cosofret, could you take a look?
Parse error: syntax error, unexpected end of file in /home/fazen735/public_html/wp-content/plugins/profile-builder/front-end/class-formbuilder.php on line 737On line 737 i have:
do_action( 'wppb_before_'.$this->args['form_type'].'_fields', $this->args['form_name'], $this->args['ID'], $this->args['form_type'] );I am using the plugin WP-Mail-SMTP and is working with the default WP profile page, i get all notifications.
Ty
Mike
Hi @teodor-cosofret,
In my case i am not using the recover password form, if the user needs to change the password he need to log in and change it in the page builder profile page, if he doesn´t know the password he can email me and i reset it, almost all my users don´t have an email, that´s why is very important to me to track any change in the account.
Thanks for the help
Mike
Forum: Plugins
In reply to: [Download Manager] Download Short-code – Change from ID to Download TitleShaon,
About the Advanced TinyMCE, is it working with the google drive addon?
Thank you
Mike
Forum: Plugins
In reply to: [Download Manager] Download Short-code – Change from ID to Download TitleThanks for the tip Shaon,
I am trying to do something similar you do with the direct link to download short-code:
$linkLabel = empty($linkLabel)?'Download '.get_the_title($params['id']):$linkLabel;Are you sure is not possible to make a small change in the Callback function for short-code to make this work?
Ty
Mike
Forum: Plugins
In reply to: [Download Manager] Download Short-code – Change from ID to Download TitleIm trying to find a work around but nothing is working.
Thanks for the help
Mike
Hi @teodor-cosofret,
When a user changes his password or email in the [wppb-edit-profile] Page the administrator never receive a email notification about the change, is this the default behaviour?
Thank you
Mike
Thank you for your help, i will keep an eye in the other thread.
Mike