Sha256: cdae33e41bf0f12536c040549ccf4b342cde04a64fe6c896db0c3cbb5f11162c

Contents?: true

Size: 655 Bytes

Versions: 1

Compression:

Stored size: 655 Bytes

Contents

module Trade
  module PaymentType::SvfCard

    def card_pay
      if payment_status == 'all_paid'
        return { success: false, message: '已经支付过了,不要重复支付' }
      end

      self.class.transaction do
        params = {
          total_amount: self.remaining_amount,
          adjust_amount: self.amount,
          user_id: self.user_id
        }

        payment = self.change_to_paid!(type: 'CardPayment', payment_uuid: UidHelper.nsec_uuid, params: params)
        { success: true, payment: payment }
      end
    rescue ActiveRecord::RecordInvalid => e
      return { success: false, message: e.message }
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_trade-0.0.3 app/models/trade/payment_type/svf_card.rb