Skip to content

Commit

Permalink
Fix bug in refund object, WSDL, and hack base object
Browse files Browse the repository at this point in the history
- Fix bug to use refund object query
- Add soap response method
  • Loading branch information
Josephu committed Jan 10, 2013
1 parent d37f9e7 commit cb69183
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions lib/zuora/objects/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,19 @@ def update
return result
end

# create the record remotely with soap response (this is a hack)
def create_soap
result = self.connector.create
apply_soap_response(result.to_hash, :create_response)
end

def update_soap
result = self.connector.update
result = apply_soap_response(result.to_hash, :update_response)
reset_complex_object_cache
return result
end

# destroy the remote object
def destroy
result = self.connector.destroy
Expand Down Expand Up @@ -197,6 +210,17 @@ def apply_response(response_hash, type)
end
end

# parse the response and apply returned id attribute or errors
def apply_soap_response(response_hash, type)
result = response_hash[type][:result]
if result[:success]
self.id = result[:id]
@previously_changed = changes
@changed_attributes.clear
end
return result
end

end
end

1 change: 1 addition & 0 deletions lib/zuora/objects/refund.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Refund < Base
read_only :accounting_code, :created_by_id, :created_date, :gateway_response,
:gateway_response_code, :reference_id, :refund_number, :refund_transaction_time,
:status, :updated_by_id, :updated_date
write_only :payment_id
end
end
end
1 change: 0 additions & 1 deletion wsdl/zuora.a.38.0.wsdl
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@
<element minOccurs="0" name="CreatedById" nillable="true" type="zns:ID" />
<element minOccurs="0" name="CreatedDate" nillable="true" type="dateTime" />
<element minOccurs="0" name="Gateway" nillable="true" type="string" />
<element minOccurs="0" name="GatewayOptionData" nillable="true" type="zns:GatewayOptionData" />
<element minOccurs="0" name="GatewayResponse" nillable="true" type="string" />
<element minOccurs="0" name="GatewayResponseCode" nillable="true" type="string" />
<element minOccurs="0" name="GatewayState" nillable="true" type="string" />
Expand Down

0 comments on commit cb69183

Please sign in to comment.