fix conflict

This commit is contained in:
Myat Zin Wai Maw
2019-06-20 15:22:06 +06:30
32 changed files with 585 additions and 80 deletions

View File

@@ -8,6 +8,25 @@ class SalePayment < ApplicationRecord
attr_accessor :received_amount, :card_payment_reference, :voucher_no, :giftcard_no, :customer_id, :external_payment_status,:action_by
def self.sync_sale_payment_records(sale_payments)
if !sale_payments.nil?
sale_payments.each do |sp|
unless SalePayment.exists?(sp['sale_payment_id'])
payment = SalePayment.new
payment.sale_payment_id = sp['sale_payment_id']
payment.sale_id = sp['sale_id']
payment.payment_method = sp['payment_method']
payment.payment_amount = sp['payment_amount']
payment.outstanding_amount = sp['outstanding_amount']
payment.payment_reference = sp['payment_reference']
payment.payment_status = sp['payment_status']
payment.save
puts '....... Sale Payment has been created ......'
end
end
end
end
def process_payment(invoice, action_by, cash_amount, payment_method,remark=nil,payment_for=false)
self.sale = invoice
self.received_amount = cash_amount
@@ -983,6 +1002,11 @@ class SalePayment < ApplicationRecord
private
def generate_custom_id
self.sale_payment_id = SeedGenerator.generate_id(self.class.name, "SPI")
prefix = "SPI"
if ENV["SERVER_MODE"] == 'cloud'
prefix = "CSPI"
end
self.sale_payment_id = SeedGenerator.generate_id(self.class.name, prefix)
end
end