@Test public void testJSONConversion() { try { JSONObject rawConversion = new JSONObject(EXAMPLE_JSON_SHIPPING_ADDRESS); assertJsonEquals(mShippingMethod.toJson(), rawConversion); } catch (JSONException jsonException) { fail("Test Data failure: " + jsonException.getLocalizedMessage()); } }
@NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); putLongIfNotNull(jsonObject, FIELD_AMOUNT, mAmount); putStringIfNotNull(jsonObject, FIELD_CURRENCY_CODE, mCurrencyCode); putStringIfNotNull(jsonObject, FIELD_DETAIL, mDetail); putStringIfNotNull(jsonObject, FIELD_IDENTIFIER, mIdentifier); putStringIfNotNull(jsonObject, FIELD_LABEL, mLabel); return jsonObject; }
ShippingMethod extends StripeJsonModel implements Parcelable { @NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); putLongIfNotNull(jsonObject, FIELD_AMOUNT, mAmount); putStringIfNotNull(jsonObject, FIELD_CURRENCY_CODE, mCurrencyCode); putStringIfNotNull(jsonObject, FIELD_DETAIL, mDetail); putStringIfNotNull(jsonObject, FIELD_IDENTIFIER, mIdentifier); putStringIfNotNull(jsonObject, FIELD_LABEL, mLabel); return jsonObject; } }
ShippingMethod extends StripeJsonModel implements Parcelable { @NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); putLongIfNotNull(jsonObject, FIELD_AMOUNT, mAmount); putStringIfNotNull(jsonObject, FIELD_CURRENCY_CODE, mCurrencyCode); putStringIfNotNull(jsonObject, FIELD_DETAIL, mDetail); putStringIfNotNull(jsonObject, FIELD_IDENTIFIER, mIdentifier); putStringIfNotNull(jsonObject, FIELD_LABEL, mLabel); return jsonObject; } ShippingMethod(@NonNull String label,
                          @NonNull String identifier,
                          @NonNull long amount,
                          @NonNull @Size(min=0, max=3) String currencyCode);  ShippingMethod(@NonNull String label,
                          @NonNull String identifier,
                          @Nullable String detail,
                          @NonNull long amount,
                          @NonNull @Size(min=0, max=3) String currencyCode); private  ShippingMethod(Parcel in); }
ShippingMethod extends StripeJsonModel implements Parcelable { @NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); putLongIfNotNull(jsonObject, FIELD_AMOUNT, mAmount); putStringIfNotNull(jsonObject, FIELD_CURRENCY_CODE, mCurrencyCode); putStringIfNotNull(jsonObject, FIELD_DETAIL, mDetail); putStringIfNotNull(jsonObject, FIELD_IDENTIFIER, mIdentifier); putStringIfNotNull(jsonObject, FIELD_LABEL, mLabel); return jsonObject; } ShippingMethod(@NonNull String label,
                          @NonNull String identifier,
                          @NonNull long amount,
                          @NonNull @Size(min=0, max=3) String currencyCode);  ShippingMethod(@NonNull String label,
                          @NonNull String identifier,
                          @Nullable String detail,
                          @NonNull long amount,
                          @NonNull @Size(min=0, max=3) String currencyCode); private  ShippingMethod(Parcel in); @NonNull Currency getCurrency(); long getAmount(); @NonNull String getLabel(); @Nullable String getDetail(); @NonNull String getIdentifier(); @NonNull @Override JSONObject toJson(); @NonNull @Override Map<String, Object> toMap(); @Override int describeContents(); @Override void writeToParcel(Parcel parcel, int i); }
ShippingMethod extends StripeJsonModel implements Parcelable { @NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); putLongIfNotNull(jsonObject, FIELD_AMOUNT, mAmount); putStringIfNotNull(jsonObject, FIELD_CURRENCY_CODE, mCurrencyCode); putStringIfNotNull(jsonObject, FIELD_DETAIL, mDetail); putStringIfNotNull(jsonObject, FIELD_IDENTIFIER, mIdentifier); putStringIfNotNull(jsonObject, FIELD_LABEL, mLabel); return jsonObject; } ShippingMethod(@NonNull String label,
                          @NonNull String identifier,
                          @NonNull long amount,
                          @NonNull @Size(min=0, max=3) String currencyCode);  ShippingMethod(@NonNull String label,
                          @NonNull String identifier,
                          @Nullable String detail,
                          @NonNull long amount,
                          @NonNull @Size(min=0, max=3) String currencyCode); private  ShippingMethod(Parcel in); @NonNull Currency getCurrency(); long getAmount(); @NonNull String getLabel(); @Nullable String getDetail(); @NonNull String getIdentifier(); @NonNull @Override JSONObject toJson(); @NonNull @Override Map<String, Object> toMap(); @Override int describeContents(); @Override void writeToParcel(Parcel parcel, int i); static final Parcelable.Creator<ShippingMethod> CREATOR; }