Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. interface RoyalPayApi {
  2.  
  3. @FormUrlEncoded
  4. @Headers("Accept: application/json", "Content-Type: application/json")
  5. @PUT("/api/v1.0/gateway/partners/{partner_code}/app_orders/{order_id}")
  6. fun createRoyalPaySDKOrder(@Path(value = "partner_code", encoded = true) partner_code: String, @Path(value = "order_id", encoded = true) order_id: String,
  7. @Query("time") time: Long, @Query("nonce_str") nonce_str: String, @Query("sign") sign: String,
  8. @Field("description") description: String,
  9. @Field("price") price: Int,
  10. @Field("currency") currency: String,
  11. @Field("channel") channel: String,
  12. @Field("operator") operator: String,
  13. @Field("system") system: String): Call<JSONObject> // com.alibaba.fastjson.JSONObject
  14.  
  15. fun createService(): RoyalPayApi {
  16. val retrofit = Retrofit.Builder()
  17. .baseUrl(ROYAL_PAY_ADDRESS)
  18. .addConverterFactory(FastJsonConverterFactory.create())
  19. .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
  20. .build()
  21.  
  22. return retrofit.create(RoyalPayApi::class.java)
  23. }
  24.  
  25. var api = createService()
  26. var call = api.createRoyalPaySDKOrder(ROYAL_PAY_PARTNER_CODE, order_id, time, ROYAL_PAY_NONCE_STR, sign,
  27. description, price, "AUD", channel, "kate", "android")
  28.  
  29. call.enqueue(object : Callback<JSONObject>{
  30. override fun onResponse(call: Call<JSONObject>, response: Response<JSONObject>) {
  31. val str = ""
  32. }
  33.  
  34. override fun onFailure(call: Call<JSONObject>, t: Throwable) {
  35. val str = ""
  36. }
  37. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement