创建发票的方法是不正常的Magento的API [英] Create Invoice Method is not working properly of Magento API

查看:160
本文介绍了创建发票的方法是不正常的Magento的API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用XMLRPC.I现在用的方法来创建使用Magento的API在Android应用程序销售订单发票 sales_order_invoice.create 创建invoice.This方法是给我发票标识的为响应一定量为<一提href=\"http://www.magentocommerce.com/api/soap/sales/salesOrderInvoice/sales_order_invoice.create.html\"相对=nofollow>的Magento维基。但问题是,发票数量不更新的Magento store.Other的是订单状态正在改变,以处理这是正确的,创造发票的进入也是present在商店的发票清单,但它显示的支付金额的 $ 0.0次这是不正确的。

I am trying to create sales order Invoice using Magento API in android application using XMLRPC.I am using the method "sales_order_invoice.create" for creating invoice.This method is giving me Invoice Id in the response for given quantity as mention in magento wiki.But the problem is that the Invoice qty isn't updated on magento store.Other thing is Order status is changing to Processing which is correct and the entry of created invoice is also present in invoice list of store but It is displaying the paid amount as $0.0 which is not correct.

我不知道如果我需要调用之前调用另一个方法 sales_order_invoice.create 或有在方法??结果的任何问题
下面是调用方法我的code的某些部分:

I don't know if I need to call another method before calling sales_order_invoice.create or is there any problem in the method??
Below is some part of my code for calling method:

import java.util.HashMap;
import org.xmlrpc.android.XMLRPCClient;
import org.xmlrpc.android.XMLRPCException;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

public class MagentoStore extends Activity {

private XMLRPCClient client;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);
            String sessionId = "";


client = new XMLRPCClient("http://www.mystore.com/index.php/api/xmlrpc");
        try {

            sessionId = (String)client.call("login", "tester", "tester");
            Log.d("MY_XMLRPC_SUCCESS_SESSION_ID", sessionId);
            }
         catch (XMLRPCException e) {

            Log.d("MY_XMLRPCException_MSG", e.getMessage());
        }

        Object salesorderInfo = null;
        Object[] methodParams = new Object[]{"100000028"};
        Object[] callParams = new Object[]{sessionId,"sales_order.info", methodParams};
        String salesorderinvoice= null;
        try {
             salesorderInfo = (Object)client.callEx("call",callParams);
             HashMap map = (HashMap)salesorderInfo;
             Object[]items=(Object[])map.get("items");
             for(Object item :items)
             {
                 HashMap itemlist=(HashMap)item;
                 String item_id=(String)itemlist.get("item_id");
                 int itemids=Integer.parseInt(item_id);
                 String base_price=(String)itemlist.get("base_price");
                 if(base_price.equals("0.0000"))
                 {
                  continue;  
                 }   
                 String name=(String)itemlist.get("name");
                 Double qty=1.0;
                 String qty_ordered =(String)itemlist.get("qty_ordered");
                 String qty_invoiced=(String)itemlist.get("qty_invoiced");
                 Object[] methodParams1 = new Object[]{"100000028",itemids,qty};
                 Object[] callParams1 = new Object[]{sessionId,"sales_order_invoice.create", methodParams1};
                 salesorderinvoice= (String)client.callEx("call",callParams1);

             } 
            } catch (Exception e) {
            Log.d("APP_INFO", "Exception: " + e.getMessage());
            }               
    }
}

人有任何想法?
在此先感谢

Anyone have any Idea?? Thanks in advance

推荐答案

FYI

当你调用API sales_order_invoice.create,您必须将数组指针名。

when you call the API sales_order_invoice.create, you must assign the array pointer name.

String qty_ordered =(String)itemlist.get("qty_ordered");
                 String qty_invoiced=(String)itemlist.get("qty_invoiced");
                 Object[] methodParams1 = new Object[]{"100000028",itemids,qty};

试图用的var_dump的methodParams1

try to var_dump the methodParams1 with

methodParams1.toString();

它必须具有相同

array(
      'orderIncrementId' => '200000008', 
      array(
            'order_item_id' => '11', 
            'qty' => '1'
      )
);

因为这是把参数的方式 sales_order_invoice.create

$result = $client->call(
    $session,
    'sales_order_invoice.create',
    array('orderIncrementId' => '200000008', array('order_item_id' => '11', 'qty' => '1'))
);

这篇关于创建发票的方法是不正常的Magento的API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆