package com.cloudmine.api.rest;

import com.android.volley.NetworkResponse;
import com.android.volley.Response;
import com.cloudmine.api.CMSessionToken;
import com.cloudmine.api.rest.options.CMServerFunction;
import com.cloudmine.api.rest.response.PaymentResponse;
import me.cloudmine.annotations.Expand;
import me.cloudmine.annotations.Optional;

/**
 * <br>Copyright CloudMine LLC. All rights reserved
 * <br> See LICENSE file included with SDK for details.
 */
public class BaseRemovePaymentMethodRequest extends CloudMineRequest<PaymentResponse> {
    public static final int REQUEST_TYPE = 419;

    private static final String URL = "/payments/account/methods/card/";

    @Expand
    public BaseRemovePaymentMethodRequest(int position, CMSessionToken sessionToken, @Optional CMServerFunction serverFunction, Response.Listener<PaymentResponse> successListener, @Optional Response.ErrorListener errorListener) {
        super(Method.DELETE, URL + position, null, sessionToken, serverFunction, successListener, errorListener);
    }

    @Override
    protected Response<PaymentResponse> parseNetworkResponse(NetworkResponse networkResponse) {
        return Response.success(new PaymentResponse(new String(networkResponse.data), networkResponse.statusCode), getCacheEntry(networkResponse));
    }

    @Override
    public int getRequestType() {
        return REQUEST_TYPE;
    }
}

@@ -345,16 +345,105 @@
 l;%0A%0A/**%0A
+ * A Volley %7B@link com.android.volley.Request%7D for removing a payment method from a user%0A
  * %3Cbr%3EC
@@ -757,16 +757,743 @@
 ard/%22;%0A%0A
+    /**%0A     * Remove the card at the specified position (0 indexed) belonging to the user associated with the specified sessionToken.%0A     * @param cardIndex a 0 based index of which card to use. Use %7B@link com.cloudmine.api.rest.BaseLoadPaymentMethodsRequest%7D to load the various options for the given user%0A     * @param sessionToken The user's whose card (identified by cardIndex) will be charged%0A     * @param serverFunction a nullable server function to be invoked after the payment method has been removed%0A     * @param successListener callback called if the call succeeds on the server%0A     * @param errorListener callback called if the call fails (error response from server, no Internet, some other exception)%0A     */%0A
     @Exp
@@ -1542,24 +1542,25 @@
 est(int 
-position
+cardIndex
 , CMSess
@@ -1762,24 +1762,25 @@
 , URL + 
-position
+cardIndex
 , null, 

Comment removing payment method