How to undo receive payment for invoice in quickbook desktop edition using qbfc sdk - c#-4.0

I use QBFC v13 and asp.net with c#. I have create one invoice and paid some amount for this invoice, problem is that now i want to undo payment for this invoice.I try this but not working.
ITxnDel txnDelRq = RecPayrequestMsgSet.AppendTxnDelRq();
txnDelRq.TxnDelType.SetValue(ENTxnDelType.tdtReceivePayment);
txnDelRq.TxnID.SetValue(TxnId);

So if you look at the Exception, you can see that you're getting a response from QuickBooks, and it's an error:
Object 339-1507104811 specified in the request cannot be found.
What QuickBooks is telling you here is that, in your request, you referred to a specific object (the object with TxnID = 339-1507104811) and QuickBooks can not find this object.
That means one of two things. Either:
Somebody else already deleted the object
You're using an incorrect TxnID value
Did somebody else already delete the payment? You? Your program on a previous run?
Are you 100% positive you have the correct TxnID value? It should be from the ReceivePaymentAdd request you initially used to create the payment.

Related

How to get default payment method from Stripe invoice?

I am listening to Stripe's invoice.payment_failed webhook with my web app and I would like to get the default_payment_method from each invoice but for some reason it always returns nothing but an empty array!
When I query for a Stripe invoice on the command line and expand on the default_payment_method like this...
Stripe::Invoice.retrieve('in_3K6dIY2KgYRkshw2LAzya63P', :expand => "default_payment_method")
...I also get empty arrays. This surprises me because all my Stripe customers do have a default payment method associated with them.
What am I missing here?
Thanks for any help.
There are three independent places a default payment method can be set. From more specific to less specific they go :
invoice.default_payment_method (which you are looking at)
subscription.default_payment_method
customer.invoice_settings.default_payment_method
Stripe charges the most specific one if it's set. When reading from the API, those values don't inherit from the level above, they can all be set individually, if they are not set explicitly then they are null. So that's why you see it as null on the Invoice level.
Instead you likely want to look at the Subscription object or the Customer object(and can leverage the expand feature for that), depending on how you built your integration and which one it sets.
Overall though, you probably actually want the PaymentMethod used in the invoice payment though? That would be from the last_payment_error.
inv = Stripe::Invoice.retrieve({
id: 'in_1K8iiKJoUivz182DMzSkuBgp',
expand: ["customer.invoice_settings.default_payment_method",
"subscription.default_payment_method",
"payment_intent"]
}
)
print("invoice : #{inv.default_payment_method} \n")
print("subscription : #{inv.subscription.default_payment_method} \n")
print("customer : #{inv.customer.invoice_settings.default_payment_method} \n")
print("failed charge : #{inv.payment_intent.last_payment_error.payment_method} \n")

Detect an Invalid User Attribute Field entry in OIM and send email notification based on the user type

I am required to create a Java Script but unable to figure on how to proceed as I don't have that much of coding idea in OIM, can someone assist(below I have mentioned the scenario)
Scenario:
In OIM User Attribute Page, there is a User Field: 'Job Code' now we have experienced that there are some issues we are facing.
From the trusted source we are getting the correct data but as soon as it reaches OIM for few users we are getting random incorrect value. Value should be numbers (123456) which is present in the Database too and valid but for few we are receiving values like E?401#q something like this.
We are required to place a check to find users who are having these invalid Job Code entry.
Once detected, we need to trigger a email to the concerned team based on the User Type (Employee or Contractor) for employee it should trigger an email to a respective team and for Contractor we have to trigger to a different team to take action.
So, I believe we have to place two conditions here, can someone assist.
If you believe it only happens during trusted source reconciliation, then you can create Post-Process Handler on User Create/Modify operation to check the value which was posted into the DB as a result of recon event.
From this handler you can do all the things you need to do: mailing, fixing, etc.
For notification purposes I'd recommend to use built-in NotificationService, though it might be bit daunting, if you have little experience in OIM development. As an alternative you can do java mailing.
If you are not sure about the moment, when this "spoiling" happens, you can create a scheduled task, to be executed periodically, which will check JobCode values, to report invalid ones.

Confusing shippo error during transaction using API

I keep getting this error when executing a transaction on rate object id's that were created a few days ago.
{
"source": "USPS",
"code": "",
"text": "The selected shipment date must be within 7 days of 02/15/2017, 07:11PM CST."
}
Im integrating shippo with my Node.js web application. I am using shippo node.js library.
shippo.shipment.create({, function(err, shipment) {});
I built a basic store. When user gets to checkout section, I get rates from shippo. I display those rates to the user. The user chooses which rate he wants. I save the rate object id to a database.
shippo.transaction.create({, function(err, transaction) {});
I fulfill the order and print the shipping label. The application goes to the database and retrieves rate object id to execute the transaction with shippo. In return Im suppose to get a tracking # and label information, but instead I get the error.
I first thought that the rate object id only last 7 days and then expires on its own or something. When I checked the rate object id:
https://api.goshippo.com/rates/2a0b50cbc5184362a0ea2385b490bc7b
It shows object was created 2/18. Today is the 2/21. So that cant be. The error says "The selected shipment date must be within 7 days of 02/15/2017, 07:11PM CST."
What does it mean? Why did I get it?
It seems to only happen to rate object id's that were create 2+ days ago. If the rate object id was created yesterday, I could still execute the transaction no problem.
screenshot
It looks like you are using a rate from the past (not the same day) that is causing this error to occur.
When you make a shipment at the /shipments/ endpoint, you are able to specify the submission_date when creating the shipment. If you do not specify the submission_date (you would generally only do this if you know the day you plan on shipping the item out), Shippo automatically sets the submission_date to the date the request is being made.
The reason that you are getting an error, is that you're using a rate for a shipment that has a submission_date in the past. Some carriers will only permit a submission date that is the current date, or some date in the future.
You can find more details here on the shipment object that might help.

How to modify a Customer Refund in an After Submit User Event

After a new Customer Refund record is saved (After Submit user event) I need to communicate with an external web service and then update 2 fields in the record. When this code is executed to load the Customer Refund
var o = nlapiLoadRecord("customerrefund", 1906);
This error message is returned:
INVALID_TRANS_TYP
Transaction type specified is incorrect.
I found a list of supported records in the "Chapter 60 SuiteScript Supported Records" of SuiteScript Developer & Reference Guide which says the Customer Refund is only available in a server side script.
How should I go about updating the Customer Refund record?
Without seeing more code, it looks ok. I would double check that the internalId of 1906 is correct.
Also, if you're just submitting two fields, I would use nlapiSubmitField(), this will take less governance points and be quicker for NetSuite rather than nlapiLoadRecord / nlapiSubmitRecord.
Your code looks correct, if you are updating the current record I would recommend using below code to avoid incorrect internalid:
var o = nlapiLoadRecord("customerrefund", nlapiGetRecordId());
Also, I would recommend that if you need to update the fields, consider using before submit user event script on customer refund and you can update the fields using nlapiSetFieldValue(FIELD_ID, FIELD_VALUE). No need to submit the record in case of before submit.
If your script is deployed in the customer refund record, you can also do nlapiGetRecordType().

Unable to find a matching line for sublist apply with key:

We are seeing failure to Netsuite while updating payments via the netsuite API,
the error message we see is as below Unable to find a matching line for sublist apply with key: [doc,line] and value: [123344,null] where 123344 is the external id of the bill.
Any ideas what might be the cause of this?
Note that SuiteTalk will give you this cryptic little message when you try to create a payment for an invoice that already has an Invoice:Paid In Full transaction status.
Don't get me wrong—it's good that NetSuite has this sanity check. I just wish the error was more helpful.
"Unable to find a matching line for sublist apply with key: [doc,line] and value: [123344,null]"
There is your problem, you can't match a line if you are not passing the line number.
We had the same problem inserting new payments, but it worked using the Internal ID for the Invoice column.
Note that the mapping specification is not clear on how to identify the Invoice when adding/updating payments for it. The API requires an invoice, and it works when you provide the Internal ID for the invoice.
I get this error when creating a customer payment. Below is my code. Make sure invoiceId is invoice's internal id and amount is less than or equal to invoice amount.
CustomerPaymentApply paymentApply = new CustomerPaymentApply();
paymentApply.setAmount(amount);
paymentApply.setApply(true);
paymentApply.setDoc(Long.valueOf(invoiceId));
We were getting this error with the Chargebee-Netsuite integration. The solution was to open the corresponding Accounting Period in Netsuite and rerun the sync.
The first number [123344,null] is the Netsuite internal ID of the affected document. If you navigate to the document in Netsuite and it has a padlock this could be the reason:
Open the Accounting Period for the affected document and rerun the sync. Setup/accounting/manage accounting periods:

Resources