Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validateCreditCard No method matching arguments.. #5

Closed
sahanh opened this issue Aug 19, 2014 · 3 comments
Closed

validateCreditCard No method matching arguments.. #5

sahanh opened this issue Aug 19, 2014 · 3 comments
Assignees
Labels

Comments

@sahanh
Copy link

sahanh commented Aug 19, 2014

Looks like it's an issue from APIs end, I'm getting the same error from IO docs simulator.

No method matching arguments: java.lang.String, java.lang.String, java.lang.Integer, java.lang.String, java.lang.String, java.lang.String, java.lang.String

http://d.pr/i/w9Fv

$infusionsoft->invoices->validateCreditCard('Visa', $cid, 'xxxxxxxxxxxxxxxx', '10', '2015', 'xxx');`

gives

Uncaught exception 'Infusionsoft\InfusionsoftException' with message 'No method matching arguments: java.lang.String, java.lang.Integer, java.lang.String, java.lang.String, java.lang.String, java.lang.String' in /Applications/MAMP/htdocs/infusion_sdk/vendor/infusionsoft/php-sdk/src/Infusionsoft/Infusionsoft.php:359

@sahanh sahanh changed the title validateCreditCard No method matching arguments: java.lang.String, java.lang.String, java.lang.Integer, java.lang.String, java.lang.String, java.lang.String, java.lang.String validateCreditCard No method matching arguments.. Aug 19, 2014
@mfairch mfairch added the bug label Aug 19, 2014
@mfairch
Copy link
Contributor

mfairch commented Aug 19, 2014

The sdk is not generating the XML properly.

This is the way the sdk generates the XML currently.

<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
    <methodName>InvoiceService.validateCreditCard</methodName>
    <params>
        <param>
            <value>
                <string></string>
            </value>
        </param>
        <param>
            <value>
                <string>Visa</string>
            </value>
        </param>
        <param>
            <value>
                <int>60</int>
            </value>
        </param>
        <param>
            <value>
                <string>xxxxxxxxxxxxxxxx</string>
            </value>
        </param>
        <param>
            <value>
                <string>10</string>
            </value>
        </param>
        <param>
            <value>
                <string>2016</string>
            </value>
        </param>
        <param>
            <value>
                <string>123</string>
            </value>
        </param>
    </params>
</methodCall>

This is how the XML should be generated.

<?xml version="1.0"?>
<methodCall>
<methodName>InvoiceService.validateCreditCard</methodName>
<params>
<param>
<value><string></string></value>
</param>
<param>
<value><struct>
<member><name>CardType</name>
<value><string>MasterCard</string></value>
</member>
<member><name>ContactId</name>
<value><int>12</int></value>
</member>
<member><name>CardNumber</name>
<value><string>xxxxxxxxxxxxxxxx</string></value>
</member>
<member><name>ExpirationMonth</name>
<value><string>12</string></value>
</member>
<member><name>ExpirationYear</name>
<value><string>2016</string></value>
</member>
<member><name>CVV2</name>
<value><string>123</string></value>
</member>
</struct></value>
</param>
</params>
</methodCall>

@mfairch
Copy link
Contributor

mfairch commented Aug 19, 2014

@sahanh If you need a quick workaround to get this working, you can replace the ValidateCrediatCard fucntion with following in the Infusionsoft/API/InvoiceService.php file

    public function validateCreditCard($CardType, $contactId, $CardNumber, $ExpirationMonth, $ExpirationYear, $CVV2)
    {
        $data = array(
            'CardType' => $CardType,
            'ContactId' => $contactId,
            'CardNumber' => $CardNumber,
            'ExpirationMonth' => $ExpirationMonth,
            'ExpirationYear' => $ExpirationYear,
            'CVV2' => $CVV2
        );
        return $this->client->request($this->method(), $data);
    }

@andrewryno
Copy link
Contributor

This is fixed. The docs are also slightly misleading where it puts the parameters on the same level as the privateKey parameter, even though the second parameter should be a struct (sample request is correct). We should update those docs as well. See: https://developer.infusionsoft.com/docs/read/Invoice_Service#validateCreditCard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants