Versión 2.6.9.1 con modificaciones para devolver mas campos en la respuesta a una creación de referencia de OXXO, como tal son los campos de oxxo_reference, error, failDescription, clientID, clientFullName, amount como número entero
This commit is contained in:
parent
59aac17968
commit
9db9febc39
274
data/plugin.log
274
data/plugin.log
@ -12667,3 +12667,277 @@ JSON con los datos a actualizar del resumen: {"Cliente": "2","Domicilio": ""Nomb
|
||||
[2025-03-08 0:04:48.426023] [info] Referencia personalizada, Valor de la respuesta: {"oxxo_reference":"12345678901234657890123456789012","url":"https:\/\/payments.stripe.com\/oxxo\/voucher\/test_YWNjdF8xT2tHMFJFRlkxV0VVdGdSLF9SdHlxVnNaTVpKYmdSNmJ5aVVWaXBYQ2JQb1ZXYzJY0100yrBYmRnW","clientID":2,"clientFullName":"Daniel Humberto Soto Villegas danydhsv2","amount":12000,"failDescription":"","error":""}
|
||||
|
||||
[2025-03-08 0:04:48.426275] [debug] Reponse que se envía a CallBell: {"url": "https://payments.stripe.com/oxxo/voucher/test_YWNjdF8xT2tHMFJFRlkxV0VVdGdSLF9SdHlxVnNaTVpKYmdSNmJ5aVVWaXBYQ2JQb1ZXYzJY0100yrBYmRnW","oxxo_reference": "12345678901234657890123456789012","error": "","failDescription": "","clientID": "2","clientFullName": "Daniel Humberto Soto Villegas danydhsv2","amount": "12000"}
|
||||
[2025-03-08 0:07:55.198347] [notice] Logging level set to:debug
|
||||
[2025-03-08 0:07:55.316042] [debug] valor el evento recibido por webhook: payment.add
|
||||
|
||||
[2025-03-08 0:07:55.316230] [debug] Valor de JSON: {"uuid":"cfd03ab1-ea71-4332-af62-2e11ca595d1a","changeType":"insert","entity":"payment","entityId":"606","eventName":"payment.add","extraData":{"entity":{"id":606,"clientId":2,"methodId":"1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae","checkNumber":null,"createdDate":"2025-03-07T18:07:54-0600","amount":120,"currencyCode":"MXN","note":null,"receiptSentDate":null,"providerName":null,"providerPaymentId":null,"providerPaymentTime":null,"paymentCovers":[],"creditAmount":120,"userId":null,"attributes":[]},"entityBeforeEdit":null}}
|
||||
|
||||
[2025-03-08 0:07:55.316509] [debug] Notification encodificado en JSON:{"uuid":"cfd03ab1-ea71-4332-af62-2e11ca595d1a","changeType":"insert","entity":"payment","entityId":606,"message":null,"clientId":2,"eventName":"payment.add","clientData":{"id":2,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"31 Chiapas","street2":null,"city":"Dolores Hidalgo Cuna de la Independencia Nacional","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":"Cliente espacial, el m\u00e1s chido","sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2024-01-25T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":true,"firstName":"Daniel Humberto","lastName":"Soto Villegas danydhsv2","username":"danydhsv","contacts":[{"id":2,"clientId":2,"email":"dhsv.141089@gmail.com","phone":"5214181878106","name":"Personal","isBilling":false,"isContact":false,"types":[{"id":1000,"name":"WhatsApp"}]},{"id":170,"clientId":2,"email":null,"phone":"5214181817609","name":"Bussiness","isBilling":false,"isContact":false,"types":[]}],"attributes":[{"id":112,"clientId":2,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_PetN1dhr4rx0kX","clientZoneVisible":true},{"id":113,"clientId":2,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"0021804341999569810","clientZoneVisible":true},{"id":178,"clientId":2,"customAttributeId":15,"name":"Site","key":"site","value":"0LOCS","clientZoneVisible":false},{"id":179,"clientId":2,"customAttributeId":16,"name":"Antena\/Sectorial","key":"antenaSectorial","value":"Sectorial-4b 172.16.13.16\/24","clientZoneVisible":false}],"accountBalance":1953.33,"accountCredit":1953.33,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[{"id":2,"name":"NS EXENTO","colorBackground":"#42a3df","colorText":"#fff"}],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1564209,"addressGpsLon":-100.9384185,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":true,"hasSuspendedService":false,"hasServiceWithoutDevices":false,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"serviceData":null,"invoiceData":null,"paymentData":{"id":606,"clientId":2,"methodId":"1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae","checkNumber":null,"createdDate":"2025-03-07T18:07:54-0600","amount":120,"currencyCode":"MXN","note":null,"receiptSentDate":null,"providerName":null,"providerPaymentId":null,"providerPaymentTime":null,"paymentCovers":[],"creditAmount":120,"userId":null,"attributes":[]}}
|
||||
|
||||
[2025-03-08 0:07:55.316570] [debug] valor del payment data: {"id":606,"clientId":2,"methodId":"1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae","checkNumber":null,"createdDate":"2025-03-07T18:07:54-0600","amount":120,"currencyCode":"MXN","note":null,"receiptSentDate":null,"providerName":null,"providerPaymentId":null,"providerPaymentTime":null,"paymentCovers":[],"creditAmount":120,"userId":null,"attributes":[]}
|
||||
|
||||
[2025-03-08 0:07:55.316679] [info] {"WhatsApp":["5214181878106"]}
|
||||
[2025-03-08 0:07:55.316721] [info] Procesando tipo de contacto original: 'WhatsApp'
|
||||
[2025-03-08 0:07:55.316757] [info] Tipo de contacto normalizado: 'whatsapp'
|
||||
[2025-03-08 0:07:55.316795] [debug] ***Se notifica y actualiza al cliente sobre su pago***
|
||||
|
||||
Eviando comprobante de pago al cliente: 2 con número: 5214181878106
|
||||
|
||||
El archivo PDF se ha descargado y guardado correctamente en: /data/ucrm/data/plugins/siip-whatsapp-notifications/src/Facade/../../comprobantes/Comprobante_Daniel_Humberto_Soto_Villegas_danydhsv2.pdf
|
||||
|
||||
El archivo PDF es válido y tiene contenido: /data/ucrm/data/plugins/siip-whatsapp-notifications/src/Facade/../../comprobantes/Comprobante_Daniel_Humberto_Soto_Villegas_danydhsv2.pdf
|
||||
|
||||
El archivo PNG se ha generado correctamente en: /data/ucrm/data/plugins/siip-whatsapp-notifications/src/Facade/../../comprobantes/Comprobante_Daniel_Humberto_Soto_Villegas_danydhsv2.png
|
||||
|
||||
Subiendo comprobante a worpdpress
|
||||
|
||||
file_to_upload: /data/ucrm/data/plugins/siip-whatsapp-notifications/src/Facade/../../comprobantes/Comprobante_Daniel_Humberto_Soto_Villegas_danydhsv2.png
|
||||
|
||||
Conexión FTP exitosa
|
||||
|
||||
El archivo ha sido cargado exitosamente.
|
||||
|
||||
La URL es: https://siip.mx/wp/wp-content/uploads/img/Comprobante_Daniel_Humberto_Soto_Villegas_danydhsv2.png
|
||||
|
||||
No se pudo obtener la lista de archivos de la carpeta FTP
|
||||
|
||||
Se terminó de subir comprobante a wordpress
|
||||
|
||||
La cadena CURL que se envia es: {
|
||||
"to": "5214181878106",
|
||||
"from": "whatsapp",
|
||||
"type": "document",
|
||||
"content": {
|
||||
"text": "S/M",
|
||||
"url": "https://siip.mx/wp/wp-content/uploads/img/Comprobante_Daniel_Humberto_Soto_Villegas_danydhsv2.png"
|
||||
},
|
||||
"template_values": ["Daniel Humberto Soto Villegas danydhsv2", "$120", "$1953.33 a favor"],
|
||||
"template_uuid": "57ead79cebd14902921477922403093b",
|
||||
"optin_contact": true
|
||||
}
|
||||
Response del CallBell: {"message":{"uuid":"7b707e0c693f475f94b2605b25a30141","status":"enqueued"}}
|
||||
Hay menos de 100 archivos en el directorio. No se eliminarán archivos.
|
||||
|
||||
La notificación fue enviada correctamente con estado: enqueued
|
||||
|
||||
Notificacion data: {"uuid":"cfd03ab1-ea71-4332-af62-2e11ca595d1a","changeType":"insert","entity":"payment","entityId":606,"message":null,"clientId":2,"eventName":"payment.add","clientData":{"id":2,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"31 Chiapas","street2":null,"city":"Dolores Hidalgo Cuna de la Independencia Nacional","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":"Cliente espacial, el m\u00e1s chido","sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2024-01-25T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":true,"firstName":"Daniel Humberto","lastName":"Soto Villegas danydhsv2","username":"danydhsv","contacts":[{"id":2,"clientId":2,"email":"dhsv.141089@gmail.com","phone":"5214181878106","name":"Personal","isBilling":false,"isContact":false,"types":[{"id":1000,"name":"WhatsApp"}]},{"id":170,"clientId":2,"email":null,"phone":"5214181817609","name":"Bussiness","isBilling":false,"isContact":false,"types":[]}],"attributes":[{"id":112,"clientId":2,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_PetN1dhr4rx0kX","clientZoneVisible":true},{"id":113,"clientId":2,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"0021804341999569810","clientZoneVisible":true},{"id":178,"clientId":2,"customAttributeId":15,"name":"Site","key":"site","value":"0LOCS","clientZoneVisible":false},{"id":179,"clientId":2,"customAttributeId":16,"name":"Antena\/Sectorial","key":"antenaSectorial","value":"Sectorial-4b 172.16.13.16\/24","clientZoneVisible":false}],"accountBalance":1953.33,"accountCredit":1953.33,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[{"id":2,"name":"NS EXENTO","colorBackground":"#42a3df","colorText":"#fff"}],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1564209,"addressGpsLon":-100.9384185,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":true,"hasSuspendedService":false,"hasServiceWithoutDevices":false,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"serviceData":null,"invoiceData":null,"paymentData":{"id":606,"clientId":2,"methodId":"1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae","checkNumber":null,"createdDate":"2025-03-07T18:07:54-0600","amount":120,"currencyCode":"MXN","note":null,"receiptSentDate":null,"providerName":null,"providerPaymentId":null,"providerPaymentTime":null,"paymentCovers":[],"creditAmount":120,"userId":null,"attributes":[]}}
|
||||
|
||||
Dentro del proceso del patch:
|
||||
|
||||
Datos traidos con payment api: [{"id":606,"clientId":2,"methodId":"1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae","checkNumber":null,"createdDate":"2025-03-07T18:07:54-0600","amount":120,"currencyCode":"MXN","note":null,"receiptSentDate":null,"providerName":null,"providerPaymentId":null,"providerPaymentTime":null,"paymentCovers":[],"creditAmount":120,"userId":null,"attributes":[]}]
|
||||
|
||||
Nombre del cliente que se va a actualizar: Daniel Humberto Soto Villegas danydhsv2
|
||||
|
||||
UUID: 74cc2bb45eb8409f92cd5dba99200d26
|
||||
|
||||
JSON con los datos a actualizar: {"name":"Daniel Humberto Soto Villegas danydhsv2","custom_fields":{"Cliente":2,"Domicilio":"\ud83d\udccd Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","Nombre":"\ud83d\udc64 Daniel Humberto Soto Villegas danydhsv2","URL":"\ud83c\udf10 https:\/\/sistema.siip.mx\/crm\/client\/2","Saldo Actual":"\ud83d\udcb21953.33 a favor","Monto Ultimo Pago":"\ud83d\udcb2 120","Estado":"\ud83d\udfe2 Activo ","Resumen":"{\"Cliente\": \"2\",\"Domicilio\": \"\"Nombre\": \"Daniel Humberto Soto Villegas danydhsv2\",\"URL\": \"https:\/\/sistema.siip.mx\/crm\/client\/2\",\"Saldo Actual\": \"\ud83d\udcb21953.33 a favor\",\"Monto Ultimo Pago\": \"$ 120\",\"Estado\": \"Activo\",\"Fecha Ultimo Pago\": \" 07\/03\/2025 18:07 con Tarjeta de cr\u00e9dito Stripe \ud83d\udcb3\",\"Fecha Ultima Actualizacion\": \"07\/03\/2025 18:07\",\"Clabe Interbancaria\": \"\",\"Site\": \"0LOCS\",\"Antena\/Sectorial\": \"Sectorial-4b 172.16.13.16\/24\"}","Fecha Ultimo Pago":"\ud83d\udcc6\ud83d\udcb8 07\/03\/2025 18:07 con Tarjeta de cr\u00e9dito Stripe \ud83d\udcb3","Fecha Ultima Actualizacion":"\ud83d\udcc6\ud83d\udd04\ufe0f 07\/03\/2025 18:07","Clabe Interbancaria":null,"Site":"0LOCS","Antena\/Sectorial":"Sectorial-4b 172.16.13.16\/24"}}
|
||||
|
||||
JSON con los datos a actualizar del resumen: {"Cliente": "2","Domicilio": ""Nombre": "Daniel Humberto Soto Villegas danydhsv2","URL": "https://sistema.siip.mx/crm/client/2","Saldo Actual": "💲1953.33 a favor","Monto Ultimo Pago": "$ 120","Estado": "Activo","Fecha Ultimo Pago": " 07/03/2025 18:07 con Tarjeta de crédito Stripe 💳","Fecha Ultima Actualizacion": "07/03/2025 18:07","Clabe Interbancaria": "","Site": "0LOCS","Antena/Sectorial": "Sectorial-4b 172.16.13.16/24"}
|
||||
|
||||
Response Patch CallBell: {"contact":{"uuid":"74cc2bb45eb8409f92cd5dba99200d26","name":"Daniel Humberto Soto Villegas danydhsv2","phoneNumber":"5214181878106","avatarUrl":null,"createdAt":"2024-01-08T17:04:13Z","closedAt":"2025-03-03T21:27:41Z","source":"whatsapp","href":"https://dash.callbell.eu/contacts/74cc2bb45eb8409f92cd5dba99200d26","conversationHref":"https://dash.callbell.eu/chat/53c8229c428c4081b197ab136feab73b","tags":["ePA","LIA"],"assignedUser":null,"customFields":{"user entry point":"inbound_message","Clabe Interbancaria":"124180650741646979","Estado":"🟢 Activo ","Fecha Ultima Actualizacion":"📆🔄️ 07/03/2025 18:07","Cliente":"2","URL":"🌐 https://sistema.siip.mx/crm/client/2","Nombre":"👤 Daniel Humberto Soto Villegas danydhsv2","Antena/Sectorial":"Sectorial-4b 172.16.13.16/24","Site":"0LOCS","Saldo Actual":"💲1953.33 a favor","Fecha Ultimo Pago":"📆💸 07/03/2025 18:07 con Tarjeta de crédito Stripe 💳","user name":"Daniel Humberto 🐁","Resumen":"{\"Cliente\": \"2\",\"Domicilio\": \"\"Nombre\": \"Daniel Humberto Soto Villegas danydhsv2\",\"URL\": \"https://sistema.siip.mx/crm/client/2\",\"Saldo Actual\": \"💲1953.33 a favor\",\"Monto Ultimo Pago\": \"$ 120\",\"Estado\": \"Activo\",\"Fecha Ultimo Pago\": \" 07/03/2025 18:07 con Tarjeta de crédito Stripe 💳\",\"Fecha Ultima Actualizacion\": \"07/03/2025 18:07\",\"Clabe Interbancaria\": \"\",\"Site\": \"0LOCS\",\"Antena/Sectorial\": \"Sectorial-4b 172.16.13.16/24\"}","Monto Ultimo Pago":"💲 120","Domicilio":"📍 Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., México"},"team":{"uuid":"3ce05a6952914ba6a44e1b066b22e4d8","name":"OXXOSEG1","default":false,"members":3,"createdAt":"2024-12-13T17:37:39Z"},"channel":{"uuid":"dbaa248932634e7ea4346a320960c24a","title":null,"type":"whatsapp","main":true},"blockedAt":null}}
|
||||
|
||||
Response 2 Patch CallBell: {"contact":{"uuid":"74cc2bb45eb8409f92cd5dba99200d26","name":"Daniel Humberto Soto Villegas danydhsv2","phoneNumber":"5214181878106","avatarUrl":null,"createdAt":"2024-01-08T17:04:13Z","closedAt":"2025-03-03T21:27:41Z","source":"whatsapp","href":"https://dash.callbell.eu/contacts/74cc2bb45eb8409f92cd5dba99200d26","conversationHref":"https://dash.callbell.eu/chat/53c8229c428c4081b197ab136feab73b","tags":["ePA","LIA"],"assignedUser":null,"customFields":{"user entry point":"inbound_message","Clabe Interbancaria":"124180650741646979","Estado":"🟢 Activo ","Fecha Ultima Actualizacion":"📆🔄️ 07/03/2025 18:07","Cliente":"2","URL":"🌐 https://sistema.siip.mx/crm/client/2","Nombre":"👤 Daniel Humberto Soto Villegas danydhsv2","Antena/Sectorial":"Sectorial-4b 172.16.13.16/24","Site":"0LOCS","Saldo Actual":"💲1953.33 a favor","Fecha Ultimo Pago":"📆💸 07/03/2025 18:07 con Tarjeta de crédito Stripe 💳","user name":"Daniel Humberto 🐁","Resumen":"{\"Cliente\": \"2\",\"Domicilio\": \"\"Nombre\": \"Daniel Humberto Soto Villegas danydhsv2\",\"URL\": \"https://sistema.siip.mx/crm/client/2\",\"Saldo Actual\": \"💲1953.33 a favor\",\"Monto Ultimo Pago\": \"$ 120\",\"Estado\": \"Activo\",\"Fecha Ultimo Pago\": \" 07/03/2025 18:07 con Tarjeta de crédito Stripe 💳\",\"Fecha Ultima Actualizacion\": \"07/03/2025 18:07\",\"Clabe Interbancaria\": \"\",\"Site\": \"0LOCS\",\"Antena/Sectorial\": \"Sectorial-4b 172.16.13.16/24\"}","Monto Ultimo Pago":"💲 120","Domicilio":"📍 Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., México"},"team":{"uuid":"3ce05a6952914ba6a44e1b066b22e4d8","name":"OXXOSEG1","default":false,"members":3,"createdAt":"2024-12-13T17:37:39Z"},"channel":{"uuid":"dbaa248932634e7ea4346a320960c24a","title":null,"type":"whatsapp","main":true},"blockedAt":null}}
|
||||
|
||||
[2025-03-08 0:08:01.709039] [notice] Logging level set to:debug
|
||||
[2025-03-08 0:08:01.877154] [debug] valor el evento recibido por webhook: payment.edit
|
||||
|
||||
[2025-03-08 0:08:01.877216] [debug] Valor de JSON: {"uuid":"018124e7-b367-44dd-b45a-4941ec760434","changeType":"edit","entity":"payment","entityId":"606","eventName":"payment.edit","extraData":{"entity":{"id":606,"clientId":2,"methodId":"1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae","checkNumber":null,"createdDate":"2025-03-07T18:07:54-0600","amount":120,"currencyCode":"MXN","note":null,"receiptSentDate":null,"providerName":null,"providerPaymentId":null,"providerPaymentTime":null,"paymentCovers":[],"creditAmount":120,"userId":null,"attributes":[]},"entityBeforeEdit":{"id":606,"clientId":2,"methodId":"1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae","checkNumber":null,"createdDate":"2025-03-07T18:07:54-0600","amount":120,"currencyCode":"MXN","note":null,"receiptSentDate":null,"providerName":null,"providerPaymentId":null,"providerPaymentTime":null,"paymentCovers":[],"creditAmount":120,"userId":null,"attributes":[]}}}
|
||||
|
||||
[2025-03-08 5:42:37.799339] [notice] Logging level set to:debug
|
||||
[2025-03-08 5:42:37.799469] [info] No UUID found in the webhook data
|
||||
[2025-03-08 5:42:37.799489] [info] Evento de referencia de oxxo recibido
|
||||
|
||||
[2025-03-08 5:42:37.799504] [info] Referencia persnoalizada, Valor del monto: 170
|
||||
|
||||
[2025-03-08 5:42:37.799516] [info] Creando referencia del cliente para OXXO:
|
||||
|
||||
[2025-03-08 5:42:37.924211] [info] Stripe Customer ID obtenido: cus_PetN1dhr4rx0kX
|
||||
|
||||
[2025-03-08 5:42:37.924258] [info] Monto proporcionado directamente: 170
|
||||
|
||||
[2025-03-08 5:42:37.924273] [info] Creando referencia en Stripe por 17000 para el cliente cus_PetN1dhr4rx0kX
|
||||
|
||||
[2025-03-08 5:42:39.454909] [info] Referencia OXXO: 12345678901234657890123456789012
|
||||
|
||||
[2025-03-08 5:42:39.455029] [info] URL del recibo: https://payments.stripe.com/oxxo/voucher/test_YWNjdF8xT2tHMFJFRlkxV0VVdGdSLF9SdTRJQmlpQXhzdTNNUWwxb3hES3F4clJFd3NKUzdh0100vt8g7Mz7
|
||||
|
||||
[2025-03-08 5:42:39.455064] [info] Referencia OXXO creada correctamente.
|
||||
|
||||
[2025-03-08 5:42:39.459223] [info] Referencia personalizada, Valor de la respuesta: {"oxxo_reference":"12345678901234657890123456789012","url":"https:\/\/payments.stripe.com\/oxxo\/voucher\/test_YWNjdF8xT2tHMFJFRlkxV0VVdGdSLF9SdTRJQmlpQXhzdTNNUWwxb3hES3F4clJFd3NKUzdh0100vt8g7Mz7","clientID":2,"clientFullName":"Daniel Humberto Soto Villegas danydhsv2","amount":0,"failDescription":"","error":""}
|
||||
|
||||
[2025-03-08 5:42:39.459328] [debug] Reponse que se envía a CallBell: {"url": "https://payments.stripe.com/oxxo/voucher/test_YWNjdF8xT2tHMFJFRlkxV0VVdGdSLF9SdTRJQmlpQXhzdTNNUWwxb3hES3F4clJFd3NKUzdh0100vt8g7Mz7","oxxo_reference": "12345678901234657890123456789012","error": "","failDescription": "","clientID": "2","clientFullName": "Daniel Humberto Soto Villegas danydhsv2","amount": "0"}
|
||||
[2025-03-08 5:45:47.008481] [notice] Logging level set to:debug
|
||||
[2025-03-08 5:45:47.127031] [debug] valor el evento recibido por webhook: payment.add
|
||||
|
||||
[2025-03-08 5:45:47.127161] [debug] Valor de JSON: {"uuid":"d4ace52a-cbb0-4455-a78b-730c073ed34a","changeType":"insert","entity":"payment","entityId":"607","eventName":"payment.add","extraData":{"entity":{"id":607,"clientId":2,"methodId":"1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae","checkNumber":null,"createdDate":"2025-03-07T23:45:46-0600","amount":170,"currencyCode":"MXN","note":null,"receiptSentDate":null,"providerName":null,"providerPaymentId":null,"providerPaymentTime":null,"paymentCovers":[],"creditAmount":170,"userId":null,"attributes":[]},"entityBeforeEdit":null}}
|
||||
|
||||
[2025-03-08 5:45:47.127432] [debug] Notification encodificado en JSON:{"uuid":"d4ace52a-cbb0-4455-a78b-730c073ed34a","changeType":"insert","entity":"payment","entityId":607,"message":null,"clientId":2,"eventName":"payment.add","clientData":{"id":2,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"31 Chiapas","street2":null,"city":"Dolores Hidalgo Cuna de la Independencia Nacional","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":"Cliente espacial, el m\u00e1s chido","sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2024-01-25T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":true,"firstName":"Daniel Humberto","lastName":"Soto Villegas danydhsv2","username":"danydhsv","contacts":[{"id":2,"clientId":2,"email":"dhsv.141089@gmail.com","phone":"5214181878106","name":"Personal","isBilling":false,"isContact":false,"types":[{"id":1000,"name":"WhatsApp"}]},{"id":170,"clientId":2,"email":null,"phone":"5214181817609","name":"Bussiness","isBilling":false,"isContact":false,"types":[]}],"attributes":[{"id":112,"clientId":2,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_PetN1dhr4rx0kX","clientZoneVisible":true},{"id":113,"clientId":2,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"0021804341999569810","clientZoneVisible":true},{"id":178,"clientId":2,"customAttributeId":15,"name":"Site","key":"site","value":"0LOCS","clientZoneVisible":false},{"id":179,"clientId":2,"customAttributeId":16,"name":"Antena\/Sectorial","key":"antenaSectorial","value":"Sectorial-4b 172.16.13.16\/24","clientZoneVisible":false}],"accountBalance":2123.33,"accountCredit":2123.33,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[{"id":2,"name":"NS EXENTO","colorBackground":"#42a3df","colorText":"#fff"}],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1564209,"addressGpsLon":-100.9384185,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":true,"hasSuspendedService":false,"hasServiceWithoutDevices":false,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"serviceData":null,"invoiceData":null,"paymentData":{"id":607,"clientId":2,"methodId":"1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae","checkNumber":null,"createdDate":"2025-03-07T23:45:46-0600","amount":170,"currencyCode":"MXN","note":null,"receiptSentDate":null,"providerName":null,"providerPaymentId":null,"providerPaymentTime":null,"paymentCovers":[],"creditAmount":170,"userId":null,"attributes":[]}}
|
||||
|
||||
[2025-03-08 5:45:47.127507] [debug] valor del payment data: {"id":607,"clientId":2,"methodId":"1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae","checkNumber":null,"createdDate":"2025-03-07T23:45:46-0600","amount":170,"currencyCode":"MXN","note":null,"receiptSentDate":null,"providerName":null,"providerPaymentId":null,"providerPaymentTime":null,"paymentCovers":[],"creditAmount":170,"userId":null,"attributes":[]}
|
||||
|
||||
[2025-03-08 5:45:47.127620] [info] {"WhatsApp":["5214181878106"]}
|
||||
[2025-03-08 5:45:47.127661] [info] Procesando tipo de contacto original: 'WhatsApp'
|
||||
[2025-03-08 5:45:47.127697] [info] Tipo de contacto normalizado: 'whatsapp'
|
||||
[2025-03-08 5:45:47.127734] [debug] ***Se notifica y actualiza al cliente sobre su pago***
|
||||
|
||||
Eviando comprobante de pago al cliente: 2 con número: 5214181878106
|
||||
|
||||
El archivo PDF se ha descargado y guardado correctamente en: /data/ucrm/data/plugins/siip-whatsapp-notifications/src/Facade/../../comprobantes/Comprobante_Daniel_Humberto_Soto_Villegas_danydhsv2.pdf
|
||||
|
||||
El archivo PDF es válido y tiene contenido: /data/ucrm/data/plugins/siip-whatsapp-notifications/src/Facade/../../comprobantes/Comprobante_Daniel_Humberto_Soto_Villegas_danydhsv2.pdf
|
||||
|
||||
El archivo PNG se ha generado correctamente en: /data/ucrm/data/plugins/siip-whatsapp-notifications/src/Facade/../../comprobantes/Comprobante_Daniel_Humberto_Soto_Villegas_danydhsv2.png
|
||||
|
||||
Subiendo comprobante a worpdpress
|
||||
|
||||
file_to_upload: /data/ucrm/data/plugins/siip-whatsapp-notifications/src/Facade/../../comprobantes/Comprobante_Daniel_Humberto_Soto_Villegas_danydhsv2.png
|
||||
|
||||
Conexión FTP exitosa
|
||||
|
||||
El archivo ha sido cargado exitosamente.
|
||||
|
||||
La URL es: https://siip.mx/wp/wp-content/uploads/img/Comprobante_Daniel_Humberto_Soto_Villegas_danydhsv2.png
|
||||
|
||||
No se pudo obtener la lista de archivos de la carpeta FTP
|
||||
|
||||
Se terminó de subir comprobante a wordpress
|
||||
|
||||
La cadena CURL que se envia es: {
|
||||
"to": "5214181878106",
|
||||
"from": "whatsapp",
|
||||
"type": "document",
|
||||
"content": {
|
||||
"text": "S/M",
|
||||
"url": "https://siip.mx/wp/wp-content/uploads/img/Comprobante_Daniel_Humberto_Soto_Villegas_danydhsv2.png"
|
||||
},
|
||||
"template_values": ["Daniel Humberto Soto Villegas danydhsv2", "$170", "$2123.33 a favor"],
|
||||
"template_uuid": "57ead79cebd14902921477922403093b",
|
||||
"optin_contact": true
|
||||
}
|
||||
Response del CallBell: {"message":{"uuid":"ab8b645a76f24167931d6b57aaae5fa9","status":"enqueued"}}
|
||||
Hay menos de 100 archivos en el directorio. No se eliminarán archivos.
|
||||
|
||||
La notificación fue enviada correctamente con estado: enqueued
|
||||
|
||||
Notificacion data: {"uuid":"d4ace52a-cbb0-4455-a78b-730c073ed34a","changeType":"insert","entity":"payment","entityId":607,"message":null,"clientId":2,"eventName":"payment.add","clientData":{"id":2,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"31 Chiapas","street2":null,"city":"Dolores Hidalgo Cuna de la Independencia Nacional","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":"Cliente espacial, el m\u00e1s chido","sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2024-01-25T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":true,"firstName":"Daniel Humberto","lastName":"Soto Villegas danydhsv2","username":"danydhsv","contacts":[{"id":2,"clientId":2,"email":"dhsv.141089@gmail.com","phone":"5214181878106","name":"Personal","isBilling":false,"isContact":false,"types":[{"id":1000,"name":"WhatsApp"}]},{"id":170,"clientId":2,"email":null,"phone":"5214181817609","name":"Bussiness","isBilling":false,"isContact":false,"types":[]}],"attributes":[{"id":112,"clientId":2,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_PetN1dhr4rx0kX","clientZoneVisible":true},{"id":113,"clientId":2,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"0021804341999569810","clientZoneVisible":true},{"id":178,"clientId":2,"customAttributeId":15,"name":"Site","key":"site","value":"0LOCS","clientZoneVisible":false},{"id":179,"clientId":2,"customAttributeId":16,"name":"Antena\/Sectorial","key":"antenaSectorial","value":"Sectorial-4b 172.16.13.16\/24","clientZoneVisible":false}],"accountBalance":2123.33,"accountCredit":2123.33,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[{"id":2,"name":"NS EXENTO","colorBackground":"#42a3df","colorText":"#fff"}],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1564209,"addressGpsLon":-100.9384185,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":true,"hasSuspendedService":false,"hasServiceWithoutDevices":false,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"serviceData":null,"invoiceData":null,"paymentData":{"id":607,"clientId":2,"methodId":"1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae","checkNumber":null,"createdDate":"2025-03-07T23:45:46-0600","amount":170,"currencyCode":"MXN","note":null,"receiptSentDate":null,"providerName":null,"providerPaymentId":null,"providerPaymentTime":null,"paymentCovers":[],"creditAmount":170,"userId":null,"attributes":[]}}
|
||||
|
||||
Dentro del proceso del patch:
|
||||
|
||||
Datos traidos con payment api: [{"id":607,"clientId":2,"methodId":"1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae","checkNumber":null,"createdDate":"2025-03-07T23:45:46-0600","amount":170,"currencyCode":"MXN","note":null,"receiptSentDate":null,"providerName":null,"providerPaymentId":null,"providerPaymentTime":null,"paymentCovers":[],"creditAmount":170,"userId":null,"attributes":[]}]
|
||||
|
||||
Nombre del cliente que se va a actualizar: Daniel Humberto Soto Villegas danydhsv2
|
||||
|
||||
UUID: 74cc2bb45eb8409f92cd5dba99200d26
|
||||
|
||||
JSON con los datos a actualizar: {"name":"Daniel Humberto Soto Villegas danydhsv2","custom_fields":{"Cliente":2,"Domicilio":"\ud83d\udccd Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","Nombre":"\ud83d\udc64 Daniel Humberto Soto Villegas danydhsv2","URL":"\ud83c\udf10 https:\/\/sistema.siip.mx\/crm\/client\/2","Saldo Actual":"\ud83d\udcb22123.33 a favor","Monto Ultimo Pago":"\ud83d\udcb2 170","Estado":"\ud83d\udfe2 Activo ","Resumen":"{\"Cliente\": \"2\",\"Domicilio\": \"\"Nombre\": \"Daniel Humberto Soto Villegas danydhsv2\",\"URL\": \"https:\/\/sistema.siip.mx\/crm\/client\/2\",\"Saldo Actual\": \"\ud83d\udcb22123.33 a favor\",\"Monto Ultimo Pago\": \"$ 170\",\"Estado\": \"Activo\",\"Fecha Ultimo Pago\": \" 07\/03\/2025 23:45 con Tarjeta de cr\u00e9dito Stripe \ud83d\udcb3\",\"Fecha Ultima Actualizacion\": \"07\/03\/2025 23:45\",\"Clabe Interbancaria\": \"\",\"Site\": \"0LOCS\",\"Antena\/Sectorial\": \"Sectorial-4b 172.16.13.16\/24\"}","Fecha Ultimo Pago":"\ud83d\udcc6\ud83d\udcb8 07\/03\/2025 23:45 con Tarjeta de cr\u00e9dito Stripe \ud83d\udcb3","Fecha Ultima Actualizacion":"\ud83d\udcc6\ud83d\udd04\ufe0f 07\/03\/2025 23:45","Clabe Interbancaria":null,"Site":"0LOCS","Antena\/Sectorial":"Sectorial-4b 172.16.13.16\/24"}}
|
||||
|
||||
JSON con los datos a actualizar del resumen: {"Cliente": "2","Domicilio": ""Nombre": "Daniel Humberto Soto Villegas danydhsv2","URL": "https://sistema.siip.mx/crm/client/2","Saldo Actual": "💲2123.33 a favor","Monto Ultimo Pago": "$ 170","Estado": "Activo","Fecha Ultimo Pago": " 07/03/2025 23:45 con Tarjeta de crédito Stripe 💳","Fecha Ultima Actualizacion": "07/03/2025 23:45","Clabe Interbancaria": "","Site": "0LOCS","Antena/Sectorial": "Sectorial-4b 172.16.13.16/24"}
|
||||
|
||||
Response Patch CallBell: {"contact":{"uuid":"74cc2bb45eb8409f92cd5dba99200d26","name":"Daniel Humberto Soto Villegas danydhsv2","phoneNumber":"5214181878106","avatarUrl":null,"createdAt":"2024-01-08T17:04:13Z","closedAt":"2025-03-03T21:27:41Z","source":"whatsapp","href":"https://dash.callbell.eu/contacts/74cc2bb45eb8409f92cd5dba99200d26","conversationHref":"https://dash.callbell.eu/chat/53c8229c428c4081b197ab136feab73b","tags":["ePA","LIA"],"assignedUser":null,"customFields":{"user entry point":"inbound_message","Clabe Interbancaria":"124180650741646979","Estado":"🟢 Activo ","Fecha Ultima Actualizacion":"📆🔄️ 07/03/2025 23:45","Cliente":"2","URL":"🌐 https://sistema.siip.mx/crm/client/2","Nombre":"👤 Daniel Humberto Soto Villegas danydhsv2","Antena/Sectorial":"Sectorial-4b 172.16.13.16/24","Site":"0LOCS","Saldo Actual":"💲2123.33 a favor","Fecha Ultimo Pago":"📆💸 07/03/2025 23:45 con Tarjeta de crédito Stripe 💳","user name":"Daniel Humberto 🐁","Resumen":"{\"Cliente\": \"2\",\"Domicilio\": \"\"Nombre\": \"Daniel Humberto Soto Villegas danydhsv2\",\"URL\": \"https://sistema.siip.mx/crm/client/2\",\"Saldo Actual\": \"💲2123.33 a favor\",\"Monto Ultimo Pago\": \"$ 170\",\"Estado\": \"Activo\",\"Fecha Ultimo Pago\": \" 07/03/2025 23:45 con Tarjeta de crédito Stripe 💳\",\"Fecha Ultima Actualizacion\": \"07/03/2025 23:45\",\"Clabe Interbancaria\": \"\",\"Site\": \"0LOCS\",\"Antena/Sectorial\": \"Sectorial-4b 172.16.13.16/24\"}","Monto Ultimo Pago":"💲 170","Domicilio":"📍 Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., México"},"team":{"uuid":"3ce05a6952914ba6a44e1b066b22e4d8","name":"OXXOSEG1","default":false,"members":3,"createdAt":"2024-12-13T17:37:39Z"},"channel":{"uuid":"dbaa248932634e7ea4346a320960c24a","title":null,"type":"whatsapp","main":true},"blockedAt":null}}
|
||||
|
||||
Response 2 Patch CallBell: {"contact":{"uuid":"74cc2bb45eb8409f92cd5dba99200d26","name":"Daniel Humberto Soto Villegas danydhsv2","phoneNumber":"5214181878106","avatarUrl":null,"createdAt":"2024-01-08T17:04:13Z","closedAt":"2025-03-03T21:27:41Z","source":"whatsapp","href":"https://dash.callbell.eu/contacts/74cc2bb45eb8409f92cd5dba99200d26","conversationHref":"https://dash.callbell.eu/chat/53c8229c428c4081b197ab136feab73b","tags":["ePA","LIA"],"assignedUser":null,"customFields":{"user entry point":"inbound_message","Clabe Interbancaria":"124180650741646979","Estado":"🟢 Activo ","Fecha Ultima Actualizacion":"📆🔄️ 07/03/2025 23:45","Cliente":"2","URL":"🌐 https://sistema.siip.mx/crm/client/2","Nombre":"👤 Daniel Humberto Soto Villegas danydhsv2","Antena/Sectorial":"Sectorial-4b 172.16.13.16/24","Site":"0LOCS","Saldo Actual":"💲2123.33 a favor","Fecha Ultimo Pago":"📆💸 07/03/2025 23:45 con Tarjeta de crédito Stripe 💳","user name":"Daniel Humberto 🐁","Resumen":"{\"Cliente\": \"2\",\"Domicilio\": \"\"Nombre\": \"Daniel Humberto Soto Villegas danydhsv2\",\"URL\": \"https://sistema.siip.mx/crm/client/2\",\"Saldo Actual\": \"💲2123.33 a favor\",\"Monto Ultimo Pago\": \"$ 170\",\"Estado\": \"Activo\",\"Fecha Ultimo Pago\": \" 07/03/2025 23:45 con Tarjeta de crédito Stripe 💳\",\"Fecha Ultima Actualizacion\": \"07/03/2025 23:45\",\"Clabe Interbancaria\": \"\",\"Site\": \"0LOCS\",\"Antena/Sectorial\": \"Sectorial-4b 172.16.13.16/24\"}","Monto Ultimo Pago":"💲 170","Domicilio":"📍 Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., México"},"team":{"uuid":"3ce05a6952914ba6a44e1b066b22e4d8","name":"OXXOSEG1","default":false,"members":3,"createdAt":"2024-12-13T17:37:39Z"},"channel":{"uuid":"dbaa248932634e7ea4346a320960c24a","title":null,"type":"whatsapp","main":true},"blockedAt":null}}
|
||||
|
||||
[2025-03-08 5:45:53.843476] [notice] Logging level set to:debug
|
||||
[2025-03-08 5:45:53.971872] [debug] valor el evento recibido por webhook: payment.edit
|
||||
|
||||
[2025-03-08 5:45:53.972006] [debug] Valor de JSON: {"uuid":"bb227fe6-cf19-483d-b3d6-aebdae3c378e","changeType":"edit","entity":"payment","entityId":"607","eventName":"payment.edit","extraData":{"entity":{"id":607,"clientId":2,"methodId":"1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae","checkNumber":null,"createdDate":"2025-03-07T23:45:46-0600","amount":170,"currencyCode":"MXN","note":null,"receiptSentDate":null,"providerName":null,"providerPaymentId":null,"providerPaymentTime":null,"paymentCovers":[],"creditAmount":170,"userId":null,"attributes":[]},"entityBeforeEdit":{"id":607,"clientId":2,"methodId":"1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae","checkNumber":null,"createdDate":"2025-03-07T23:45:46-0600","amount":170,"currencyCode":"MXN","note":null,"receiptSentDate":null,"providerName":null,"providerPaymentId":null,"providerPaymentTime":null,"paymentCovers":[],"creditAmount":170,"userId":null,"attributes":[]}}}
|
||||
|
||||
[2025-03-08 5:47:58.567975] [notice] Logging level set to:debug
|
||||
[2025-03-08 5:47:58.568116] [info] No UUID found in the webhook data
|
||||
[2025-03-08 5:47:58.568150] [info] Evento de referencia de oxxo recibido
|
||||
|
||||
[2025-03-08 5:47:58.568160] [info] Referencia persnoalizada, Valor del monto: 190
|
||||
|
||||
[2025-03-08 5:47:58.568169] [info] Creando referencia del cliente para OXXO:
|
||||
|
||||
[2025-03-08 5:47:58.697120] [info] Stripe Customer ID obtenido: cus_PetN1dhr4rx0kX
|
||||
|
||||
[2025-03-08 5:47:58.697161] [info] Monto proporcionado directamente: 190
|
||||
|
||||
[2025-03-08 5:47:58.697175] [info] Creando referencia en Stripe por 19000 para el cliente cus_PetN1dhr4rx0kX
|
||||
|
||||
[2025-03-08 5:48:00.149175] [info] Referencia OXXO: 12345678901234657890123456789012
|
||||
|
||||
[2025-03-08 5:48:00.149746] [info] URL del recibo: https://payments.stripe.com/oxxo/voucher/test_YWNjdF8xT2tHMFJFRlkxV0VVdGdSLF9SdTROTWRxVndvN0ZxY1pmaThhelVxZURtdk1vZTlL0100TOf5Miwe
|
||||
|
||||
[2025-03-08 5:48:00.149914] [info] Referencia OXXO creada correctamente.
|
||||
|
||||
[2025-03-08 5:48:00.155117] [info] Referencia personalizada, Valor de la respuesta: {"oxxo_reference":"12345678901234657890123456789012","url":"https:\/\/payments.stripe.com\/oxxo\/voucher\/test_YWNjdF8xT2tHMFJFRlkxV0VVdGdSLF9SdTROTWRxVndvN0ZxY1pmaThhelVxZURtdk1vZTlL0100TOf5Miwe","clientID":2,"clientFullName":"Daniel Humberto Soto Villegas danydhsv2","amount":190,"failDescription":"","error":""}
|
||||
|
||||
[2025-03-08 5:48:00.155381] [debug] Reponse que se envía a CallBell: {"url": "https://payments.stripe.com/oxxo/voucher/test_YWNjdF8xT2tHMFJFRlkxV0VVdGdSLF9SdTROTWRxVndvN0ZxY1pmaThhelVxZURtdk1vZTlL0100TOf5Miwe","oxxo_reference": "12345678901234657890123456789012","error": "","failDescription": "","clientID": "2","clientFullName": "Daniel Humberto Soto Villegas danydhsv2","amount": "190"}
|
||||
[2025-03-08 5:51:02.352112] [notice] Logging level set to:debug
|
||||
[2025-03-08 5:51:02.471072] [debug] valor el evento recibido por webhook: payment.add
|
||||
|
||||
[2025-03-08 5:51:02.471126] [debug] Valor de JSON: {"uuid":"49d0904c-9b01-4a60-b292-28fdf0d6c575","changeType":"insert","entity":"payment","entityId":"608","eventName":"payment.add","extraData":{"entity":{"id":608,"clientId":2,"methodId":"1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae","checkNumber":null,"createdDate":"2025-03-07T23:51:02-0600","amount":190,"currencyCode":"MXN","note":null,"receiptSentDate":null,"providerName":null,"providerPaymentId":null,"providerPaymentTime":null,"paymentCovers":[],"creditAmount":190,"userId":null,"attributes":[]},"entityBeforeEdit":null}}
|
||||
|
||||
[2025-03-08 5:51:02.471379] [debug] Notification encodificado en JSON:{"uuid":"49d0904c-9b01-4a60-b292-28fdf0d6c575","changeType":"insert","entity":"payment","entityId":608,"message":null,"clientId":2,"eventName":"payment.add","clientData":{"id":2,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"31 Chiapas","street2":null,"city":"Dolores Hidalgo Cuna de la Independencia Nacional","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":"Cliente espacial, el m\u00e1s chido","sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2024-01-25T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":true,"firstName":"Daniel Humberto","lastName":"Soto Villegas danydhsv2","username":"danydhsv","contacts":[{"id":2,"clientId":2,"email":"dhsv.141089@gmail.com","phone":"5214181878106","name":"Personal","isBilling":false,"isContact":false,"types":[{"id":1000,"name":"WhatsApp"}]},{"id":170,"clientId":2,"email":null,"phone":"5214181817609","name":"Bussiness","isBilling":false,"isContact":false,"types":[]}],"attributes":[{"id":112,"clientId":2,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_PetN1dhr4rx0kX","clientZoneVisible":true},{"id":113,"clientId":2,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"0021804341999569810","clientZoneVisible":true},{"id":178,"clientId":2,"customAttributeId":15,"name":"Site","key":"site","value":"0LOCS","clientZoneVisible":false},{"id":179,"clientId":2,"customAttributeId":16,"name":"Antena\/Sectorial","key":"antenaSectorial","value":"Sectorial-4b 172.16.13.16\/24","clientZoneVisible":false}],"accountBalance":2313.33,"accountCredit":2313.33,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[{"id":2,"name":"NS EXENTO","colorBackground":"#42a3df","colorText":"#fff"}],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1564209,"addressGpsLon":-100.9384185,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":true,"hasSuspendedService":false,"hasServiceWithoutDevices":false,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"serviceData":null,"invoiceData":null,"paymentData":{"id":608,"clientId":2,"methodId":"1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae","checkNumber":null,"createdDate":"2025-03-07T23:51:02-0600","amount":190,"currencyCode":"MXN","note":null,"receiptSentDate":null,"providerName":null,"providerPaymentId":null,"providerPaymentTime":null,"paymentCovers":[],"creditAmount":190,"userId":null,"attributes":[]}}
|
||||
|
||||
[2025-03-08 5:51:02.471404] [debug] valor del payment data: {"id":608,"clientId":2,"methodId":"1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae","checkNumber":null,"createdDate":"2025-03-07T23:51:02-0600","amount":190,"currencyCode":"MXN","note":null,"receiptSentDate":null,"providerName":null,"providerPaymentId":null,"providerPaymentTime":null,"paymentCovers":[],"creditAmount":190,"userId":null,"attributes":[]}
|
||||
|
||||
[2025-03-08 5:51:02.471472] [info] {"WhatsApp":["5214181878106"]}
|
||||
[2025-03-08 5:51:02.471488] [info] Procesando tipo de contacto original: 'WhatsApp'
|
||||
[2025-03-08 5:51:02.471498] [info] Tipo de contacto normalizado: 'whatsapp'
|
||||
[2025-03-08 5:51:02.471508] [debug] ***Se notifica y actualiza al cliente sobre su pago***
|
||||
|
||||
Eviando comprobante de pago al cliente: 2 con número: 5214181878106
|
||||
|
||||
El archivo PDF se ha descargado y guardado correctamente en: /data/ucrm/data/plugins/siip-whatsapp-notifications/src/Facade/../../comprobantes/Comprobante_Daniel_Humberto_Soto_Villegas_danydhsv2.pdf
|
||||
|
||||
El archivo PDF es válido y tiene contenido: /data/ucrm/data/plugins/siip-whatsapp-notifications/src/Facade/../../comprobantes/Comprobante_Daniel_Humberto_Soto_Villegas_danydhsv2.pdf
|
||||
|
||||
El archivo PNG se ha generado correctamente en: /data/ucrm/data/plugins/siip-whatsapp-notifications/src/Facade/../../comprobantes/Comprobante_Daniel_Humberto_Soto_Villegas_danydhsv2.png
|
||||
|
||||
Subiendo comprobante a worpdpress
|
||||
|
||||
file_to_upload: /data/ucrm/data/plugins/siip-whatsapp-notifications/src/Facade/../../comprobantes/Comprobante_Daniel_Humberto_Soto_Villegas_danydhsv2.png
|
||||
|
||||
Conexión FTP exitosa
|
||||
|
||||
El archivo ha sido cargado exitosamente.
|
||||
|
||||
La URL es: https://siip.mx/wp/wp-content/uploads/img/Comprobante_Daniel_Humberto_Soto_Villegas_danydhsv2.png
|
||||
|
||||
No se pudo obtener la lista de archivos de la carpeta FTP
|
||||
|
||||
Se terminó de subir comprobante a wordpress
|
||||
|
||||
La cadena CURL que se envia es: {
|
||||
"to": "5214181878106",
|
||||
"from": "whatsapp",
|
||||
"type": "document",
|
||||
"content": {
|
||||
"text": "S/M",
|
||||
"url": "https://siip.mx/wp/wp-content/uploads/img/Comprobante_Daniel_Humberto_Soto_Villegas_danydhsv2.png"
|
||||
},
|
||||
"template_values": ["Daniel Humberto Soto Villegas danydhsv2", "$190", "$2313.33 a favor"],
|
||||
"template_uuid": "57ead79cebd14902921477922403093b",
|
||||
"optin_contact": true
|
||||
}
|
||||
Response del CallBell: {"message":{"uuid":"db6120d314264994bb746bdaeb36ba4f","status":"enqueued"}}
|
||||
Hay menos de 100 archivos en el directorio. No se eliminarán archivos.
|
||||
|
||||
La notificación fue enviada correctamente con estado: enqueued
|
||||
|
||||
Notificacion data: {"uuid":"49d0904c-9b01-4a60-b292-28fdf0d6c575","changeType":"insert","entity":"payment","entityId":608,"message":null,"clientId":2,"eventName":"payment.add","clientData":{"id":2,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"31 Chiapas","street2":null,"city":"Dolores Hidalgo Cuna de la Independencia Nacional","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":"Cliente espacial, el m\u00e1s chido","sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2024-01-25T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":true,"firstName":"Daniel Humberto","lastName":"Soto Villegas danydhsv2","username":"danydhsv","contacts":[{"id":2,"clientId":2,"email":"dhsv.141089@gmail.com","phone":"5214181878106","name":"Personal","isBilling":false,"isContact":false,"types":[{"id":1000,"name":"WhatsApp"}]},{"id":170,"clientId":2,"email":null,"phone":"5214181817609","name":"Bussiness","isBilling":false,"isContact":false,"types":[]}],"attributes":[{"id":112,"clientId":2,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_PetN1dhr4rx0kX","clientZoneVisible":true},{"id":113,"clientId":2,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"0021804341999569810","clientZoneVisible":true},{"id":178,"clientId":2,"customAttributeId":15,"name":"Site","key":"site","value":"0LOCS","clientZoneVisible":false},{"id":179,"clientId":2,"customAttributeId":16,"name":"Antena\/Sectorial","key":"antenaSectorial","value":"Sectorial-4b 172.16.13.16\/24","clientZoneVisible":false}],"accountBalance":2313.33,"accountCredit":2313.33,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[{"id":2,"name":"NS EXENTO","colorBackground":"#42a3df","colorText":"#fff"}],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1564209,"addressGpsLon":-100.9384185,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":true,"hasSuspendedService":false,"hasServiceWithoutDevices":false,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"serviceData":null,"invoiceData":null,"paymentData":{"id":608,"clientId":2,"methodId":"1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae","checkNumber":null,"createdDate":"2025-03-07T23:51:02-0600","amount":190,"currencyCode":"MXN","note":null,"receiptSentDate":null,"providerName":null,"providerPaymentId":null,"providerPaymentTime":null,"paymentCovers":[],"creditAmount":190,"userId":null,"attributes":[]}}
|
||||
|
||||
Dentro del proceso del patch:
|
||||
|
||||
Datos traidos con payment api: [{"id":608,"clientId":2,"methodId":"1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae","checkNumber":null,"createdDate":"2025-03-07T23:51:02-0600","amount":190,"currencyCode":"MXN","note":null,"receiptSentDate":null,"providerName":null,"providerPaymentId":null,"providerPaymentTime":null,"paymentCovers":[],"creditAmount":190,"userId":null,"attributes":[]}]
|
||||
|
||||
Nombre del cliente que se va a actualizar: Daniel Humberto Soto Villegas danydhsv2
|
||||
|
||||
UUID: 74cc2bb45eb8409f92cd5dba99200d26
|
||||
|
||||
JSON con los datos a actualizar: {"name":"Daniel Humberto Soto Villegas danydhsv2","custom_fields":{"Cliente":2,"Domicilio":"\ud83d\udccd Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","Nombre":"\ud83d\udc64 Daniel Humberto Soto Villegas danydhsv2","URL":"\ud83c\udf10 https:\/\/sistema.siip.mx\/crm\/client\/2","Saldo Actual":"\ud83d\udcb22313.33 a favor","Monto Ultimo Pago":"\ud83d\udcb2 190","Estado":"\ud83d\udfe2 Activo ","Resumen":"{\"Cliente\": \"2\",\"Domicilio\": \"\"Nombre\": \"Daniel Humberto Soto Villegas danydhsv2\",\"URL\": \"https:\/\/sistema.siip.mx\/crm\/client\/2\",\"Saldo Actual\": \"\ud83d\udcb22313.33 a favor\",\"Monto Ultimo Pago\": \"$ 190\",\"Estado\": \"Activo\",\"Fecha Ultimo Pago\": \" 07\/03\/2025 23:51 con Tarjeta de cr\u00e9dito Stripe \ud83d\udcb3\",\"Fecha Ultima Actualizacion\": \"07\/03\/2025 23:51\",\"Clabe Interbancaria\": \"\",\"Site\": \"0LOCS\",\"Antena\/Sectorial\": \"Sectorial-4b 172.16.13.16\/24\"}","Fecha Ultimo Pago":"\ud83d\udcc6\ud83d\udcb8 07\/03\/2025 23:51 con Tarjeta de cr\u00e9dito Stripe \ud83d\udcb3","Fecha Ultima Actualizacion":"\ud83d\udcc6\ud83d\udd04\ufe0f 07\/03\/2025 23:51","Clabe Interbancaria":null,"Site":"0LOCS","Antena\/Sectorial":"Sectorial-4b 172.16.13.16\/24"}}
|
||||
|
||||
JSON con los datos a actualizar del resumen: {"Cliente": "2","Domicilio": ""Nombre": "Daniel Humberto Soto Villegas danydhsv2","URL": "https://sistema.siip.mx/crm/client/2","Saldo Actual": "💲2313.33 a favor","Monto Ultimo Pago": "$ 190","Estado": "Activo","Fecha Ultimo Pago": " 07/03/2025 23:51 con Tarjeta de crédito Stripe 💳","Fecha Ultima Actualizacion": "07/03/2025 23:51","Clabe Interbancaria": "","Site": "0LOCS","Antena/Sectorial": "Sectorial-4b 172.16.13.16/24"}
|
||||
|
||||
Response Patch CallBell: {"contact":{"uuid":"74cc2bb45eb8409f92cd5dba99200d26","name":"Daniel Humberto Soto Villegas danydhsv2","phoneNumber":"5214181878106","avatarUrl":null,"createdAt":"2024-01-08T17:04:13Z","closedAt":"2025-03-03T21:27:41Z","source":"whatsapp","href":"https://dash.callbell.eu/contacts/74cc2bb45eb8409f92cd5dba99200d26","conversationHref":"https://dash.callbell.eu/chat/53c8229c428c4081b197ab136feab73b","tags":["ePA","LIA"],"assignedUser":null,"customFields":{"user entry point":"inbound_message","Clabe Interbancaria":"124180650741646979","Estado":"🟢 Activo ","Fecha Ultima Actualizacion":"📆🔄️ 07/03/2025 23:51","Cliente":"2","URL":"🌐 https://sistema.siip.mx/crm/client/2","Nombre":"👤 Daniel Humberto Soto Villegas danydhsv2","Antena/Sectorial":"Sectorial-4b 172.16.13.16/24","Site":"0LOCS","Saldo Actual":"💲2313.33 a favor","Fecha Ultimo Pago":"📆💸 07/03/2025 23:51 con Tarjeta de crédito Stripe 💳","user name":"Daniel Humberto 🐁","Resumen":"{\"Cliente\": \"2\",\"Domicilio\": \"\"Nombre\": \"Daniel Humberto Soto Villegas danydhsv2\",\"URL\": \"https://sistema.siip.mx/crm/client/2\",\"Saldo Actual\": \"💲2313.33 a favor\",\"Monto Ultimo Pago\": \"$ 190\",\"Estado\": \"Activo\",\"Fecha Ultimo Pago\": \" 07/03/2025 23:51 con Tarjeta de crédito Stripe 💳\",\"Fecha Ultima Actualizacion\": \"07/03/2025 23:51\",\"Clabe Interbancaria\": \"\",\"Site\": \"0LOCS\",\"Antena/Sectorial\": \"Sectorial-4b 172.16.13.16/24\"}","Monto Ultimo Pago":"💲 190","Domicilio":"📍 Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., México"},"team":{"uuid":"3ce05a6952914ba6a44e1b066b22e4d8","name":"OXXOSEG1","default":false,"members":3,"createdAt":"2024-12-13T17:37:39Z"},"channel":{"uuid":"dbaa248932634e7ea4346a320960c24a","title":null,"type":"whatsapp","main":true},"blockedAt":null}}
|
||||
|
||||
Response 2 Patch CallBell: {"contact":{"uuid":"74cc2bb45eb8409f92cd5dba99200d26","name":"Daniel Humberto Soto Villegas danydhsv2","phoneNumber":"5214181878106","avatarUrl":null,"createdAt":"2024-01-08T17:04:13Z","closedAt":"2025-03-03T21:27:41Z","source":"whatsapp","href":"https://dash.callbell.eu/contacts/74cc2bb45eb8409f92cd5dba99200d26","conversationHref":"https://dash.callbell.eu/chat/53c8229c428c4081b197ab136feab73b","tags":["ePA","LIA"],"assignedUser":null,"customFields":{"user entry point":"inbound_message","Clabe Interbancaria":"124180650741646979","Estado":"🟢 Activo ","Fecha Ultima Actualizacion":"📆🔄️ 07/03/2025 23:51","Cliente":"2","URL":"🌐 https://sistema.siip.mx/crm/client/2","Nombre":"👤 Daniel Humberto Soto Villegas danydhsv2","Antena/Sectorial":"Sectorial-4b 172.16.13.16/24","Site":"0LOCS","Saldo Actual":"💲2313.33 a favor","Fecha Ultimo Pago":"📆💸 07/03/2025 23:51 con Tarjeta de crédito Stripe 💳","user name":"Daniel Humberto 🐁","Resumen":"{\"Cliente\": \"2\",\"Domicilio\": \"\"Nombre\": \"Daniel Humberto Soto Villegas danydhsv2\",\"URL\": \"https://sistema.siip.mx/crm/client/2\",\"Saldo Actual\": \"💲2313.33 a favor\",\"Monto Ultimo Pago\": \"$ 190\",\"Estado\": \"Activo\",\"Fecha Ultimo Pago\": \" 07/03/2025 23:51 con Tarjeta de crédito Stripe 💳\",\"Fecha Ultima Actualizacion\": \"07/03/2025 23:51\",\"Clabe Interbancaria\": \"\",\"Site\": \"0LOCS\",\"Antena/Sectorial\": \"Sectorial-4b 172.16.13.16/24\"}","Monto Ultimo Pago":"💲 190","Domicilio":"📍 Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., México"},"team":{"uuid":"3ce05a6952914ba6a44e1b066b22e4d8","name":"OXXOSEG1","default":false,"members":3,"createdAt":"2024-12-13T17:37:39Z"},"channel":{"uuid":"dbaa248932634e7ea4346a320960c24a","title":null,"type":"whatsapp","main":true},"blockedAt":null}}
|
||||
|
||||
[2025-03-08 5:51:08.833151] [notice] Logging level set to:debug
|
||||
[2025-03-08 5:51:08.948936] [debug] valor el evento recibido por webhook: payment.edit
|
||||
|
||||
[2025-03-08 5:51:08.949083] [debug] Valor de JSON: {"uuid":"35b9f87b-bdd2-466e-a90a-c2df990c45cf","changeType":"edit","entity":"payment","entityId":"608","eventName":"payment.edit","extraData":{"entity":{"id":608,"clientId":2,"methodId":"1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae","checkNumber":null,"createdDate":"2025-03-07T23:51:02-0600","amount":190,"currencyCode":"MXN","note":null,"receiptSentDate":null,"providerName":null,"providerPaymentId":null,"providerPaymentTime":null,"paymentCovers":[],"creditAmount":190,"userId":null,"attributes":[]},"entityBeforeEdit":{"id":608,"clientId":2,"methodId":"1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae","checkNumber":null,"createdDate":"2025-03-07T23:51:02-0600","amount":190,"currencyCode":"MXN","note":null,"receiptSentDate":null,"providerName":null,"providerPaymentId":null,"providerPaymentTime":null,"paymentCovers":[],"creditAmount":190,"userId":null,"attributes":[]}}}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
"displayName": "SIIP - Procesador de Pagos en línea con Stripe, Oxxo y Transferencia, Sincronizador de CallBell y Envío de Notificaciones y comprobantes vía WhatsApp",
|
||||
"description": "Este plugin sincroniza los clientes del sistema UISP CRM con los contactos de WhatsApp en CallBell, además procesa pagos de Stripe como las trasferencias bancarias y genera referencias de pago vía OXXO, además envía comprobantes de pago en formato imagen PNG o texto vía Whatsapp a los clientes",
|
||||
"url": "https://siip.mx/",
|
||||
"version": "2.6.9",
|
||||
"version": "2.6.9.1",
|
||||
"unmsVersionCompliancy": {
|
||||
"min": "2.1.0",
|
||||
"max": null
|
||||
|
||||
@ -61,287 +61,287 @@ abstract class AbstractOxxoOperationsFacade
|
||||
* @throws Exception
|
||||
*/
|
||||
public function createOxxoPaymentIntent($event_json, $amount = null): array
|
||||
{
|
||||
//declarar un array asociativo de strings pero no asignarle nada aun
|
||||
$arrayOxxoPayment = array();
|
||||
|
||||
|
||||
$this->logger->info("Creando referencia del cliente para OXXO: " . PHP_EOL);
|
||||
$configManager = \Ubnt\UcrmPluginSdk\Service\PluginConfigManager::create();
|
||||
$config = $configManager->loadConfig();
|
||||
$StripeToken = $config['tokenstripe'];
|
||||
$IPServer = $config['ipserver'];
|
||||
$tokenCRM = $config['apitoken'];
|
||||
|
||||
$baseUri = 'https://' . $IPServer . '/crm/api/v1.0/';
|
||||
$this->ucrmApi = UcrmApi::create();
|
||||
$currentUserAdmin = $this->ucrmApi->get('users/admins', []);
|
||||
$clientID = $event_json['client_id'];
|
||||
|
||||
$stripeCustomerId = null;
|
||||
$clientEmail = '';
|
||||
|
||||
$clientGuzzleHttp = new Client([
|
||||
'base_uri' => $baseUri,
|
||||
'headers' => [
|
||||
'X-Auth-App-Key' => $tokenCRM,
|
||||
'Accept' => 'application/json',
|
||||
],
|
||||
'verify' => false,
|
||||
'timeout' => 5, // Timeout de 5 segundos
|
||||
]);
|
||||
|
||||
try {
|
||||
$response = $clientGuzzleHttp->request('GET', "clients/" . $clientID);
|
||||
$arrayClientCRM = json_decode($response->getBody()->getContents(), true);
|
||||
//$this->logger->info("Valor de arrayClientCRM: " . print_r($arrayClientCRM, true) . PHP_EOL);
|
||||
$clientFullName = $arrayClientCRM['firstName'] . ' ' . $arrayClientCRM['lastName'];
|
||||
} catch (RequestException $e) {
|
||||
if ($e->getCode() === 404) {
|
||||
$this->logger->error("Cliente no encontrado en CRM: " . $clientID . PHP_EOL);
|
||||
//devolver un array con los campos del codigo error, descripción de la falla, clientID, clientFullName y amount
|
||||
$arrayOxxoPayment['oxxo_reference'] = '';
|
||||
$arrayOxxoPayment['url'] = '';
|
||||
$arrayOxxoPayment['error'] = 'errorGetClientNotFound';
|
||||
$arrayOxxoPayment['failDescription'] = 'Cliente no encontrado en CRM: ' . $clientID;
|
||||
$arrayOxxoPayment['clientID'] = $clientID;
|
||||
$arrayOxxoPayment['clientFullName'] = $clientFullName;
|
||||
$arrayOxxoPayment['amount'] = $amount;
|
||||
return $arrayOxxoPayment;
|
||||
|
||||
|
||||
}
|
||||
//timeout
|
||||
if ($e->getCode() === 408) {
|
||||
$this->logger->error("Timeout al obtener el cliente en CRM: " . $clientID . PHP_EOL);
|
||||
{
|
||||
//declarar un array asociativo de strings pero no asignarle nada aun
|
||||
$arrayOxxoPayment = array();
|
||||
$integerAmount = $amount;
|
||||
|
||||
$this->logger->info("Creando referencia del cliente para OXXO: " . PHP_EOL);
|
||||
$configManager = \Ubnt\UcrmPluginSdk\Service\PluginConfigManager::create();
|
||||
$config = $configManager->loadConfig();
|
||||
$StripeToken = $config['tokenstripe'];
|
||||
$IPServer = $config['ipserver'];
|
||||
$tokenCRM = $config['apitoken'];
|
||||
|
||||
$baseUri = 'https://' . $IPServer . '/crm/api/v1.0/';
|
||||
$this->ucrmApi = UcrmApi::create();
|
||||
$currentUserAdmin = $this->ucrmApi->get('users/admins', []);
|
||||
$clientID = $event_json['client_id'];
|
||||
|
||||
$stripeCustomerId = null;
|
||||
$clientEmail = '';
|
||||
|
||||
$clientGuzzleHttp = new Client([
|
||||
'base_uri' => $baseUri,
|
||||
'headers' => [
|
||||
'X-Auth-App-Key' => $tokenCRM,
|
||||
'Accept' => 'application/json',
|
||||
],
|
||||
'verify' => false,
|
||||
'timeout' => 5, // Timeout de 5 segundos
|
||||
]);
|
||||
|
||||
try {
|
||||
$response = $clientGuzzleHttp->request('GET', "clients/" . $clientID);
|
||||
$arrayClientCRM = json_decode($response->getBody()->getContents(), true);
|
||||
//$this->logger->info("Valor de arrayClientCRM: " . print_r($arrayClientCRM, true) . PHP_EOL);
|
||||
$clientFullName = $arrayClientCRM['firstName'] . ' ' . $arrayClientCRM['lastName'];
|
||||
} catch (RequestException $e) {
|
||||
if ($e->getCode() === 404) {
|
||||
$this->logger->error("Cliente no encontrado en CRM: " . $clientID . PHP_EOL);
|
||||
//devolver un array con los campos del codigo error, descripción de la falla, clientID, clientFullName y amount
|
||||
$arrayOxxoPayment['oxxo_reference'] = '';
|
||||
$arrayOxxoPayment['url'] = '';
|
||||
$arrayOxxoPayment['error'] = 'errorGetClientNotFound';
|
||||
$arrayOxxoPayment['failDescription'] = 'Cliente no encontrado en CRM: ' . $clientID;
|
||||
$arrayOxxoPayment['clientID'] = $clientID;
|
||||
$arrayOxxoPayment['clientFullName'] = $clientFullName;
|
||||
$arrayOxxoPayment['amount'] = $integerAmount;
|
||||
return $arrayOxxoPayment;
|
||||
|
||||
|
||||
}
|
||||
//timeout
|
||||
if ($e->getCode() === 408) {
|
||||
$this->logger->error("Timeout al obtener el cliente en CRM: " . $clientID . PHP_EOL);
|
||||
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
|
||||
$arrayOxxoPayment['oxxo_reference'] = '';
|
||||
$arrayOxxoPayment['error'] = 'errorTimeoutGetClient';
|
||||
$arrayOxxoPayment['failDescription'] = 'Timeout al obtener el cliente en CRM: ' . $clientID;
|
||||
$arrayOxxoPayment['clientID'] = $clientID;
|
||||
$arrayOxxoPayment['clientFullName'] = $clientFullName;
|
||||
$arrayOxxoPayment['amount'] = $integerAmount;
|
||||
return $arrayOxxoPayment;
|
||||
}
|
||||
$this->logger->error("Error al obtener el cliente en CRM (Error {$e->getCode()}): " . $e->getMessage() . PHP_EOL);
|
||||
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
|
||||
$arrayOxxoPayment['oxxo_reference'] = '';
|
||||
$arrayOxxoPayment['error'] = 'errorTimeoutGetClient';
|
||||
$arrayOxxoPayment['failDescription'] = 'Timeout al obtener el cliente en CRM: ' . $clientID;
|
||||
$arrayOxxoPayment['error'] = 'errorGetClient';
|
||||
$arrayOxxoPayment['failDescription'] = 'Error al obtener el cliente en CRM: ' . $clientID;
|
||||
$arrayOxxoPayment['clientID'] = $clientID;
|
||||
$arrayOxxoPayment['clientFullName'] = $clientFullName;
|
||||
$arrayOxxoPayment['amount'] = $amount;
|
||||
$arrayOxxoPayment['amount'] = $integerAmount;
|
||||
return $arrayOxxoPayment;
|
||||
|
||||
}
|
||||
$this->logger->error("Error al obtener el cliente en CRM (Error {$e->getCode()}): " . $e->getMessage() . PHP_EOL);
|
||||
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
|
||||
$arrayOxxoPayment['oxxo_reference'] = '';
|
||||
$arrayOxxoPayment['error'] = 'errorGetClient';
|
||||
$arrayOxxoPayment['failDescription'] = 'Error al obtener el cliente en CRM: ' . $clientID;
|
||||
$arrayOxxoPayment['clientID'] = $clientID;
|
||||
$arrayOxxoPayment['clientFullName'] = $clientFullName;
|
||||
$arrayOxxoPayment['amount'] = $amount;
|
||||
return $arrayOxxoPayment;
|
||||
|
||||
}
|
||||
|
||||
// Obtener email del cliente
|
||||
foreach ($arrayClientCRM['contacts'] as $contact) {
|
||||
if (!empty($contact['email'])) {
|
||||
$clientEmail = $contact['email'];
|
||||
break;
|
||||
} else {
|
||||
$clientEmail = 'siip8873@gmail.com'; // Default
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// Obtener stripeCustomerId
|
||||
foreach ($arrayClientCRM['attributes'] as $attribute) {
|
||||
if ($attribute['key'] === 'stripeCustomerId') {
|
||||
$stripeCustomerId = $attribute['value'];
|
||||
|
||||
// Obtener email del cliente
|
||||
foreach ($arrayClientCRM['contacts'] as $contact) {
|
||||
if (!empty($contact['email'])) {
|
||||
$clientEmail = $contact['email'];
|
||||
break;
|
||||
} else {
|
||||
$clientEmail = 'siip8873@gmail.com'; // Default
|
||||
}
|
||||
}
|
||||
|
||||
$this->logger->info("Stripe Customer ID obtenido: " . $stripeCustomerId . PHP_EOL);
|
||||
} catch (Exception $e) {
|
||||
$this->logger->error("Error al obtener el Customer ID de Stripe (Error {$e->getCode()}): " . $e->getMessage() . PHP_EOL);
|
||||
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
|
||||
$arrayOxxoPayment['oxxo_reference'] = '';
|
||||
$arrayOxxoPayment['error'] = 'errorGetCustomerStripe';
|
||||
$arrayOxxoPayment['failDescription'] = 'Error al obtener el Customer ID de Stripe: ' . $clientID;
|
||||
$arrayOxxoPayment['clientID'] = $clientID;
|
||||
$arrayOxxoPayment['clientFullName'] = $clientFullName;
|
||||
$arrayOxxoPayment['amount'] = $amount;
|
||||
return $arrayOxxoPayment;
|
||||
}
|
||||
|
||||
if ($amount === null) {
|
||||
$amount = abs($arrayClientCRM['accountOutstanding']);
|
||||
} else {
|
||||
$this->logger->info("Monto proporcionado directamente: $amount " . PHP_EOL);
|
||||
}
|
||||
|
||||
if ($amount > 10) {
|
||||
$amount = intval($amount * 100);
|
||||
|
||||
|
||||
try {
|
||||
$this->logger->info("Creando referencia en Stripe por $amount para el cliente $stripeCustomerId" . PHP_EOL);
|
||||
$guzzleClient = new Client([
|
||||
'timeout' => 5,
|
||||
]);
|
||||
|
||||
$response = $guzzleClient->post('https://api.stripe.com/v1/payment_intents', [
|
||||
'auth' => [$StripeToken, ''],
|
||||
'form_params' => [
|
||||
'amount' => $amount,
|
||||
'currency' => 'mxn',
|
||||
'payment_method_types' => ['customer_balance', 'card', 'oxxo'],
|
||||
'description' => 'Pago de servicio de SIIP Internet',
|
||||
'customer' => $stripeCustomerId,
|
||||
'metadata' => [
|
||||
'clientId' => $clientID,
|
||||
'createdBy' => 'UCRM',
|
||||
'paymentType' => 'card.one_time',
|
||||
'signedInAdminId' => $currentUserAdmin[1]['id'],
|
||||
'tipoPago' => 'OXXO',
|
||||
],
|
||||
'payment_method_options' => [
|
||||
'oxxo' => [
|
||||
'expires_after_days' => 3,
|
||||
],
|
||||
],
|
||||
]
|
||||
]);
|
||||
|
||||
$paymentIntent = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
} catch (\Stripe\Exception\ApiConnectionException $e) {
|
||||
$this->logger->error("Error de conexión con Stripe (Error {$e->getCode()}): " . $e->getMessage() . PHP_EOL);
|
||||
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
|
||||
$arrayOxxoPayment['oxxo_reference'] = '';
|
||||
$arrayOxxoPayment['url'] = '';
|
||||
$arrayOxxoPayment['error'] = 'errorConnectionStripe';
|
||||
$arrayOxxoPayment['failDescription'] = 'Error de conexión con Stripe: ' . $clientID;
|
||||
$arrayOxxoPayment['clientID'] = $clientID;
|
||||
$arrayOxxoPayment['clientFullName'] = $clientFullName;
|
||||
$arrayOxxoPayment['amount'] = $amount;
|
||||
return $arrayOxxoPayment;
|
||||
|
||||
} catch (\Stripe\Exception\ApiErrorException $e) {
|
||||
$this->logger->error("Error de la API de Stripe: " . $e->getMessage() . PHP_EOL);
|
||||
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
|
||||
$arrayOxxoPayment['oxxo_reference'] = '';
|
||||
$arrayOxxoPayment['url'] = '';
|
||||
$arrayOxxoPayment['error'] = 'errorApiStripe';
|
||||
$arrayOxxoPayment['failDescription'] = 'Error de la API de Stripe: ' . $clientID;
|
||||
$arrayOxxoPayment['clientID'] = $clientID;
|
||||
$arrayOxxoPayment['clientFullName'] = $clientFullName;
|
||||
$arrayOxxoPayment['amount'] = $amount;
|
||||
return $arrayOxxoPayment;
|
||||
|
||||
// Obtener stripeCustomerId
|
||||
foreach ($arrayClientCRM['attributes'] as $attribute) {
|
||||
if ($attribute['key'] === 'stripeCustomerId') {
|
||||
$stripeCustomerId = $attribute['value'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->logger->info("Stripe Customer ID obtenido: " . $stripeCustomerId . PHP_EOL);
|
||||
} catch (Exception $e) {
|
||||
$this->logger->error("Error inesperado al crear PaymentIntent (Error {$e->getCode()}): " . $e->getMessage() . PHP_EOL);
|
||||
$this->logger->error("Error al obtener el Customer ID de Stripe (Error {$e->getCode()}): " . $e->getMessage() . PHP_EOL);
|
||||
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
|
||||
$arrayOxxoPayment['oxxo_reference'] = '';
|
||||
$arrayOxxoPayment['url'] = '';
|
||||
$arrayOxxoPayment['error'] = 'errorCreatePaymentIntent';
|
||||
$arrayOxxoPayment['failDescription'] = 'Error inesperado al crear PaymentIntent: ' . $clientID;
|
||||
$arrayOxxoPayment['error'] = 'errorGetCustomerStripe';
|
||||
$arrayOxxoPayment['failDescription'] = 'Error al obtener el Customer ID de Stripe: ' . $clientID;
|
||||
$arrayOxxoPayment['clientID'] = $clientID;
|
||||
$arrayOxxoPayment['amount'] = $amount;
|
||||
$arrayOxxoPayment['clientFullName'] = $clientFullName;
|
||||
$arrayOxxoPayment['amount'] = $integerAmount;
|
||||
return $arrayOxxoPayment;
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
$firstName = isset($arrayClientCRM['firstName']) ? trim($arrayClientCRM['firstName']) : '';
|
||||
$lastName = isset($arrayClientCRM['lastName']) ? trim($arrayClientCRM['lastName']) : '';
|
||||
|
||||
if (strlen($firstName) < 2 || strlen($lastName) < 2) {
|
||||
$this->logger->error("Nombre/apellido inválido: ' . $firstName . ' ' . $lastName" . PHP_EOL);
|
||||
|
||||
if ($amount === null) {
|
||||
$amount = abs($arrayClientCRM['accountOutstanding']);
|
||||
} else {
|
||||
$this->logger->info("Monto proporcionado directamente: $amount " . PHP_EOL);
|
||||
}
|
||||
|
||||
if ($amount > 10) {
|
||||
$amount = intval($amount * 100);
|
||||
|
||||
try {
|
||||
$this->logger->info("Creando referencia en Stripe por $amount para el cliente $stripeCustomerId" . PHP_EOL);
|
||||
$guzzleClient = new Client([
|
||||
'timeout' => 5,
|
||||
]);
|
||||
|
||||
$response = $guzzleClient->post('https://api.stripe.com/v1/payment_intents', [
|
||||
'auth' => [$StripeToken, ''],
|
||||
'form_params' => [
|
||||
'amount' => $amount,
|
||||
'currency' => 'mxn',
|
||||
'payment_method_types' => ['customer_balance', 'card', 'oxxo'],
|
||||
'description' => 'Pago de servicio de SIIP Internet',
|
||||
'customer' => $stripeCustomerId,
|
||||
'metadata' => [
|
||||
'clientId' => $clientID,
|
||||
'createdBy' => 'UCRM',
|
||||
'paymentType' => 'card.one_time',
|
||||
'signedInAdminId' => $currentUserAdmin[1]['id'],
|
||||
'tipoPago' => 'OXXO',
|
||||
],
|
||||
'payment_method_options' => [
|
||||
'oxxo' => [
|
||||
'expires_after_days' => 3,
|
||||
],
|
||||
],
|
||||
]
|
||||
]);
|
||||
|
||||
$paymentIntent = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
} catch (\Stripe\Exception\ApiConnectionException $e) {
|
||||
$this->logger->error("Error de conexión con Stripe (Error {$e->getCode()}): " . $e->getMessage() . PHP_EOL);
|
||||
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
|
||||
$arrayOxxoPayment['oxxo_reference'] = '';
|
||||
$arrayOxxoPayment['url'] = '';
|
||||
$arrayOxxoPayment['error'] = 'errorNombreApellidoInvalido';
|
||||
$arrayOxxoPayment['failDescription'] = "Nombre/apellido inválido: ' . $firstName . ' ' . $lastName";
|
||||
$arrayOxxoPayment['error'] = 'errorConnectionStripe';
|
||||
$arrayOxxoPayment['failDescription'] = 'Error de conexión con Stripe: ' . $clientID;
|
||||
$arrayOxxoPayment['clientID'] = $clientID;
|
||||
$arrayOxxoPayment['clientFullName'] = $clientFullName;
|
||||
$arrayOxxoPayment['amount'] = $amount;
|
||||
$arrayOxxoPayment['amount'] = $integerAmount;
|
||||
return $arrayOxxoPayment;
|
||||
|
||||
|
||||
} catch (\Stripe\Exception\ApiErrorException $e) {
|
||||
$this->logger->error("Error de la API de Stripe: " . $e->getMessage() . PHP_EOL);
|
||||
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
|
||||
$arrayOxxoPayment['oxxo_reference'] = '';
|
||||
$arrayOxxoPayment['url'] = '';
|
||||
$arrayOxxoPayment['error'] = 'errorApiStripe';
|
||||
$arrayOxxoPayment['failDescription'] = 'Error de la API de Stripe: ' . $clientID;
|
||||
$arrayOxxoPayment['clientID'] = $clientID;
|
||||
$arrayOxxoPayment['clientFullName'] = $clientFullName;
|
||||
$arrayOxxoPayment['amount'] = $integerAmount;
|
||||
return $arrayOxxoPayment;
|
||||
|
||||
} catch (Exception $e) {
|
||||
$this->logger->error("Error inesperado al crear PaymentIntent (Error {$e->getCode()}): " . $e->getMessage() . PHP_EOL);
|
||||
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
|
||||
$arrayOxxoPayment['oxxo_reference'] = '';
|
||||
$arrayOxxoPayment['url'] = '';
|
||||
$arrayOxxoPayment['error'] = 'errorCreatePaymentIntent';
|
||||
$arrayOxxoPayment['failDescription'] = 'Error inesperado al crear PaymentIntent: ' . $clientID;
|
||||
$arrayOxxoPayment['clientID'] = $clientID;
|
||||
$arrayOxxoPayment['amount'] = $integerAmount;
|
||||
$arrayOxxoPayment['clientFullName'] = $clientFullName;
|
||||
return $arrayOxxoPayment;
|
||||
|
||||
}
|
||||
|
||||
$responsePaymentMethod = $guzzleClient->post('https://api.stripe.com/v1/payment_methods', [
|
||||
'auth' => [$StripeToken, ''],
|
||||
'form_params' => [
|
||||
'type' => 'oxxo',
|
||||
'billing_details' => [
|
||||
'name' => "$firstName $lastName",
|
||||
'email' => $clientEmail,
|
||||
],
|
||||
]
|
||||
]);
|
||||
|
||||
$paymentMethod = json_decode($responsePaymentMethod->getBody()->getContents(), true);
|
||||
|
||||
$responseConfirmPaymentIntent = $guzzleClient->post('https://api.stripe.com/v1/payment_intents/' . $paymentIntent['id'] . '/confirm', [
|
||||
'auth' => [$StripeToken, ''],
|
||||
'form_params' => [
|
||||
'payment_method' => $paymentMethod['id'],
|
||||
]
|
||||
]);
|
||||
|
||||
$paymentIntentConfirm = json_decode($responseConfirmPaymentIntent->getBody()->getContents(), true);
|
||||
|
||||
} catch (Exception $e) {
|
||||
$this->logger->error("Error al confirmar PaymentIntent: " . $e->getMessage() . PHP_EOL);
|
||||
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
|
||||
$arrayOxxoPayment['oxxo_reference'] = '';
|
||||
$arrayOxxoPayment['url'] = '';
|
||||
$arrayOxxoPayment['error'] = 'errorConfirmPaymentIntent';
|
||||
$arrayOxxoPayment['failDescription'] = 'Error al confirmar PaymentIntent: ' . $e->getMessage();
|
||||
$arrayOxxoPayment['clientID'] = $clientID;
|
||||
$arrayOxxoPayment['clientFullName'] = $clientFullName;
|
||||
$arrayOxxoPayment['amount'] = $amount;
|
||||
return $arrayOxxoPayment;
|
||||
}
|
||||
|
||||
if (!empty($paymentIntentConfirm['next_action']) && isset($paymentIntentConfirm['next_action']['oxxo_display_details'])) {
|
||||
$oxxoPayment = $paymentIntentConfirm['next_action']['oxxo_display_details'];
|
||||
$oxxo_reference = $oxxoPayment['number'];
|
||||
$oxxo_receipt_url = $oxxoPayment['hosted_voucher_url'];
|
||||
|
||||
$this->logger->info("Referencia OXXO: " . $oxxo_reference . PHP_EOL);
|
||||
$this->logger->info("URL del recibo: " . $oxxo_receipt_url . PHP_EOL);
|
||||
//devolver un array con los campos de url de oxxo, descripción de la falla, clientID y amount
|
||||
$arrayOxxoPayment['oxxo_reference'] = $oxxo_reference;
|
||||
$arrayOxxoPayment['url'] = $oxxo_receipt_url;
|
||||
$arrayOxxoPayment['clientID'] = $clientID;
|
||||
$arrayOxxoPayment['clientFullName'] = $clientFullName;
|
||||
$arrayOxxoPayment['amount'] = $amount;
|
||||
$arrayOxxoPayment['failDescription'] = '';
|
||||
$arrayOxxoPayment['error'] = '';
|
||||
$this->logger->info("Referencia OXXO creada correctamente." . PHP_EOL);
|
||||
return $arrayOxxoPayment;
|
||||
|
||||
try {
|
||||
$firstName = isset($arrayClientCRM['firstName']) ? trim($arrayClientCRM['firstName']) : '';
|
||||
$lastName = isset($arrayClientCRM['lastName']) ? trim($arrayClientCRM['lastName']) : '';
|
||||
|
||||
if (strlen($firstName) < 2 || strlen($lastName) < 2) {
|
||||
$this->logger->error("Nombre/apellido inválido: ' . $firstName . ' ' . $lastName" . PHP_EOL);
|
||||
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
|
||||
$arrayOxxoPayment['oxxo_reference'] = '';
|
||||
$arrayOxxoPayment['url'] = '';
|
||||
$arrayOxxoPayment['error'] = 'errorNombreApellidoInvalido';
|
||||
$arrayOxxoPayment['failDescription'] = "Nombre/apellido inválido: ' . $firstName . ' ' . $lastName";
|
||||
$arrayOxxoPayment['clientID'] = $clientID;
|
||||
$arrayOxxoPayment['clientFullName'] = $clientFullName;
|
||||
$arrayOxxoPayment['amount'] = $integerAmount;
|
||||
return $arrayOxxoPayment;
|
||||
|
||||
}
|
||||
|
||||
$responsePaymentMethod = $guzzleClient->post('https://api.stripe.com/v1/payment_methods', [
|
||||
'auth' => [$StripeToken, ''],
|
||||
'form_params' => [
|
||||
'type' => 'oxxo',
|
||||
'billing_details' => [
|
||||
'name' => "$firstName $lastName",
|
||||
'email' => $clientEmail,
|
||||
],
|
||||
]
|
||||
]);
|
||||
|
||||
$paymentMethod = json_decode($responsePaymentMethod->getBody()->getContents(), true);
|
||||
|
||||
$responseConfirmPaymentIntent = $guzzleClient->post('https://api.stripe.com/v1/payment_intents/' . $paymentIntent['id'] . '/confirm', [
|
||||
'auth' => [$StripeToken, ''],
|
||||
'form_params' => [
|
||||
'payment_method' => $paymentMethod['id'],
|
||||
]
|
||||
]);
|
||||
|
||||
$paymentIntentConfirm = json_decode($responseConfirmPaymentIntent->getBody()->getContents(), true);
|
||||
|
||||
} catch (Exception $e) {
|
||||
$this->logger->error("Error al confirmar PaymentIntent: " . $e->getMessage() . PHP_EOL);
|
||||
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
|
||||
$arrayOxxoPayment['oxxo_reference'] = '';
|
||||
$arrayOxxoPayment['url'] = '';
|
||||
$arrayOxxoPayment['error'] = 'errorConfirmPaymentIntent';
|
||||
$arrayOxxoPayment['failDescription'] = 'Error al confirmar PaymentIntent: ' . $e->getMessage();
|
||||
$arrayOxxoPayment['clientID'] = $clientID;
|
||||
$arrayOxxoPayment['clientFullName'] = $clientFullName;
|
||||
$arrayOxxoPayment['amount'] = $integerAmount;
|
||||
return $arrayOxxoPayment;
|
||||
}
|
||||
|
||||
if (!empty($paymentIntentConfirm['next_action']) && isset($paymentIntentConfirm['next_action']['oxxo_display_details'])) {
|
||||
$oxxoPayment = $paymentIntentConfirm['next_action']['oxxo_display_details'];
|
||||
$oxxo_reference = $oxxoPayment['number'];
|
||||
$oxxo_receipt_url = $oxxoPayment['hosted_voucher_url'];
|
||||
|
||||
$this->logger->info("Referencia OXXO: " . $oxxo_reference . PHP_EOL);
|
||||
$this->logger->info("URL del recibo: " . $oxxo_receipt_url . PHP_EOL);
|
||||
//devolver un array con los campos de url de oxxo, descripción de la falla, clientID y amount
|
||||
$arrayOxxoPayment['oxxo_reference'] = $oxxo_reference;
|
||||
$arrayOxxoPayment['url'] = $oxxo_receipt_url;
|
||||
$arrayOxxoPayment['clientID'] = $clientID;
|
||||
$arrayOxxoPayment['clientFullName'] = $clientFullName;
|
||||
$arrayOxxoPayment['amount'] = $integerAmount;
|
||||
$arrayOxxoPayment['failDescription'] = '';
|
||||
$arrayOxxoPayment['error'] = '';
|
||||
$this->logger->info("Referencia OXXO creada correctamente." . PHP_EOL);
|
||||
return $arrayOxxoPayment;
|
||||
} else {
|
||||
$this->logger->info("El PaymentIntent no tiene detalles de OXXO disponibles. Estado: " . $paymentIntentConfirm['status'] . PHP_EOL);
|
||||
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
|
||||
$arrayOxxoPayment['oxxo_reference'] = '';
|
||||
$arrayOxxoPayment['url'] = '';
|
||||
$arrayOxxoPayment['error'] = 'errorPaymentIntentWithoutOxxoDetails';
|
||||
$arrayOxxoPayment['failDescription'] = 'El PaymentIntent no tiene detalles de OXXO disponibles. Estado: ' . $paymentIntentConfirm['status'];
|
||||
$arrayOxxoPayment['clientID'] = $clientID;
|
||||
$arrayOxxoPayment['clientFullName'] = $clientFullName;
|
||||
$arrayOxxoPayment['amount'] = $integerAmount;
|
||||
return $arrayOxxoPayment;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->logger->info("El PaymentIntent no tiene detalles de OXXO disponibles. Estado: " . $paymentIntentConfirm['status'] . PHP_EOL);
|
||||
$this->logger->info("Este cliente no tiene adeudos." . PHP_EOL);
|
||||
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
|
||||
$arrayOxxoPayment['oxxo_reference'] = '';
|
||||
$arrayOxxoPayment['url'] = '';
|
||||
$arrayOxxoPayment['error'] = 'errorPaymentIntentWithoutOxxoDetails';
|
||||
$arrayOxxoPayment['failDescription'] = 'El PaymentIntent no tiene detalles de OXXO disponibles. Estado: ' . $paymentIntentConfirm['status'];
|
||||
$arrayOxxoPayment['error'] = 'errorsinadeudo';
|
||||
$arrayOxxoPayment['failDescription'] = 'Este cliente no tiene adeudos.';
|
||||
$arrayOxxoPayment['clientID'] = $clientID;
|
||||
$arrayOxxoPayment['clientFullName'] = $clientFullName;
|
||||
$arrayOxxoPayment['amount'] = $amount;
|
||||
$arrayOxxoPayment['amount'] = $integerAmount;
|
||||
return $arrayOxxoPayment;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->logger->info("Este cliente no tiene adeudos." . PHP_EOL);
|
||||
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
|
||||
$arrayOxxoPayment['oxxo_reference'] = '';
|
||||
$arrayOxxoPayment['url'] = '';
|
||||
$arrayOxxoPayment['error'] = 'errorsinadeudo';
|
||||
$arrayOxxoPayment['failDescription'] = 'Este cliente no tiene adeudos.';
|
||||
$arrayOxxoPayment['clientID'] = $clientID;
|
||||
$arrayOxxoPayment['clientFullName'] = $clientFullName;
|
||||
$arrayOxxoPayment['amount'] = $amount;
|
||||
return $arrayOxxoPayment;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
4
vendor/composer/installed.php
vendored
4
vendor/composer/installed.php
vendored
@ -5,7 +5,7 @@
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'reference' => '2819804ad8010155a47b3c266d2745e531d79f68',
|
||||
'reference' => '59aac17968cf6f8bb03edcd81c8c25877a11c8cc',
|
||||
'name' => 'ucrm-plugins/sms-twilio',
|
||||
'dev' => false,
|
||||
),
|
||||
@ -307,7 +307,7 @@
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'reference' => '2819804ad8010155a47b3c266d2745e531d79f68',
|
||||
'reference' => '59aac17968cf6f8bb03edcd81c8c25877a11c8cc',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user