update rebate and update api

This commit is contained in:
Aung Myo
2017-11-14 18:30:57 +06:30
parent f927d99807
commit 28dbb75774
8 changed files with 39 additions and 32 deletions

View File

@@ -23,13 +23,17 @@ class Customer < ApplicationRecord
# urltest =self.url_exist?(url)
begin
response = HTTParty.get(url, :body => { membership_id: customer.membership_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
},
:timeout => 10
)
response = HTTParty.get(url, :body => {
membership_id: customer.membership_id,
merchant_uid:merchant_uid,
type: "summary",
auth_token:auth_token
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2'
},
:timeout => 10)
rescue HTTParty::Error
response = {status: false, message: "Server Error"}
@@ -63,7 +67,7 @@ class Customer < ApplicationRecord
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
'Accept' => 'application/json; version=2'
},
:timeout => 10
)
@@ -116,7 +120,7 @@ class Customer < ApplicationRecord
:body => member_params,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
'Accept' => 'application/json; version=2'
})
rescue Net::OpenTimeout
response = { status: false, message: "Server Time out" }
@@ -183,7 +187,7 @@ class Customer < ApplicationRecord
receipt_no: receipt_no,auth_token:auth_token}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
'Accept' => 'application/json; version=2'
}, :timeout => 10)
rescue Net::OpenTimeout
response = { "status": false , "message": "Connect To" }
@@ -215,7 +219,7 @@ class Customer < ApplicationRecord
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
'Accept' => 'application/json; version=2'
},
:timeout => 10
)

View File

@@ -85,7 +85,7 @@ class SalePayment < ApplicationRecord
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
'Accept' => 'application/json; version=2'
}, :timeout => 10
)
rescue Net::OpenTimeout
@@ -120,17 +120,18 @@ class SalePayment < ApplicationRecord
# Control for Paypar Cloud
begin
response = HTTParty.post(url,
:body => { generic_customer_id:membership_id,
:body => { membership_id:membership_id,
total_amount: redeem_prices,
total_sale_transaction_amount: sale_data.grand_total,
redeem_amount:received_amount,
receipt_no:sale_data.receipt_no,
campaign_type_id:campaign_type_id,
account_no:"",merchant_uid:merchant_uid,
account_no:"",
merchant_uid:merchant_uid,
auth_token:auth_token}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
'Accept' => 'application/json; version=2'
},
:timeout => 10
)
@@ -399,7 +400,7 @@ class SalePayment < ApplicationRecord
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
'Accept' => 'application/json; version=2'
}, :timeout => 10)
rescue Net::OpenTimeout
response = { "status": false , "message": "Connect To" }
@@ -468,7 +469,7 @@ class SalePayment < ApplicationRecord
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
'Accept' => 'application/json; version=2'
}, :timeout => 10)
rescue Net::OpenTimeout
response = { "status": false , "message": "Connect To" }