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

FOP_CreateFormOfPayment error: SOAP-ERROR: Encoding: object has no 'attributeType' property" #163

Closed
aosand opened this issue Mar 22, 2018 · 10 comments

Comments

@aosand
Copy link

aosand commented Mar 22, 2018

Hi,
I'm getting SOAP-ERROR when I try to add a credit car information to create an FP.
I just try using one of the examples in this page, and get the same error. I am wondering if this has something to do with the service version, I have in our WSDL Version 11.1.1A.
This is part of our code:

        $options = new FopCreateFopOptions([
            'transactionCode' => FopCreateFopOptions::TRANS_CREATE_FORM_OF_PAYMENT,
            'fopGroup' => [
                new Group([
                    'elementRef' => [
                        new ElementRef([
                            'type' => ElementRef::TYPE_TST_NUMBER,
                            'value' => $tst['id']
                        ])
                    ],
                    'mopInfo' => [
                        new MopInfo([
                            'sequenceNr' => $secuence++,
                            'fopCode' => 'CC' . $this->_AmadeusCards[$payment->card_brand],
                            'fopType' => MopInfo::FOPTYPE_FP_ELEMENT,
                            'payMerchant' => $tst['validatingCarrier'],
                            'payments' => [
                                new Payment([
                                    'type' => Payment::TYPE_TOTAL_FARE_AMOUNT,
                                    'amount' => $payment->amount,
                                    'currency' => $tst['currency']
                                ])
                            ],
                            'mopPaymentType' => MopInfo::MOP_PAY_TYPE_CREDIT_CARD,
                            'creditCardInfo' => new CreditCardInfo([
                                'vendorCode' => $this->_AmadeusCards[$payment->card_brand],
                                'cardNumber' => $payment->cc_number,
                                'expiryDate' => $payment->cc_exp,
                                'securityId' => $payment->cc_cvc,
                                'approvalCode' => $payment->authorization,
                                'sourceOfApproval' => CreditCardInfo::APPROVAL_SOURCE_MANUAL,
                                'name' => $payment->titular
                            ])
                        ])
                    ]
                ])
            ]
        ]);
        $fopResponse = $client->fopCreateFormOfPayment($options);

Thank you for your help

Ariel

@DerMika
Copy link
Collaborator

DerMika commented Mar 22, 2018

Can you get me the logfile of the entire request XML that is being sent?

Please see https://github.com/amabnl/amadeus-ws-client/blob/master/docs/how-to.rst#logging-request-and-response

@aosand
Copy link
Author

aosand commented Mar 23, 2018

I've attached the log file.
But the request is empty because the error is generated, I assumed when the XML is generated. I'm trying my self to debug it too.
amadeusServices.log

@DerMika
Copy link
Collaborator

DerMika commented Mar 23, 2018

I can't see it right now, but there's probably a difference in the message version 11.1 (which you have in your WSDL) versus the 15.4 version I've used to implement the message.

@DerMika
Copy link
Collaborator

DerMika commented Mar 23, 2018

I think I may have found it.

In version 15.4, the XML node
FOP_CreateFormOfPayment/fopGroup/mopDescription/paymentModule/groupUsage/attributeDetails is defined as a sequence of up to 99 nodes, while in version 11.1 it's defined as one single node.

Maybe you can temporarily try to hack the file /src/Amadeus/Client/Struct/Fop/GroupUsage like this:

class GroupUsage
{
    /**
     * @var AttributeDetails
     */
    public $attributeDetails;

    /**
     * GroupUsage constructor.
     *
     * @param string $fopType AttributeDetails::TYPE_*
     */
    public function __construct($fopType)
    {
        $this->attributeDetails = new AttributeDetails($fopType);
    }
}

And after you do that, try to make the call again.

If that fixes the problem, let me know here, and I'll make a fix to support both formats depending on the message version.

@aosand
Copy link
Author

aosand commented Mar 23, 2018

Ok, the hack worked, but now I get this message:
"code": "18",
"text": "Fusion DSC found an exception !\n\tMissing Mandatory tag :\n\tExpected element: dummy\n\tCurrent position in buffer: ns1:creditCardData<ns1:credi\n\tLast 15 characters before error: fopInformation>\n\tCurrent path in the grammar : /mopInformation#1/paymentModule#1/mopDescription#2/fopGroup#1",
"level": "Presentation"

amadeusServices.log

@DerMika
Copy link
Collaborator

DerMika commented Mar 23, 2018

Did you update to version 1.6.1 of the library? I recently fixed that issue.

@aosand
Copy link
Author

aosand commented Mar 23, 2018

Oh, My bad, I've updated and run again and it work perfectly.
Thank you so much for your help

@aosand aosand closed this as completed Mar 25, 2018
@DerMika
Copy link
Collaborator

DerMika commented Mar 25, 2018

I'm going to keep this issue open as I want it to work with version 11.1 without having to hack that file. I'll close it when I've pushed that fix.

@DerMika
Copy link
Collaborator

DerMika commented Mar 31, 2018

Pushed a fix to the master branch to support FOP_CreateFormOfPayment versions 14 and below.

You can test it by pointing your composer.json to dev-master and doing a composer update.

You should now be able to call this message using your 11.1 version without having to manually edit any files.

Will be released with version 1.7.0.

@DerMika DerMika closed this as completed Mar 31, 2018
@DerMika DerMika added this to the 1.7.0 milestone Mar 31, 2018
@DerMika
Copy link
Collaborator

DerMika commented Apr 30, 2018

Version 1.7.0 has just been released!

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

No branches or pull requests

2 participants