Need a webhook that returns data to a controller with post data of type
Message
The issue is that if you try to get data via the JInput, the data is not there..
also the deprecated:
$post = JRequest::get('post');
is not bringing any data...
Instead you need to use:
$postdata = file_get_contents("php://input");
Which i feel is pretty unsafe..for joomla standards in order to use!
the url that returns that explains the webhook is here:
https://github.com/VivaPayments/API/wiki/Webhooks
the actual post data to be inside JINPUT....
the above function with file_get_contents gets the following data:
stdClass Object
(
[Url] => https://www.keeppet.gr/develop/index.php?option=com_keeppet&task=api.receiveVivaWebHook
[EventData] => stdClass Object
(
[Email] => chrisvalmas@gmail.com
[ParentId] =>
[Amount] => 340
[ClientId] =>
[MerchantId] => a488534f-b418-4a01-8031-7499f784ee1a
[OrderCode] => 334178772608
[ProductId] =>
[StatusId] => F
[FullName] => dasdas
[Statement] =>
[ResellerId] =>
[InsDate] => 2015-08-28T17:07:15.33
[TotalFee] => 0
[CardNumber] => 411111XXXXXX1111
[SourceCode] => Default
[CompanyName] => 6978999659
[TransactionId] => f6f18164-5e62-44e7-9fda-892ce1a771ad
[CurrencyCode] => 978
[OrderCulture] => el-GR
[MerchantTrns] => b1
[CustomerTrns] => dasddasdsa
[IsManualRefund] =>
[TargetPersonId] =>
[TransactionTypeId] => 5
[TotalInstallments] => 0
[TotalCommission] => 8.4
[CurrentInstallment] => 0
[ResellerSourceCode] =>
[ResellerSourceName] =>
[ResellerCompanyName] =>
[ResellerSourceAddress] =>
[CardTypeId] => 0
[AssignedMerchantUsers] => Array
(
)
[AssignedResellerUsers] => Array
(
)
)
[Created] => 2015-08-28T14:07:15.4848312Z
[EventTypeId] => 1796
[MessageId] => d3bd60c1-5760-4ecd-b4c6-3b6dc6a589c5
[RecipientId] => a488534f-b418-4a01-8031-7499f784ee1a
[MessageTypeId] => 512
)
no data in jinput:
JInput Object
(
[options:protected] => Array
(
)
[filter:protected] => JFilterInput Object
(
[tagsArray] => Array
(
)
[attrArray] => Array
(
)
[tagsMethod] => 0
[attrMethod] => 0
[xssAuto] => 1
[tagBlacklist] => Array
(
[0] => applet
[1] => body
[2] => bgsound
[3] => base
[4] => basefont
[5] => embed
[6] => frame
[7] => frameset
[8] => head
[9] => html
[10] => id
[11] => iframe
[12] => ilayer
[13] => layer
[14] => link
[15] => meta
[16] => name
[17] => object
[18] => script
[19] => style
[20] => title
[21] => xml
)
[attrBlacklist] => Array
(
[0] => action
[1] => background
[2] => codebase
[3] => dynsrc
[4] => lowsrc
)
)
[data:protected] => Array
(
[option] => com_keeppet
[task] => receiveVivaWebHook
[Itemid] =>
)
[inputs:protected] => Array
(
[cookie] => JInputCookie Object
(
[options:protected] => Array
(
)
[filter:protected] => JFilterInput Object
(
[tagsArray] => Array
(
)
[attrArray] => Array
(
)
[tagsMethod] => 0
[attrMethod] => 0
[xssAuto] => 1
[tagBlacklist] => Array
(
[0] => applet
[1] => body
[2] => bgsound
[3] => base
[4] => basefont
[5] => embed
[6] => frame
[7] => frameset
[8] => head
[9] => html
[10] => id
[11] => iframe
[12] => ilayer
[13] => layer
[14] => link
[15] => meta
[16] => name
[17] => object
[18] => script
[19] => style
[20] => title
[21] => xml
)
[attrBlacklist] => Array
(
[0] => action
[1] => background
[2] => codebase
[3] => dynsrc
[4] => lowsrc
)
)
[data:protected] => Array
(
)
[inputs:protected] => Array
(
)
)
[get] => JInput Object
(
[options:protected] => Array
(
)
[filter:protected] => JFilterInput Object
(
[tagsArray] => Array
(
)
[attrArray] => Array
(
)
[tagsMethod] => 0
[attrMethod] => 0
[xssAuto] => 1
[tagBlacklist] => Array
(
[0] => applet
[1] => body
[2] => bgsound
[3] => base
[4] => basefont
[5] => embed
[6] => frame
[7] => frameset
[8] => head
[9] => html
[10] => id
[11] => iframe
[12] => ilayer
[13] => layer
[14] => link
[15] => meta
[16] => name
[17] => object
[18] => script
[19] => style
[20] => title
[21] => xml
)
[attrBlacklist] => Array
(
[0] => action
[1] => background
[2] => codebase
[3] => dynsrc
[4] => lowsrc
)
)
[data:protected] => Array
(
[option] => com_keeppet
[task] => api.receiveVivaWebHook
)
[inputs:protected] => Array
(
)
)
[post] => JInput Object
(
[options:protected] => Array
(
)
[filter:protected] => JFilterInput Object
(
[tagsArray] => Array
(
)
[attrArray] => Array
(
)
[tagsMethod] => 0
[attrMethod] => 0
[xssAuto] => 1
[tagBlacklist] => Array
(
[0] => applet
[1] => body
[2] => bgsound
[3] => base
[4] => basefont
[5] => embed
[6] => frame
[7] => frameset
[8] => head
[9] => html
[10] => id
[11] => iframe
[12] => ilayer
[13] => layer
[14] => link
[15] => meta
[16] => name
[17] => object
[18] => script
[19] => style
[20] => title
[21] => xml
)
[attrBlacklist] => Array
(
[0] => action
[1] => background
[2] => codebase
[3] => dynsrc
[4] => lowsrc
)
)
[data:protected] => Array
(
)
[inputs:protected] => Array
(
)
)
[files] => JInputFiles Object
(
[decodedData:protected] => Array
(
)
[options:protected] => Array
(
)
[filter:protected] => JFilterInput Object
(
[tagsArray] => Array
(
)
[attrArray] => Array
(
)
[tagsMethod] => 0
[attrMethod] => 0
[xssAuto] => 1
[tagBlacklist] => Array
(
[0] => applet
[1] => body
[2] => bgsound
[3] => base
[4] => basefont
[5] => embed
[6] => frame
[7] => frameset
[8] => head
[9] => html
[10] => id
[11] => iframe
[12] => ilayer
[13] => layer
[14] => link
[15] => meta
[16] => name
[17] => object
[18] => script
[19] => style
[20] => title
[21] => xml
)
[attrBlacklist] => Array
(
[0] => action
[1] => background
[2] => codebase
[3] => dynsrc
[4] => lowsrc
)
)
[data:protected] => Array
(
)
[inputs:protected] => Array
(
)
)
)
Joomla 3.4.3 hosted on Bluehost PHP 5.4
I can help in reproduce and check any code suggestions for this in my custom component as it's rather complicated to build up a test environmen!
thanks!
worked like a charm!
cann close tracker :)
2015-08-28 18:06 GMT+03:00 Michael Babker notifications@github.com:
Using JInput you can access $input->json->get('whatever'). The json in
there loads up a JInputJson
https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/input/json.php
object that will let you pull that data through the API.—
Reply to this email directly or view it on GitHub
#7781 (comment).
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-08-28 15:36:17 |
Closed_By | ⇒ | brianteeman |
Using JInput you can access
$input->json->get('whatever')
. Thejson
in there loads up a JInputJson object that will let you pull that data through the API.