cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Accept js in Angular 2

Hello,

 

Im new on the Usage of the Accept js library.

 

Im trying to integrate with my Angular 2 project. 

 

Im trying to call the dispatch data funtion:

 

 

Accept.dispatchData(secureData, this.responseHandler);

 responseHandler(response: any) {
        if (response.messages.resultCode === "Error") {
            var i = 0;
            while (i < response.messages.message.length) {
                //paymentError(response.messages.message[i].text);
                console.log(response.messages.message[i].text);
                i = i + 1;
            }
        } else {
            //paymentNewUser(response.opaqueData, infoData);
        }
    }

But I get this error:

 

 

ERROR TypeError: a[c].match is not a function
at h (AcceptCore.js:1)
at b (AcceptCore.js:1)
at Object.function.a.dispatchData.a.dispatchData (AcceptCore.js:1)
at t.sendPaymentDataToAnet (payment-modal.component.ts:92)
at Object.eval [as handleEvent] (t.html:92)
at _ (core.js:13254)
at li (core.js:14739)
at Object.Zr [as handleEvent] (core.js:14326)
at he (core.js:9703)
at core.js:10317

 

Can any one help me with this? Can be the responseHandler function that is causing that issue?

 

 

Thanks!

 

 

 

 

mtarantooms01
Contributor
1 ACCEPTED SOLUTION

Accepted Solutions

Now is working I figure out. The problem was that I was sending the cardData with month and year as number instead of string.

View solution in original post

mtarantooms01
Contributor
6 REPLIES 6

Now is working I figure out. The problem was that I was sending the cardData with month and year as number instead of string.

mtarantooms01
Contributor

How you inject accept.js file in your angular 2. I am facing problem to inject accept.js

 

How you inject accept.js library in your angular 2. i am facing problem to inject this liberary

How you inject accept.js library in your angular 2. I am facing problem to inject accept.js library in my angular 5 .

    How you inject accept.js library in your angular 2. I am facing problem to inject accept.js library in my angular 5 .

Hi Just imported on the index. 

 

 <script src="https://jstest.authorize.net/v1/Accept.js" charset="utf-8"></script>

 

And the declare the global vaiable on the component. 

 


declare var Accept: any;

 

@Component({
selector: 'payment',
 ...
})
export class PaymentComponent implements OnInit {

 

....

 

 

mtarantooms01
Contributor