Open DaveyCornelissen opened 3 years ago
Hi @DaveyCornelissen We're looking into it Max
Hey guy's, Do you have any update on the related problem?
Thanks! Davey Cornelissen
Hi!!!
I'm in the same situation !! Any update ?
Thx
Hi @DaveyCornelissen, @anthonytison Sorry for the late response. We ran our internal tests but couldn't figure out what your problem is. Can you provide more details about this issue? How does your payin object look like?
Take a look here for the examples, maybe it helps you.
Mircea
Hi @SoloJr ,
Thank you for responding. The code you share is quite similar to mine however on my side it doesn't work.
I'm on the version : mangopay2-nodejs-sdk@1.15.0
Here's my code
public async cardDirectPayin(userId, cardId, app){ return await this.api.PayIns.create({ CreditedWalletId: app.walletTo, AuthorId: userId, DebitedFunds: new this.api.models.Money({ Currency: "EUR", Amount: app.amount }), Fees: new this.api.models.Money({ Currency: "EUR", Amount: 0 }), CardId: cardId, SecureModeReturnURL: `${process.env.FRONT_URL}/payment-redirect`, PaymentType: 'CARD', ExecutionType: 'DIRECT', Tag: 'Direct payment via web app' }) }
And this is the warning (which turns into an error when building the app) i have when i try to set PaymentType: 'CARD'
(property) MangoPay.payIn.CreateCardDirectPayIn.PaymentType: "CARD" No overload matches this call. The last overload gave the following error. Type '"CARD"' is not assignable to type '"BANK_WIRE"'.ts(2769) index.d.ts(2846, 7): The expected type comes from property 'PaymentType' which is declared here on type 'CreateBankWireDirectPayIn' index.d.ts(128, 5): The last overload is declared here.
I hope it will help you understanding where the issue could come from.
Hi, any update on this issue ? I'm having the same thing here, even when trying to copy-paste exactly the example.
const payIn = {
CreditedWalletId: walletID,
AuthorId: userID,
DebitedFunds: {
Amount: 1000,
Currency: 'EUR'
},
Fees: {
Amount: 0,
Currency: 'EUR'
},
CardId: cardID,
SecureModeReturnURL: 'http://test.com',
PaymentType: 'CARD',
ExecutionType: 'DIRECT',
Billing: {
FirstName: "John",
LastName: "Doe",
Address: {
"AddressLine1": "4101 Reservoir Rd NW",
"AddressLine2": "",
"City": "Washington",
"Region": "District of Columbia",
"PostalCode": "68400",
"Country": "US"
}
}
};
api.PayIns.create(payIn).then((cardDirectPayInData) => {
response.send(`Card direct pay in data = ${cardDirectPayInData.body.Status.toString}`);
});
I only replaced the IDs with mine. This gives me the error:
src/payment/index.ts:153:27 - error TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type '{ CreditedWalletId: string; AuthorId: any; DebitedFunds: { Amount: number; Currency: string; }; Fees: { Amount: number; Currency: string; }; CardId: any; SecureModeReturnURL: string; PaymentType: string; ExecutionType: string; Billing: { ...; }; }' is not assignable to parameter of type 'CreateBankWireDirectPayIn'.
Type '{ CreditedWalletId: string; AuthorId: any; DebitedFunds: { Amount: number; Currency: string; }; Fees: { Amount: number; Currency: string; }; CardId: any; SecureModeReturnURL: string; PaymentType: string; ExecutionType: string; Billing: { ...; }; }' is missing the following properties from type 'CreateBankWireDirectPayIn': CreditedUserId, DeclaredDebitedFunds, DeclaredFees
If I try to add CreditedUserId
, DeclaredDebitedFunds
and DeclaredFees
as requested, for instance:
DeclaredDebitedFunds: {
Amount: amount,
Currency: currency,
},
DeclaredFees: {
Amount: 0,
Currency: currency,
},
CreditedUserId: userID,
I get this error:
src/payment/index.ts:164:27 - error TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type '{ CreditedWalletId: string; AuthorId: any; DebitedFunds: { Amount: number; Currency: string; }; Fees: { Amount: number; Currency: string; }; CardId: any; SecureModeReturnURL: string; PaymentType: string; ... 4 more ...; CreditedUserId: any; }' is not assignable to parameter of type 'CreateBankWireDirectPayIn'.
Types of property 'ExecutionType' are incompatible.
Type 'string' is not assignable to type '"DIRECT"'.
I am using mangopay2-nodejs-sdk@1.16.0
Hello again,
Well I figured out how to build without errors \o/ I don't know if you're using TypeScript as well, but the problem is that we have to cast ExecutionType and PaymentType (and SecureMode, when you correct the first 2, this one pops).
I let you read this answer on StackOverflow: https://stackoverflow.com/questions/37978528/typescript-type-string-is-not-assignable-to-type
Here is my code, used to solve my build issue:
const payIn = {
AuthorId: userID,
CreditedWalletId: walletID,
DebitedFunds: {
Amount: 1000,
Currency: "EUR",
},
Fees: {
Amount: 0,
Currency: "EUR",
},
SecureModeReturnURL: "http://test.com",
SecureMode: "DEFAULT" as const,
CardId: cardID,
ExecutionType: "DIRECT" as const,
PaymentType: "CARD" as const,
};
api.PayIns.create(payIn).then((cardDirectPayInData) => {
response.send(cardDirectPayInData);
}).catch((error) => {
response.send(`Failed to create a PayIn object: ${error}`);
});
Tested, it works fine. I hope it helps
Hello,
I am working on implementing the PayIn part of the NodeJS SDK, but I stumble upon this error:
While I want to add my object to the create method.
return new Promise((resolve, reject) => { this.mangoApi.PayIns.create(payIn).then(success => resolve(success), error => { reject(error); throw new BadRequestException({ mangopay: error.message }); }); });
The error keeps referring to this type 'CreateBankWireDirectPayIn' very odd. Because I didn't specify any object type.
Maybe someone can help me get through... Thanks!
Regards, Davey Cornelissen