lib/veritrans/client.rb in veritrans-1.1.3 vs lib/veritrans/client.rb in veritrans-1.2.0
- old
+ new
@@ -39,14 +39,26 @@
# client.get_keys
#
def get_keys
init_instance
+ if customer_specification_flag == "0" && shipping_flag == "0"
+ raise "required_shipping_address must be '1'"
+ end
+
params = prepare_params(PostData::ServerParam,PostData::PostParam)
if @commodity.class == Array
commodity = @commodity.collect do |data|
+ if data.keys.index "COMMODITY_QTY"
+ data["COMMODITY_NUM"] = data["COMMODITY_QTY"]
+ data.delete "COMMODITY_QTY"
+ end
+ if data.keys.index "COMMODITY_PRICE"
+ data["COMMODITY_UNIT"] = data["COMMODITY_PRICE"]
+ data.delete "COMMODITY_PRICE"
+ end
uri = Addressable::URI.new
uri.query_values = data
uri.query
end
end
@@ -113,9 +125,29 @@
end
# :nodoc:
def token
return @token
+ end
+
+ # :nodoc:
+ def billing_address_different_with_shipping_address
+ @customer_specification_flag
+ end
+
+ # :nodoc:
+ def billing_address_different_with_shipping_address=(flag)
+ @customer_specification_flag = customer_specification_flag
+ end
+
+ # :nodoc:
+ def required_shipping_address
+ @shipping_flag
+ end
+
+ # :nodoc:
+ def required_shipping_address=(flag)
+ @shipping_flag = flag
end
private
def merchanthash